Re: [PATCH] vfio: Support VFIO_NOIOMMU with iommufd

Jason Gunthorpe
2023-01-10T00:29:47Z

On Mon, Jan 09, 2023 at 04:34:34PM -0700, Alex Williamson wrote:
> On Mon, 9 Jan 2023 10:22:59 -0400
> Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> > Add a small amount of emulation to vfio_compat to accept the SET_IOMMU
> > to VFIO_NOIOMMU_IOMMU and have vfio just ignore iommufd if it is working
> > on a no-iommu enabled device.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> > drivers/iommu/iommufd/Kconfig | 2 +-
> > drivers/iommu/iommufd/vfio_compat.c | 46 ++++++++++++++++++++++++-----
> > drivers/vfio/group.c | 13 ++++----
> > drivers/vfio/iommufd.c | 21 ++++++++++++-
> > include/linux/iommufd.h | 6 ++--
> > 5 files changed, 70 insertions(+), 18 deletions(-)
> >
> > This needs a testing confirmation with dpdk to go forward, thanks
>
> How do we create a noiommu group w/o the vfio_noiommu flag that's
> provided by container.c?

Ah, the module option is now in the wrong place, I'll move it to
vfio_main.c

> Even without dpdk, you should be able to turn off the system IOMMU
> and get something bound to vfio-pci that still taints the kernel and
> provides a noiommu-%d group under /dev/vfio/. There's a rudimentary
> unit test for noiommu here[1]. Thanks,

Thanks, I'll check it

Jason