[optoe] Reset page select byte to 0 before upper memory access on page 0h#463
Merged
prgeor merged 4 commits intosonic-net:masterfrom Feb 14, 2025
Merged
Conversation
…e 0h Signed-off-by: Mihir Patel <patelmi@microsoft.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
prgeor
previously approved these changes
Feb 12, 2025
saiarcot895
reviewed
Feb 13, 2025
Contributor
|
@donboll FYI |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
prgeor
previously approved these changes
Feb 13, 2025
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
saiarcot895
approved these changes
Feb 13, 2025
prgeor
approved these changes
Feb 14, 2025
Contributor
Author
|
@kperumalbfn Can you please help to cherry-pick this to 202411 branch? |
|
Cherry-pick PR to 202411: #464 |
mssonicbld
added a commit
to mssonicbld/sonic-linux-kernel
that referenced
this pull request
Feb 26, 2025
…s on page 0h" Reverts sonic-net#463
liushilongbuaa
pushed a commit
to Azure/sonic-linux-kernel.msft
that referenced
this pull request
Mar 18, 2025
…s on page 0h" (#468) Reverts sonic-net/sonic-linux-kernel#463
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The optoe kernel driver currently assumes that the page select byte (page 0, byte 127) is set to 0h before accessing the upper memory on page 0h.
This assumption causes failures when accessing the module's EEPROM in multiple scenarios.
On the contrary, the driver currently sets the page select byte if the intended page to be accessed is > 0 as evident from the below code
https://github.com/opencomputeproject/oom/blob/c32499a89dff005e7ff2acb48b33f55543ce5140/optoe/optoe.c#L344-L353
Impact
If the optoe driver accesses any page except page 0h and the code for restoring the page select byte to 0h fails, subsequent attempts to
access the upper memory of page 0h will fail because the page select byte from the previous transaction remains unchanged.
https://github.com/opencomputeproject/oom/blob/c32499a89dff005e7ff2acb48b33f55543ce5140/optoe/optoe.c#L373-L392
Steps to recreate the failure scenario
One way to recreate this issue is:
with garbage content, as the page select byte is set to 0x9F instead of 0x0.
Fix
Before optoe accesses any address from upper page 0h, the page select byte is now set to 0.
This fix is done only for non-SFP modules to limit the scope of impact. SFP modules require additional handling since the page select byte
is on page A2h and NOT A0h unlike non-SFP modules which do not have the concept of A0h and A2h page.
Testing
The fix has been tested on a non-SFP module and it was ensured that the sfputil show fwversion EthernetXX CLI command executes successfully without any traceback.
Logs for testing the fix
Logs for the failure scenario
MSFT ADO - 31376026
Signed-off-by: Mihir Patel patelmi@microsoft.com