The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] vfio: selftests: Add iommufd multi iommu test
@ 2026-05-05 22:14 Samiullah Khawaja
  2026-05-05 22:14 ` [PATCH 1/2] vfio: selftests: Add support of creating multiple iommus from iommufd Samiullah Khawaja
  2026-05-05 22:14 ` [PATCH 2/2] vfio: selftests: Add iommufd multi iommu test Samiullah Khawaja
  0 siblings, 2 replies; 11+ messages in thread
From: Samiullah Khawaja @ 2026-05-05 22:14 UTC (permalink / raw)
  To: David Matlack, Aex Williamson, Shuah Khan; +Cc: Samiullah Khawaja, linux-kernel

IOMMUFD allows creating IOAS and the underlying HWPTs using already open
iommufd. Currently the VFIO selftest framework only allows user to
create one iommu against an iommufd.

This series adds new functionality to allow,

- Creating an IOMMU against an already open iommufd.
  - The new IOMMU basically uses a new iommufd IOAS.
  - The user has option to create a new HWPT when creating the new IOMMU
    instead of using automatically created HWPT internally.
- Attaching the new iommufd IOMMU with a device that was setup using a
  different IOMMU.

This series also adds a new test that creates multiple iommus and
switches between them and does DMA to verify that everything works
properly.

This was tested in Qemu with a virtio-pci device and also on an Intel
machine with Intel DSA device.

 TAP version 13
 1..9
 # Starting 9 tests from 9 test cases.
 #  RUN           vfio_iommufd_multi_iommu_test.DEFAULT_to_DEFAULT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.DEFAULT_to_DEFAULT.memcpy
 ok 1 vfio_iommufd_multi_iommu_test.DEFAULT_to_DEFAULT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.DEFAULT_to_WITH_PT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.DEFAULT_to_WITH_PT.memcpy
 ok 2 vfio_iommufd_multi_iommu_test.DEFAULT_to_WITH_PT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.DEFAULT_to_WITHOUT_PT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.DEFAULT_to_WITHOUT_PT.memcpy
 ok 3 vfio_iommufd_multi_iommu_test.DEFAULT_to_WITHOUT_PT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.WITH_PT_to_DEFAULT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.WITH_PT_to_DEFAULT.memcpy
 ok 4 vfio_iommufd_multi_iommu_test.WITH_PT_to_DEFAULT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.WITH_PT_to_WITH_PT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.WITH_PT_to_WITH_PT.memcpy
 ok 5 vfio_iommufd_multi_iommu_test.WITH_PT_to_WITH_PT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.WITH_PT_to_WITHOUT_PT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.WITH_PT_to_WITHOUT_PT.memcpy
 ok 6 vfio_iommufd_multi_iommu_test.WITH_PT_to_WITHOUT_PT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_DEFAULT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_DEFAULT.memcpy
 ok 7 vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_DEFAULT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_WITH_PT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_WITH_PT.memcpy
 ok 8 vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_WITH_PT.memcpy
 #  RUN           vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_WITHOUT_PT.memcpy ...
 #            OK  vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_WITHOUT_PT.memcpy
 ok 9 vfio_iommufd_multi_iommu_test.WITHOUT_PT_to_WITHOUT_PT.memcpy
 # PASSED: 9 / 9 tests passed.
 # Totals: pass:9 fail:0 xfail:0 xpass:0 skip:0 error:0

The vfio framework patch was earlier sent with a different series, but I
am sending it separately in this series as this can go in independently:

https://lore.kernel.org/all/20260107201800.2486137-3-skhawaja@google.com/

Samiullah Khawaja (2):
  vfio: selftests: Add support of creating multiple iommus from iommufd
  vfio: selftests: Add iommufd multi iommu test

 tools/testing/selftests/vfio/Makefile         |   1 +
 .../vfio/lib/include/libvfio/iommu.h          |   5 +
 .../lib/include/libvfio/vfio_pci_device.h     |   2 +
 tools/testing/selftests/vfio/lib/iommu.c      |  62 +++++-
 .../selftests/vfio/lib/vfio_pci_device.c      |  22 +-
 .../vfio/vfio_iommufd_multi_iommu_test.c      | 203 ++++++++++++++++++
 6 files changed, 288 insertions(+), 7 deletions(-)
 create mode 100644 tools/testing/selftests/vfio/vfio_iommufd_multi_iommu_test.c


base-commit: 9974969c14031a097d6b45bcb7a06bb4aa525c40
-- 
2.54.0.545.g6539524ca2-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-05-11 21:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 22:14 [PATCH 0/2] vfio: selftests: Add iommufd multi iommu test Samiullah Khawaja
2026-05-05 22:14 ` [PATCH 1/2] vfio: selftests: Add support of creating multiple iommus from iommufd Samiullah Khawaja
2026-05-08 18:17   ` David Matlack
2026-05-11 20:21     ` Samiullah Khawaja
2026-05-11 20:59       ` David Matlack
2026-05-11 21:41         ` Samiullah Khawaja
2026-05-05 22:14 ` [PATCH 2/2] vfio: selftests: Add iommufd multi iommu test Samiullah Khawaja
2026-05-08 20:14   ` David Matlack
2026-05-11 20:53     ` Samiullah Khawaja
2026-05-11 21:10       ` David Matlack
2026-05-11 21:27         ` Samiullah Khawaja

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox