-
Notifications
You must be signed in to change notification settings - Fork 13
ot_otp: Add scrambling on DAI writes to secret partitions + REGWEN fixes
#258
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
Merged
AlexJones0
merged 7 commits into
lowRISC:ot-9.2.0
from
AlexJones0:otp_secret_dai_writes
Oct 28, 2025
Merged
ot_otp: Add scrambling on DAI writes to secret partitions + REGWEN fixes
#258
AlexJones0
merged 7 commits into
lowRISC:ot-9.2.0
from
AlexJones0:otp_secret_dai_writes
Oct 28, 2025
Conversation
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
luismarques
approved these changes
Oct 23, 2025
luismarques
left a comment
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.
LGTM
fd5be5d to
7e2dc4f
Compare
ot_otp: Add scrambling on DAI writes to secret partitions + check REGWENsot_otp: Add scrambling on DAI writes to secret partitions + REGWEN fixes
rivos-eblot
reviewed
Oct 24, 2025
7e2dc4f to
37df8d5
Compare
88aa8f2 to
4ec1b76
Compare
rivos-eblot
approved these changes
Oct 27, 2025
The actual check registers remain unimplemented, but the REGWENs surrounding them are now properly implemented and writable. Also corrects the access types of some of the associated registers. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
The actual check registers remain unimplemented, but the REGWENs surrounding them are now properly implemented and writable. Also corrects the access types of some of the associated registers. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Introduce scrambling to DAI writes of secret partitions, which should always be a 64-bit granularity. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Introduce scrambling to DAI writes of secret partitions, which should always be a 64-bit granularity. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
This regwen is not read-only - SW can write a 0 to clear it and lock the DAI interface. The REGWEN should still be locked when the DAI is non-idle, but now it has a permanent software lock which is only resolved by a reset of the `otp_ctrl`. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
This regwen is not read-only - SW can write a 0 to clear it and lock the DAI interface. The REGWEN should still be locked when the DAI is non-idle, but now it has a permanent software lock which is only resolved by a reset of the `otp_ctrl`. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
This test is now passing with the otp_ctrl REGWENs being emulated. Also add a couple extra passing tests that have not yet been marked as such (`otp_ctrl_descrambling_test` and `usbdev_vbus_test`). Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
4ec1b76 to
13d0e33
Compare
2 tasks
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.
While we have scrambling on reads from secret partitions, to properly support provisioning flows we will need to be able to scramble when programming these secret partitions via DAI writes. Add support for these to both Earlgrey and Darjeeling.
As part of testing this, I also found that the two check REGWEN registers were unimplemented, which were being checked by some SW test utilities. While the check functionality is still unimplemented, writes/reads of these REGWENs are now implemented in both Earlgrey and Darjeeling, and the access permissions of some of these registers are fixed. This should be sufficient now to support the
lc_ctrl_otp_hw_cfg0_test, as well as theotp_ctrl_smoketestwhen QEMU is enabled for that test upstream.There was no nice existing test for this feature in OpenTitan except in DV environments, so I threw together something to quickly test it on an Opentitan branch here, constructing an OTP image and removing some irrelevant keymgr checks from the DV test. This is sufficient to check that we can write a value to the SECRET2 partition (which is scrambled), and read it back and get the same value.
Edit: the third change to fix
DIRECT_ACCESS_REGWENis another small bug fix while I'm in the area which should be enough to getotp_ctrl_mem_access_testpassing when QEMU support is added for this in OpenTitan.