From: Prashant Gupta <prashant.gupta_3@nxp.com>
To: stephen@networkplumber.org, dev@dpdk.org
Subject: [PATCH v5-S1 1/5] bus/fslmc: defer bus initialization to probe
Date: Tue, 29 Sep 2026 19:51:13 +0530 [thread overview]
Message-ID: <20260929142117.3109066-2-prashant.gupta_3@nxp.com> (raw)
In-Reply-To: <20260929142117.3109066-1-prashant.gupta_3@nxp.com>
The fslmc bus initialization (register the sequence number mbuf
dynfield, set up the VFIO group, DMA map the memory segments) needs the
DPDK heap and the memory segment list in shared (hugepage) memory for
multi-process sharing. But these are not available during the bus scan
(EAL runs rte_bus_scan() before memzone, memory and malloc heap init),
so it fails there.
Device discovery does not need it, and get_iommu_class() only checks
sysfs paths to report the IOVA mode, so the init is not needed in scan.
Move it back to probe.
Fixes: cdefd2e980bd ("drivers/bus: initialize NXP bus specifics in scan")
Signed-off-by: Prashant Gupta <prashant.gupta_3@nxp.com>
---
drivers/bus/fslmc/fslmc_bus.c | 92 +++++++++++++++++++----------------
1 file changed, 51 insertions(+), 41 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 3626b12316..1c638a2d82 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -368,46 +368,6 @@ 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.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;
@@ -423,6 +383,56 @@ rte_fslmc_scan(void)
return 0;
}
+/* Bus initialization needs the DPDK heap and DMA mapping of the memory
+ * segments, which EAL only sets up after the bus scan, so it is done here.
+ */
+static int
+rte_fslmc_probe(struct rte_bus *bus)
+{
+ 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),
+ };
+ int ret;
+
+ if (TAILQ_EMPTY(&rte_fslmc_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 dpaa2_seqn_dynfield_offset;
+ }
+
+ ret = fslmc_vfio_setup_group();
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to setup VFIO %d", ret);
+ return ret;
+ }
+
+ /* 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 ret;
+ }
+ }
+
+ ret = fslmc_vfio_process_group();
+ if (ret) {
+ DPAA2_BUS_ERR("Unable to setup devices %d", ret);
+ return ret;
+ }
+
+ return rte_bus_generic_probe(bus);
+}
+
static bool
fslmc_bus_match(const struct rte_driver *drv, const struct rte_device *dev)
{
@@ -544,7 +554,7 @@ fslmc_bus_unplug_device(struct rte_device *rte_dev)
struct rte_bus rte_fslmc_bus = {
.scan = rte_fslmc_scan,
- .probe = rte_bus_generic_probe,
+ .probe = rte_fslmc_probe,
.cleanup = rte_fslmc_close,
.parse = rte_fslmc_parse,
.dev_compare = fslmc_dev_compare,
next prev parent reply other threads:[~2026-09-29 14:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 11:34 [PATCH v3-S1 0/5] dpaa2: bus, DMA and mempool base fixes Prashant Gupta
2026-09-15 11:34 ` [PATCH v3-S1 1/5] bus/fslmc: defer bus initialization to probe Prashant Gupta
2026-09-15 11:34 ` [PATCH v3-S1 2/5] bus/fslmc: reduce probe-time logging and MC traffic Prashant Gupta
2026-09-15 11:34 ` [PATCH v3-S1 3/5] dma/dpaa2: fix array-bounds warning in dequeue path Prashant Gupta
2026-09-15 11:34 ` [PATCH v3-S1 4/5] dma/dpaa2: validate IOVA in pre-populate helpers Prashant Gupta
2026-09-15 11:34 ` [PATCH v3-S1 5/5] mempool/dpaa2: support ops index from primary in secondary Prashant Gupta
2026-09-15 15:24 ` [PATCH v3-S1 0/5] dpaa2: bus, DMA and mempool base fixes Stephen Hemminger
2026-09-22 9:21 ` [PATCH v4-S1 " Prashant Gupta
2026-09-22 9:21 ` [PATCH v4-S1 1/5] bus/fslmc: defer bus initialization to probe Prashant Gupta
2026-09-22 9:21 ` [PATCH v4-S1 2/5] bus/fslmc: reduce probe-time logging and MC traffic Prashant Gupta
2026-09-22 9:21 ` [PATCH v4-S1 3/5] dma/dpaa2: fix array-bounds warning in dequeue path Prashant Gupta
2026-09-22 9:21 ` [PATCH v4-S1 4/5] dma/dpaa2: validate IOVA in pre-populate helpers Prashant Gupta
2026-09-22 9:21 ` [PATCH v4-S1 5/5] mempool/dpaa2: support ops index from primary in secondary Prashant Gupta
2026-09-22 13:59 ` [PATCH v4-S1 0/5] dpaa2: bus, DMA and mempool base fixes Stephen Hemminger
2026-09-29 14:21 ` [PATCH v5-S1 " Prashant Gupta
2026-09-29 14:21 ` Prashant Gupta [this message]
2026-09-29 14:21 ` [PATCH v5-S1 2/5] bus/fslmc: reduce probe-time logging and skip ignored devices Prashant Gupta
2026-09-29 14:21 ` [PATCH v5-S1 3/5] dma/dpaa2: fix array-bounds warning and SG FD double-put Prashant Gupta
2026-09-29 14:21 ` [PATCH v5-S1 4/5] dma/dpaa2: validate FLE pool IOVA mapping at vchan setup Prashant Gupta
2026-09-29 14:21 ` [PATCH v5-S1 5/5] mempool/dpaa2: look up ops index locally in secondary Prashant Gupta
2026-09-29 15:45 ` [PATCH v5-S1 0/5] dpaa2: bus, DMA and mempool base fixes Stephen Hemminger
2026-10-06 14:57 ` [EXT] " Prashant Gupta
2026-10-06 15:07 ` [PATCH v6-S1 0/6] " Prashant Gupta
2026-10-06 15:07 ` [PATCH v6-S1 1/6] bus/fslmc: defer bus initialization to probe Prashant Gupta
2026-10-06 15:07 ` [PATCH v6-S1 2/6] bus/fslmc: reduce probe logging and skip ignored devices Prashant Gupta
2026-10-06 15:07 ` [PATCH v6-S1 3/6] dma/dpaa2: use memcpy to fill completion index ring Prashant Gupta
2026-10-06 15:07 ` [PATCH v6-S1 4/6] dma/dpaa2: release SG FLE on completion ring overflow Prashant Gupta
2026-10-06 15:07 ` [PATCH v6-S1 5/6] dma/dpaa2: validate FLE pool IOVA mapping at vchan setup Prashant Gupta
2026-10-06 15:07 ` [PATCH v6-S1 6/6] mempool/dpaa2: look up ops index locally in secondary Prashant Gupta
2026-10-07 15:51 ` [PATCH v6-S1 0/6] dpaa2: bus, DMA and mempool base fixes Stephen Hemminger
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=20260929142117.3109066-2-prashant.gupta_3@nxp.com \
--to=prashant.gupta_3@nxp.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/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