[PATCH 07/11] vfio: Update noiommu device detection logic for cdev
From: Jacob Pan
Date: Fri Feb 27 2026 - 12:53:47 EST
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;
}
#else
struct vfio_group;
--
2.34.1