zero-day-labs / riscv-iommu

IOMMU IP compliant with the RISC-V IOMMU Specification v1.0
Apache License 2.0
66 stars 12 forks source link

Wrong update of dc cache and error not raised when InclPC == 0 and dc.tc.pdtv == 1 #11

Closed mhayat-10xe closed 2 months ago

mhayat-10xe commented 2 months ago

If PC support(InclPC), InclDBG, and MSITrans are disabled, ddtp.iommu_mode == 2 and dc.tc.pdtv == 1, RTL is not throwing an error instead it is updating the ddtc with the wrong device context.

Below is the counter example where we can see ddt_walk_o goes high at cycle 3, in the 4th cycle dc.tc.pdtv goes high and after loading the device context completely in the 8th cycle i_rv_iommu_ddtc.update_i goes high which shouldn't be high at that time instead it should give an error with cause_code == transaction_type_disallowed(cause == 260) because when InclPC == 0, dc.tc.pdtv must be 0 too but it is 1 here. image

malejo97 commented 2 months ago

Fixed in PR #12