From: Vincent Jardin <[email protected]>

On Layerscape platforms when SMMU is disabled by ATF, the root DPRC probes
with its dma_mask pointer unset which leads to a notification:
  "DMA mask not set"
so the device is left with a zero DMA mask instead of a sane default.

Let's seed the masks for all cases.

It was tested on LX2160A with no SMMU on the MC domain: the warning is gone
and the DPAA2 children probe unchanged.

Signed-off-by: Vincent Jardin <[email protected]>
---
fsl_mc_device_add() already seeds a default dma_mask for non-DPRC
objects, but never for the DPRC devices themselves.

It was tested on LX2160A, SMMU disabled.
---
Changes in v2:
- seed the masks in the common path (Thanks Ioana)
- rewrite the commit log, drop Fixes: and Cc: stable
- Link to v1: 
https://lore.kernel.org/r/20260724-for-upstream-fsl-mc-dprc-dma-mask-v1-1-6f08af883...@free.fr
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 64d75eed0d34..35f480aa317b 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -797,6 +797,10 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
        }
        dev_set_name(&mc_dev->dev, "%s.%d", obj_desc->type, obj_desc->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;
+
        if (strcmp(obj_desc->type, "dprc") == 0) {
                struct fsl_mc_io *mc_io2;
 
@@ -838,9 +842,6 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
                 * parent's ICID.
                 */
                mc_dev->icid = parent_mc_dev->icid;
-               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;
        }
 
        /*

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

Best regards,
-- 
Vincent Jardin <[email protected]>



Reply via email to