From: Samiullah Khawaja <skhawaja@google.com>
To: David Matlack <dmatlack@google.com>,
Aex Williamson <alex@shazbot.org>, Shuah Khan <shuah@kernel.org>
Cc: Samiullah Khawaja <skhawaja@google.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] vfio: selftests: Add iommufd multi iommu test
Date: Tue, 5 May 2026 22:14:34 +0000 [thread overview]
Message-ID: <20260505221518.619123-1-skhawaja@google.com> (raw)
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
next reply other threads:[~2026-05-05 22:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 22:14 Samiullah Khawaja [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260505221518.619123-1-skhawaja@google.com \
--to=skhawaja@google.com \
--cc=alex@shazbot.org \
--cc=dmatlack@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox