Skip to content

[fuse_ctrl,dv] Split up smoke_test_fc_ratchet_seed_write_read#756

Closed
rswarbrick wants to merge 9 commits intomainfrom
lowrisc_split_fc_ratchet_test
Closed

[fuse_ctrl,dv] Split up smoke_test_fc_ratchet_seed_write_read#756
rswarbrick wants to merge 9 commits intomainfrom
lowrisc_split_fc_ratchet_test

Conversation

@rswarbrick
Copy link
Contributor

To avoid a bunch of PRs that all depend on each other, this builds on #751. The last two commits are unique to this PR. The first adds some status reporting to the DAI functions and the second is the main point of the PR: it splits up this test, which was timing out.

Honestly, I think we could also reasonably only write some random subset of the fuses in each partition (since we don't really expect variation within a partition). But I'm hopeful that this will already be split up enough: I think the previous version of the test wasn't quite finishing in 4 hours. Dividing by 4 should hopefully mean it now finishes in roughly an hour.

This avoids fuse_ctrl_mmap.h defining something that actually gets
instantiated (and defines a symbol). Without fixing that, if more than
one compilation unit includes the header then link will fail because
more than one object file defines "partitions" and various fuse index
arrays.
No functional change (but hopefully it makes things a bit clearer: I
found these ranges a bit hard to reason about).
The value in caliptra_ss_fuse_ctrl_manuf_prod_prov hadn't yet been
updated for the change in 275521b. This change should make it so
that test and also caliptra_ss_fuse_ctrl_init_fail get a magic number
from a single (documented) place.

Apply the same change to caliptra_ss_fuse_ctrl_test_unlocked0_prov.
This is a bit fiddly to do properly, because you end up needing to map
from a partition with a read lock to that partition's read lock
address (which depends on soc_mmap.h).

My solution is to have a template generate that map (which will
contain actual addresses that get pulled from soc_mmap.h at compile
time).
Carefully work through the logic in wait_dai_op_idle and document
exactly what it is doing.

This changes behaviour slightly if status_mask is nonzero. To look at
all sites where this might have an effect, I grepped for the following
regex: "wait_dai_op_idle([^0)]"

This commit tidies up the obvious matches. There are a couple of
places where this function is copy-pasted:

  - `cptra_uds_prog.c`
  - `cptra_zeroization`

Tidying these up to use the (now correct!) version of this function
should be a separate change.
This test injects an error and then reads the status register to check
it shows a bus integrity error.

The preceding dai_wr transaction is wrong though: *that* should report
the error (by reading the same register). Apparently, that check
wasn't working before but we've just tweaked wait_dai_op_idle to check
more sensibly and that now fails because we're calling it with no
expected error.

Expect the error, which fixes that failure and also makes the
following read redundant.
These are "safe" to add, because no caller expected a return value
before! The advantage is that tests that want to do some DAI
operations can fail rather more quickly if something unexpected
happens.
This test was taking a long time (more than 4 hours) and thus got
killed. But this is a bit silly: we don't really expect the partitions
to interact with each other anyway.

I've made lots of tidy-ups in the code and made things complete more
quickly by just checking two partitions each time. Of course, that
lowers the test coverage (because 2 < 8). To get that back again, I've
multiplied the reseed count for the test by 5 (which is more than
8/2).
@rswarbrick rswarbrick marked this pull request as ready for review September 25, 2025 21:24
…ith updated timestamp and hash after successful run
@rswarbrick
Copy link
Contributor Author

Now part of #774.

@rswarbrick rswarbrick closed this Sep 30, 2025
@rswarbrick rswarbrick deleted the lowrisc_split_fc_ratchet_test branch September 30, 2025 19:00
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.

1 participant