[PATCH v13 19/24] bus/pci: use the new VFIO mode API
Anatoly Burakov
anatoly.burakov at intel.com
Thu Aug 27 17:14:22 CEST 2026
Use the new VFIO mode API to query no-IOMMU status. This requires moving
the VFIO init earlier in the init sequence, as now checking no-IOMMU mode
is not a sysfs check but instead relies on full VFIO subsystem to be
initialized and available.
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
drivers/bus/pci/linux/pci.c | 2 +-
lib/eal/linux/eal.c | 15 ++++++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index af37a65c45..b9fe4797fb 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -596,7 +596,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,
static int is_vfio_noiommu_enabled = -1;
if (is_vfio_noiommu_enabled == -1) {
- if (dev_vfio_noiommu_is_enabled() == 1)
+ if (dev_vfio_get_mode() == DEV_VFIO_MODE_NOIOMMU)
is_vfio_noiommu_enabled = 1;
else
is_vfio_noiommu_enabled = 0;
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 77691a7908..11e6217826 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -676,6 +676,16 @@ rte_eal_init(int argc, char **argv)
}
}
+ /*
+ * VFIO must be initialized before bus scan because buses need to know
+ * about no-IOMMU mode status.
+ */
+ if (dev_vfio_enable("vfio")) {
+ rte_eal_init_alert("Cannot init VFIO");
+ rte_errno = EAGAIN;
+ goto err_out;
+ }
+
if (rte_bus_scan()) {
rte_eal_init_alert("Cannot scan the buses for devices");
rte_errno = ENODEV;
@@ -771,11 +781,6 @@ rte_eal_init(int argc, char **argv)
#endif
}
- if (dev_vfio_enable("vfio")) {
- rte_eal_init_alert("Cannot init VFIO");
- rte_errno = EAGAIN;
- goto err_out;
- }
/* in secondary processes, memory init may allocate additional fbarrays
* not present in primary processes, so to avoid any potential issues,
* initialize memzones first.
--
2.52.0
More information about the dev
mailing list