[PATCH] bus: fsl-mc: set dma_mask for the root DPRC device

Vincent Jardin via B4 Relay posted 1 patch 22 hours ago
drivers/bus/fsl-mc/fsl-mc-bus.c | 8 ++++++++
1 file changed, 8 insertions(+)
[PATCH] bus: fsl-mc: set dma_mask for the root DPRC device
Posted by Vincent Jardin via B4 Relay 22 hours ago
From: Vincent Jardin <vjardin@free.fr>

On Layerscape platforms, when SMMU is disabled,
fsl_mc_device_add() leads to the DPRC device with a NULL dma_mask.

It has been tested on LX2160A, no SMMU on the MC
domain: the root DPRC can probe cleanly and fsl_mc children
enumerate.

Fixes: a259ed1618d2 ("bus/fsl-mc: support dma configure for devices on fsl-mc bus")
Cc: stable@vger.kernel.org
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
fsl_mc_device_add() already seeds a default dma_mask for non-DPRC
objects, but never for the DPRC devices themselves. When the MC I/O
domain is not behind an SMMU, the root DPRC reaches
fsl_mc_dma_configure() -> of_dma_configure_id() with a NULL dma_mask
and the probe warns "DMA mask not set". This mirrors the existing
non-DPRC seeding into the DPRC branch.

Tested on LX2160A with no SMMU on the MC domain: the root DPRC probes
cleanly and its fsl_mc children enumerate.
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 64d75eed0d34..585345ac0179 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -832,6 +832,14 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
 		error = get_dprc_icid(mc_io2, obj_desc->id, &mc_dev->icid);
 		if (error < 0)
 			goto error_cleanup_dev;
+
+		/*
+		 * Seed dma_mask so platforms without an SMMU don't complain
+		 * with "DMA mask not set" in of_dma_configure_id().
+		 */
+		mc_dev->dma_mask = FSL_MC_DEFAULT_DMA_MASK;
+		mc_dev->dev.dma_mask = &mc_dev->dma_mask;
+		mc_dev->dev.coherent_dma_mask = mc_dev->dma_mask;
 	} else {
 		/*
 		 * A non-DPRC object has to be a child of a DPRC, use the

---
base-commit: 248951ddc14de84de3910f9b13f51491a8cd91df
change-id: 20260724-for-upstream-fsl-mc-dprc-dma-mask-a11e4c5a85c6

Best regards,
-- 
Vincent Jardin <vjardin@free.fr>