DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, maxime.coquelin@redhat.com,
	Nipun Gupta <nipun.gupta@amd.com>,
	Nikhil Agarwal <nikhil.agarwal@amd.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Sachin Saxena <sachin.saxena@nxp.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	Chenbo Xia <chenbox@nvidia.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>,
	Harman Kalra <hkalra@marvell.com>
Subject: [RFC 3/8] vfio: remove public wrappers
Date: Wed,  3 Sep 2025 09:28:20 +0200	[thread overview]
Message-ID: <20250903072826.1727004-4-david.marchand@redhat.com> (raw)
In-Reply-To: <20250903072826.1727004-1-david.marchand@redhat.com>

The public header defines a number of wrappers that can be removed or
hidden internally.

Either, those concern old Linux kernel versions that are not supported by
dpdk anymore (DPDK now requires Linux v5.4 at least), like:
- the request notifier feature, present since Linux v4.0,
- the noiommu mode, present since Linux v4.5,
- the capability support, present since Linux v4.6,
- the msix mapping feature, present since Linux v4.16,

Or, those wrappers can be made private as only consumed internally.
- VFIO_GET_REGION_IDX() has no equivalent in the Linux uapi, but
  is only used by the Linux PCI bus code,
- VFIO_DEVICE_FEATURE is only used by the CDX bus code,
- the various macros around /dev/vfio/ or the noiommu kmod parameter are
  only used by eal_vfio.c,

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/cdx/cdx_vfio.c       | 27 ++++++++++++
 drivers/bus/fslmc/fslmc_vfio.c   | 17 ++++----
 drivers/bus/pci/linux/pci_vfio.c | 23 +++--------
 drivers/bus/pci/pci_common.c     |  2 -
 lib/eal/include/rte_vfio.h       | 71 --------------------------------
 lib/eal/linux/eal_interrupts.c   | 10 -----
 lib/eal/linux/eal_vfio.c         | 23 ++++-------
 7 files changed, 50 insertions(+), 123 deletions(-)

diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 37e0c424d4..03d156388e 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -613,6 +613,33 @@ rte_cdx_vfio_intr_disable(const struct rte_intr_handle *intr_handle)
 	return ret;
 }
 
+/* VFIO_DEVICE_FEATURE is defined for kernel version 5.7 and newer. */
+#ifdef	VFIO_DEVICE_FEATURE
+#define	RTE_VFIO_DEVICE_FEATURE	VFIO_DEVICE_FEATURE
+#else
+#define	RTE_VFIO_DEVICE_FEATURE	_IO(VFIO_TYPE, VFIO_BASE + 17)
+struct vfio_device_feature {
+	__u32	argsz;
+	__u32	flags;
+#define	VFIO_DEVICE_FEATURE_MASK	(0xffff) /* 16-bit feature index */
+#define	VFIO_DEVICE_FEATURE_GET		(1 << 16) /* Get feature into data[] */
+#define	VFIO_DEVICE_FEATURE_SET		(1 << 17) /* Set feature from data[] */
+#define	VFIO_DEVICE_FEATURE_PROBE	(1 << 18) /* Probe feature support */
+	__u8	data[];
+};
+#endif
+
+#ifdef	VFIO_DEVICE_FEATURE_BUS_MASTER
+#define	RTE_VFIO_DEVICE_FEATURE_BUS_MASTER	VFIO_DEVICE_FEATURE_BUS_MASTER
+#else
+#define	RTE_VFIO_DEVICE_FEATURE_BUS_MASTER	10
+struct vfio_device_feature_bus_master {
+	__u32 op;
+#define	VFIO_DEVICE_FEATURE_CLEAR_MASTER	0	/* Clear Bus Master */
+#define	VFIO_DEVICE_FEATURE_SET_MASTER		1	/* Set Bus Master */
+};
+#endif
+
 /* Enable Bus Mastering */
 RTE_EXPORT_INTERNAL_SYMBOL(rte_cdx_vfio_bm_enable)
 int
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 68439cbd8c..cc4311989b 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -190,7 +190,7 @@ fslmc_vfio_add_group(int 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)
-		group->iommu_type = RTE_VFIO_NOIOMMU;
+		group->iommu_type = VFIO_NOIOMMU_IOMMU;
 	else
 		group->iommu_type = VFIO_TYPE1_IOMMU;
 	LIST_INSERT_HEAD(&s_vfio_container.groups, group, next);
@@ -396,8 +396,7 @@ fslmc_vfio_open_group_fd(const char *group_name)
 	/* if primary, try to open the group */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		/* try regular group format */
-		snprintf(filename, sizeof(filename),
-			VFIO_GROUP_FMT, iommu_group_num);
+		snprintf(filename, sizeof(filename), "/dev/vfio/%u", iommu_group_num);
 		vfio_group_fd = open(filename, O_RDWR);
 
 		goto add_vfio_group;
@@ -451,7 +450,7 @@ fslmc_vfio_check_extensions(int vfio_container_fd)
 	int ret;
 	uint32_t idx, n_extensions = 0;
 	static const int type_id[] = {RTE_VFIO_TYPE1, RTE_VFIO_SPAPR,
-		RTE_VFIO_NOIOMMU};
+		VFIO_NOIOMMU_IOMMU};
 	static const char * const type_id_nm[] = {"Type 1",
 		"sPAPR", "No-IOMMU"};
 
@@ -495,10 +494,10 @@ fslmc_vfio_open_container_fd(void)
 
 	/* if we're in a primary process, try to open the container */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		vfio_container_fd = open(VFIO_CONTAINER_PATH, O_RDWR);
+		vfio_container_fd = open("/dev/vfio/vfio", O_RDWR);
 		if (vfio_container_fd < 0) {
-			DPAA2_BUS_ERR("Open VFIO container(%s), err(%d)",
-				VFIO_CONTAINER_PATH, vfio_container_fd);
+			DPAA2_BUS_ERR("Open VFIO container, err(%d)",
+				vfio_container_fd);
 			ret = vfio_container_fd;
 			goto err_exit;
 		}
@@ -851,7 +850,7 @@ fslmc_map_dma(uint64_t vaddr, rte_iova_t iovaddr, size_t len)
 			return fd;
 		return -EIO;
 	}
-	if (fslmc_vfio_iommu_type(fd) == RTE_VFIO_NOIOMMU) {
+	if (fslmc_vfio_iommu_type(fd) == VFIO_NOIOMMU_IOMMU) {
 		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
 		if (phy != iovaddr) {
 			DPAA2_BUS_ERR("IOVA should support with IOMMU");
@@ -951,7 +950,7 @@ fslmc_unmap_dma(uint64_t vaddr, uint64_t iovaddr, size_t len)
 			return fd;
 		return -EIO;
 	}
-	if (fslmc_vfio_iommu_type(fd) == RTE_VFIO_NOIOMMU) {
+	if (fslmc_vfio_iommu_type(fd) == VFIO_NOIOMMU_IOMMU) {
 		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
 		return 0;
 	}
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index d0844585fe..9e5776ce3c 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -273,7 +273,6 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 	return -1;
 }
 
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 /*
  * Spinlock for device hot-unplug failure handling.
  * If it tries to access bus or device, such as handle sigbus on bus
@@ -390,7 +389,6 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
 
 	return 0;
 }
-#endif
 
 static int
 pci_vfio_is_ioport_bar(const struct rte_pci_device *dev, int vfio_dev_fd,
@@ -665,12 +663,12 @@ pci_vfio_info_cap(struct vfio_region_info *info, int cap)
 	struct vfio_info_cap_header *h;
 	size_t offset;
 
-	if ((info->flags & RTE_VFIO_INFO_FLAG_CAPS) == 0) {
+	if ((info->flags & VFIO_REGION_INFO_FLAG_CAPS) == 0) {
 		/* VFIO info does not advertise capabilities */
 		return NULL;
 	}
 
-	offset = VFIO_CAP_OFFSET(info);
+	offset = info->cap_offset;
 	while (offset != 0) {
 		h = RTE_PTR_ADD(info, offset);
 		if (h->id == cap)
@@ -690,7 +688,7 @@ pci_vfio_msix_is_mappable(int vfio_dev_fd, int msix_region)
 	if (ret < 0)
 		return -1;
 
-	ret = pci_vfio_info_cap(info, RTE_VFIO_CAP_MSIX_MAPPABLE) != NULL;
+	ret = pci_vfio_info_cap(info, VFIO_REGION_INFO_CAP_MSIX_MAPPABLE) != NULL;
 
 	/* cleanup */
 	free(info);
@@ -745,10 +743,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 	if (rte_intr_fd_set(dev->intr_handle, -1))
 		return -1;
 
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	if (rte_intr_fd_set(dev->vfio_req_intr_handle, -1))
 		return -1;
-#endif
 
 	/* store PCI address string */
 	snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
@@ -904,13 +900,11 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		goto err_map;
 	}
 
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	if (pci_vfio_enable_notifier(dev, vfio_dev_fd) != 0) {
 		PCI_LOG(ERR, "Error setting up notifier!");
 		goto err_map;
 	}
 
-#endif
 	TAILQ_INSERT_TAIL(vfio_res_list, vfio_res, next);
 
 	return 0;
@@ -945,10 +939,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 
 	if (rte_intr_fd_set(dev->intr_handle, -1))
 		return -1;
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	if (rte_intr_fd_set(dev->vfio_req_intr_handle, -1))
 		return -1;
-#endif
 
 	/* store PCI address string */
 	snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
@@ -1002,10 +994,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 	/* we need save vfio_dev_fd, so it can be used during release */
 	if (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd))
 		goto err_vfio_dev_fd;
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	if (rte_intr_dev_fd_set(dev->vfio_req_intr_handle, vfio_dev_fd))
 		goto err_vfio_dev_fd;
-#endif
 
 	return 0;
 err_vfio_dev_fd:
@@ -1085,14 +1075,12 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
 	snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
 			loc->domain, loc->bus, loc->devid, loc->function);
 
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	ret = pci_vfio_disable_notifier(dev);
 	if (ret) {
 		PCI_LOG(ERR, "fail to disable req notifier.");
 		return -1;
 	}
 
-#endif
 	if (rte_intr_fd_get(dev->intr_handle) < 0)
 		return -1;
 
@@ -1226,6 +1214,7 @@ pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,
 	return 0;
 }
 
+#define PCI_VFIO_GET_REGION_IDX(x) (x >> 40)
 void
 pci_vfio_ioport_read(struct rte_pci_ioport *p,
 		     void *data, size_t len, off_t offset)
@@ -1239,7 +1228,7 @@ pci_vfio_ioport_read(struct rte_pci_ioport *p,
 	if (pread(vfio_dev_fd, data,
 		    len, p->base + offset) <= 0)
 		PCI_LOG(ERR, "Can't read from PCI bar (%" PRIu64 ") : offset (%x)",
-			VFIO_GET_REGION_IDX(p->base), (int)offset);
+			PCI_VFIO_GET_REGION_IDX(p->base), (int)offset);
 }
 
 void
@@ -1255,7 +1244,7 @@ pci_vfio_ioport_write(struct rte_pci_ioport *p,
 	if (pwrite(vfio_dev_fd, data,
 		     len, p->base + offset) <= 0)
 		PCI_LOG(ERR, "Can't write to PCI bar (%" PRIu64 ") : offset (%x)",
-			VFIO_GET_REGION_IDX(p->base), (int)offset);
+			PCI_VFIO_GET_REGION_IDX(p->base), (int)offset);
 }
 
 int
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index c88634f790..bf5df3d94e 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -603,7 +603,6 @@ pci_hot_unplug_handler(struct rte_device *dev)
 		return -1;
 
 	switch (pdev->kdrv) {
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	case RTE_PCI_KDRV_VFIO:
 		/*
 		 * vfio kernel module guaranty the pci device would not be
@@ -614,7 +613,6 @@ pci_hot_unplug_handler(struct rte_device *dev)
 		rte_dev_event_callback_process(dev->name,
 					       RTE_DEV_EVENT_REMOVE);
 		break;
-#endif
 	case RTE_PCI_KDRV_IGB_UIO:
 	case RTE_PCI_KDRV_UIO_GENERIC:
 	case RTE_PCI_KDRV_NIC_UIO:
diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
index 035b727dd0..509ffec80c 100644
--- a/lib/eal/include/rte_vfio.h
+++ b/lib/eal/include/rte_vfio.h
@@ -21,79 +21,8 @@ extern "C" {
 
 #ifdef RTE_EXEC_ENV_LINUX
 
-#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
-#define HAVE_VFIO_DEV_REQ_INTERFACE
-#endif /* kernel version >= 4.0.0 */
-
 #include <linux/vfio.h>
 
-#define VFIO_DIR "/dev/vfio"
-#define VFIO_CONTAINER_PATH "/dev/vfio/vfio"
-#define VFIO_GROUP_FMT "/dev/vfio/%u"
-#define VFIO_NOIOMMU_GROUP_FMT "/dev/vfio/noiommu-%u"
-#define VFIO_GET_REGION_IDX(x) (x >> 40)
-#define VFIO_NOIOMMU_MODE      \
-	"/sys/module/vfio/parameters/enable_unsafe_noiommu_mode"
-
-/* NOIOMMU is defined from kernel version 4.5 onwards */
-#ifdef VFIO_NOIOMMU_IOMMU
-#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU
-#else
-#define RTE_VFIO_NOIOMMU 8
-#endif
-
-/*
- * capabilities are only supported on kernel 4.6+. there were also some API
- * changes as well, so add a macro to get cap offset.
- */
-#ifdef VFIO_REGION_INFO_FLAG_CAPS
-#define RTE_VFIO_INFO_FLAG_CAPS VFIO_REGION_INFO_FLAG_CAPS
-#define VFIO_CAP_OFFSET(x) (x->cap_offset)
-#else
-#define RTE_VFIO_INFO_FLAG_CAPS (1 << 3)
-#define VFIO_CAP_OFFSET(x) (x->resv)
-struct vfio_info_cap_header {
-	uint16_t id;
-	uint16_t version;
-	uint32_t next;
-};
-#endif
-
-/* kernels 4.16+ can map BAR containing MSI-X table */
-#ifdef VFIO_REGION_INFO_CAP_MSIX_MAPPABLE
-#define RTE_VFIO_CAP_MSIX_MAPPABLE VFIO_REGION_INFO_CAP_MSIX_MAPPABLE
-#else
-#define RTE_VFIO_CAP_MSIX_MAPPABLE 3
-#endif
-
-/* VFIO_DEVICE_FEATURE is defined for kernel version 5.7 and newer. */
-#ifdef	VFIO_DEVICE_FEATURE
-#define	RTE_VFIO_DEVICE_FEATURE	VFIO_DEVICE_FEATURE
-#else
-#define	RTE_VFIO_DEVICE_FEATURE	_IO(VFIO_TYPE, VFIO_BASE + 17)
-struct vfio_device_feature {
-	__u32	argsz;
-	__u32	flags;
-#define	VFIO_DEVICE_FEATURE_MASK	(0xffff) /* 16-bit feature index */
-#define	VFIO_DEVICE_FEATURE_GET		(1 << 16) /* Get feature into data[] */
-#define	VFIO_DEVICE_FEATURE_SET		(1 << 17) /* Set feature from data[] */
-#define	VFIO_DEVICE_FEATURE_PROBE	(1 << 18) /* Probe feature support */
-	__u8	data[];
-};
-#endif
-
-#ifdef	VFIO_DEVICE_FEATURE_BUS_MASTER
-#define	RTE_VFIO_DEVICE_FEATURE_BUS_MASTER	VFIO_DEVICE_FEATURE_BUS_MASTER
-#else
-#define	RTE_VFIO_DEVICE_FEATURE_BUS_MASTER	10
-struct vfio_device_feature_bus_master {
-	__u32 op;
-#define	VFIO_DEVICE_FEATURE_CLEAR_MASTER	0	/* Clear Bus Master */
-#define	VFIO_DEVICE_FEATURE_SET_MASTER		1	/* Set Bus Master */
-};
-#endif
-
 #else /* ! RTE_EXEC_ENV_LINUX */
 
 /* we don't need an actual definition, only pointer is used */
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index d420ecf947..43e05c86a2 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -336,7 +336,6 @@ vfio_disable_msix(const struct rte_intr_handle *intr_handle) {
 	return ret;
 }
 
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 /* enable req notifier */
 static int
 vfio_enable_req(const struct rte_intr_handle *intr_handle)
@@ -396,7 +395,6 @@ vfio_disable_req(const struct rte_intr_handle *intr_handle)
 
 	return ret;
 }
-#endif
 
 static int
 uio_intx_intr_disable(const struct rte_intr_handle *intr_handle)
@@ -741,12 +739,10 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)
 		if (vfio_enable_intx(intr_handle))
 			rc = -1;
 		break;
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	case RTE_INTR_HANDLE_VFIO_REQ:
 		if (vfio_enable_req(intr_handle))
 			rc = -1;
 		break;
-#endif
 	/* not used at this moment */
 	case RTE_INTR_HANDLE_DEV_EVENT:
 		rc = -1;
@@ -808,10 +804,8 @@ rte_intr_ack(const struct rte_intr_handle *intr_handle)
 		if (vfio_ack_intx(intr_handle))
 			return -1;
 		break;
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	case RTE_INTR_HANDLE_VFIO_REQ:
 		return -1;
-#endif
 	/* not used at this moment */
 	case RTE_INTR_HANDLE_DEV_EVENT:
 		return -1;
@@ -871,12 +865,10 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)
 		if (vfio_disable_intx(intr_handle))
 			rc = -1;
 		break;
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 	case RTE_INTR_HANDLE_VFIO_REQ:
 		if (vfio_disable_req(intr_handle))
 			rc = -1;
 		break;
-#endif
 	/* not used at this moment */
 	case RTE_INTR_HANDLE_DEV_EVENT:
 		rc = -1;
@@ -937,9 +929,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 		case RTE_INTR_HANDLE_ALARM:
 			bytes_read = sizeof(buf.timerfd_num);
 			break;
-#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
 		case RTE_INTR_HANDLE_VFIO_REQ:
-#endif
 		case RTE_INTR_HANDLE_VFIO_MSIX:
 		case RTE_INTR_HANDLE_VFIO_MSI:
 		case RTE_INTR_HANDLE_VFIO_LEGACY:
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index 805f0ff92c..dfc3bd6e62 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -85,7 +85,7 @@ static const struct vfio_iommu_type iommu_types[] = {
 	},
 	/* IOMMU-less mode */
 	{
-		.type_id = RTE_VFIO_NOIOMMU,
+		.type_id = VFIO_NOIOMMU_IOMMU,
 		.name = "No-IOMMU",
 		.partial_unmap = true,
 		.dma_map_func = &vfio_noiommu_dma_map,
@@ -363,8 +363,7 @@ vfio_open_group_fd(int iommu_group_num)
 	/* if primary, try to open the group */
 	if (internal_conf->process_type == RTE_PROC_PRIMARY) {
 		/* try regular group format */
-		snprintf(filename, sizeof(filename),
-				 VFIO_GROUP_FMT, iommu_group_num);
+		snprintf(filename, sizeof(filename), "/dev/vfio/%u", iommu_group_num);
 		vfio_group_fd = open(filename, O_RDWR);
 		if (vfio_group_fd < 0) {
 			/* if file not found, it's not an error */
@@ -375,9 +374,8 @@ vfio_open_group_fd(int iommu_group_num)
 			}
 
 			/* special case: try no-IOMMU path as well */
-			snprintf(filename, sizeof(filename),
-					VFIO_NOIOMMU_GROUP_FMT,
-					iommu_group_num);
+			snprintf(filename, sizeof(filename), "/dev/vfio/noiommu-%u",
+				iommu_group_num);
 			vfio_group_fd = open(filename, O_RDWR);
 			if (vfio_group_fd < 0) {
 				if (errno != ENOENT) {
@@ -1128,7 +1126,7 @@ rte_vfio_enable(const char *modname)
 	}
 
 	/* VFIO directory might not exist (e.g., unprivileged containers) */
-	dir = opendir(VFIO_DIR);
+	dir = opendir("/dev/vfio");
 	if (dir == NULL) {
 		EAL_LOG(DEBUG,
 			"VFIO directory does not exist, skipping VFIO support...");
@@ -1315,15 +1313,12 @@ rte_vfio_get_container_fd(void)
 	const struct internal_config *internal_conf =
 		eal_get_internal_configuration();
 
-
 	/* if we're in a primary process, try to open the container */
 	if (internal_conf->process_type == RTE_PROC_PRIMARY) {
-		vfio_container_fd = open(VFIO_CONTAINER_PATH, O_RDWR);
+		vfio_container_fd = open("/dev/vfio/vfio", O_RDWR);
 		if (vfio_container_fd < 0) {
-			EAL_LOG(ERR,
-					"Cannot open VFIO container %s, error "
-					"%i (%s)", VFIO_CONTAINER_PATH,
-					errno, strerror(errno));
+			EAL_LOG(ERR, "Cannot open VFIO container, error %i (%s)",
+				errno, strerror(errno));
 			return -1;
 		}
 
@@ -2053,7 +2048,7 @@ rte_vfio_noiommu_is_enabled(void)
 	ssize_t cnt;
 	char c;
 
-	fd = open(VFIO_NOIOMMU_MODE, O_RDONLY);
+	fd = open("/sys/module/vfio/parameters/enable_unsafe_noiommu_mode", O_RDONLY);
 	if (fd < 0) {
 		if (errno != ENOENT) {
 			EAL_LOG(ERR, "Cannot open VFIO noiommu file "
-- 
2.51.0


  parent reply	other threads:[~2025-09-03  7:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  7:28 [RFC 0/8] Cleanup VFIO API and import Linux uAPI header David Marchand
2025-09-03  7:28 ` [RFC 1/8] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03  9:38   ` Xu, Rosen
2025-09-03  7:28 ` [RFC 2/8] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03  7:28 ` David Marchand [this message]
2025-09-03  7:28 ` [RFC 4/8] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03  7:28 ` [RFC 5/8] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03  7:28 ` [RFC 6/8] vfio: stop including Linux kernel header in public and driver API David Marchand
2025-09-03  9:38   ` Xu, Rosen
2025-09-03  7:28 ` [RFC 7/8] uapi: import VFIO header David Marchand
2025-09-03  7:28 ` [RFC 8/8] vfio: use imported uAPI header David Marchand
2025-09-03  9:38   ` Xu, Rosen
2025-09-03  7:50 ` [RFC 0/8] Cleanup VFIO API and import Linux " David Marchand
2025-09-03  9:29 ` Burakov, Anatoly
2025-09-03  9:52   ` David Marchand
2025-09-03 14:25     ` Burakov, Anatoly
2025-09-03 15:13 ` [RFC v2 0/9] " David Marchand
2025-09-03 15:13   ` [RFC v2 1/9] drivers: remove unneeded VFIO header inclusion David Marchand
2025-09-03 15:13   ` [RFC v2 2/9] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03 15:13   ` [RFC v2 3/9] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03 15:13   ` [RFC v2 4/9] vfio: remove public wrappers David Marchand
2025-09-03 15:13   ` [RFC v2 5/9] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03 15:13   ` [RFC v2 6/9] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03 15:22   ` [RFC v2 0/9] Cleanup VFIO API and import Linux uAPI header David Marchand
2025-09-03 15:17 ` David Marchand
2025-09-03 15:17   ` [RFC v2 1/9] drivers: remove unneeded VFIO header inclusion David Marchand
2025-09-03 15:17   ` [RFC v2 2/9] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03 15:17   ` [RFC v2 3/9] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03 15:17   ` [RFC v2 4/9] vfio: remove public wrappers David Marchand
2025-09-03 15:17   ` [RFC v2 5/9] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03 15:17   ` [RFC v2 6/9] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03 15:17   ` [RFC v2 7/9] vfio: stop including Linux kernel header in public and driver API David Marchand
2025-09-03 15:17   ` [RFC v2 8/9] uapi: import VFIO header David Marchand
2025-09-03 15:17   ` [RFC v2 9/9] vfio: use imported uAPI header David Marchand
2025-09-04  7:08   ` [RFC v2 0/9] Cleanup VFIO API and import Linux " David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250903072826.1727004-4-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=hkalra@marvell.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=sachin.saxena@nxp.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).