This series corrects MSI fault records in the RISC-V IOMMU and adds regression coverage for the trap callback.
Patch 1 preserves the original IOVA through MSI interception, recovers the GPA for MSI lookup, and keeps internal recovery walks out of the modeled HPM events. It includes four firmware-independent MSI qtests. Patch 2 separately aligns MSI fault PV reporting with QEMU's existing PDTV policy. Its PD8/DPE regression selects default process zero and checks PV, PID, and the original IOVA. Complete per-request PID-validity metadata handling is outside this change. Patch 3 shares the private callback with nine deterministic unit tests for recovery faults and ordinary-DMA fallback, without adding a public API or runtime test hooks. The context stub uses a distinct release reference so cleanup checks cannot confuse it with the context. Patch 1 can be applied on its own. Patch 2 builds on patch 1; neither requires patch 3. The refactoring and unit tests in patch 3 can be reviewed separately if the private implementation fragment or test structure needs further discussion. The series is based on QEMU master at e9fa1f66f0d4. Validation covers RISC-V IOMMU qtests, MSI trap unit tests, the MSI regression probe, and an x86_64-softmmu-only unit-test build with -Werror. The initial local series was also built and tested after each individual patch. Issue: https://gitlab.com/qemu-project/qemu/-/work_items/3562 Zephyr Li (3): hw/riscv/riscv-iommu: Preserve IOVA in MSI fault records hw/riscv/riscv-iommu: Fix MSI fault PV reporting for process ID zero hw/riscv/riscv-iommu: Add unit tests for MSI trap handling MAINTAINERS | 1 + hw/riscv/riscv-iommu-trap.c.inc | 69 ++++++++ hw/riscv/riscv-iommu.c | 61 +++---- tests/qtest/iommu-riscv-test.c | 181 ++++++++++++++++++-- tests/unit/meson.build | 1 + tests/unit/test-riscv-iommu-trap.c | 266 +++++++++++++++++++++++++++++ 6 files changed, 525 insertions(+), 54 deletions(-) create mode 100644 hw/riscv/riscv-iommu-trap.c.inc create mode 100644 tests/unit/test-riscv-iommu-trap.c -- 2.43.0
