summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/vfio/lib/include
diff options
context:
space:
mode:
authorDavid Matlack <dmatlack@google.com>2025-11-26 23:17:20 +0000
committerAlex Williamson <alex@shazbot.org>2025-11-28 10:58:06 -0700
commitc9756b4d2702cc33748eed5916ddc159d349cba6 (patch)
tree23d71b4d9f0d56f134f02d5a243e3c334133ce36 /tools/testing/selftests/vfio/lib/include
parentdd56ef239d832d9782f5ed204533824bea4548f7 (diff)
downloadlinux-next-c9756b4d2702cc33748eed5916ddc159d349cba6.tar.gz
linux-next-c9756b4d2702cc33748eed5916ddc159d349cba6.zip
vfio: selftests: Introduce struct iommu
Introduce struct iommu, which logically represents either a VFIO container or an iommufd IOAS, depending on which IOMMU mode is used by the test. This will be used in a subsequent commit to allow devices to be added to the same container/iommufd. Reviewed-by: Alex Mastro <amastro@fb.com> Tested-by: Alex Mastro <amastro@fb.com> Reviewed-by: Raghavendra Rao Ananta <rananta@google.com> Signed-off-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20251126231733.3302983-6-dmatlack@google.com Signed-off-by: Alex Williamson <alex@shazbot.org>
Diffstat (limited to 'tools/testing/selftests/vfio/lib/include')
-rw-r--r--tools/testing/selftests/vfio/lib/include/vfio_util.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/testing/selftests/vfio/lib/include/vfio_util.h b/tools/testing/selftests/vfio/lib/include/vfio_util.h
index 2f5555138d7f..3160f2d1ea6d 100644
--- a/tools/testing/selftests/vfio/lib/include/vfio_util.h
+++ b/tools/testing/selftests/vfio/lib/include/vfio_util.h
@@ -163,15 +163,19 @@ struct vfio_pci_driver {
int msi;
};
+struct iommu {
+ const struct iommu_mode *mode;
+ int container_fd;
+ int iommufd;
+ u32 ioas_id;
+ struct list_head dma_regions;
+};
+
struct vfio_pci_device {
int fd;
-
- const struct iommu_mode *iommu_mode;
int group_fd;
- int container_fd;
- int iommufd;
- u32 ioas_id;
+ struct iommu *iommu;
struct vfio_device_info info;
struct vfio_region_info config_space;
@@ -180,8 +184,6 @@ struct vfio_pci_device {
struct vfio_irq_info msi_info;
struct vfio_irq_info msix_info;
- struct list_head dma_regions;
-
/* eventfds for MSI and MSI-x interrupts */
int msi_eventfds[PCI_MSIX_FLAGS_QSIZE + 1];