riscv-non-isa / riscv-iommu

RISC-V IOMMU Specification
https://jira.riscv.org/browse/RVG-55
Creative Commons Attribution 4.0 International
98 stars 17 forks source link

Question about the detection when change the ddt levels in the model #362

Closed viktoryou closed 5 months ago

viktoryou commented 5 months ago

From the spec,

The IOMMU behavior of writing iommu_mode to 1LVL, 2LVL, or 3LVL, when the previous value of the iommu_mode is not Off or Bare is UNSPECIFIED.

The model would jump the detection of the previous value of the iommu_mode when the value get changed into 1LVL, 2LVL, or 3LVL. I agree this detection is not compulsory. But just like other UNSPECIFIED behavior that is CSR-related, would the model tends to avoid such unexpected updates?

Also, I find it's not clear to understand this sentence:

To change DDT levels, the IOMMU must first be transitioned to Bare or Off state.

From my undertanding, it only says about a rule that software must follow when chanding DDT levels. However, it also seems that IOMMU itself needs to take some action. What should be the right understanding of it?

ved-rivos commented 5 months ago

But just like other UNSPECIFIED behavior that is CSR-related, would the model tends to avoid such unexpected updates?

The behavior is unspecified but every implementation has some default behavior. Just that they may be different between implementations and software should not rely on them. To illustrate this I will go ahead and change the behavior to ignore the write if previous value is not Off or Bare.

From my undertanding, it only says about a rule that software must follow when chanding DDT levels. However, it also seems that IOMMU itself needs to take some action. What should be the right understanding of it?

This is explaining - to software - what the right sequence is. There is no action needed by IOMMU.