Open mhayat-10xe opened 3 months ago
The bug arises from the condition specified in this line. Even if pdt_walk
has not occurred previously, resulting in the pdtc cache not being updated before, pdtc_lu_contect.ta.sum
still remains 0, incorrectly satisfying the condition.
To fix this issue, modify the line to (priv_lvl_i && iotlb_lu_1S_content.u && ((pdtc_lu_hit && !pdtc_lu_content.ta.sum) || iotlb_lu_1S_content.x)))
. This makes sure that it will only check the condition when there is a pdtc hit.
@malejo97 can you please clarify the default value of sum when we have no process context?
Hi @mhayat-10xe,
The RISC-V IOMMU specification states that "_For requests without a processid the privilege mode must be User".
Thus, requests with DC.tc.PDTV=0
, or PV=0 and DC.tc.DPE=0
, or with DC.fsc.pdtp.MODE = Bare
(i.e., requests without Process Contexts) cannot have supervisor privilege mode. This is because the Process Context holds the ENS bit, which enables transactions requesting Supervisor privilege mode.
The real issue is that it was possible for an S-mode transaction to reach the if
condition you refer without having an associated Process Context. I have included a check after updating the DDTC to guarantee that an S-mode transaction raises an error (Cause 260 - Transaction type disallowed) if it does not have an associated Process Context.
I wrote an assertion that states:
Below is the counter-example of the assertion failure, in the 12th cycle when we have a right leaf pte,
dc.tc.pdtv
== 0, and second stage is disabled then in the next cycle it must givetrans_valid
but it is givingtrans_error
in 12th cycle withcause_code
== 15 which is wrong.