From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, stephen@networkplumber.org,
bruce.richardson@intel.com,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@nxp.com>,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [PATCH 14/23] drivers/bus: initialize NXP bus specifics in scan
Date: Wed, 29 Apr 2026 13:44:47 +0200 [thread overview]
Message-ID: <20260429114503.932575-15-david.marchand@redhat.com> (raw)
In-Reply-To: <20260429114503.932575-1-david.marchand@redhat.com>
Move bus-specific initialization code from probe() to scan() operations
for DPAA and FSLMC buses. This separates device discovery and bus setup
(scan) from driver matching and probing (probe), preparing for a future
generic probe() implementation in EAL.
Both buses now have a clean separation:
- scan(): discover devices + initialize bus
- probe(): match drivers + call probe_device()
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/dpaa/dpaa_bus.c | 76 +++++++++++++++---------------
drivers/bus/fslmc/fslmc_bus.c | 88 +++++++++++++++++------------------
2 files changed, 80 insertions(+), 84 deletions(-)
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index b0ed61ba39..43d71cefa4 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -569,40 +569,6 @@ dpaa_bus_dev_compare(const char *name1, const char *name2)
return strncmp(devname1, devname2, sizeof(devname1));
}
-#define DPAA_DEV_PATH1 "/sys/devices/platform/soc/soc:fsl,dpaa"
-#define DPAA_DEV_PATH2 "/sys/devices/platform/fsl,dpaa"
-
-static int
-rte_dpaa_bus_scan(void)
-{
- int ret;
-
- BUS_INIT_FUNC_TRACE();
-
- if ((access(DPAA_DEV_PATH1, F_OK) != 0) &&
- (access(DPAA_DEV_PATH2, F_OK) != 0)) {
- DPAA_BUS_LOG(DEBUG, "DPAA Bus not present. Skipping.");
- return 0;
- }
-
- if (rte_dpaa_bus.detected)
- return 0;
-
- rte_dpaa_bus.detected = 1;
-
- /* create the key, supplying a function that'll be invoked
- * when a portal affined thread will be deleted.
- */
- ret = pthread_key_create(&dpaa_portal_key, dpaa_portal_finish);
- if (ret) {
- DPAA_BUS_LOG(DEBUG, "Unable to create pthread key. (%d)", ret);
- dpaa_clean_device_list();
- return ret;
- }
-
- return 0;
-}
-
/* register a dpaa bus based dpaa driver */
RTE_EXPORT_INTERNAL_SYMBOL(rte_dpaa_driver_register)
void
@@ -701,20 +667,43 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)
return 0;
}
+#define DPAA_DEV_PATH1 "/sys/devices/platform/soc/soc:fsl,dpaa"
+#define DPAA_DEV_PATH2 "/sys/devices/platform/fsl,dpaa"
+
static int
-rte_dpaa_bus_probe(void)
+rte_dpaa_bus_scan(void)
{
- int ret = -1;
struct rte_dpaa_device *dev;
FILE *svr_file = NULL;
uint32_t svr_ver;
static int process_once;
char *penv;
+ int ret;
+
+ BUS_INIT_FUNC_TRACE();
+
+ if ((access(DPAA_DEV_PATH1, F_OK) != 0) &&
+ (access(DPAA_DEV_PATH2, F_OK) != 0)) {
+ DPAA_BUS_LOG(DEBUG, "DPAA Bus not present. Skipping.");
+ return 0;
+ }
- /* If DPAA bus is not present nothing needs to be done */
- if (!rte_dpaa_bus.detected)
+ if (rte_dpaa_bus.detected)
return 0;
+ rte_dpaa_bus.detected = 1;
+
+ /* create the key, supplying a function that'll be invoked
+ * when a portal affined thread will be deleted.
+ */
+ ret = pthread_key_create(&dpaa_portal_key, dpaa_portal_finish);
+ if (ret) {
+ DPAA_BUS_LOG(DEBUG, "Unable to create pthread key. (%d)", ret);
+ dpaa_clean_device_list();
+ return ret;
+ }
+
+ /* SoC version detection and configuration */
svr_file = fopen(DPAA_SOC_ID_FILE, "r");
if (svr_file) {
if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
@@ -786,9 +775,19 @@ rte_dpaa_bus_probe(void)
/* And initialize the PA->VA translation table */
dpaax_iova_table_populate();
+ dpaa_bus_global_init = 1;
+ return 0;
+}
+
+static int
+rte_dpaa_bus_probe(void)
+{
+ struct rte_dpaa_device *dev;
+
/* For each registered driver, and device, call the driver->probe */
RTE_BUS_FOREACH_DEV(dev, &rte_dpaa_bus.bus) {
struct rte_driver *driver = NULL;
+ int ret;
next_driver:
driver = rte_bus_find_driver(&rte_dpaa_bus.bus, driver, &dev->device);
@@ -801,7 +800,6 @@ rte_dpaa_bus_probe(void)
else if (ret > 0)
goto next_driver;
}
- dpaa_bus_global_init = 1;
return 0;
}
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index e6db8f5100..156f4e295f 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -322,7 +322,6 @@ rte_fslmc_scan(void)
}
return 0;
}
- process_once = 1;
/* Now we only support single group per process.*/
group_name = getenv("DPRC");
@@ -368,6 +367,48 @@ rte_fslmc_scan(void)
/* If debugging is enabled, device list is dumped to log output */
dump_device_list();
+ /* Bus initialization - only if devices were found */
+ if (!TAILQ_EMPTY(&rte_fslmc_bus.bus.device_list)) {
+ static const struct rte_mbuf_dynfield dpaa2_seqn_dynfield_desc = {
+ .name = DPAA2_SEQN_DYNFIELD_NAME,
+ .size = sizeof(dpaa2_seqn_t),
+ .align = alignof(dpaa2_seqn_t),
+ };
+
+ dpaa2_seqn_dynfield_offset =
+ rte_mbuf_dynfield_register(&dpaa2_seqn_dynfield_desc);
+ if (dpaa2_seqn_dynfield_offset < 0) {
+ DPAA2_BUS_ERR("Failed to register mbuf field for dpaa sequence number");
+ return 0;
+ }
+
+ ret = fslmc_vfio_setup_group();
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to setup VFIO %d", ret);
+ return 0;
+ }
+
+ /* Map existing segments as well as, in case of hotpluggable memory,
+ * install callback handler.
+ */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ ret = fslmc_vfio_dmamap();
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to DMA map existing VAs: (%d)", ret);
+ DPAA2_BUS_ERR("FSLMC VFIO Mapping failed");
+ return 0;
+ }
+ }
+
+ ret = fslmc_vfio_process_group();
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to setup devices %d", ret);
+ return 0;
+ }
+ }
+
+ process_once = 1;
+
return 0;
scan_fail_cleanup:
@@ -408,51 +449,8 @@ rte_fslmc_close(void)
static int
rte_fslmc_probe(void)
{
- int ret = 0;
-
struct rte_dpaa2_device *dev;
-
- static const struct rte_mbuf_dynfield dpaa2_seqn_dynfield_desc = {
- .name = DPAA2_SEQN_DYNFIELD_NAME,
- .size = sizeof(dpaa2_seqn_t),
- .align = alignof(dpaa2_seqn_t),
- };
-
- if (TAILQ_EMPTY(&rte_fslmc_bus.bus.device_list))
- return 0;
-
- dpaa2_seqn_dynfield_offset =
- rte_mbuf_dynfield_register(&dpaa2_seqn_dynfield_desc);
- if (dpaa2_seqn_dynfield_offset < 0) {
- DPAA2_BUS_ERR("Failed to register mbuf field for dpaa sequence number");
- return 0;
- }
-
- ret = fslmc_vfio_setup_group();
- if (ret) {
- DPAA2_BUS_ERR("Unable to setup VFIO %d", ret);
- return 0;
- }
-
- /* Map existing segments as well as, in case of hotpluggable memory,
- * install callback handler.
- */
- if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- ret = fslmc_vfio_dmamap();
- if (ret) {
- DPAA2_BUS_ERR("Unable to DMA map existing VAs: (%d)",
- ret);
- /* Not continuing ahead */
- DPAA2_BUS_ERR("FSLMC VFIO Mapping failed");
- return 0;
- }
- }
-
- ret = fslmc_vfio_process_group();
- if (ret) {
- DPAA2_BUS_ERR("Unable to setup devices %d", ret);
- return 0;
- }
+ int ret;
RTE_BUS_FOREACH_DEV(dev, &rte_fslmc_bus.bus) {
struct rte_driver *driver = NULL;
--
2.53.0
next prev 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 ` [PATCH 13/23] bus: support multiple probe David Marchand
2026-04-29 11:44 ` David Marchand [this message]
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-15-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=sachin.saxena@nxp.com \
--cc=stephen@networkplumber.org \
--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