On Wed, Aug 27, 2025 at 11:55 AM Alex Williamson
wrote:
>
> On Fri, 22 Aug 2025 21:24:47 +0000
> David Matlack wrote:
>
> > This series introduces VFIO selftests, located in
> > tools/testing/selftests/vfio/.
> >
> > VFIO selftests aim to enable kernel develo
Add a new IOMMU mode for using iommufd directly. In this mode userspace
opens /dev/iommu and binds it to a device FD acquired through
/dev/vfio/devices/vfioX.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 6 +-
.../selftests/vfio/lib
: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 8 +++
.../selftests/vfio/lib/vfio_pci_device.c | 1 +
.../selftests/vfio/vfio_dma_mapping_test.c| 24 +--
.../selftests/vfio/vfio_pci_driver_test.c | 13 +-
4 files changed, 32 insertions
plenty to stress test VFIO and the IOMMU.
The driver does not yet support requesting interrupt handles, as this
commit was not tested against hardware that requires it.
Cc: Vinicius Costa Gomes
Cc: Dave Jiang
Acked-by: Vinicius Costa Gomes
Acked-by: Shuah Khan
Signed-off-by: David Matlack
Add a new IOMMU mode for using VFIO_TYPE1v2_IOMMU.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 3 ++-
tools/testing/selftests/vfio/lib/vfio_pci_device.c | 5 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a
made when importing: None
Acked-by: Vinicius Costa Gomes
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/arch/x86/include/asm/io.h| 26 +
tools/arch/x86/include/asm/special_insns.h | 27 ++
2 files changed, 53 insertions(+)
create
: David Matlack
---
tools/include/asm-generic/io.h | 482 +
tools/include/asm/io.h | 7 +
tools/include/linux/io.h | 4 +-
3 files changed, 492 insertions(+), 1 deletion(-)
create mode 100644 tools/include/asm-generic/io.h
create mode 100644 tools
then cleanup all the devices.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
tools/testing/selftests/vfio/run.sh | 109 ++
2 files changed, 110 insertions(+)
create mode 100755 tools/testing/selftests/vfio/run.sh
Now that VFIO selftests support iommufd, make it the default mode.
IOMMUFD is the successor to VFIO_TYPE1{,v2}_IOMMU and all new features
are being added there, so it's a slightly better fit as the default
mode.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests
Encapsulate the "IOMMU mode" a test should use behind a new struct.
In the future this will be used to support other types of IOMMUs besides
VFIO_TYPE1_IOMMU, and allow users to select the mode on the command
line.
No functional change intended.
Acked-by: Shuah Khan
Signed-off-by: Dav
Add a helper function for matching a device against a given vendor and
device ID. This will be used in a subsequent commit to match devices
against drivers.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 7 +++
tools/testing
transparently.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 4 +++-
tools/testing/selftests/vfio/lib/vfio_pci_device.c | 10 ++
tools/testing/selftests/vfio/vfio_dma_mapping_test.c | 12 ++--
3 files changed, 23
acros (e.g. IOAT_CHANCMD_RESET) and struct ioat_dma_descriptor.
Cc: Dave Jiang
Cc: Dan Williams
Acked-by: Dave Jiang
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/drivers/ioat/hw.h | 1 +
.../selftests/vfio/lib/drivers/ioat/ioat.c| 235 ++
: Dave Jiang
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
drivers/dma/ioat/dma.h | 2 ++
drivers/dma/ioat/hw.h | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index a180171087a8..12a4a4860a74 100644
--- a/drivers/dma
Add a symlink to include/linux/pci_ids.h to tools/include/. This will be
used by VFIO selftests in subsequent commits to match device and vendor
IDs.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/include/linux/pci_ids.h | 1 +
1 file changed, 1 insertion(+)
create mode 12
Import the x86-specific overrides for from the kernel
headers into tools/include/.
Changes made when importing:
- Replace CONFIG_X86_64 with __x86_64__.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/arch/x86/include/asm/io.h | 75 +
tools
Move the helper function to get the VFIO cdev path to libvfio so that it
can be used in libvfio in a subsequent commit.
No functional change intended.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 1 +
.../selftests/vfio/lib
Add an empty definition for __iomem so that kernel headers that use
__iomem can be imported into tools/include/ with less modifications.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/include/linux/compiler.h | 4
1 file changed, 4 insertions(+)
diff --git a/tools/include
: Vinicius Costa Gomes
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
drivers/dma/idxd/registers.h | 4
1 file changed, 4 insertions(+)
diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h
index 9c1c546fe443..02bab136385e 100644
--- a/drivers/dma/idxd/registers.h
Add a new selftest that tests all driver operations. This test serves
both as a demonstration of the driver framework, and also as a
correctness test for future drivers.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
.../selftests
are then used by drivers.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 23 +++--
.../selftests/vfio/lib/vfio_pci_device.c | 49 ---
.../selftests/vfio/vfio_dma_mapping_test.c| 31 ++--
3 files changed
commits will introduce drivers for specific devices.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 92 ++
tools/testing/selftests/vfio/lib/libvfio.mk | 1 +
.../selftests/vfio/lib/vfio_pci_device.c | 5
Make it possible to assert that a given MSI eventfd did _not_ fire by
adding a helper to mark an eventfd non-blocking. Demonstrate this in
vfio_pci_device_test by asserting the MSI eventfd did not fire before
vfio_pci_irq_trigger().
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools
skipped if
that directory is not available (i.e. non-Intel IOMMUs).
Signed-off-by: Josh Hilke
[reword commit message, refactor code]
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
.../selftests/vfio/vfio_dma_mapping_test.c| 111 ++
1 file changed, 111 insertions(+)
diff
Khan
Signed-off-by: David Matlack
---
.../selftests/vfio/vfio_dma_mapping_test.c| 38 ---
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
index b56cebb
From: Josh Hilke
Add a test to vfio_pci_device_test which resets the device. If reset is
not supported by the device, the test is skipped.
Signed-off-by: Josh Hilke
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 1 +
tools
-off-by: Josh Hilke
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
.../selftests/vfio/vfio_dma_mapping_test.c| 51 +++
.../selftests/vfio/vfio_pci_device_test.c | 18 ---
3 files changed, 52 insertions(+), 18
From: Josh Hilke
Add a vfio test suite which verifies that userspace can bind and unbind
devices, allocate I/O address space, and attach a device to an IOMMU
domain using the cdev + IOMMUfd VFIO interface.
Signed-off-by: Josh Hilke
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools
MSI-x
- Reading and writing to PCI config space
This test should work with most PCI devices, as long as they are bound
to vfio-pci.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
.../selftests/vfio/vfio_pci_device_test.c | 180
Create the directory tools/testing/selftests/vfio with a stub Makefile
and hook it up to the top-level selftests Makefile.
This directory will be used in subsequent commits to host selftests for
the VFIO subsystem.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
MAINTAINERS
subsequent commit.
Acked-by: Shuah Khan
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 14 +
.../selftests/vfio/lib/include/vfio_util.h| 140 +++
tools/testing/selftests/vfio/lib/libvfio.mk | 15 +
.../selftests/vfio/lib/vfio_pci_device.c | 365
50404193923.1413163-68-sea...@google.com/
[3] https://lore.kernel.org/kvm/20250620232031.2705638-32-dmatl...@google.com/
David Matlack (25):
selftests: Create tools/testing/selftests/vfio
vfio: selftests: Add a helper library for VFIO selftests
vfio: selftests: Introduce vfio_pci_device_test
On Thu, Aug 21, 2025 at 1:10 PM Alex Williamson
wrote:
>
> I think we have all the required acks now and reviews just suggest some
> minor patch shuffling, right?. You were also going to switch from
> reviewer to maintainer of the selftests in MAINTAINERS ;)
>
> Are you planning to collect those
On Tue, Aug 12, 2025 at 8:04 AM David Matlack wrote:
>
> On 2025-08-05 05:08 PM, Joel Granados wrote:
> > On Fri, Jun 20, 2025 at 11:19:58PM +, David Matlack wrote:
> > > This series introduces VFIO selftests, located in
> > > tools/testing/selftests/vfio/.
&g
On Mon, Aug 18, 2025 at 4:41 PM Vinicius Costa Gomes
wrote:
> David Matlack writes:
> > +
> > +static int dsa_probe(struct vfio_pci_device *device)
> > +{
> > + if (!vfio_pci_device_match(device, PCI_VENDOR_ID_INTEL,
> > +
On Mon, Aug 18, 2025 at 4:25 PM Vinicius Costa Gomes
wrote:
>
> David Matlack writes:
>
> > Import iosubmit_cmds512() from arch/x86/include/asm/io.h into tools/ so
> > it can be used by VFIO selftests to interact with Intel DSA devices.
> >
>
> minor: perhaps m
On Mon, Aug 18, 2025 at 12:37 PM Alex Williamson
wrote:
>
> On Mon, 18 Aug 2025 11:59:39 -0700
> David Matlack wrote:
>
> > On Thu, Jul 31, 2025 at 1:55 PM David Matlack wrote:
> > >
> > > On Tue, Jul 29, 2025 at 3:26 PM Jason Gunthorpe wrote:
> > >
On Thu, Jul 31, 2025 at 1:55 PM David Matlack wrote:
>
> On Tue, Jul 29, 2025 at 3:26 PM Jason Gunthorpe wrote:
> >
> > On Mon, Jul 28, 2025 at 10:27:37AM -0600, Alex Williamson wrote:
> > > On Fri, 25 Jul 2025 09:47:48 -0700
> > > David Matlack wrote:
&
On 2025-08-05 05:08 PM, Joel Granados wrote:
> On Fri, Jun 20, 2025 at 11:19:58PM +0000, David Matlack wrote:
> > This series introduces VFIO selftests, located in
> > tools/testing/selftests/vfio/.
> Sorry for coming late to the party. Only recently got some cycles to go
&g
On Tue, Jul 29, 2025 at 3:26 PM Jason Gunthorpe wrote:
>
> On Mon, Jul 28, 2025 at 10:27:37AM -0600, Alex Williamson wrote:
> > On Fri, 25 Jul 2025 09:47:48 -0700
> > David Matlack wrote:
> > > I also was curious about your thoughts on maintenance of VFIO
> > &g
On Fri, Jun 20, 2025 at 4:21 PM David Matlack wrote:
>
> This series introduces VFIO selftests, located in
> tools/testing/selftests/vfio/.
Hi Alex,
I wanted to discuss how you would like to proceed with this series.
The series is quite large, so one thing I was wondering is if you
On Mon, Jun 30, 2025 at 5:24 AM Sairaj Kodilkar wrote:
>
> On 5/24/2025 5:00 AM, David Matlack wrote:
> > Make it possible to assert that a given MSI eventfd did _not_ fire by
> > adding a helper to mark an eventfd non-blocking. Demonstrate this in
> > vfio_pci_device_t
On Thu, Jun 26, 2025 at 9:57 PM Sairaj Kodilkar wrote:
>
>
>
> On 6/26/2025 9:59 PM, David Matlack wrote:
> > On Thu, Jun 26, 2025 at 4:44 AM Sairaj Kodilkar wrote:
> >> On 6/26/2025 4:57 PM, Sairaj Kodilkar wrote:
> >>> On 6/21/2025 4:50 AM, David Matlack
On Thu, Jun 26, 2025 at 4:44 AM Sairaj Kodilkar wrote:
> On 6/26/2025 4:57 PM, Sairaj Kodilkar wrote:
> > On 6/21/2025 4:50 AM, David Matlack wrote:
> >> +/*
> >> + * Limit the number of MSIs enabled/disabled by the test regardless
> >> of the
> >>
device-posted interrupts in Intel).
Signed-off-by: David Matlack
---
.../selftests/kvm/vfio_pci_device_irq_test.c | 61 +--
1 file changed, 55 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/kvm/vfio_pci_device_irq_test.c
b/tools/testing/selftests/kvm
the hardware path (e.g. VT-d on Intel).
This test only supports x86_64 for now, but can be ported to other
architectures in the future.
Signed-off-by: David Matlack
---
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../testing/selftests/kvm/include/kvm_util.h | 4 +
tools/testing
different CFLAGS when building without
conflicting with each other.
Signed-off-by: David Matlack
---
tools/testing/selftests/kvm/Makefile.kvm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/kvm/Makefile.kvm
b/tools/testing/selftests/kvm/Makefile.kvm
index 57d7a8fee047
then cleanup all the devices.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
tools/testing/selftests/vfio/run.sh | 109 ++
2 files changed, 110 insertions(+)
create mode 100755 tools/testing/selftests/vfio/run.sh
diff --git a/tools
Now that VFIO selftests support iommufd, make it the default mode.
IOMMUFD is the successor to VFIO_TYPE1{,v2}_IOMMU and all new features
are being added there, so it's a slightly better fit as the default
mode.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/vfio_pci_dev
Add a new IOMMU mode for using iommufd directly. In this mode userspace
opens /dev/iommu and binds it to a device FD acquired through
/dev/vfio/devices/vfioX.
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 6 +-
.../selftests/vfio/lib/vfio_pci_device.c
transparently.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 4 +++-
tools/testing/selftests/vfio/lib/vfio_pci_device.c | 10 ++
tools/testing/selftests/vfio/vfio_dma_mapping_test.c | 12 ++--
3 files changed, 23 insertions(+), 3 deletions
Add a new IOMMU mode for using VFIO_TYPE1v2_IOMMU.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 3 ++-
tools/testing/selftests/vfio/lib/vfio_pci_device.c | 5 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests
Automatically replicate vfio_dma_mapping_test and vfio_pci_driver_test
across all supported IOMMU modes using fixture variants. Both of these
tests exercise DMA mapping to some degree so having automatic coverage
across all IOMMU modes will help catch bugs.
Signed-off-by: David Matlack
plenty to stress test VFIO and the IOMMU.
The driver does not yet support requesting interrupt handles, as this
commit was not tested against hardware that requires it.
Cc: Vinicius Costa Gomes
Cc: Dave Jiang
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/drivers/dsa/dsa.c | 416
Move the helper function to get the VFIO cdev path to libvfio so that it
can be used in libvfio in a subsequent commit.
No functional change intended.
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 1 +
.../selftests/vfio/lib/vfio_pci_device.c | 31
Encapsulate the "IOMMU mode" a test should use behind a new struct.
In the future this will be used to support other types of IOMMUs besides
VFIO_TYPE1_IOMMU, and allow users to select the mode on the command
line.
No functional change intended.
Signed-off-by: David Matlack
---
...
-by: David Matlack
---
drivers/dma/idxd/registers.h | 4
1 file changed, 4 insertions(+)
diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h
index 006ba206ab1b..bf79bc39a5f3 100644
--- a/drivers/dma/idxd/registers.h
+++ b/drivers/dma/idxd/registers.h
@@ -3,7 +3,11
acros (e.g. IOAT_CHANCMD_RESET) and struct ioat_dma_descriptor.
Cc: Dave Jiang
Cc: Dan Williams
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/drivers/ioat/hw.h | 1 +
.../selftests/vfio/lib/drivers/ioat/ioat.c| 235 ++
.../vfio/lib/drivers/ioat/registers.h
-by: David Matlack
---
drivers/dma/ioat/dma.h | 2 ++
drivers/dma/ioat/hw.h | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index a180171087a8..12a4a4860a74 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
Add a new selftest that tests all driver operations. This test serves
both as a demonstration of the driver framework, and also as a
correctness test for future drivers.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
.../selftests/vfio
commits will introduce drivers for specific devices.
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 92 ++
tools/testing/selftests/vfio/lib/libvfio.mk | 1 +
.../selftests/vfio/lib/vfio_pci_device.c | 5 +
.../selftests/vfio/lib
Add a helper function for matching a device against a given vendor and
device ID. This will be used in a subsequent commit to match devices
against drivers.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 7 +++
tools/testing/selftests/vfio
Make it possible to assert that a given MSI eventfd did _not_ fire by
adding a helper to mark an eventfd non-blocking. Demonstrate this in
vfio_pci_device_test by asserting the MSI eventfd did not fire before
vfio_pci_irq_trigger().
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio
are then used by drivers.
Signed-off-by: David Matlack
---
.../selftests/vfio/lib/include/vfio_util.h| 23 +++--
.../selftests/vfio/lib/vfio_pci_device.c | 49 ---
.../selftests/vfio/vfio_dma_mapping_test.c| 21 +---
3 files changed, 75 insertions(+), 18
Import the x86-specific overrides for from the kernel
headers into tools/include/.
Changes made when importing:
- Replace CONFIG_X86_64 with __x86_64__.
Signed-off-by: David Matlack
---
tools/arch/x86/include/asm/io.h | 75 +
tools/include/asm/io.h
Add a symlink to include/linux/pci_ids.h to tools/include/. This will be
used by VFIO selftests in subsequent commits to match device and vendor
IDs.
Signed-off-by: David Matlack
---
tools/include/linux/pci_ids.h | 1 +
1 file changed, 1 insertion(+)
create mode 12 tools/include/linux
skipped if
that directory is not available (i.e. non-Intel IOMMUs).
Signed-off-by: Josh Hilke
[reword commit message, refactor code]
Signed-off-by: David Matlack
---
.../selftests/vfio/vfio_dma_mapping_test.c| 111 ++
1 file changed, 111 insertions(+)
diff --git a/tools/testing
made when importing: None
Signed-off-by: David Matlack
---
tools/arch/x86/include/asm/io.h| 26 +
tools/arch/x86/include/asm/special_insns.h | 27 ++
2 files changed, 53 insertions(+)
create mode 100644 tools/arch/x86/include/asm/special_insns.h
directly).
Changes made when importing:
- Add missing includes at the top.
- Stub out mmiowb_set_pending().
- Stub out _THIS_IP_.
- Stub out log_*_mmio() calls.
- Drop the CONFIG_64BIT checks, since tools/include/linux/types.h
always defines u64.
Signed-off-by: David Matlack
---
tools
Add an empty definition for __iomem so that kernel headers that use
__iomem can be imported into tools/include/ with less modifications.
Signed-off-by: David Matlack
---
tools/include/linux/compiler.h | 4
1 file changed, 4 insertions(+)
diff --git a/tools/include/linux/compiler.h b/tools
-off-by: Josh Hilke
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
.../selftests/vfio/vfio_dma_mapping_test.c| 49 +++
.../selftests/vfio/vfio_pci_device_test.c | 16 --
3 files changed, 50 insertions(+), 16 deletions(-)
create
From: Josh Hilke
Add test coverage of mapping 2M and 1G HugeTLB to vfio_dma_mapping_test
using a fixture variant. If there isn't enough HugeTLB memory available
for the test, just skip them.
Signed-off-by: Josh Hilke
[switch from command line option to fixture variant]
Signed-off-by:
From: Josh Hilke
Add a test to vfio_pci_device_test which resets the device. If reset is
not supported by the device, the test is skipped.
Signed-off-by: Josh Hilke
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 1 +
tools/testing/selftests/vfio/lib
From: Josh Hilke
Add a vfio test suite which verifies that userspace can bind and unbind
devices, allocate I/O address space, and attach a device to an IOMMU
domain using the cdev + IOMMUfd VFIO interface.
Signed-off-by: Josh Hilke
Signed-off-by: David Matlack
---
tools/testing/selftests
MSI-x
- Reading and writing to PCI config space
This test should work with most PCI devices, as long as they are bound
to vfio-pci.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
.../selftests/vfio/vfio_pci_device_test.c | 178 ++
2
subsequent commit.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 14 +
.../selftests/vfio/lib/include/vfio_util.h| 140 +++
tools/testing/selftests/vfio/lib/libvfio.mk | 15 +
.../selftests/vfio/lib/vfio_pci_device.c | 365 ++
4 files
Create the directory tools/testing/selftests/vfio with a stub Makefile
and hook it up to the top-level selftests Makefile.
This directory will be used in subsequent commits to host selftests for
the VFIO subsystem.
Signed-off-by: David Matlack
---
MAINTAINERS | 7
Mahameed
Cc: Adithya Jayachandran
Cc: Joel Granados
[1]
https://github.com/Joelgranados/qemu/blob/pcie-testdev/hw/misc/pcie-ats-testdev.c
[2] https://lore.kernel.org/kvm/20250404193923.1413163-68-sea...@google.com/
David Matlack (28):
selftests: Create tools/testing/selftests/vfio
vfio: selftests
On 2025-05-30 02:25 PM, Jason Gunthorpe wrote:
> On Fri, May 30, 2025 at 09:50:22AM -0700, David Matlack wrote:
> > I'll explore doing this. For a single dimension this looks possible.
> > But for multiple dimensions (e.g. cross product of iommu_mode and
> > backing_src)
On Sun, Jun 1, 2025 at 12:45 AM Greg Kroah-Hartman
wrote:
>
> On Sat, May 31, 2025 at 10:09:34PM +0300, Andy Shevchenko wrote:
> > On Fri, May 30, 2025 at 02:12:36PM -0700, David Matlack wrote:
> > > On Fri, May 23, 2025 at 4:30 PM David Matlack wrote:
> >
> > .
On Mon, May 26, 2025 at 10:20 AM Jason Gunthorpe wrote:
>
> On Fri, May 23, 2025 at 11:30:14PM +, David Matlack wrote:
> > Now that VFIO selftests support iommufd, make it the default mode.
> > IOMMUFD is the successor to VFIO_TYPE1{,v2}_IOMMU and all new features
> &g
On Mon, Jun 2, 2025 at 4:08 PM Alex Williamson
wrote:
> On Fri, 23 May 2025 23:30:15 +
> > +function add_id() {
> > + if echo $(echo ${1} | tr : ' ') > ${2}/new_id 2> /dev/null; then
> > + echo "Added ${1} to ${2}"
> > + return 0
> > + fi
> > +
> > + return
On Mon, Jun 2, 2025 at 4:08 PM Alex Williamson
wrote:
>
> On Fri, 23 May 2025 23:29:49 +0000
> David Matlack wrote:
> > +int main(int argc, char *argv[])
> > +{
> > + char *bdf;
> > +
> > + if (argc != 2) {
> > + pri
On Fri, May 23, 2025 at 4:30 PM David Matlack wrote:
> +static int iommu_mapping_get(const char *bdf, u64 iova,
> +struct iommu_mapping *mapping)
> +{
> + if (access("/sys/kernel/debug/iommu/intel", F_OK))
> + return in
On Mon, May 26, 2025 at 10:15 AM Jason Gunthorpe wrote:
>
> On Fri, May 23, 2025 at 11:29:52PM +, David Matlack wrote:
> > From: Josh Hilke
> >
> > Add a command line arg to vfio_dma_mapping_test to choose the size of
> > page which is mapped in VFIO.
>
>
On Tue, May 27, 2025 at 5:11 PM Jason Gunthorpe wrote:
>
> On Tue, May 27, 2025 at 04:01:52PM -0700, David Matlack wrote:
> > > A reusable mini-driver framework that can trigger DMA is a huge leap
> > > forward.
> >
> > How broad do you think the reusability
On Mon, May 26, 2025 at 10:18 AM Jason Gunthorpe wrote:
>
> On Fri, May 23, 2025 at 11:29:58PM +, David Matlack wrote:
> > Import drivers/dma/ioat/{hw.h,registers.h} into tools/include/ so that
> > they can be used in VFIO selftests to interact with Intel CBDMA devices.
&g
On Mon, May 26, 2025 at 10:16 AM Jason Gunthorpe wrote:
>
> On Fri, May 23, 2025 at 11:29:53PM +, David Matlack wrote:
> > From: Josh Hilke
> >
> > Update vfio dma mapping test to verify that the IOMMU uses 2M and 1G
> > mappings when 2M and 1G HugeTLB
On Mon, May 26, 2025 at 10:09 AM Jason Gunthorpe wrote:
>
> On Fri, May 23, 2025 at 11:29:45PM +, David Matlack wrote:
> > Drivers must implement the following methods:
> >
> > - probe():Check if the driver supports a given device.
> > - init():
On Mon, May 26, 2025 at 2:07 AM Yi Liu wrote:
>
> On 2025/5/24 07:29, David Matlack wrote:
> > This series introduces VFIO selftests, located in
> > tools/testing/selftests/vfio/.
> >
> > VFIO selftests aim to enable kernel developers to write and run tests
>
and parse them into an array, setup all the devices, pass the list of
BDFs to the test, and then cleanup all the devices.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
tools/testing/selftests/vfio/run.sh | 110 ++
2 files changed, 111
MSI-x
- Reading and writing to PCI config space
This test should work with most PCI devices, as long as they are bound
to vfio-pci.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 1 +
.../selftests/vfio/vfio_pci_device_test.c | 180 ++
2
subsequent commit.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/Makefile | 13 +
.../selftests/vfio/lib/include/vfio_util.h| 126 +++
tools/testing/selftests/vfio/lib/libvfio.mk | 17 +
.../selftests/vfio/lib/vfio_pci_device.c | 330 ++
4 files
From: Josh Hilke
Add a vfio test suite which verifies that userspace can bind and unbind
devices, allocate I/O address space, and attach a device to an IOMMU
domain using the cdev + IOMMUfd VFIO interface.
Signed-off-by: Josh Hilke
Signed-off-by: David Matlack
---
tools/testing/selftests
Encapsulate the "IOMMU mode" a test should use behind a new struct.
In the future this will be used to support other types of IOMMUs besides
VFIO_TYPE1_IOMMU, and allow users to select the mode on the command
line.
No functional change intended.
Signed-off-by: David Matlack
---
...
the hardware path (e.g. VT-d on Intel).
This test only supports x86_64 for now, but can be ported to other
architectures in the future.
Signed-off-by: David Matlack
---
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../testing/selftests/kvm/include/kvm_util.h | 4 +
tools/testing
Now that VFIO selftests support iommufd, make it the default mode.
IOMMUFD is the successor to VFIO_TYPE1{,v2}_IOMMU and all new features
are being added there, so it's a slightly better fit as the default
mode.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/vfio_pci_dev
Bypass (e.g. VT-d device-posted interrupts in Intel).
Signed-off-by: David Matlack
---
.../selftests/kvm/vfio_pci_device_irq_test.c | 66 +++
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/kvm/vfio_pci_device_irq_test.c
b/tools/testing
different CFLAGS when building without
conflicting with each other.
Signed-off-by: David Matlack
---
tools/testing/selftests/kvm/Makefile.kvm | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/Makefile.kvm
b/tools/testing/selftests/kvm/Makefile.kvm
index
transparently.
Signed-off-by: David Matlack
---
tools/testing/selftests/vfio/lib/vfio_pci_device.c | 10 ++
1 file changed, 10 insertions(+)
diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
index b349d901cfdc..205bbfb3d54e
1 - 100 of 125 matches
Mail list logo