Re: [PATCH V2 07/11] vfio: Update noiommu device detection logic for cdev
From: Jacob Pan
Date: Wed Apr 01 2026 - 18:17:48 EST
Hi Mostafa,
On Sun, 22 Mar 2026 10:04:35 +0000
Mostafa Saleh <smostafa@xxxxxxxxxx> wrote:
> On Thu, Mar 12, 2026 at 08:56:33AM -0700, Jacob Pan wrote:
> > Rework vfio_device_is_noiommu() to derive noiommu mode based on
> > device, group type, and configurations.
> >
> > Signed-off-by: Jacob Pan <jacob.pan@xxxxxxxxxxxxxxxxxxx>
> > ---
> > drivers/vfio/vfio.h | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
> > index 838c08077ce2..c5541967ef9b 100644
> > --- a/drivers/vfio/vfio.h
> > +++ b/drivers/vfio/vfio.h
> > @@ -127,8 +127,13 @@ static inline bool
> > vfio_null_group_allowed(void)
> > static inline bool vfio_device_is_noiommu(struct vfio_device *vdev)
> > {
> > - return IS_ENABLED(CONFIG_VFIO_NOIOMMU) &&
> > - vdev->group->type == VFIO_NO_IOMMU;
> > + if (!IS_ENABLED(CONFIG_VFIO_NOIOMMU))
> > + return false;
> > +
> > + if (vfio_null_group_allowed())
> > + return vdev->noiommu;
> > +
> > + return vdev->group->type == VFIO_NO_IOMMU;
>
> I see that noiommu is set for both, can this just be simplified to:
>
> return IS_ENABLED(CONFIG_VFIO_NOIOMMU) && vdev->noiommu;
>
Good point, no need to check group now. will do.
Sorry for the late response.
Thanks,
Jacob