From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v3 13/20] vfio: remove group-based API
Date: Tue, 18 Nov 2025 16:29:14 +0000 [thread overview]
Message-ID: <907f38201ed6c1873e61676cb92bda8cb346283f.1763483254.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1763483253.git.anatoly.burakov@intel.com> <cover.1763483253.git.anatoly.burakov@intel.com>
All drivers have been adjusted to not use the VFIO group API directly and
instead rely on container device assignment model, so the group API is no
longer useful and can be removed.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/eal/freebsd/eal.c | 33 ---------------
lib/eal/include/rte_vfio.h | 72 --------------------------------
lib/eal/linux/eal_vfio.c | 47 ++++++++++-----------
lib/eal/linux/eal_vfio.h | 2 +
lib/eal/linux/eal_vfio_mp_sync.c | 2 +-
5 files changed, 26 insertions(+), 130 deletions(-)
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index a7360db7a7..f66ac01ba2 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -848,13 +848,6 @@ int rte_vfio_noiommu_is_enabled(void)
return 0;
}
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_clear_group)
-int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
-{
- rte_errno = ENOTSUP;
- return -1;
-}
-
RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_get_group_num)
int
rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
@@ -873,14 +866,6 @@ rte_vfio_get_container_fd(void)
return -1;
}
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_get_group_fd)
-int
-rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
-{
- rte_errno = ENOTSUP;
- return -1;
-}
-
RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_create)
int
rte_vfio_container_create(void)
@@ -897,24 +882,6 @@ rte_vfio_container_destroy(__rte_unused int container_fd)
return -1;
}
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_group_bind)
-int
-rte_vfio_container_group_bind(__rte_unused int container_fd,
- __rte_unused int iommu_group_num)
-{
- rte_errno = ENOTSUP;
- return -1;
-}
-
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_group_unbind)
-int
-rte_vfio_container_group_unbind(__rte_unused int container_fd,
- __rte_unused int iommu_group_num)
-{
- rte_errno = ENOTSUP;
- return -1;
-}
-
RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_dma_map)
int
rte_vfio_container_dma_map(__rte_unused int container_fd,
diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
index e7e2ee950b..941b7d0541 100644
--- a/lib/eal/include/rte_vfio.h
+++ b/lib/eal/include/rte_vfio.h
@@ -136,24 +136,6 @@ int rte_vfio_is_enabled(const char *modname);
__rte_internal
int rte_vfio_noiommu_is_enabled(void);
-/**
- * @internal
- * Remove group fd from internal VFIO group fd array.
- *
- * This function is only relevant to linux and will return
- * an error on BSD.
- *
- * @param vfio_group_fd
- * VFIO Group FD.
- *
- * @return
- * 0 on success.
- * <0 on failure.
- */
-__rte_internal
-int
-rte_vfio_clear_group(int vfio_group_fd);
-
/**
* @internal
* Parse IOMMU group number for a device.
@@ -218,24 +200,6 @@ __rte_internal
int
rte_vfio_get_container_fd(void);
-/**
- * @internal
- * Open VFIO group fd or get an existing one.
- *
- * This function is only relevant to linux and will return
- * an error on BSD.
- *
- * @param iommu_group_num
- * iommu group number
- *
- * @return
- * > 0 group fd
- * < 0 for errors
- */
-__rte_internal
-int
-rte_vfio_get_group_fd(int iommu_group_num);
-
/**
* @internal
* Create a new container for device binding.
@@ -297,42 +261,6 @@ int
rte_vfio_container_assign_device(int vfio_container_fd, const char *sysfs_base,
const char *dev_addr);
-/**
- * @internal
- * Bind a IOMMU group to a container.
- *
- * @param container_fd
- * the container's fd
- *
- * @param iommu_group_num
- * the iommu group number to bind to container
- *
- * @return
- * group fd if successful
- * <0 if failed
- */
-__rte_internal
-int
-rte_vfio_container_group_bind(int container_fd, int iommu_group_num);
-
-/**
- * @internal
- * Unbind a IOMMU group from a container.
- *
- * @param container_fd
- * the container fd of container
- *
- * @param iommu_group_num
- * the iommu group number to delete from container
- *
- * @return
- * 0 if successful
- * <0 if failed
- */
-__rte_internal
-int
-rte_vfio_container_group_unbind(int container_fd, int iommu_group_num);
-
/**
* @internal
* Perform DMA mapping for devices in a container.
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index 02fec64658..7893d334eb 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -67,6 +67,9 @@ static int vfio_noiommu_dma_mem_map(int, uint64_t, uint64_t, uint64_t, int);
static int vfio_dma_mem_map(struct vfio_config *vfio_cfg, uint64_t vaddr,
uint64_t iova, uint64_t len, int do_map);
+static int vfio_container_group_bind(int container_fd, int iommu_group_num);
+static int vfio_container_group_unbind(int container_fd, int iommu_group_num);
+
/* IOMMU types we support */
static const struct vfio_iommu_type iommu_types[] = {
/* x86 IOMMU, otherwise known as type 1 */
@@ -532,9 +535,8 @@ get_vfio_cfg_by_container_fd(int container_fd)
return NULL;
}
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_get_group_fd)
int
-rte_vfio_get_group_fd(int iommu_group_num)
+vfio_get_group_fd_by_num(int iommu_group_num)
{
struct vfio_config *vfio_cfg;
@@ -731,9 +733,8 @@ vfio_sync_default_container(void)
return -1;
}
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_clear_group)
-int
-rte_vfio_clear_group(int vfio_group_fd)
+static int
+vfio_clear_group(int vfio_group_fd)
{
int i;
struct vfio_config *vfio_cfg;
@@ -787,7 +788,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
return -1;
/* get the actual group fd */
- vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num);
+ vfio_group_fd = vfio_get_group_fd_by_num(iommu_group_num);
if (vfio_group_fd < 0 && vfio_group_fd != -ENOENT)
return -1;
@@ -813,14 +814,14 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
EAL_LOG(ERR, "%s cannot get VFIO group status, "
"error %i (%s)", dev_addr, errno, strerror(errno));
close(vfio_group_fd);
- rte_vfio_clear_group(vfio_group_fd);
+ vfio_clear_group(vfio_group_fd);
return -1;
} else if (!(group_status.flags & VFIO_GROUP_FLAGS_VIABLE)) {
EAL_LOG(ERR, "%s VFIO group is not viable! "
"Not all devices in IOMMU group bound to VFIO or unbound",
dev_addr);
close(vfio_group_fd);
- rte_vfio_clear_group(vfio_group_fd);
+ vfio_clear_group(vfio_group_fd);
return -1;
}
@@ -841,7 +842,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
"%s cannot add VFIO group to container, error "
"%i (%s)", dev_addr, errno, strerror(errno));
close(vfio_group_fd);
- rte_vfio_clear_group(vfio_group_fd);
+ vfio_clear_group(vfio_group_fd);
return -1;
}
@@ -865,7 +866,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
"%s failed to select IOMMU type",
dev_addr);
close(vfio_group_fd);
- rte_vfio_clear_group(vfio_group_fd);
+ vfio_clear_group(vfio_group_fd);
return -1;
}
/* lock memory hotplug before mapping and release it
@@ -882,7 +883,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
"%i (%s)",
dev_addr, errno, strerror(errno));
close(vfio_group_fd);
- rte_vfio_clear_group(vfio_group_fd);
+ vfio_clear_group(vfio_group_fd);
rte_mcfg_mem_read_unlock();
return -1;
}
@@ -951,7 +952,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
if (ret < 0) {
EAL_LOG(ERR, "Could not sync default VFIO container");
close(vfio_group_fd);
- rte_vfio_clear_group(vfio_group_fd);
+ vfio_clear_group(vfio_group_fd);
return -1;
}
/* we have successfully initialized VFIO, notify user */
@@ -988,7 +989,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
EAL_LOG(WARNING, "Getting a vfio_dev_fd for %s failed",
dev_addr);
close(vfio_group_fd);
- rte_vfio_clear_group(vfio_group_fd);
+ vfio_clear_group(vfio_group_fd);
return -1;
}
@@ -1026,9 +1027,9 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr,
}
/* get the actual group fd */
- vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num);
+ vfio_group_fd = vfio_get_group_fd_by_num(iommu_group_num);
if (vfio_group_fd < 0) {
- EAL_LOG(INFO, "rte_vfio_get_group_fd failed for %s",
+ EAL_LOG(INFO, "vfio_get_group_fd_by_num failed for %s",
dev_addr);
ret = vfio_group_fd;
goto out;
@@ -1064,7 +1065,7 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr,
goto out;
}
- if (rte_vfio_clear_group(vfio_group_fd) < 0) {
+ if (vfio_clear_group(vfio_group_fd) < 0) {
EAL_LOG(INFO, "Error when clearing group for %s",
dev_addr);
ret = -1;
@@ -2091,7 +2092,7 @@ rte_vfio_container_destroy(int container_fd)
for (i = 0; i < RTE_DIM(vfio_cfg->vfio_groups); i++)
if (vfio_cfg->vfio_groups[i].group_num != -1)
- rte_vfio_container_group_unbind(container_fd,
+ vfio_container_group_unbind(container_fd,
vfio_cfg->vfio_groups[i].group_num);
close(container_fd);
@@ -2122,7 +2123,7 @@ rte_vfio_container_assign_device(int vfio_container_fd, const char *sysfs_base,
return -1;
}
- ret = rte_vfio_container_group_bind(vfio_container_fd,
+ ret = vfio_container_group_bind(vfio_container_fd,
iommu_group_num);
if (ret < 0) {
EAL_LOG(ERR,
@@ -2134,9 +2135,8 @@ rte_vfio_container_assign_device(int vfio_container_fd, const char *sysfs_base,
return 0;
}
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_group_bind)
-int
-rte_vfio_container_group_bind(int container_fd, int iommu_group_num)
+static int
+vfio_container_group_bind(int container_fd, int iommu_group_num)
{
struct vfio_config *vfio_cfg;
@@ -2149,9 +2149,8 @@ rte_vfio_container_group_bind(int container_fd, int iommu_group_num)
return vfio_get_group_fd(vfio_cfg, iommu_group_num);
}
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_group_unbind)
-int
-rte_vfio_container_group_unbind(int container_fd, int iommu_group_num)
+static int
+vfio_container_group_unbind(int container_fd, int iommu_group_num)
{
struct vfio_group *cur_grp = NULL;
struct vfio_config *vfio_cfg;
diff --git a/lib/eal/linux/eal_vfio.h b/lib/eal/linux/eal_vfio.h
index 89c4b5ba45..30389fb274 100644
--- a/lib/eal/linux/eal_vfio.h
+++ b/lib/eal/linux/eal_vfio.h
@@ -51,6 +51,8 @@ vfio_set_iommu_type(int vfio_container_fd);
int
vfio_get_iommu_type(void);
+int vfio_get_group_fd_by_num(int iommu_group_num);
+
/* check if we have any supported extensions */
int
vfio_has_supported_extensions(int vfio_container_fd);
diff --git a/lib/eal/linux/eal_vfio_mp_sync.c b/lib/eal/linux/eal_vfio_mp_sync.c
index 22136f2e8b..3eaeef2fc8 100644
--- a/lib/eal/linux/eal_vfio_mp_sync.c
+++ b/lib/eal/linux/eal_vfio_mp_sync.c
@@ -34,7 +34,7 @@ vfio_mp_primary(const struct rte_mp_msg *msg, const void *peer)
case SOCKET_REQ_GROUP:
r->req = SOCKET_REQ_GROUP;
r->group_num = m->group_num;
- fd = rte_vfio_get_group_fd(m->group_num);
+ fd = vfio_get_group_fd_by_num(m->group_num);
if (fd < 0 && fd != -ENOENT)
r->result = SOCKET_ERR;
else if (fd == -ENOENT)
--
2.47.3
next prev parent reply other threads:[~2025-11-18 16:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1763141462.git.anatoly.burakov@intel.com>
2025-11-18 16:29 ` [PATCH v3 00/20] Support VFIO cdev API in DPDK Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 01/20] doc: add deprecation notice for VFIO API Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 02/20] doc: add deprecation notice for vDPA driver API Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 03/20] uapi: update to v6.17 and add iommufd.h Anatoly Burakov
2025-11-18 17:36 ` Stephen Hemminger
2025-11-18 16:29 ` [PATCH v3 04/20] vfio: make all functions internal Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 05/20] vfio: split get device info from setup Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 06/20] vfio: add container device assignment API Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 07/20] net/nbl: do not use VFIO group bind API Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 08/20] net/ntnic: use container device assignment API Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 09/20] vdpa/ifc: " Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 10/20] vdpa/nfp: " Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 11/20] vdpa/sfc: " Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 12/20] vhost: remove group-related API from drivers Anatoly Burakov
2025-11-18 16:29 ` Anatoly Burakov [this message]
2025-11-18 16:29 ` [PATCH v3 14/20] vfio: cleanup and refactor Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 15/20] bus/pci: use the new VFIO mode API Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 16/20] bus/fslmc: " Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 17/20] net/hinic3: " Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 18/20] net/ntnic: " Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 19/20] vfio: remove no-IOMMU check API Anatoly Burakov
2025-11-18 16:29 ` [PATCH v3 20/20] vfio: introduce cdev mode Anatoly Burakov
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=907f38201ed6c1873e61676cb92bda8cb346283f.1763483254.git.anatoly.burakov@intel.com \
--to=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=roretzla@linux.microsoft.com \
/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).