DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, stephen@networkplumber.org,
	bruce.richardson@intel.com, Parav Pandit <parav@nvidia.com>,
	Xueming Li <xuemingl@nvidia.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>,
	Rosen Xu <rosen.xu@altera.com>, Chenbo Xia <chenbox@nvidia.com>,
	Tomasz Duszynski <tduszynski@marvell.com>,
	Chengwen Feng <fengchengwen@huawei.com>,
	Long Li <longli@microsoft.com>, Wei Hu <weh@microsoft.com>
Subject: [PATCH 13/23] bus: support multiple probe
Date: Wed, 29 Apr 2026 13:44:46 +0200	[thread overview]
Message-ID: <20260429114503.932575-14-david.marchand@redhat.com> (raw)
In-Reply-To: <20260429114503.932575-1-david.marchand@redhat.com>

Add infrastructure to declare support for multiple probe attempts
on the same device. This prepares for the introduction of
generic probe_device operation.

The PCI bus enables this feature to support drivers with
RTE_PCI_DRV_PROBE_AGAIN flag.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/auxiliary_common.c | 6 ------
 drivers/bus/cdx/cdx.c                    | 5 -----
 drivers/bus/dpaa/dpaa_bus.c              | 3 ---
 drivers/bus/fslmc/fslmc_bus.c            | 3 ---
 drivers/bus/ifpga/ifpga_bus.c            | 7 -------
 drivers/bus/pci/pci_common.c             | 1 +
 drivers/bus/platform/platform.c          | 3 ---
 drivers/bus/uacce/uacce.c                | 5 -----
 drivers/bus/vdev/vdev.c                  | 3 ---
 drivers/bus/vmbus/vmbus_common.c         | 6 ------
 lib/eal/common/eal_common_dev.c          | 3 +++
 lib/eal/include/bus_driver.h             | 1 +
 12 files changed, 5 insertions(+), 41 deletions(-)

diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 7824c26f92..c210e303ce 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -94,12 +94,6 @@ auxiliary_probe_device(struct rte_driver *drv, struct rte_device *dev)
 	if (aux_dev->device.numa_node < 0 && rte_socket_count() > 1)
 		AUXILIARY_LOG(INFO, "Device %s is not NUMA-aware", aux_dev->name);
 
-	if (rte_dev_is_probed(&aux_dev->device)) {
-		AUXILIARY_LOG(DEBUG, "Device %s is already probed on auxiliary bus",
-			aux_dev->device.name);
-		return -EEXIST;
-	}
-
 	iova_mode = rte_eal_iova_mode();
 	if ((aux_drv->drv_flags & RTE_AUXILIARY_DRV_NEED_IOVA_AS_VA) > 0 &&
 	    iova_mode != RTE_IOVA_VA) {
diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index c38eae325b..64fb0a8534 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -315,11 +315,6 @@ cdx_probe_device(struct rte_driver *drv, struct rte_device *dev)
 	const char *dev_name = cdx_dev->name;
 	int ret;
 
-	if (rte_dev_is_probed(&cdx_dev->device)) {
-		CDX_BUS_INFO("Device %s is already probed", dev_name);
-		return -EEXIST;
-	}
-
 	CDX_BUS_DEBUG("  probe device %s using driver: %s", dev_name,
 		cdx_drv->driver.name);
 
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 14cd64cc32..b0ed61ba39 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -826,9 +826,6 @@ dpaa_bus_probe_device(struct rte_driver *drv, struct rte_device *dev)
 	struct rte_dpaa_driver *dpaa_drv = RTE_BUS_DRIVER(drv, *dpaa_drv);
 	int ret;
 
-	if (rte_dev_is_probed(&dpaa_dev->device))
-		return 0;
-
 	if (rte_bus_device_is_ignored(&rte_dpaa_bus.bus, dpaa_dev->name))
 		return 0;
 
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index a975e464c1..e6db8f5100 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -541,9 +541,6 @@ fslmc_bus_probe_device(struct rte_driver *driver, struct rte_device *rte_dev)
 	struct rte_dpaa2_driver *drv = RTE_BUS_DRIVER(driver, *drv);
 	int ret = 0;
 
-	if (rte_dev_is_probed(&dev->device))
-		return 0;
-
 	if (dev->device.devargs &&
 	    dev->device.devargs->policy == RTE_DEV_BLOCKED) {
 		DPAA2_BUS_DEBUG("%s Blocked, skipping",
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 92ad3513e0..d3f3370bc5 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -274,13 +274,6 @@ ifpga_probe_device(struct rte_driver *drv, struct rte_device *dev)
 	struct rte_afu_driver *afu_drv = RTE_BUS_DRIVER(drv, *afu_drv);
 	int ret;
 
-	/* Check if a driver is already loaded */
-	if (rte_dev_is_probed(&afu_dev->device)) {
-		IFPGA_BUS_DEBUG("Device %s is already probed",
-				rte_ifpga_device_name(afu_dev));
-		return -EEXIST;
-	}
-
 	/* reference driver structure */
 	afu_dev->driver = afu_drv;
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index b57320064e..02542a903a 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -823,6 +823,7 @@ rte_pci_pasid_set_state(const struct rte_pci_device *dev,
 
 struct rte_pci_bus rte_pci_bus = {
 	.bus = {
+		.allow_multi_probe = true,
 		.scan = rte_pci_scan,
 		.probe = pci_probe,
 		.cleanup = pci_cleanup,
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 22979f31b3..3d04ba4d25 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -331,9 +331,6 @@ driver_call_probe(struct rte_platform_driver *pdrv, struct rte_platform_device *
 {
 	int ret;
 
-	if (rte_dev_is_probed(&pdev->device))
-		return -EBUSY;
-
 	if (pdrv->probe != NULL) {
 		pdev->driver = pdrv;
 		ret = pdrv->probe(pdev);
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index d8e15cd479..3dedc783ce 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -358,11 +358,6 @@ uacce_probe_device(struct rte_driver *drv, struct rte_device *dev)
 	const char *dev_name = uacce_dev->name;
 	int ret;
 
-	if (rte_dev_is_probed(&uacce_dev->device)) {
-		UACCE_BUS_INFO("device %s is already probed", dev_name);
-		return -EEXIST;
-	}
-
 	UACCE_BUS_DEBUG("probe device %s using driver %s", dev_name, uacce_drv->driver.name);
 
 	ret = uacce_drv->probe(uacce_drv, uacce_dev);
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 5464fe28d4..4da9a2c950 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -190,9 +190,6 @@ vdev_probe_device(struct rte_driver *drv, struct rte_device *dev)
 	enum rte_iova_mode iova_mode;
 	int ret;
 
-	if (rte_dev_is_probed(&vdev_dev->device))
-		return -EEXIST;
-
 	name = rte_vdev_device_name(vdev_dev);
 	VDEV_LOG(DEBUG, "Search driver to probe device %s", name);
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index ba923a2669..24b1c24f43 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -91,12 +91,6 @@ vmbus_probe_device(struct rte_driver *drv, struct rte_device *dev)
 	char guid[RTE_UUID_STRLEN];
 	int ret;
 
-	/* Check if a driver is already loaded */
-	if (rte_dev_is_probed(&vmbus_dev->device)) {
-		VMBUS_LOG(DEBUG, "VMBUS driver already loaded");
-		return 0;
-	}
-
 	rte_uuid_unparse(vmbus_dev->device_id, guid, sizeof(guid));
 	VMBUS_LOG(INFO, "VMBUS device %s on NUMA socket %i",
 		  guid, vmbus_dev->device.numa_node);
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index a38c211e5d..9047a01c4a 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -225,6 +225,9 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
 	drv = rte_bus_find_driver(dev->bus, drv, dev);
 	if (drv == NULL) {
 		ret = -ENOTSUP;
+	} else if (rte_dev_is_probed(dev) && !dev->bus->allow_multi_probe) {
+		EAL_LOG(INFO, "Device %s is already probed", dev->name);
+		ret = -EEXIST;
 	} else {
 		ret = dev->bus->probe_device(drv, dev);
 		if (ret > 0)
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index 55568fe08a..5ab988426c 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -327,6 +327,7 @@ typedef void *(*rte_bus_dev_iterate_t)(const struct rte_bus *bus,
 struct rte_bus {
 	RTE_TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */
 	const char *name;            /**< Name of the bus */
+	bool allow_multi_probe;      /**< Allow probing devices multiple times */
 	rte_bus_scan_t scan;         /**< Scan for devices attached to bus */
 	rte_bus_probe_t probe;       /**< Probe devices on bus */
 	rte_bus_find_device_t find_device; /**< Find a device on the bus */
-- 
2.53.0


  parent reply	other threads:[~2026-04-29 11:47 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 11:44 [PATCH 00/23] Consolidate bus driver infrastructure David Marchand
2026-04-29 11:44 ` [PATCH 01/23] bus/ifpga: remove unused AFU lookup helper David Marchand
2026-04-29 11:44 ` [PATCH 02/23] crypto/octeontx: remove check on driver in remove David Marchand
2026-04-29 11:59   ` [EXTERNAL] " Anoob Joseph
2026-04-29 11:44 ` [PATCH 03/23] bus: remove device and driver checks in DMA map/unmap David Marchand
2026-04-29 11:44 ` [PATCH 04/23] drivers/bus: remove device and driver checks in unplug David Marchand
2026-04-29 11:44 ` [PATCH 05/23] drivers/bus: remove device and driver checks in plug David Marchand
2026-04-29 11:44 ` [PATCH 06/23] bus: add bus conversion macros David Marchand
2026-04-29 11:44 ` [PATCH 07/23] bus: factorize driver list David Marchand
2026-04-29 11:44 ` [PATCH 08/23] bus: factorize device list David Marchand
2026-04-29 11:44 ` [PATCH 09/23] bus: consolidate device lookup David Marchand
2026-04-29 11:44 ` [PATCH 10/23] bus: consolidate device iteration David Marchand
2026-04-29 11:44 ` [PATCH 11/23] bus: factorize driver lookup David Marchand
2026-04-29 11:44 ` [PATCH 12/23] bus: refactor device probe David Marchand
2026-04-29 11:44 ` David Marchand [this message]
2026-04-29 11:44 ` [PATCH 14/23] drivers/bus: initialize NXP bus specifics in scan David Marchand
2026-04-29 11:44 ` [PATCH 15/23] bus: implement probe in EAL David Marchand
2026-04-29 11:44 ` [PATCH 16/23] bus: factorize driver reference David Marchand
2026-04-29 11:44 ` [PATCH 17/23] drivers: rely on generic driver David Marchand
2026-04-29 11:44 ` [PATCH 18/23] drivers/bus: remove bus-specific driver references David Marchand
2026-04-29 11:44 ` [PATCH 19/23] dma/idxd: remove specific bus type David Marchand
2026-04-29 11:44 ` [PATCH 20/23] drivers/bus: separate specific bus metadata for NXP drivers David Marchand
2026-04-29 11:44 ` [PATCH 21/23] drivers/bus: remove specific bus types David Marchand
2026-04-29 11:44 ` [PATCH 22/23] eventdev: rename dev field to device David Marchand
2026-04-29 11:44 ` [PATCH 23/23] bus: add class device conversion macro David Marchand
2026-05-06 15:51 ` [PATCH v2 00/23] Consolidate bus driver infrastructure David Marchand
2026-05-06 15:51   ` [PATCH v2 01/23] bus/ifpga: remove unused AFU lookup helper David Marchand
2026-05-06 15:51   ` [PATCH v2 02/23] crypto/octeontx: remove check on driver in remove David Marchand
2026-05-06 15:51   ` [PATCH v2 03/23] bus: remove device and driver checks in DMA map/unmap David Marchand
2026-05-06 15:51   ` [PATCH v2 04/23] drivers/bus: remove device and driver checks in unplug David Marchand
2026-05-06 15:51   ` [PATCH v2 05/23] drivers/bus: remove device and driver checks in plug David Marchand
2026-05-06 15:51   ` [PATCH v2 06/23] bus: add bus conversion macros David Marchand
2026-05-06 15:51   ` [PATCH v2 07/23] bus: factorize driver list David Marchand
2026-05-06 15:51   ` [PATCH v2 08/23] bus: factorize device list David Marchand
2026-05-06 15:51   ` [PATCH v2 09/23] bus: consolidate device lookup David Marchand
2026-05-06 15:51   ` [PATCH v2 10/23] bus: consolidate device iteration David Marchand
2026-05-06 15:51   ` [PATCH v2 11/23] bus: factorize driver lookup David Marchand
2026-05-06 15:51   ` [PATCH v2 12/23] bus: refactor device probe David Marchand
2026-05-06 15:51   ` [PATCH v2 13/23] bus: support multiple probe David Marchand
2026-05-06 15:51   ` [PATCH v2 14/23] drivers/bus: initialize NXP bus specifics in scan David Marchand
2026-05-06 15:51   ` [PATCH v2 15/23] bus: implement probe in EAL David Marchand
2026-05-06 15:51   ` [PATCH v2 16/23] bus: factorize driver reference David Marchand
2026-05-06 15:51   ` [PATCH v2 17/23] drivers: rely on generic driver David Marchand
2026-05-06 15:51   ` [PATCH v2 18/23] drivers/bus: remove bus-specific driver references David Marchand
2026-05-06 15:51   ` [PATCH v2 19/23] dma/idxd: remove specific bus type David Marchand
2026-05-06 15:51   ` [PATCH v2 20/23] drivers/bus: separate specific bus metadata for NXP drivers David Marchand
2026-05-06 15:51   ` [PATCH v2 21/23] drivers/bus: remove specific bus types David Marchand
2026-05-06 15:51   ` [PATCH v2 22/23] eventdev: rename dev field to device David Marchand
2026-05-06 15:51   ` [PATCH v2 23/23] bus: add class device conversion macro 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=20260429114503.932575-14-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=longli@microsoft.com \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.com \
    --cc=parav@nvidia.com \
    --cc=rosen.xu@altera.com \
    --cc=sachin.saxena@nxp.com \
    --cc=stephen@networkplumber.org \
    --cc=tduszynski@marvell.com \
    --cc=thomas@monjalon.net \
    --cc=weh@microsoft.com \
    --cc=xuemingl@nvidia.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