Re: [PATCH v5 6/9] vfio/group: Add VFIO_CDEV_NOIOMMU Kconfig and tolerate NULL group

From: Jacob Pan

Date: Wed May 20 2026 - 13:23:40 EST


Hi Alex,

On Tue, 19 May 2026 21:45:16 -0600
Alex Williamson <alex@xxxxxxxxxxx> wrote:

> On Mon, 11 May 2026 11:41:11 -0700
> Jacob Pan <jacob.pan@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > Add a new CONFIG_VFIO_CDEV_NOIOMMU option, independent of
> > CONFIG_VFIO_GROUP, to support noiommu mode via the cdev interface.
> >
> > Since CONFIG_VFIO_GROUP can be enabled while
> > CONFIG_VFIO_GROUP_NOIOMMU is not, guard the noiommu group
> > allocation in vfio_group_find_or_alloc() with
> > IS_ENABLED(CONFIG_VFIO_GROUP_NOIOMMU) to prevent creating spurious
> > /dev/vfio/noiommu-N group files when only cdev noiommu is
> > configured.
> >
> > For cdev noiommu devices that have no group, let
> > vfio_device_set_group() return success with a NULL group pointer
> > and add null guards in group functions that may be called during
> > device lifecycle. These guards are contained within group.c and are
> > dead code for IOMMU-enabled devices where device->group is always
> > non-NULL.
> >
> > Signed-off-by: Jacob Pan <jacob.pan@xxxxxxxxxxxxxxxxxxx>
> > ---
> > drivers/vfio/Kconfig | 17 +++++++++++++++++
> > drivers/vfio/group.c | 31 +++++++++++++++++++++++++++++--
> > 2 files changed, 46 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
> > index 39939be2908e..b1b1633412a9 100644
> > --- a/drivers/vfio/Kconfig
> > +++ b/drivers/vfio/Kconfig
> > @@ -75,6 +75,23 @@ config VFIO_GROUP_NOIOMMU
> >
> > If you don't know what to do here, say N.
> >
> > +config VFIO_CDEV_NOIOMMU
> > + bool "VFIO cdev No-IOMMU support"
> > + depends on VFIO_DEVICE_CDEV
> > + select IOMMUFD_NOIOMMU
>
> AIUI, config would warn but allow this to select IOMMUFD_NOIOMMU
> even if the dependency on !GENERIC_ATOMIC64 in the Kconfig is unmet.
> This should include that dependency as well. Thanks,
>
Yes, will add
depends on !GENERIC_ATOMIC64