2019-11-07 09:57:51

by Nicolas Saenz Julienne

[permalink] [raw]
Subject: [PATCH v3 0/2] arm64: Fix CMA/crashkernel reservation

As pointed out by Qian Cai[1] the series enabling ZONE_DMA in arm64
breaks CMA/crashkernel reservations on large devices, as it changed its
default placement. After discussing it with Catalin Marinas we're
restoring the old behavior.

The Raspberry Pi 4, being the only device that needs CMA and crashkernel
in ZONE_DMA will explicitly do so trough it's device tree.

[1] https://lkml.org/lkml/2019/10/21/725

---

Changes since v1:
- Move CMA area registration into bcm2711.dtsi

Changes since v1:
- s/Raspberry Pi/bcm2711 in bcm2711.dtsi

Nicolas Saenz Julienne (2):
ARM: dts: bcm2711: force CMA into first GB of memory
arm64: mm: reserve CMA and crashkernel in ZONE_DMA32

arch/arm/boot/dts/bcm2711.dtsi | 20 ++++++++++++++++++++
arch/arm64/mm/init.c | 4 ++--
2 files changed, 22 insertions(+), 2 deletions(-)

--
2.23.0


2019-11-07 09:59:59

by Nicolas Saenz Julienne

[permalink] [raw]
Subject: [PATCH v3 1/2] ARM: dts: bcm2711: force CMA into first GB of memory

arm64 places the CMA in ZONE_DMA32, which is not good enough for the
Raspberry Pi 4 since it contains peripherals that can only address the
first GB of memory. Explicitly place the CMA into that area.

Signed-off-by: Nicolas Saenz Julienne <[email protected]>

---

Changes since v1:
- Move into bcm2711.dtsi

Changes since v1:
- s/Raspberry Pi/bcm2711

arch/arm/boot/dts/bcm2711.dtsi | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index ac83dac2e6ba..667658497898 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -12,6 +12,26 @@

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 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:
--
2.23.0

2019-11-07 11:23:58

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] ARM: dts: bcm2711: force CMA into first GB of memory

Hi Nicolas,

On Thu, Nov 07, 2019 at 10:56:10AM +0100, Nicolas Saenz Julienne wrote:
> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
> index ac83dac2e6ba..667658497898 100644
> --- a/arch/arm/boot/dts/bcm2711.dtsi
> +++ b/arch/arm/boot/dts/bcm2711.dtsi
> @@ -12,6 +12,26 @@
>
> 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 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:

Sorry, I just realised I can't merge this as it depends on a patch
that's only in -next: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi
4 support").

I'll queue the second patch in the series to fix the regression
introduces by the ZONE_DMA patches and, AFAICT, the dts update can be
queued independently.

--
Catalin

2019-11-07 18:00:26

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] ARM: dts: bcm2711: force CMA into first GB of memory

On 11/7/19 3:20 AM, Catalin Marinas wrote:
> Hi Nicolas,
>
> On Thu, Nov 07, 2019 at 10:56:10AM +0100, Nicolas Saenz Julienne wrote:
>> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
>> index ac83dac2e6ba..667658497898 100644
>> --- a/arch/arm/boot/dts/bcm2711.dtsi
>> +++ b/arch/arm/boot/dts/bcm2711.dtsi
>> @@ -12,6 +12,26 @@
>>
>> 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 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:
>
> Sorry, I just realised I can't merge this as it depends on a patch
> that's only in -next: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi
> 4 support").
>
> I'll queue the second patch in the series to fix the regression
> introduces by the ZONE_DMA patches and, AFAICT, the dts update can be
> queued independently.

I will take it directly, unless you have more stuff coming Stefan?
--
Florian

2019-11-07 19:11:47

by Stefan Wahren

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] ARM: dts: bcm2711: force CMA into first GB of memory


Am 07.11.19 um 18:59 schrieb Florian Fainelli:
> On 11/7/19 3:20 AM, Catalin Marinas wrote:
>> Hi Nicolas,
...
>> Sorry, I just realised I can't merge this as it depends on a patch
>> that's only in -next: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi
>> 4 support").
>>
>> I'll queue the second patch in the series to fix the regression
>> introduces by the ZONE_DMA patches and, AFAICT, the dts update can be
>> queued independently.
> I will take it directly, unless you have more stuff coming Stefan?
Please take. Thanks

Stefan

2019-11-14 20:39:57

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] ARM: dts: bcm2711: force CMA into first GB of memory

On 11/7/19 11:09 AM, Stefan Wahren wrote:
>
> Am 07.11.19 um 18:59 schrieb Florian Fainelli:
>> On 11/7/19 3:20 AM, Catalin Marinas wrote:
>>> Hi Nicolas,
> ...
>>> Sorry, I just realised I can't merge this as it depends on a patch
>>> that's only in -next: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi
>>> 4 support").
>>>
>>> I'll queue the second patch in the series to fix the regression
>>> introduces by the ZONE_DMA patches and, AFAICT, the dts update can be
>>> queued independently.
>> I will take it directly, unless you have more stuff coming Stefan?
> Please take. Thanks

I picked up v2 because it had your explicit Acked-by tag, but amended in
a similar way to what Nicolas did, except s/Raspberry Pi 4/BCM2711/:

https://github.com/Broadcom/stblinux/commit/d98a8dbdaec628f5c993cc711ba9ab98fe909f0f

neither of you will probably mind me having done that.
--
Florian

2019-11-15 09:04:18

by Nicolas Saenz Julienne

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] ARM: dts: bcm2711: force CMA into first GB of memory

On Thu, 2019-11-14 at 12:35 -0800, Florian Fainelli wrote:
> On 11/7/19 11:09 AM, Stefan Wahren wrote:
> > Am 07.11.19 um 18:59 schrieb Florian Fainelli:
> > > On 11/7/19 3:20 AM, Catalin Marinas wrote:
> > > > Hi Nicolas,
> > ...
> > > > Sorry, I just realised I can't merge this as it depends on a patch
> > > > that's only in -next: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi
> > > > 4 support").
> > > >
> > > > I'll queue the second patch in the series to fix the regression
> > > > introduces by the ZONE_DMA patches and, AFAICT, the dts update can be
> > > > queued independently.
> > > I will take it directly, unless you have more stuff coming Stefan?
> > Please take. Thanks
>
> I picked up v2 because it had your explicit Acked-by tag, but amended in
> a similar way to what Nicolas did, except s/Raspberry Pi 4/BCM2711/:
>
>
https://github.com/Broadcom/stblinux/commit/d98a8dbdaec628f5c993cc711ba9ab98fe909f0f
>
> neither of you will probably mind me having done that.

All good, thanks!


Attachments:
signature.asc (499.00 B)
This is a digitally signed message part