Hi Philippe,

On 2025/12/27 06:56, Philippe Mathieu-Daudé wrote:
Hi Tao,

On 24/12/25 04:46, Tao Tang wrote:
Add a minimal PCI test device designed to exercise IOMMU translation
(such as ARM SMMUv3) without requiring guest firmware or OS. The device
provides MMIO registers to configure and trigger DMA operations with
controllable attributes (security state, address space), enabling
deterministic IOMMU testing.

Key features:
- Bare-metal IOMMU testing via simple MMIO interface
- Configurable DMA attributes for security states and address spaces
- Write-then-read verification pattern with automatic result checking

The device performs a deterministic DMA test pattern: write a known
value (0x12345678) to a configured GVA, read it back, and verify data
integrity. Results are reported through a dedicated result register,
eliminating the need for complex interrupt handling or driver
infrastructure in tests.

This is purely a test device and not intended for production use or
machine realism. It complements existing test infrastructure like
pci-testdev but focuses specifically on IOMMU translation path
validation.

Signed-off-by: Tao Tang <[email protected]>
Reviewed-by: Pierrick Bouvier <[email protected]>
Reviewed-by: Clément Mathieu--Drif <[email protected]>
Reviewed-by: Fabiano Rosas <[email protected]>
---
  MAINTAINERS                     |   7 +
  docs/specs/index.rst            |   1 +
  docs/specs/iommu-testdev.rst    | 112 +++++++++++++
  hw/misc/Kconfig                 |   5 +
  hw/misc/iommu-testdev.c         | 271 ++++++++++++++++++++++++++++++++
  hw/misc/meson.build             |   1 +
  hw/misc/trace-events            |  10 ++
  include/hw/misc/iommu-testdev.h |  68 ++++++++
  8 files changed, 475 insertions(+)
  create mode 100644 docs/specs/iommu-testdev.rst
  create mode 100644 hw/misc/iommu-testdev.c
  create mode 100644 include/hw/misc/iommu-testdev.h


diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig
index fccd735c24..b5f6fdbd9c 100644
--- a/hw/misc/Kconfig
+++ b/hw/misc/Kconfig
@@ -25,6 +25,11 @@ config PCI_TESTDEV
      default y if TEST_DEVICES
      depends on PCI
  +config IOMMU_TESTDEV
+    bool
+    default y if TEST_DEVICES
+    depends on PCI

       "depends on PCI && ARM"

?


Thanks for your review.


iommu-testdev is intended to be a generic PCI test DMA engine, usable to exercise different IOMMU models, not ARM-specific. The current series uses SMMUv3 as the first backend/example, but the device itself should only depend on PCI and is gated by TEST_DEVICES.


Regards,

Tao


Reply via email to