[PATCH v2 15/19] bus/fslmc: use the new VFIO mode API

Anatoly Burakov
2025-11-14T17:42:36Z

FSLMC bus only supports operating in group mode, and relies on no-IOMMU
mode checks. Use the new VFIO API's to query no-IOMMU status, as well as
protect the bus from initializing in non-group mode.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/bus/fslmc/fslmc_bus.c | 10 +++++++++-
drivers/bus/fslmc/fslmc_vfio.c | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 49c61c9d2d..17b97d46bc 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -335,6 +335,13 @@ rte_fslmc_scan(void)
goto scan_fail;
}

+ /* for container groups to work, VFIO must be in group mode */
+ if (rte_vfio_get_mode() != RTE_VFIO_MODE_GROUP &&
+ rte_vfio_get_mode() != RTE_VFIO_MODE_NOIOMMU) {
+ ret = -EINVAL;
+ goto scan_fail;
+ }
+
ret = fslmc_get_container_group(group_name, &groupid);
if (ret != 0)
goto scan_fail;
@@ -582,7 +589,8 @@ rte_dpaa2_get_iommu_class(void)
return RTE_IOVA_DC;

/* check if all devices on the bus support Virtual addressing or not */
- if (fslmc_all_device_support_iova() != 0 && rte_vfio_noiommu_is_enabled() == 0)
+ if (fslmc_all_device_support_iova() != 0 &&
+ rte_vfio_get_mode() != RTE_VFIO_MODE_NOIOMMU)
return RTE_IOVA_VA;

return RTE_IOVA_PA;
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 550d4e0e8d..c20f7a26a3 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -192,7 +192,7 @@ fslmc_vfio_add_group(int vfio_group_fd,
group->fd = vfio_group_fd;
group->groupid = iommu_group_num;
rte_strscpy(group->group_name, group_name, sizeof(group->group_name));
- if (rte_vfio_noiommu_is_enabled() > 0)
+ if (rte_vfio_get_mode() == RTE_VFIO_MODE_NOIOMMU)
group->iommu_type = VFIO_NOIOMMU_IOMMU;
else
group->iommu_type = VFIO_TYPE1_IOMMU;
--
2.47.3