Re: [PATCH V2 07/11] vfio: Update noiommu device detection logic for cdev
From: Mostafa Saleh
Date: Sun Mar 22 2026 - 06:04:46 EST
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;
Thanks,
Mostafa
> }
> #else
> struct vfio_group;
> --
> 2.34.1
>