Skip to content

tests/qtest: add Intel IOMMU IOTLB invalidation test

Junjie Cao qemu-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tests/qtest/libqos: share Intel IOMMU test setup helperstests/qtest/iommu-intel-test.c tests/qtest/libqos/qos-intel-iommu.c tests/qtest/libqos/qos-intel-iommu.h+101 -770 replies
2/3tests/qtest/libqos: add Intel IOMMU invalidation helperstests/qtest/libqos/qos-intel-iommu.c tests/qtest/libqos/qos-intel-iommu.h+159 -00 replies
3/3tests/qtest: add IOTLB invalidation test for Intel IOMMUMAINTAINERS tests/qtest/iommu-intel-inv-test.c tests/qtest/meson.build+348 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/3] tests/qtest: add Intel IOMMU IOTLB invalidation test

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/[email protected]/

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

Signature · 1 line
2.43.0