-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rom_ext, ownership] Fix the flash region configuration #26077
Conversation
dfef607
to
d34904e
Compare
d34904e
to
0c2d6ba
Compare
lock = kHardenedBoolFalse; | ||
} | ||
|
||
if (*mp_index < 2 * FLASH_CONFIG_REGIONS_PER_SLOT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the MP layout you have in mind? It would be good to capture it in an md doc so that we can provide it as a reference. I am seeing some questions from integration teams.
MP Slot | Description |
---|---|
0 | ROM_EXT slot A |
1 | ROM_EXT slot B |
2 | Owner Slot A - Entry 0 |
3 | Owner Slot A - Entry 1 |
4 | Owner Slot A - Entry 2 |
5 | Owner Slot B - Entry 0 |
6 | Owner Slot B - Entry 1 |
7 | Owner Slot B - Entry 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct: in the LockedOwner
state, SlotA entries are programmed into MP_REGION registers first, then SlotB entries.
In the unlocked states (UnlockedAny
, UnlockedEndorsed
), current_owner's entries are programmed first (for whichever side is primary), then next_owner's entries are programmed (for whichever side is secondary). This ordering was chosen to keep current_owner's firmware booting in the primary slot and to allow next_owner to program their image into the secondary slot and then attempt a boot with a SetBl0Next
command.
I did not write correct test cases that would check a flash configuration similar to the owner config already deployed in some skus. This oversight could cause ownership initialization to fail on devies with such a configuration. 1. Permit a maximum of 3 regions per side in the flash configuration. The regions must be fully within the bounds of SlotA or SlotB and may not overlap the ROM_EXT region. 2. Apply the region configuration in order. Previously, there was a correspondence between the index of the region in the owner config and the MP_REGION register that it would land in, but this makes ownership transfers prone to configuration clashes. 3. Flash configuration is done in two passes to configure each side independently (the reason for this is to allow next_owner's flash config to apply to the non-primary side during ownership transfer). The flash_apply function now takex an index parameter to manage the desination MP_REGION register between passes. 4. Create a unittest case with a flash configuration similar to the already-deployed configuration. Include the ROM_EXT, application, filesystem and reserved segments. 5. Update the existing test cases to accomodate the new configuration scheme (e.g. applying in order rather than by index). Signed-off-by: Chris Frantz <[email protected]>
0c2d6ba
to
9be96dc
Compare
I did not write correct test cases that would check a flash configuration similar to the owner config already deployed in some skus. This oversight could cause ownership initialization to fail on devies with such a configuration.
first_pass
parameter to theflash_apply
function to allow managing the internal state.Fixes #25435.