devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: bcm283x: Unify CMA configuration
@ 2020-01-10 17:29 Nicolas Saenz Julienne
  2020-01-10 17:37 ` Phil Elwell
  2020-01-15 23:40 ` Florian Fainelli
  0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Saenz Julienne @ 2020-01-10 17:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Nicolas Saenz Julienne,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Stefan Wahren
  Cc: phil, devicetree, linux-rpi-kernel, linux-arm-kernel, linux-kernel

With the introduction of the Raspberry Pi 4 we were forced to explicitly
configure CMA's location, since arm64 defaults it into the ZONE_DMA32
memory area, which is not good enough to perform DMA operations on that
device. To bypass this limitation a dedicated CMA DT node was created,
explicitly indicating the acceptable memory range and size.

That said, compatibility between boards is a must on the Raspberry Pi
ecosystem so this creates a common CMA DT node so as for DT overlays to
be able to update CMA's properties regardless of the board being used.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---

If this doesn't make it into v5.5 I'd be tempted to add:
Fixes: d98a8dbdaec6 ("ARM: dts: bcm2711: force CMA into first GB of memory")

 arch/arm/boot/dts/bcm2711.dtsi | 33 +++++++++++++--------------------
 arch/arm/boot/dts/bcm283x.dtsi | 13 +++++++++++++
 2 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index 8687534d4528..c8e4041308e0 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -12,26 +12,6 @@ / {
 
 	interrupt-parent = <&gicv2>;
 
-	reserved-memory {
-		#address-cells = <2>;
-		#size-cells = <1>;
-		ranges;
-
-		/*
-		 * arm64 reserves the CMA by default somewhere in ZONE_DMA32,
-		 * that's not good enough for the BCM2711 as some devices can
-		 * only address the lower 1G of memory (ZONE_DMA).
-		 */
-		linux,cma {
-			compatible = "shared-dma-pool";
-			size = <0x2000000>; /* 32MB */
-			alloc-ranges = <0x0 0x00000000 0x40000000>;
-			reusable;
-			linux,cma-default;
-		};
-	};
-
-
 	soc {
 		/*
 		 * Defined ranges:
@@ -869,6 +849,19 @@ pin-rts {
 	};
 };
 
+&rmem {
+	#address-cells = <2>;
+};
+
+&cma {
+	/*
+	 * arm64 reserves the CMA by default somewhere in ZONE_DMA32,
+	 * that's not good enough for the BCM2711 as some devices can
+	 * only address the lower 1G of memory (ZONE_DMA).
+	 */
+	alloc-ranges = <0x0 0x00000000 0x40000000>;
+};
+
 &i2c0 {
 	compatible = "brcm,bcm2711-i2c", "brcm,bcm2835-i2c";
 	interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 839491628e87..6128baed83c2 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -30,6 +30,19 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	rmem: reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		cma: linux,cma {
+			compatible = "shared-dma-pool";
+			size = <0x4000000>; /* 64MB */
+			reusable;
+			linux,cma-default;
+		};
+	};
+
 	thermal-zones {
 		cpu_thermal: cpu-thermal {
 			polling-delay-passive = <0>;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dts: bcm283x: Unify CMA configuration
  2020-01-10 17:29 [PATCH] ARM: dts: bcm283x: Unify CMA configuration Nicolas Saenz Julienne
@ 2020-01-10 17:37 ` Phil Elwell
  2020-01-15 23:40 ` Florian Fainelli
  1 sibling, 0 replies; 3+ messages in thread
From: Phil Elwell @ 2020-01-10 17:37 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Rob Herring, Mark Rutland,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Stefan Wahren
  Cc: devicetree, linux-rpi-kernel, linux-arm-kernel, linux-kernel

Hi Nicolas,

On 10/01/2020 17:29, Nicolas Saenz Julienne wrote:
> With the introduction of the Raspberry Pi 4 we were forced to explicitly
> configure CMA's location, since arm64 defaults it into the ZONE_DMA32
> memory area, which is not good enough to perform DMA operations on that
> device. To bypass this limitation a dedicated CMA DT node was created,
> explicitly indicating the acceptable memory range and size.
> 
> That said, compatibility between boards is a must on the Raspberry Pi
> ecosystem so this creates a common CMA DT node so as for DT overlays to
> be able to update CMA's properties regardless of the board being used.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> ---
> 
> If this doesn't make it into v5.5 I'd be tempted to add:
> Fixes: d98a8dbdaec6 ("ARM: dts: bcm2711: force CMA into first GB of memory")
> 
>   arch/arm/boot/dts/bcm2711.dtsi | 33 +++++++++++++--------------------
>   arch/arm/boot/dts/bcm283x.dtsi | 13 +++++++++++++
>   2 files changed, 26 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
> index 8687534d4528..c8e4041308e0 100644
> --- a/arch/arm/boot/dts/bcm2711.dtsi
> +++ b/arch/arm/boot/dts/bcm2711.dtsi
> @@ -12,26 +12,6 @@ / {
>   
>   	interrupt-parent = <&gicv2>;
>   
> -	reserved-memory {
> -		#address-cells = <2>;
> -		#size-cells = <1>;
> -		ranges;
> -
> -		/*
> -		 * arm64 reserves the CMA by default somewhere in ZONE_DMA32,
> -		 * that's not good enough for the BCM2711 as some devices can
> -		 * only address the lower 1G of memory (ZONE_DMA).
> -		 */
> -		linux,cma {
> -			compatible = "shared-dma-pool";
> -			size = <0x2000000>; /* 32MB */
> -			alloc-ranges = <0x0 0x00000000 0x40000000>;
> -			reusable;
> -			linux,cma-default;
> -		};
> -	};
> -
> -
>   	soc {
>   		/*
>   		 * Defined ranges:
> @@ -869,6 +849,19 @@ pin-rts {
>   	};
>   };
>   
> +&rmem {
> +	#address-cells = <2>;
> +};
> +
> +&cma {
> +	/*
> +	 * arm64 reserves the CMA by default somewhere in ZONE_DMA32,
> +	 * that's not good enough for the BCM2711 as some devices can
> +	 * only address the lower 1G of memory (ZONE_DMA).
> +	 */
> +	alloc-ranges = <0x0 0x00000000 0x40000000>;
> +};
> +
>   &i2c0 {
>   	compatible = "brcm,bcm2711-i2c", "brcm,bcm2835-i2c";
>   	interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
> diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
> index 839491628e87..6128baed83c2 100644
> --- a/arch/arm/boot/dts/bcm283x.dtsi
> +++ b/arch/arm/boot/dts/bcm283x.dtsi
> @@ -30,6 +30,19 @@ chosen {
>   		stdout-path = "serial0:115200n8";
>   	};
>   
> +	rmem: reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		cma: linux,cma {
> +			compatible = "shared-dma-pool";
> +			size = <0x4000000>; /* 64MB */
> +			reusable;
> +			linux,cma-default;
> +		};
> +	};
> +
>   	thermal-zones {
>   		cpu_thermal: cpu-thermal {
>   			polling-delay-passive = <0>;
> 

For what it's worth,

Reviewed-by: Phil Elwell <phil@raspberrypi.org>

Phil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: dts: bcm283x: Unify CMA configuration
  2020-01-10 17:29 [PATCH] ARM: dts: bcm283x: Unify CMA configuration Nicolas Saenz Julienne
  2020-01-10 17:37 ` Phil Elwell
@ 2020-01-15 23:40 ` Florian Fainelli
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2020-01-15 23:40 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Ray Jui, Scott Branden, Stefan Wahren
  Cc: phil, devicetree, linux-rpi-kernel, linux-arm-kernel, linux-kernel

On Fri, 10 Jan 2020 18:29:35 +0100, Nicolas Saenz Julienne <nsaenzjulienne@suse.de> wrote:
> With the introduction of the Raspberry Pi 4 we were forced to explicitly
> configure CMA's location, since arm64 defaults it into the ZONE_DMA32
> memory area, which is not good enough to perform DMA operations on that
> device. To bypass this limitation a dedicated CMA DT node was created,
> explicitly indicating the acceptable memory range and size.
> 
> That said, compatibility between boards is a must on the Raspberry Pi
> ecosystem so this creates a common CMA DT node so as for DT overlays to
> be able to update CMA's properties regardless of the board being used.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> ---

Applied to devicetree/next, thanks!
--
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-15 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 17:29 [PATCH] ARM: dts: bcm283x: Unify CMA configuration Nicolas Saenz Julienne
2020-01-10 17:37 ` Phil Elwell
2020-01-15 23:40 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).