csr_regfile: zero mtval/stval on interrupt traps (fix GPLEN-1 bit select) - #3386
csr_regfile: zero mtval/stval on interrupt traps (fix GPLEN-1 bit select)#3386codeadpool wants to merge 2 commits into
Conversation
c9feaec to
f29227d
Compare
…ect) Signed-off-by: Dharani Suryachandra Malleswarapu <dharanisuryachandra@gmail.com>
f29227d to
3250ed4
Compare
|
By reviewing this PR, we can wonder whether code could be simplified. |
LGTM |
|
@JeanRochCoulon this pr leaves ZERO_TVAL doing exactly what it did before. the only change is the interrupt check now sits outside the guard. with ZERO_TVAL=0 that reduces to just cause[XLEN-1], so interrupts zero tval in every build. that's the part spec requires, tandem or not. the exception cause list is still gated exactly as before, so if you decide the trick isn't necessary, dropping it only affects that list and interrupts stay correct. ran this branch against unmodified csr_regfile:
logs and traces: https://github.com/codeadpool/cva6-priv-sva/tree/main/evidence/mstatus limitation: htinst/mtinst have their interrupt condition inside the ZERO_TVAL guard, so on a RVH build an interrupt can still leave them non-zero. that's outside the config i verified (RVH=0), so i kept it out of this PR, happy to open a separate issue for it. |
|
the previous table was bmc only (depth 12), re-ran with an unbounded proof, and this pr changes three sites and i'd only checked mtval.
the antecedent covers (M/S interrupt with nonzero tval) still reach on the fixed rtl, and both witness covers are the exact negation of a proven assertion, so they're unreachable by proof rather than by bounded search. still uncovered: vstval (needs RVH=1, outside the config i verify) plus the htinst/mtinst limitation noted above. logs and traces: https://github.com/codeadpool/cva6-priv-sva/tree/main/evidence/mstatus |
|
❌ failed run, report available here. |
|
Hi! Any news about this PR ? |
|
Hi im waiting for feedback from the code owner to see if any adjustments are needed on my side. I’ll update the PR accordingly once I hear back |


…ect)
Two related bugs leave the interrupted instruction's encoding in mtval/stval after an interrupt, where the privileged spec requires zero.
Fixes #3379
The hypervisor htinst path has a similar ZERO_TVAL gated interrupt term, but it is only active on RVH builds. This config is RVH=0, so that path is not exercised by the formal check and is left out of this PR. htval is unchanged its GPLEN slice is guest physical length not a cause bit select, so its not affected.