Skip to content

Conversation

@AlexJones0
Copy link

@AlexJones0 AlexJones0 commented Oct 23, 2025

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 the otp_ctrl_smoketest when 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_REGWEN is another small bug fix while I'm in the area which should be enough to get otp_ctrl_mem_access_test passing when QEMU support is added for this in OpenTitan.

Copy link

@luismarques luismarques left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlexJones0 AlexJones0 force-pushed the otp_secret_dai_writes branch from fd5be5d to 7e2dc4f Compare October 23, 2025 20:55
@AlexJones0 AlexJones0 changed the title ot_otp: Add scrambling on DAI writes to secret partitions + check REGWENs ot_otp: Add scrambling on DAI writes to secret partitions + REGWEN fixes Oct 23, 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>
@AlexJones0 AlexJones0 force-pushed the otp_secret_dai_writes branch from 4ec1b76 to 13d0e33 Compare October 28, 2025 13:43
@AlexJones0 AlexJones0 merged commit 67f1883 into lowRISC:ot-9.2.0 Oct 28, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants