DPDK patches and discussions
 help / color / mirror / Atom feed
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 v2 18/19] vfio: remove group API functions
Date: Fri, 14 Nov 2025 17:40:28 +0000	[thread overview]
Message-ID: <78c7d385b5ca38f077852dde8a40e7c7ca7e3625.1763142008.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1763142007.git.anatoly.burakov@intel.com> <cover.1763142007.git.anatoly.burakov@intel.com>

These functions are not used by anything in DPDK, and they are built around
group API which is no longer the only VFIO API available. Remove these
functions to reduce API surface.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/eal/freebsd/eal.c      |  39 --------
 lib/eal/include/rte_vfio.h | 110 ----------------------
 lib/eal/linux/eal_vfio.c   | 185 -------------------------------------
 3 files changed, 334 deletions(-)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index efdb9dd369..efca7f8463 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -842,19 +842,6 @@ int rte_vfio_is_enabled(__rte_unused const char *modname)
 	return 0;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_noiommu_is_enabled)
-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 +860,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 +876,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 bfa59094fe..b8830cef20 100644
--- a/lib/eal/include/rte_vfio.h
+++ b/lib/eal/include/rte_vfio.h
@@ -170,42 +170,6 @@ __rte_internal
 enum rte_vfio_mode
 rte_vfio_get_mode(void);
 
-/**
- * @internal
- * Check if VFIO NOIOMMU mode is enabled.
- *
- * This function is only relevant on Linux in group mode.
- *
- * @return
- *   1 if enabled.
- *   0 if not enabled or not supported.
- */
-__rte_internal
-int
-rte_vfio_noiommu_is_enabled(void);
-
-/**
- * @internal
- * Remove group fd from internal VFIO tracking.
- *
- * This function is only relevant on Linux in group mode.
- *
- * @param vfio_group_fd
- *   VFIO group fd.
- *
- * @return
- *   0 on success.
- *   <0 on failure, rte_errno is set.
- *
- * Possible rte_errno values include:
- * - ENOENT  - Group not found.
- * - ENXIO   - VFIO support not initialized.
- * - ENOTSUP - Unsupported VFIO mode.
- */
-__rte_internal
-int
-rte_vfio_clear_group(int vfio_group_fd);
-
 /**
  * @internal
  * Parse IOMMU group number for a device.
@@ -279,28 +243,6 @@ __rte_internal
 int
 rte_vfio_get_container_fd(void);
 
-/**
- * @internal
- * Return file descriptor for an open VFIO group.
- *
- * This function is only relevant on Linux in group mode.
- *
- * @param iommu_group_num
- *   IOMMU group number.
- *
- * @return
- *   Non-negative group file descriptor on success.
- *   <0 on failure, rte_errno is set.
- *
- * Possible rte_errno values include:
- * - ENOENT  - Group not found.
- * - ENXIO   - VFIO support not initialized.
- * - ENOTSUP - Unsupported VFIO mode.
- */
-__rte_internal
-int
-rte_vfio_get_group_fd(int iommu_group_num);
-
 /**
  * @internal
  * Create a new VFIO container for device assignment and DMA mapping.
@@ -387,58 +329,6 @@ int
 rte_vfio_container_assign_device(int vfio_container_fd,
 		const char *sysfs_base, const char *dev_addr);
 
-/**
- * @internal
- * Bind an IOMMU group to a container.
- *
- * This function is only relevant on Linux in group mode.
- *
- * @param container_fd
- *   Container file descriptor.
- * @param iommu_group_num
- *   IOMMU group number to bind to container.
- *
- * @return
- *   0 on success.
- *   <0 on failure, rte_errno is set.
- *
- * Possible rte_errno values include:
- * - ENODEV  - IOMMU group not managed by VFIO.
- * - ENOSPC  - No space in VFIO container to track the group.
- * - EINVAL  - Invalid container file descriptor.
- * - ENXIO   - VFIO support not initialized.
- * - ENOTSUP - Unsupported VFIO mode.
- */
-__rte_internal
-int
-rte_vfio_container_group_bind(int container_fd, int iommu_group_num);
-
-/**
- * @internal
- * Unbind an IOMMU group from a container.
- *
- * This function is only relevant on Linux in group mode.
- *
- * @param container_fd
- *   Container file descriptor.
- * @param iommu_group_num
- *   IOMMU group number to unbind from container.
- *
- * @return
- *   0 on success.
- *   <0 on failure, rte_errno is set.
- *
- * Possible rte_errno values include:
- * - ENOENT  - VFIO group not found in container.
- * - ENODEV  - Container not managed by VFIO.
- * - EINVAL  - Invalid container file descriptor.
- * - ENXIO   - VFIO support not initialized.
- * - ENOTSUP - Unsupported VFIO mode.
- */
-__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 7d5edc7865..4479945683 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -429,37 +429,6 @@ vfio_device_erase(struct container *cfg, struct vfio_device *dev)
 	cfg->n_devices--;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_get_group_fd)
-int
-rte_vfio_get_group_fd(int iommu_group_num)
-{
-	struct container *cfg;
-	struct vfio_group *grp;
-
-	if (vfio_cfg.mode == RTE_VFIO_MODE_NONE) {
-		EAL_LOG(ERR, "VFIO support not initialized");
-		rte_errno = ENXIO;
-		return -1;
-	}
-	if (vfio_cfg.mode != RTE_VFIO_MODE_GROUP &&
-			vfio_cfg.mode != RTE_VFIO_MODE_NOIOMMU) {
-		EAL_LOG(ERR, "VFIO not initialized in group mode");
-		rte_errno = ENOTSUP;
-		return -1;
-	}
-
-	CONTAINER_FOREACH_ACTIVE(cfg) {
-		GROUP_FOREACH_ACTIVE(cfg, grp)
-			if (grp->group_num == iommu_group_num)
-				return grp->fd;
-	}
-
-	/* group doesn't exist */
-	EAL_LOG(ERR, "IOMMU group %d not bound to any VFIO container", iommu_group_num);
-	rte_errno = ENOENT;
-	return -1;
-}
-
 static void
 vfio_mem_event_callback(enum rte_mem_event type, const void *addr, size_t len,
 		void *arg __rte_unused)
@@ -508,48 +477,6 @@ vfio_mem_event_callback(enum rte_mem_event type, const void *addr, size_t len,
 	}
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_clear_group)
-int
-rte_vfio_clear_group(int vfio_group_fd)
-{
-	struct container *cfg;
-	struct vfio_group *grp;
-	struct vfio_device *dev;
-
-	if (vfio_cfg.mode == RTE_VFIO_MODE_NONE) {
-		EAL_LOG(ERR, "VFIO support not initialized");
-		rte_errno = ENXIO;
-		return -1;
-	}
-
-	if (vfio_cfg.mode != RTE_VFIO_MODE_GROUP &&
-			vfio_cfg.mode != RTE_VFIO_MODE_NOIOMMU) {
-		EAL_LOG(ERR, "VFIO not initialized in group mode");
-		rte_errno = ENOTSUP;
-		return -1;
-	}
-
-	/* find our group */
-	CONTAINER_FOREACH_ACTIVE(cfg) {
-		GROUP_FOREACH_ACTIVE(cfg, grp) {
-			if (grp->fd != vfio_group_fd)
-				continue;
-			/* clear out all devices within this group */
-			DEVICE_FOREACH_ACTIVE(cfg, dev) {
-				if (dev->group != grp->group_num)
-					continue;
-				vfio_device_erase(cfg, dev);
-			}
-			/* clear out group itself */
-			vfio_group_erase(cfg, grp);
-			return 0;
-		}
-	}
-
-	rte_errno = ENOENT;
-	return -1;
-}
-
 static int
 vfio_register_mem_event_callback(void)
 {
@@ -1385,13 +1312,6 @@ container_dma_unmap(struct container *cfg, uint64_t vaddr, uint64_t iova,
 	return ret;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_noiommu_is_enabled)
-int
-rte_vfio_noiommu_is_enabled(void)
-{
-	return vfio_cfg.mode == RTE_VFIO_MODE_NOIOMMU;
-}
-
 RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_create)
 int
 rte_vfio_container_create(void)
@@ -1494,111 +1414,6 @@ rte_vfio_container_destroy(int container_fd)
 	return 0;
 }
 
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_group_bind)
-int
-rte_vfio_container_group_bind(int container_fd, int iommu_group_num)
-{
-	struct container *cfg;
-	struct vfio_group *grp;
-	int ret;
-
-	if (vfio_cfg.mode == RTE_VFIO_MODE_NONE) {
-		EAL_LOG(ERR, "VFIO support not initialized");
-		rte_errno = ENXIO;
-		return -1;
-	}
-	if (vfio_cfg.mode != RTE_VFIO_MODE_GROUP && vfio_cfg.mode != RTE_VFIO_MODE_NOIOMMU) {
-		EAL_LOG(ERR, "VFIO not initialized in group mode");
-		rte_errno = ENOTSUP;
-		return -1;
-	}
-
-	cfg = vfio_container_get_by_fd(container_fd);
-	if (cfg == NULL) {
-		EAL_LOG(ERR, "Invalid VFIO container fd");
-		rte_errno = EINVAL;
-		return -1;
-	}
-
-	/* does the group already exist and already bound? */
-	grp = vfio_group_get_by_num(cfg, iommu_group_num);
-	if (grp != NULL)
-		return 0;
-
-	/* group doesn't exist, create it */
-	grp = vfio_group_create(cfg, iommu_group_num);
-	if (grp == NULL) {
-		EAL_LOG(ERR, "Failed to bind VFIO group %d", iommu_group_num);
-		rte_errno = ENOSPC;
-		return -1;
-	}
-
-	/* group created, now open fd */
-	ret = vfio_group_open_fd(cfg, grp);
-	if (ret == -ENOENT) {
-		EAL_LOG(ERR, "IOMMU group %d not managed by VFIO", iommu_group_num);
-		vfio_group_erase(cfg, grp);
-		rte_errno = ENODEV;
-		return -1;
-	} else if (ret < 0) {
-		EAL_LOG(ERR, "Cannot open VFIO group %d", iommu_group_num);
-		rte_errno = errno;
-		vfio_group_erase(cfg, grp);
-		return -1;
-	}
-
-	/* we're done */
-	return 0;
-}
-
-RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_group_unbind)
-int
-rte_vfio_container_group_unbind(int container_fd, int iommu_group_num)
-{
-	struct container *cfg;
-	struct vfio_group *grp;
-	struct vfio_device *dev;
-
-	if (vfio_cfg.mode == RTE_VFIO_MODE_NONE) {
-		EAL_LOG(ERR, "VFIO support not initialized");
-		rte_errno = ENODEV;
-		return -1;
-	}
-
-	if (vfio_cfg.mode != RTE_VFIO_MODE_GROUP && vfio_cfg.mode != RTE_VFIO_MODE_NOIOMMU) {
-		EAL_LOG(ERR, "VFIO not initialized in group mode");
-		rte_errno = ENOTSUP;
-		return -1;
-	}
-
-	/* find container */
-	cfg = vfio_container_get_by_fd(container_fd);
-	if (cfg == NULL) {
-		EAL_LOG(ERR, "Invalid VFIO container fd");
-		rte_errno = EINVAL;
-		return -1;
-	}
-
-	/* find the group */
-	grp = vfio_group_get_by_num(cfg, iommu_group_num);
-	if (grp == NULL) {
-		EAL_LOG(ERR, "VFIO group %d not found in container", iommu_group_num);
-		rte_errno = ENOENT;
-		return -1;
-	}
-
-	/* remove all devices from this group */
-	DEVICE_FOREACH_ACTIVE(cfg, dev) {
-		if (dev->group != grp->group_num)
-			continue;
-		vfio_device_erase(cfg, dev);
-	}
-
-	vfio_group_erase(cfg, grp);
-
-	return 0;
-}
-
 RTE_EXPORT_INTERNAL_SYMBOL(rte_vfio_container_dma_map)
 int
 rte_vfio_container_dma_map(int container_fd, uint64_t vaddr, uint64_t iova, uint64_t len)
-- 
2.47.3


  parent reply	other threads:[~2025-11-14 17:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 16:43 [PATCH v1 0/8] Support VFIO cdev API in DPDK Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 1/8] uapi: update to v6.17 and add iommufd.h Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 2/8] vfio: add container device assignment API Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 3/8] vhost: remove group-related API from drivers Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 4/8] vfio: do not setup the device on get device info Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 5/8] vfio: cleanup and refactor Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 6/8] vfio: introduce cdev mode Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 7/8] doc: deprecate VFIO group-based APIs Anatoly Burakov
2025-10-28 16:43 ` [PATCH v1 8/8] vfio: deprecate group-based API Anatoly Burakov
2025-10-29  9:50 ` 回复:[PATCH v1 0/8] Support VFIO cdev API in DPDK Dimon
2025-10-29 12:03   ` Burakov, Anatoly
2025-10-30  9:21 ` [PATCH " David Marchand
2025-10-30 10:11   ` Burakov, Anatoly
2025-11-14 17:40 ` [PATCH v2 00/19] " Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 01/19] doc: add deprecation notice for VFIO API Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 02/19] doc: add deprecation notice for vDPA driver API Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 03/19] uapi: update to v6.17 and add iommufd.h Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 04/19] vfio: make all functions internal Anatoly Burakov
2025-11-14 18:18     ` Stephen Hemminger
2025-11-14 17:40   ` [PATCH v2 05/19] vfio: add container device assignment API Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 06/19] vfio: split get device info from setup Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 07/19] net/nbl: do not use VFIO group bind API Anatoly Burakov
2025-11-15  8:31     ` 回复:[PATCH " Dimon
2025-11-14 17:40   ` [PATCH v2 08/19] net/ntnic: use container device assignment API Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 09/19] vdpa/ifc: " Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 10/19] vdpa/nfp: " Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 11/19] vdpa/sfc: " Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 12/19] vhost: remove group-related API from drivers Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 13/19] vfio: cleanup and refactor Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 14/19] bus/pci: use the new VFIO mode API Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 15/19] bus/fslmc: " Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 16/19] net/hinic3: " Anatoly Burakov
2025-11-14 17:40   ` [PATCH v2 17/19] net/ntnic: " Anatoly Burakov
2025-11-14 17:40   ` Anatoly Burakov [this message]
2025-11-14 17:40   ` [PATCH v2 19/19] 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=78c7d385b5ca38f077852dde8a40e7c7ca7e3625.1763142008.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).