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 cause_code if dc.tc.v == 0 and at the same time dc.tc.gade == 1. #10

Closed mhayat-10xe closed 2 months ago

mhayat-10xe commented 2 months ago

The specifications stated in section 2.3.1 "Process to locate the Device-context":

  1. If DC.tc.v == 0, stop and report "DDT entry not valid" (cause = 258).

  2. If the DC is misconfigured as determined by the rules outlined in Section 2.1.4, then stop and report "DDT entry misconfigured" (cause = 259).

However, in our case when DC.tc.v == 0, satisfying point 9, and simultaneously DC.tc.gade == 1, satisfying point 10, preference should be given to point 9 and should give cause = 258 but RTL is giving preference to point number 10, and giving cause = 259 which is wrong.

Here is the counter Example of a violation of specs where in the third cycle there is ddt_walk_o and in the fourth cycle dc.tc.v == 0 and dc.tc.gade == 1 which should result in cause_n == 257 but it is giving cause_n == 258 which is a violation of specs. image

malejo97 commented 2 months ago

Fixed in PR #12