Add new IOMMU modes for using iommufd in compatibility mode with
VFIO_TYPE1_IOMMU and VFIO_TYPE1v2_IOMMU.

In these modes, VFIO selftests will open /dev/iommu and treats it as a
container FD (as if it had opened /dev/vfio/vfio) and the kernel
translates the container ioctls to iommufd calls transparently.

Signed-off-by: David Matlack <[email protected]>
---
 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 100644
--- a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
+++ b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
@@ -371,6 +371,16 @@ static const struct vfio_iommu_mode iommu_modes[] = {
                .container_path = "/dev/vfio/vfio",
                .group_iommu_type = VFIO_TYPE1v2_IOMMU,
        },
+       {
+               .name = "iommufd_compat_type1",
+               .container_path = "/dev/iommu",
+               .group_iommu_type = VFIO_TYPE1_IOMMU,
+       },
+       {
+               .name = "iommufd_compat_type1v2",
+               .container_path = "/dev/iommu",
+               .group_iommu_type = VFIO_TYPE1v2_IOMMU,
+       },
 };
 
 const char *default_iommu_mode = "vfio_type1_iommu";
-- 
2.49.0.1151.ga128411c76-goog


Reply via email to