<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From f3e5f85353153a6941fc9e32871b5037e875d1ae Mon Sep 17 00:00:00 2001
From: Phil Elwell &lt;phil@raspberrypi.com&gt;
Date: Wed, 17 May 2023 13:39:18 +0100
Subject: [PATCH] ARM: dts: bcm2711-rpi: Set a 1GB ZONE_DMA limit

The arm64 initialisation uses the physical address reachable by all
DMA controllers to set the size of ZONE_DMA. This fails on BCM2711
with the current dts files because the declaration of the I/O space
fools it into thinking the legacy 30-bit DMA channels can see most
of the 32-bit space.

Take advantage of the simple nature of the implementation by adding
a node with a restricted dma-ranges property solely so to act as the
limiting factor in the calculation.

See: https://github.com/raspberrypi/linux/issues/5470

Signed-off-by: Phil Elwell &lt;phil@raspberrypi.com&gt;
---
 arch/arm/boot/dts/bcm2711-rpi-ds.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/arch/arm/boot/dts/bcm2711-rpi-ds.dtsi
+++ b/arch/arm/boot/dts/bcm2711-rpi-ds.dtsi
@@ -63,6 +63,16 @@
 		spi6 = &amp;spi6;
 		/delete-property/ intc;
 	};
+
+	/*
+	 * Add a node with a dma-ranges value that exists only to be found
+	 * by of_dma_get_max_cpu_address, and hence limit the DMA zone.
+	 */
+	zone_dma {
+		#address-cells = &lt;1&gt;;
+		#size-cells = &lt;1&gt;;
+		dma-ranges = &lt;0x0  0x0 0x0  0x40000000&gt;;
+	};
 };
 
 &amp;vc4 {
</pre></body></html>