The iommu-testdev framework lets a qtest drive an emulated vIOMMU
without a guest, and Intel translation tests already build on it [1].
The next behaviour worth covering is invalidation: no in-tree qtest
checks that any vIOMMU actually flushes a stale IOTLB entry. This
series adds that for VT-d.
Each case populates the IOTLB (map IOVA->PA_A, DMA), rewrites the leaf
PTE to PA_B without invalidating and confirms the stale entry still
serves PA_A, then invalidates and confirms a fresh walk reaches PA_B.
Without the stale check, a device that never cached would also pass.
Cases cover {legacy, scalable-slt, scalable-flt} x {global, domain,
page}, driving vtd_process_inv_desc -> vtd_process_iotlb_desc ->
vtd_iotlb_{global,domain,page}_invalidate. Three more cases cache a
second page to check page-selective scope: it survives for second-level
and, as QEMU flushes first-stage entries domain-wide, is evicted for
scalable-flt.
Patch 1 moves the VT-d setup helpers out of iommu-intel-test.c into the
shared qos-intel-iommu module with no functional change; patch 2 adds
the invalidation helpers; patch 3 adds the test.
scalable-flt uses the legacy VTD_INV_DESC_IOTLB descriptor, the path
QEMU runs for its unified IOTLB; PASID-selective PIOTLB and domain-level
selectivity are left as follow-ups.
[1] https://lore.kernel.org/qemu-devel/cover.1774421649.git.15fengyuan@gmail.com/
Junjie Cao (3):
tests/qtest/libqos: share Intel IOMMU test setup helpers
tests/qtest/libqos: add Intel IOMMU invalidation helpers
tests/qtest: add IOTLB invalidation test for Intel IOMMU
MAINTAINERS | 1 +
tests/qtest/iommu-intel-inv-test.c | 346 +++++++++++++++++++++++++++
tests/qtest/iommu-intel-test.c | 78 +-----
tests/qtest/libqos/qos-intel-iommu.c | 185 ++++++++++++++
tests/qtest/libqos/qos-intel-iommu.h | 74 ++++++
tests/qtest/meson.build | 2 +-
6 files changed, 608 insertions(+), 78 deletions(-)
create mode 100644 tests/qtest/iommu-intel-inv-test.c
base-commit: b4bdad7dcef623d2874df4e79e0be01075096c3b
--
2.43.0