On Wed, 16 Nov 2022 17:05:36 -0400 Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > If the VFIO container is compiled out, give a kconfig option for iommufd > to provide the miscdev node with the same name and permissions as vfio > uses. > > The compatibility node supports the same ioctls as VFIO and automatically > enables the VFIO compatible pinned page accounting mode. > > Tested-by: Nicolin Chen <nicolinc@xxxxxxxxxx> > Tested-by: Yi Liu <yi.l.liu@xxxxxxxxx> > Tested-by: Lixiao Yang <lixiao.yang@xxxxxxxxx> > Tested-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx> > Tested-by: Yu He <yu.he@xxxxxxxxx> > Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> > Reviewed-by: Yi Liu <yi.l.liu@xxxxxxxxx> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > drivers/iommu/iommufd/Kconfig | 12 ++++++++++++ > drivers/iommu/iommufd/main.c | 36 +++++++++++++++++++++++++++++++++++ > 2 files changed, 48 insertions(+) > > diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig > index 399a2edeaef6de..f387f803dc6f7f 100644 > --- a/drivers/iommu/iommufd/Kconfig > +++ b/drivers/iommu/iommufd/Kconfig > @@ -12,6 +12,18 @@ config IOMMUFD > If you don't know what to do here, say N. > > if IOMMUFD > +config IOMMUFD_VFIO_CONTAINER > + bool "IOMMUFD provides the VFIO container /dev/vfio/vfio" > + depends on VFIO && !VFIO_CONTAINER > + default VFIO && !VFIO_CONTAINER > + help > + IOMMUFD will provide /dev/vfio/vfio instead of VFIO. This relies on > + IOMMUFD providing compatibility emulation to give the same ioctls. > + It provides an option to build a kernel with legacy VFIO components > + removed. > + > + Unless testing IOMMUFD say N here. > + "Unless testing..." alone is a bit more subtle that I thought we were discussing. I was expecting something more like: IOMMUFD VFIO container emulation is known to lack certain features of the native VFIO container, such as no-IOMMU support, peer-to-peer DMA mapping, PPC IOMMU support, as well as other potentially undiscovered gaps. This option is currently intended for the purpose of testing IOMMUFD with unmodified userspace supporting VFIO and making use of the Type1 VFIO IOMMU backend. General purpose enabling of this option is currently discouraged. Unless testing IOMMUFD, say N here. Thanks, Alex