Skip to content

tests/qtest: Add Intel IOMMU bare-metal test using iommu-testdev

Fengyuan Yu qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 4 repliesIn review
  2. v22 patches 6 repliesSuperseded
  3. v1 RFC2 patches 6 repliesSuperseded

Changes in v3 from the cover letter

----------------
- Fix MAINTAINERS: move qos-intel-iommu* to "QTest IOMMU helpers" section, move iommu-intel-test.c entry to patch 2/2, remove duplicate entries from x86 general section
- Remove duplicate Q35_IOMMU_BASE macro, use existing Q35_HOST_BRIDGE_IOMMU_ADDR instead
- Drop unused QVTD_TM_SCALABLE_NESTED enum value
- Fix parameter alignment in function declarations
- Clarify qvtd_build_dma_attrs() comment: PASID=0 is reached via VT-d's no-PASID fallback, not via DMA attributes

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2tests/qtest/libqos: Add Intel IOMMU helper libraryMAINTAINERS tests/qtest/libqos/meson.build tests/qtest/libqos/qos-intel-iommu.c +1 more+643 -02 replies
2/2tests/qtest: Add Intel IOMMU bare-metal testMAINTAINERS tests/qtest/iommu-intel-test.c tests/qtest/meson.build+219 -02 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchChao LiuFabiano RosasTao Tang
1/2R-b R-b R-b
2/2R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/2] tests/qtest: Add Intel IOMMU bare-metal test using iommu-testdev

Hi,

This patch series adds a bare-metal qtest for the Intel IOMMU (VT-d) using the iommu-testdev framework. The test exercises address translation paths without requiring a full guest OS boot.

Motivation
----------

The Intel IOMMU implementation in QEMU supports various translation modes. Currently, comprehensive testing of these translation paths requires booting a full guest OS with appropriate drivers, which is time-consuming and makes regression testing difficult.

This new test fills that gap by using iommu-testdev to trigger DMA transactions and validate the IOMMU's translation logic directly.

Test Coverage
-------------

The new test provides:
- Legacy pass-through mode (identity mapping)
- Legacy translated mode with 4-level second-level page table walks
- Scalable pass-through mode (PGTT=100b)
- Scalable second-level translation mode (PGTT=010b)
- Scalable first-level translation mode (PGTT=001b)
- Root/Context Entry, PASID Directory/Table Entry configuration
- Complete 48-bit address space translation
- End-to-end DMA verification with memory validation

Testing
-------

QTEST_QEMU_BINARY=./build/qemu-system-x86_64 \
./build/tests/qtest/iommu-intel-test --tap -k

Changes v1 -> v2
----------------
- Rebase onto latest upstream to resolve compilation errors
- Add scalable translation mode tests (SLT, FLT, PassThrough)
- Add spec-aligned register field comments for improved readability

Changes v2 -> v3
----------------
- Fix MAINTAINERS: move qos-intel-iommu* to "QTest IOMMU helpers" section, move iommu-intel-test.c entry to patch 2/2, remove duplicate entries from x86 general section
- Remove duplicate Q35_IOMMU_BASE macro, use existing Q35_HOST_BRIDGE_IOMMU_ADDR instead
- Drop unused QVTD_TM_SCALABLE_NESTED enum value
- Fix parameter alignment in function declarations
- Clarify qvtd_build_dma_attrs() comment: PASID=0 is reached via VT-d's no-PASID fallback, not via DMA attributes

Thanks,
Fengyuan

Fengyuan Yu (2):
tests/qtest/libqos: Add Intel IOMMU helper library tests/qtest: Add Intel IOMMU bare-metal test

 MAINTAINERS |   2 +
 tests/qtest/iommu-intel-test.c   | 216 +++++++++++++
 tests/qtest/libqos/meson.build   |   3 +
 tests/qtest/libqos/qos-intel-iommu.c | 454 +++++++++++++++++++++++++++
 tests/qtest/libqos/qos-intel-iommu.h | 185 +++++++++++
 tests/qtest/meson.build  |   2 +
 6 files changed, 862 insertions(+)
 create mode 100644 tests/qtest/iommu-intel-test.c
 create mode 100644 tests/qtest/libqos/qos-intel-iommu.c
 create mode 100644 tests/qtest/libqos/qos-intel-iommu.h
Signature · 1 line
2.39.5