Closed baimengwei closed 8 months ago
Thanks for pointing that out. Fix in PR #266
if the fqt is 1023 and fqh is 0, and the max queue size is 1024, is this a full condition, which only can store 1023 record item, rather than 1024 item?
If c model changes the full condition, should the specification change synchronous? https://github.com/riscv-non-isa/riscv-iommu/blob/main/iommu_registers.adoc#fault-queue-csr-fqcsr
The fault-queue-overflow bit is set to 1 if the IOMMU needs to queue a fault record but the fault-queue is full (i.e., fqt == fqh - 1).
The fault-record is discarded and no more fault records are generated until software clears fqof by writing 1 to the bit.
if the fqt is 1023 and fqh is 0, and the max queue size is 1024, is this a full condition, which only can store 1023 record item, rather than 1024 item?
Yes. Please see Chapter 3 - "A queue is empty if the head is equal to the tail. A queue is full if the tail is the head minus one. The head and tail wrap around when they reach the end of the circular buffer."
if the fqt is 1023 and fqh is 0, and the max queue size is 1024, is this a full condition, which only can store 1023 record item, rather than 1024 item?
Yes. Please see Chapter 3 - "A queue is empty if the head is equal to the tail. A queue is full if the tail is the head minus one. The head and tail wrap around when they reach the end of the circular buffer."
Thanks
https://github.com/riscv-non-isa/riscv-iommu/blob/main/iommu_ref_model/libiommu/src/iommu_faults.c#L124C30-L124C30 if the fqt is 1023 and fqh is 0, and the max queue size is 1024, then the condition will be 1023 == -1, which seems incorrect?