PMP TOR writes and behavior
-
There appears to be a functional difference between spike and ibex in the interaction between L and A=TOR; riscv/riscv-isa-manual#545 endorsed the spike interpretation.
-
Should https://github.com/lowRISC/ibex/blob/master/rtl/ibex_pmp.sv#L92-L93 be generating both ends of the TOR range from the same pmpaddr?
-
Do we differ from spike here? Locking of the address registers is implemented here. I think we verified the Ibex implementation against spike - @udinator will be able to confirm
-
The start address of the TOR range comes from
region_start_addresswhich will be the previous PMP region address - see here
On 1. I think we'll disallow writes to pmp_addr[i] if entry i+1 has A=TOR regardless of the lock bit on entry i+1 where the spec update (which matches current Spike behavior) indicates we should allow those unless entry i+1 has both A=TOR and the lock bit set?
Yep - just re-read it myself - will fix to match the new spec for 1.
Does this just show that we haven't tried these tests against a recent Spike, or is it a proper test hole?
We should also check what the OVPsim behavior is here. Given our behavior was spec compliant until https://github.com/riscv/riscv-isa-manual/pull/545 went in 7 hours ago OVPsim may also have similar behavior and not match Spike.
@tomroberts-lowrisc - yes, we verified the Ibex implementation against both Spike and OVPsim, not taking into account this recent spec change. @rswarbrick to your point - yes, it means that we haven't tried these tests against recent versions of Spike and OVPsim, so I'll need to update both and verify the Ibex implementation in this new context. It might be worth adding an explicit test for this feature in the spec just to make sure as well.
@udinator the Spike behavior has been the same since it went in in 2018 though?
@sorear: good point - after investigating more deeply this indeed seems to be a small test hole, the existing suite of PMP tests exercises repeated writes to the pmpcfg CSRs (which work as intended), just not to the pmpaddr CSRs.
@GregAC @tomroberts-lowrisc I've been able to reproduce this issue with some updates to the current PMP test suite, and I've opened #1054 to fix the RTL issue.
Fixed in #1054