Skip to contentSkip to conversation

board: rpi: Pass CMA through from firmware DT

PATCH In review Peter Robinson 3 participants 4 messages Oct 11, 2024 – Oct 14, 2024 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 board: rpi: Pass CMA through from firmware DT

For a lot of usecases, such as display, camera, media the Raspberry Pi needs a lot more CMA than distros configure as default so we should pass this parameter through so things work as expected. Fix a spelling mistake while we're at it.

---

v2: Update the cma string

 board/raspberrypi/rpi/rpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.c +4 -1
index ab5ea85cf9f..dd5a318d239 100644
@@ -540,12 +540,15 @@ void  update_fdt_from_fw(void *fdt, void *fw_fdt)
 	if (fdt == fw_fdt)
 		return;
 
-	/* The firmware provides a more precie model; so copy that */
+	/* The firmware provides a more precise model; so copy that */
 	copy_property(fdt, fw_fdt, "/", "model");
 
 	/* memory reserve as suggested by the firmware */
 	copy_property(fdt, fw_fdt, "/", "memreserve");
 
+	/* copy the CMA memory setting from the firmware DT to linux */
+	copy_property(fdt, fw_fdt, "/reserved-memory/linux,cma", "size");
+
 	/* Adjust dma-ranges for the SD card and PCI bus as they can depend on
 	 * the SoC revision
 	 */
Signature · 1 line
2.47.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Peter Robinson

For a lot of usecases, such as display, camera, media the Raspberry Pi needs a lot more CMA than distros configure as default so we should pass this parameter through so things work as expected. Fix a spelling mistake while we're at it.

Quoted 8 lines

---

v2: Update the cma string

 board/raspberrypi/rpi/rpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 7 lines
board/raspberrypi/rpi/rpi.c +0 -0
index ab5ea85cf9f..dd5a318d239 100644
@@ -540,12 +540,15 @@ void  update_fdt_from_fw(void *fdt, void *fw_fdt)
        if (fdt == fw_fdt)
                return;

board/raspberrypi/rpi/rpi.c void update_fdt_from_fw(void *fdt, void *fw_fdt) · line 550

Quoted 10 lines
board/raspberrypi/rpi/rpi.c +3 -1
 
-       /* The firmware provides a more precie model; so copy that */
+       /* The firmware provides a more precise model; so copy that */
        copy_property(fdt, fw_fdt, "/", "model");
 
        /* memory reserve as suggested by the firmware */
        copy_property(fdt, fw_fdt, "/", "memreserve");
 
+       /* copy the CMA memory setting from the firmware DT to linux */
+       copy_property(fdt, fw_fdt, "/reserved-memory/linux,cma", "size");

Does this need / have nodes pointing to it from elsewhere in the tree?

Quoted 7 lines
board/raspberrypi/rpi/rpi.c +1 -1
+
        /* Adjust dma-ranges for the SD card and PCI bus as they can depend on
         * the SoC revision
         */
--

2.47.0

Regards,
Simon

#2 lore raw
Quoted 32 lines · Simon Glass
Quoted 7 lines · Peter Robinson

For a lot of usecases, such as display, camera, media the Raspberry Pi needs a lot more CMA than distros configure as default so we should pass this parameter through so things work as expected. Fix a spelling mistake while we're at it.

Quoted 8 lines

---

v2: Update the cma string

 board/raspberrypi/rpi/rpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 12 lines
board/raspberrypi/rpi/rpi.c +1 -1
index ab5ea85cf9f..dd5a318d239 100644
@@ -540,12 +540,15 @@ void  update_fdt_from_fw(void *fdt, void *fw_fdt)
        if (fdt == fw_fdt)
                return;
 
-       /* The firmware provides a more precie model; so copy that */
+       /* The firmware provides a more precise model; so copy that */
        copy_property(fdt, fw_fdt, "/", "model");
 
Quoted 7 lines

board/raspberrypi/rpi/rpi.c void update_fdt_from_fw(void *fdt, void *fw_fdt) · line 550

Quoted 5 lines
board/raspberrypi/rpi/rpi.c +2 -0
        /* memory reserve as suggested by the firmware */
        copy_property(fdt, fw_fdt, "/", "memreserve");
 
+       /* copy the CMA memory setting from the firmware DT to linux */
+       copy_property(fdt, fw_fdt, "/reserved-memory/linux,cma", "size");

Does this need / have nodes pointing to it from elsewhere in the tree?

Yes! It doesn't work without the /, I am planning on looking at this some more but this fixes the issue at hand. Using the fdt cmd from the command prompt needs it as well.

Quoted 10 lines
Quoted 7 lines
board/raspberrypi/rpi/rpi.c +1 -1
+
        /* Adjust dma-ranges for the SD card and PCI bus as they can depend on
         * the SoC revision
         */
--

2.47.0

Regards,
Simon

Acked-by on v2 1/1
#3 lore raw
In reply to Peter Robinson
Quoted 7 lines · Peter Robinson

For a lot of usecases, such as display, camera, media the Raspberry Pi needs a lot more CMA than distros configure as default so we should pass this parameter through so things work as expected. Fix a spelling mistake while we're at it.

Quoted 28 lines

---

v2: Update the cma string

  board/raspberrypi/rpi/rpi.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.c +4 -1
index ab5ea85cf9f..dd5a318d239 100644
@@ -540,12 +540,15 @@ void  update_fdt_from_fw(void *fdt, void *fw_fdt)
  	if (fdt == fw_fdt)
  		return;
 
-	/* The firmware provides a more precie model; so copy that */
+	/* The firmware provides a more precise model; so copy that */
  	copy_property(fdt, fw_fdt, "/", "model");
 
  	/* memory reserve as suggested by the firmware */
  	copy_property(fdt, fw_fdt, "/", "memreserve");
 
+	/* copy the CMA memory setting from the firmware DT to linux */
+	copy_property(fdt, fw_fdt, "/reserved-memory/linux,cma", "size");
+
  	/* Adjust dma-ranges for the SD card and PCI bus as they can depend on
  	 * the SoC revision
  	 */