[PATCH v2] bus/dpaa: defer bus initialization to probe

Prashant Gupta prashant.gupta_3 at nxp.com
Mon Aug 31 11:33:28 CEST 2026


The DPAA bus initialization (build device list, load QMAN/BMAN drivers,
register mbuf pool ops, populate the PA to VA table) needs QMAN/BMAN
resources in shared (hugepage) memory for multi-process sharing. But
hugepages are not available during the bus scan (EAL runs
rte_bus_scan() before memory and heap init), so it fails there.

get_iommu_class() only checks two sysfs paths, so this init is not
needed in scan to report the IOVA mode. Move it back to probe.

Fixes: cdefd2e980bd ("drivers/bus: initialize NXP bus specifics in scan")

Signed-off-by: Prashant Gupta <prashant.gupta_3 at nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
v2:
- Reword commit log to explain the actual issue (per David Marchand's
  request): QMAN/BMAN init needs hugepage/shared memory for
  multi-process, which is not available during bus scan.
- Add Hemant Agrawal's Acked-by.
- No functional change.

 drivers/bus/dpaa/dpaa_bus.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 368c8eeb98..97bf3dc458 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -673,10 +673,8 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)
 static int
 rte_dpaa_bus_scan(void)
 {
-	struct rte_dpaa_device *dev;
 	FILE *svr_file = NULL;
 	uint32_t svr_ver;
-	static int process_once;
 	char *penv;
 	int ret;
 
@@ -735,9 +733,29 @@ rte_dpaa_bus_scan(void)
 			dpaa_bus.max_push_rxq_num = DPAA_MAX_PUSH_MODE_QUEUE;
 	}
 
+	return 0;
+}
+
+/* Bus initialization needs the DPDK heap and a memzone, which EAL only sets
+ * up after the bus scan, so it is done here.
+ */
+static int
+rte_dpaa_bus_probe(struct rte_bus *bus)
+{
+	static int process_once;
+	struct rte_dpaa_device *dev;
+	int ret;
+
+	if (!dpaa_bus.detected)
+		return 0;
+
 	/* Device list creation is only done once */
 	if (!process_once) {
-		rte_dpaa_bus_dev_build();
+		ret = rte_dpaa_bus_dev_build();
+		if (ret) {
+			DPAA_BUS_ERR("Unable to build device list. (%d)", ret);
+			return ret;
+		}
 		/* One time load of Qman/Bman drivers */
 		ret = qman_global_init();
 		if (ret) {
@@ -751,8 +769,8 @@ rte_dpaa_bus_scan(void)
 				     ret);
 			return ret;
 		}
+		process_once = 1;
 	}
-	process_once = 1;
 
 	/* If no device present on DPAA bus nothing needs to be done */
 	if (TAILQ_EMPTY(&rte_dpaa_bus.device_list))
@@ -775,7 +793,8 @@ rte_dpaa_bus_scan(void)
 	dpaax_iova_table_populate();
 
 	dpaa_bus_global_init = 1;
-	return 0;
+
+	return rte_bus_generic_probe(bus);
 }
 
 /*
@@ -856,7 +875,7 @@ RTE_FINI_PRIO(dpaa_cleanup, 102)
 
 static struct rte_bus rte_dpaa_bus = {
 	.scan = rte_dpaa_bus_scan,
-	.probe = rte_bus_generic_probe,
+	.probe = rte_dpaa_bus_probe,
 	.parse = rte_dpaa_bus_parse,
 	.dev_compare = dpaa_bus_dev_compare,
 	.find_device = rte_bus_generic_find_device,
-- 
2.43.0



More information about the dev mailing list