On Wed, 18 Jan 2023 13:50:28 -0400 Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h > index f8219a438bfbf5..9e94abcf8ee1a8 100644 > --- a/drivers/vfio/vfio.h > +++ b/drivers/vfio/vfio.h > @@ -10,10 +10,10 @@ > #include <linux/device.h> > #include <linux/cdev.h> > #include <linux/module.h> > +#include <linux/vfio.h> > > struct iommufd_ctx; > struct iommu_group; > -struct vfio_device; > struct vfio_container; > > void vfio_device_put_registration(struct vfio_device *device); > @@ -88,6 +88,12 @@ bool vfio_device_has_container(struct vfio_device *device); > int __init vfio_group_init(void); > void vfio_group_cleanup(void); > > +static inline bool vfio_device_is_noiommu(struct vfio_device *vdev) > +{ > + return IS_ENABLED(CONFIG_VFIO_NOIOMMU) && > + vdev->group->type == VFIO_NO_IOMMU; > +} What about: static inline bool vfio_group_type_is_noiommu(struct vfio_group *group) which would allow us to pickup the group.c use with only extending the callers here as s/vdev/vdev->group/? Or we could even make a vfio_device_group_type_is_noiommu(struct vfio_device*) calling the above if we want a device specific interface. Thanks, Alex