All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-07-24 21:34 Andrey Skvortsov
  2023-07-27 14:57   ` Andre Przywara
  2023-08-21 16:08   ` Pavel Machek
  0 siblings, 2 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-07-24 21:34 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris
  Cc: Andrey Skvortsov

This patch reserves some memory in the DTS and sets up a
pstore device tree node to enable pstore support.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>

Gbp-Pq: Topic pinephone
Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
---
 .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 87847116ab6d..84f9410b0b70 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -19,6 +19,22 @@ aliases {
 		serial0 = &uart0;
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		pstore_mem: ramoops@61000000 {
+			compatible = "ramoops";
+			reg = <0x61000000 0x100000>;
+			record-size = <0x20000>;
+			console-size = <0x20000>;
+			ftrace-size = <0x20000>;
+			pmsg-size = <0x20000>;
+			ecc-size = <16>;
+		};
+	};
+
 	backlight: backlight {
 		compatible = "pwm-backlight";
 		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
-- 
2.39.2


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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-07-24 21:34 [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64 Andrey Skvortsov
@ 2023-07-27 14:57   ` Andre Przywara
  2023-08-21 16:08   ` Pavel Machek
  1 sibling, 0 replies; 17+ messages in thread
From: Andre Przywara @ 2023-07-27 14:57 UTC (permalink / raw)
  To: Andrey Skvortsov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Kees Cook,
	Tony Luck, Guilherme G. Piccoli, devicetree, linux-arm-kernel,
	linux-sunxi, linux-kernel, linux-hardening, Jarrah Gosbell,
	Arnaud Ferraris

Hi,

On 24/07/2023 22:34, Andrey Skvortsov wrote:
> This patch reserves some memory in the DTS and sets up a
> pstore device tree node to enable pstore support.
> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> 
> Gbp-Pq: Topic pinephone
> Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> ---
>   .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> index 87847116ab6d..84f9410b0b70 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -19,6 +19,22 @@ aliases {
>   		serial0 = &uart0;
>   	};
>   
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		pstore_mem: ramoops@61000000 {
> +			compatible = "ramoops";
> +			reg = <0x61000000 0x100000>;

So what's the significance of this address? That's 528MB into DRAM, so 
somewhat in the middle of it, fragmenting the physical address space.
And is there any other firmware component that needs to know about this 
address?

Cheers,
Andre


> +			record-size = <0x20000>;
> +			console-size = <0x20000>;
> +			ftrace-size = <0x20000>;
> +			pmsg-size = <0x20000>;
> +			ecc-size = <16>;
> +		};
> +	};
> +
>   	backlight: backlight {
>   		compatible = "pwm-backlight";
>   		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;

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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-07-27 14:57   ` Andre Przywara
  0 siblings, 0 replies; 17+ messages in thread
From: Andre Przywara @ 2023-07-27 14:57 UTC (permalink / raw)
  To: Andrey Skvortsov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Kees Cook,
	Tony Luck, Guilherme G. Piccoli, devicetree, linux-arm-kernel,
	linux-sunxi, linux-kernel, linux-hardening, Jarrah Gosbell,
	Arnaud Ferraris

Hi,

On 24/07/2023 22:34, Andrey Skvortsov wrote:
> This patch reserves some memory in the DTS and sets up a
> pstore device tree node to enable pstore support.
> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> 
> Gbp-Pq: Topic pinephone
> Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> ---
>   .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> index 87847116ab6d..84f9410b0b70 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -19,6 +19,22 @@ aliases {
>   		serial0 = &uart0;
>   	};
>   
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		pstore_mem: ramoops@61000000 {
> +			compatible = "ramoops";
> +			reg = <0x61000000 0x100000>;

So what's the significance of this address? That's 528MB into DRAM, so 
somewhat in the middle of it, fragmenting the physical address space.
And is there any other firmware component that needs to know about this 
address?

Cheers,
Andre


> +			record-size = <0x20000>;
> +			console-size = <0x20000>;
> +			ftrace-size = <0x20000>;
> +			pmsg-size = <0x20000>;
> +			ecc-size = <16>;
> +		};
> +	};
> +
>   	backlight: backlight {
>   		compatible = "pwm-backlight";
>   		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-07-27 14:57   ` Andre Przywara
@ 2023-07-28 20:25     ` Andrey Skvortsov
  -1 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-07-28 20:25 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris

On 23-07-27 15:57, Andre Przywara wrote:
> Hi,
> 
> On 24/07/2023 22:34, Andrey Skvortsov wrote:
> > This patch reserves some memory in the DTS and sets up a
> > pstore device tree node to enable pstore support.
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > 
> > Gbp-Pq: Topic pinephone
> > Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> > ---
> >   .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
> >   1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > index 87847116ab6d..84f9410b0b70 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > @@ -19,6 +19,22 @@ aliases {
> >   		serial0 = &uart0;
> >   	};
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		pstore_mem: ramoops@61000000 {
> > +			compatible = "ramoops";
> > +			reg = <0x61000000 0x100000>;
> 
> So what's the significance of this address? That's 528MB into DRAM, so
> somewhat in the middle of it, fragmenting the physical address space.
> And is there any other firmware component that needs to know about this
> address?

Hi, Andre,

there is nothing special about this address.
Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
later in the boot process.
Ramdisk start address is 0x4FF00000, Mobian initramfs for PinePhone
for kernel with some hacking features and debug info enabled can
take more than 100Mb and final address will be around 0x58000000.
So I've picked address that will most likely not overlap with
that. Probably it can be moved below 512Mb. If you have address
suggestion, I'd happy to check it.

-- 
Best regards,
Andrey Skvortsov

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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-07-28 20:25     ` Andrey Skvortsov
  0 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-07-28 20:25 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris

On 23-07-27 15:57, Andre Przywara wrote:
> Hi,
> 
> On 24/07/2023 22:34, Andrey Skvortsov wrote:
> > This patch reserves some memory in the DTS and sets up a
> > pstore device tree node to enable pstore support.
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > 
> > Gbp-Pq: Topic pinephone
> > Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> > ---
> >   .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
> >   1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > index 87847116ab6d..84f9410b0b70 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > @@ -19,6 +19,22 @@ aliases {
> >   		serial0 = &uart0;
> >   	};
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		pstore_mem: ramoops@61000000 {
> > +			compatible = "ramoops";
> > +			reg = <0x61000000 0x100000>;
> 
> So what's the significance of this address? That's 528MB into DRAM, so
> somewhat in the middle of it, fragmenting the physical address space.
> And is there any other firmware component that needs to know about this
> address?

Hi, Andre,

there is nothing special about this address.
Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
later in the boot process.
Ramdisk start address is 0x4FF00000, Mobian initramfs for PinePhone
for kernel with some hacking features and debug info enabled can
take more than 100Mb and final address will be around 0x58000000.
So I've picked address that will most likely not overlap with
that. Probably it can be moved below 512Mb. If you have address
suggestion, I'd happy to check it.

-- 
Best regards,
Andrey Skvortsov

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-07-24 21:34 [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64 Andrey Skvortsov
@ 2023-08-21 16:08   ` Pavel Machek
  2023-08-21 16:08   ` Pavel Machek
  1 sibling, 0 replies; 17+ messages in thread
From: Pavel Machek @ 2023-08-21 16:08 UTC (permalink / raw)
  To: Andrey Skvortsov
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris

Hi!

> This patch reserves some memory in the DTS and sets up a
> pstore device tree node to enable pstore support.
> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> 
> Gbp-Pq: Topic pinephone
> Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> ---
>  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> index 87847116ab6d..84f9410b0b70 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -19,6 +19,22 @@ aliases {
>  		serial0 = &uart0;
>  	};
>  
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		pstore_mem: ramoops@61000000 {
> +			compatible = "ramoops";
> +			reg = <0x61000000 0x100000>;
> +			record-size = <0x20000>;
> +			console-size = <0x20000>;
> +			ftrace-size = <0x20000>;
> +			pmsg-size = <0x20000>;
> +			ecc-size = <16>;
> +		};
> +	};

dts is supposed to be for hardware description, but this is really policy decision.

Should we have something like "any dram is suitable for pstore"....?

Best regards,
										Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-08-21 16:08   ` Pavel Machek
  0 siblings, 0 replies; 17+ messages in thread
From: Pavel Machek @ 2023-08-21 16:08 UTC (permalink / raw)
  To: Andrey Skvortsov
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris

Hi!

> This patch reserves some memory in the DTS and sets up a
> pstore device tree node to enable pstore support.
> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> 
> Gbp-Pq: Topic pinephone
> Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> ---
>  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> index 87847116ab6d..84f9410b0b70 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -19,6 +19,22 @@ aliases {
>  		serial0 = &uart0;
>  	};
>  
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		pstore_mem: ramoops@61000000 {
> +			compatible = "ramoops";
> +			reg = <0x61000000 0x100000>;
> +			record-size = <0x20000>;
> +			console-size = <0x20000>;
> +			ftrace-size = <0x20000>;
> +			pmsg-size = <0x20000>;
> +			ecc-size = <16>;
> +		};
> +	};

dts is supposed to be for hardware description, but this is really policy decision.

Should we have something like "any dram is suitable for pstore"....?

Best regards,
										Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-08-21 16:08   ` Pavel Machek
@ 2023-08-22  9:23     ` Andrey Skvortsov
  -1 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-08-22  9:23 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris,
	Pavel Machek
  Cc: Andrey Skvortsov

This patch reserves some memory in the DTS and sets up a
pstore device tree node to enable pstore support.

In general any DRAM address, that isn't overwritten during a boot is
suitable for pstore.

Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
later in the boot process. Ramdisk start address is 0x4FF00000,
initramfs for kernel with some hacking features and debug info enabled
can take more than 100Mb and final address will be around 0x58000000.
Address 0x61000000 will most likely not overlap with that.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
---

Changes in v2:
 - Update commit description with information about why this base address is used.

 .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 87847116ab6d..84f9410b0b70 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -19,6 +19,22 @@ aliases {
 		serial0 = &uart0;
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		pstore_mem: ramoops@61000000 {
+			compatible = "ramoops";
+			reg = <0x61000000 0x100000>;
+			record-size = <0x20000>;
+			console-size = <0x20000>;
+			ftrace-size = <0x20000>;
+			pmsg-size = <0x20000>;
+			ecc-size = <16>;
+		};
+	};
+
 	backlight: backlight {
 		compatible = "pwm-backlight";
 		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
-- 
2.40.1


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

* [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-08-22  9:23     ` Andrey Skvortsov
  0 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-08-22  9:23 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris,
	Pavel Machek
  Cc: Andrey Skvortsov

This patch reserves some memory in the DTS and sets up a
pstore device tree node to enable pstore support.

In general any DRAM address, that isn't overwritten during a boot is
suitable for pstore.

Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
later in the boot process. Ramdisk start address is 0x4FF00000,
initramfs for kernel with some hacking features and debug info enabled
can take more than 100Mb and final address will be around 0x58000000.
Address 0x61000000 will most likely not overlap with that.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
---

Changes in v2:
 - Update commit description with information about why this base address is used.

 .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 87847116ab6d..84f9410b0b70 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -19,6 +19,22 @@ aliases {
 		serial0 = &uart0;
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		pstore_mem: ramoops@61000000 {
+			compatible = "ramoops";
+			reg = <0x61000000 0x100000>;
+			record-size = <0x20000>;
+			console-size = <0x20000>;
+			ftrace-size = <0x20000>;
+			pmsg-size = <0x20000>;
+			ecc-size = <16>;
+		};
+	};
+
 	backlight: backlight {
 		compatible = "pwm-backlight";
 		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-08-21 16:08   ` Pavel Machek
@ 2023-08-22  9:26     ` Andrey Skvortsov
  -1 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-08-22  9:26 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris

Hi Pavel,

On 23-08-21 18:08, Pavel Machek wrote:
> Hi!
> 
> > This patch reserves some memory in the DTS and sets up a
> > pstore device tree node to enable pstore support.
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > 
> > Gbp-Pq: Topic pinephone
> > Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> > ---
> >  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > index 87847116ab6d..84f9410b0b70 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > @@ -19,6 +19,22 @@ aliases {
> >  		serial0 = &uart0;
> >  	};
> >  
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		pstore_mem: ramoops@61000000 {
> > +			compatible = "ramoops";
> > +			reg = <0x61000000 0x100000>;
> > +			record-size = <0x20000>;
> > +			console-size = <0x20000>;
> > +			ftrace-size = <0x20000>;
> > +			pmsg-size = <0x20000>;
> > +			ecc-size = <16>;
> > +		};
> > +	};
> 
> dts is supposed to be for hardware description, but this is really policy decision.
> 
> Should we have something like "any dram is suitable for pstore"....?
Thanks for the review. I'll add into commit message more details why
this address was picked.

-- 
Best regards,
Andrey Skvortsov

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

* Re: [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-08-22  9:26     ` Andrey Skvortsov
  0 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-08-22  9:26 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris

Hi Pavel,

On 23-08-21 18:08, Pavel Machek wrote:
> Hi!
> 
> > This patch reserves some memory in the DTS and sets up a
> > pstore device tree node to enable pstore support.
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > 
> > Gbp-Pq: Topic pinephone
> > Gbp-Pq: Name 0161-arm64-dts-pinephone-Add-pstore-support-for-PinePhone.patch
> > ---
> >  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > index 87847116ab6d..84f9410b0b70 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > @@ -19,6 +19,22 @@ aliases {
> >  		serial0 = &uart0;
> >  	};
> >  
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		pstore_mem: ramoops@61000000 {
> > +			compatible = "ramoops";
> > +			reg = <0x61000000 0x100000>;
> > +			record-size = <0x20000>;
> > +			console-size = <0x20000>;
> > +			ftrace-size = <0x20000>;
> > +			pmsg-size = <0x20000>;
> > +			ecc-size = <16>;
> > +		};
> > +	};
> 
> dts is supposed to be for hardware description, but this is really policy decision.
> 
> Should we have something like "any dram is suitable for pstore"....?
Thanks for the review. I'll add into commit message more details why
this address was picked.

-- 
Best regards,
Andrey Skvortsov

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-08-22  9:23     ` Andrey Skvortsov
@ 2023-08-23 19:36       ` Jernej Škrabec
  -1 siblings, 0 replies; 17+ messages in thread
From: Jernej Škrabec @ 2023-08-23 19:36 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland, Kees Cook, Tony Luck, Guilherme G. Piccoli,
	devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
	linux-hardening, Jarrah Gosbell, Arnaud Ferraris, Pavel Machek,
	Andrey Skvortsov
  Cc: Andrey Skvortsov

Hi Andrey,

send new revision as standalone e-mail, not as reply to old discussion.

Dne torek, 22. avgust 2023 ob 11:23:58 CEST je Andrey Skvortsov napisal(a):
> This patch reserves some memory in the DTS and sets up a
> pstore device tree node to enable pstore support.
> 
> In general any DRAM address, that isn't overwritten during a boot is
> suitable for pstore.
> 
> Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
> internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
> later in the boot process. Ramdisk start address is 0x4FF00000,
> initramfs for kernel with some hacking features and debug info enabled
> can take more than 100Mb and final address will be around 0x58000000.
> Address 0x61000000 will most likely not overlap with that.

There are other bootloaders as U-Boot, especially on PinePhone. Are you sure 
it works there too? What about U-Boot configuration, will those addresses still 
be used if configuration is changed?

Best regards,
Jernej

> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> ---
> 
> Changes in v2:
>  - Update commit description with information about why this base address is
> used.
> 
>  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi index
> 87847116ab6d..84f9410b0b70 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -19,6 +19,22 @@ aliases {
>  		serial0 = &uart0;
>  	};
> 
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		pstore_mem: ramoops@61000000 {
> +			compatible = "ramoops";
> +			reg = <0x61000000 0x100000>;
> +			record-size = <0x20000>;
> +			console-size = <0x20000>;
> +			ftrace-size = <0x20000>;
> +			pmsg-size = <0x20000>;
> +			ecc-size = <16>;
> +		};
> +	};
> +
>  	backlight: backlight {
>  		compatible = "pwm-backlight";
>  		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;





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

* Re: [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-08-23 19:36       ` Jernej Škrabec
  0 siblings, 0 replies; 17+ messages in thread
From: Jernej Škrabec @ 2023-08-23 19:36 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland, Kees Cook, Tony Luck, Guilherme G. Piccoli,
	devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
	linux-hardening, Jarrah Gosbell, Arnaud Ferraris, Pavel Machek,
	Andrey Skvortsov
  Cc: Andrey Skvortsov

Hi Andrey,

send new revision as standalone e-mail, not as reply to old discussion.

Dne torek, 22. avgust 2023 ob 11:23:58 CEST je Andrey Skvortsov napisal(a):
> This patch reserves some memory in the DTS and sets up a
> pstore device tree node to enable pstore support.
> 
> In general any DRAM address, that isn't overwritten during a boot is
> suitable for pstore.
> 
> Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
> internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
> later in the boot process. Ramdisk start address is 0x4FF00000,
> initramfs for kernel with some hacking features and debug info enabled
> can take more than 100Mb and final address will be around 0x58000000.
> Address 0x61000000 will most likely not overlap with that.

There are other bootloaders as U-Boot, especially on PinePhone. Are you sure 
it works there too? What about U-Boot configuration, will those addresses still 
be used if configuration is changed?

Best regards,
Jernej

> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> ---
> 
> Changes in v2:
>  - Update commit description with information about why this base address is
> used.
> 
>  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi index
> 87847116ab6d..84f9410b0b70 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -19,6 +19,22 @@ aliases {
>  		serial0 = &uart0;
>  	};
> 
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		pstore_mem: ramoops@61000000 {
> +			compatible = "ramoops";
> +			reg = <0x61000000 0x100000>;
> +			record-size = <0x20000>;
> +			console-size = <0x20000>;
> +			ftrace-size = <0x20000>;
> +			pmsg-size = <0x20000>;
> +			ecc-size = <16>;
> +		};
> +	};
> +
>  	backlight: backlight {
>  		compatible = "pwm-backlight";
>  		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-08-23 19:36       ` Jernej Škrabec
@ 2023-08-24 13:50         ` Andre Przywara
  -1 siblings, 0 replies; 17+ messages in thread
From: Andre Przywara @ 2023-08-24 13:50 UTC (permalink / raw)
  To: Andrey Skvortsov
  Cc: Jernej Škrabec, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chen-Yu Tsai, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris,
	Pavel Machek

On Wed, 23 Aug 2023 21:36:51 +0200
Jernej Škrabec <jernej.skrabec@gmail.com> wrote:


Hi Andrey,

> send new revision as standalone e-mail, not as reply to old discussion.
> 
> Dne torek, 22. avgust 2023 ob 11:23:58 CEST je Andrey Skvortsov napisal(a):
> > This patch reserves some memory in the DTS and sets up a
> > pstore device tree node to enable pstore support.
> > 
> > In general any DRAM address, that isn't overwritten during a boot is
> > suitable for pstore.
> > 
> > Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
> > internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
> > later in the boot process. Ramdisk start address is 0x4FF00000,
> > initramfs for kernel with some hacking features and debug info enabled
> > can take more than 100Mb and final address will be around 0x58000000.
> > Address 0x61000000 will most likely not overlap with that.  
> 
> There are other bootloaders as U-Boot, especially on PinePhone. Are you sure 
> it works there too? What about U-Boot configuration, will those addresses still 
> be used if configuration is changed?

Also going along with what Pavel said (that's it more a policy
decision, not a device property), I feel like this node should be added
by the bootloader then. And indeed U-Boot has support for that already.
From skimming over the code in cmd/pstore.c: if you enable
CONFIG_CMD_PSTORE and set CONFIG_CMD_PSTORE_MEM_ADDR to your chosen
address, then the U-Boot code will insert a reserved memory node on the
fly. Would that solve your problem?

Cheers,
Andre

> Best regards,
> Jernej
> 
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > ---
> > 
> > Changes in v2:
> >  - Update commit description with information about why this base address is
> > used.
> > 
> >  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi index
> > 87847116ab6d..84f9410b0b70 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > @@ -19,6 +19,22 @@ aliases {
> >  		serial0 = &uart0;
> >  	};
> > 
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		pstore_mem: ramoops@61000000 {
> > +			compatible = "ramoops";
> > +			reg = <0x61000000 0x100000>;
> > +			record-size = <0x20000>;
> > +			console-size = <0x20000>;
> > +			ftrace-size = <0x20000>;
> > +			pmsg-size = <0x20000>;
> > +			ecc-size = <16>;
> > +		};
> > +	};
> > +
> >  	backlight: backlight {
> >  		compatible = "pwm-backlight";
> >  		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;  
> 
> 
> 
> 
> 


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

* Re: [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-08-24 13:50         ` Andre Przywara
  0 siblings, 0 replies; 17+ messages in thread
From: Andre Przywara @ 2023-08-24 13:50 UTC (permalink / raw)
  To: Andrey Skvortsov
  Cc: Jernej Škrabec, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chen-Yu Tsai, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris,
	Pavel Machek

On Wed, 23 Aug 2023 21:36:51 +0200
Jernej Škrabec <jernej.skrabec@gmail.com> wrote:


Hi Andrey,

> send new revision as standalone e-mail, not as reply to old discussion.
> 
> Dne torek, 22. avgust 2023 ob 11:23:58 CEST je Andrey Skvortsov napisal(a):
> > This patch reserves some memory in the DTS and sets up a
> > pstore device tree node to enable pstore support.
> > 
> > In general any DRAM address, that isn't overwritten during a boot is
> > suitable for pstore.
> > 
> > Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
> > internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
> > later in the boot process. Ramdisk start address is 0x4FF00000,
> > initramfs for kernel with some hacking features and debug info enabled
> > can take more than 100Mb and final address will be around 0x58000000.
> > Address 0x61000000 will most likely not overlap with that.  
> 
> There are other bootloaders as U-Boot, especially on PinePhone. Are you sure 
> it works there too? What about U-Boot configuration, will those addresses still 
> be used if configuration is changed?

Also going along with what Pavel said (that's it more a policy
decision, not a device property), I feel like this node should be added
by the bootloader then. And indeed U-Boot has support for that already.
From skimming over the code in cmd/pstore.c: if you enable
CONFIG_CMD_PSTORE and set CONFIG_CMD_PSTORE_MEM_ADDR to your chosen
address, then the U-Boot code will insert a reserved memory node on the
fly. Would that solve your problem?

Cheers,
Andre

> Best regards,
> Jernej
> 
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > ---
> > 
> > Changes in v2:
> >  - Update commit description with information about why this base address is
> > used.
> > 
> >  .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi index
> > 87847116ab6d..84f9410b0b70 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > @@ -19,6 +19,22 @@ aliases {
> >  		serial0 = &uart0;
> >  	};
> > 
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		pstore_mem: ramoops@61000000 {
> > +			compatible = "ramoops";
> > +			reg = <0x61000000 0x100000>;
> > +			record-size = <0x20000>;
> > +			console-size = <0x20000>;
> > +			ftrace-size = <0x20000>;
> > +			pmsg-size = <0x20000>;
> > +			ecc-size = <16>;
> > +		};
> > +	};
> > +
> >  	backlight: backlight {
> >  		compatible = "pwm-backlight";
> >  		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;  
> 
> 
> 
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
  2023-08-24 13:50         ` Andre Przywara
@ 2023-08-25 10:36           ` Andrey Skvortsov
  -1 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-08-25 10:36 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Jernej Škrabec, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chen-Yu Tsai, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris,
	Pavel Machek

Hi Andre,

On 23-08-24 14:50, Andre Przywara wrote:
> On Wed, 23 Aug 2023 21:36:51 +0200
> Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
> 
> 
> Hi Andrey,
> 
> > send new revision as standalone e-mail, not as reply to old discussion.
> > 
> > Dne torek, 22. avgust 2023 ob 11:23:58 CEST je Andrey Skvortsov napisal(a):
> > > This patch reserves some memory in the DTS and sets up a
> > > pstore device tree node to enable pstore support.
> > > 
> > > In general any DRAM address, that isn't overwritten during a boot is
> > > suitable for pstore.
> > > 
> > > Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
> > > internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
> > > later in the boot process. Ramdisk start address is 0x4FF00000,
> > > initramfs for kernel with some hacking features and debug info enabled
> > > can take more than 100Mb and final address will be around 0x58000000.
> > > Address 0x61000000 will most likely not overlap with that.  
> > 
> > There are other bootloaders as U-Boot, especially on PinePhone. Are you sure 
> > it works there too? What about U-Boot configuration, will those addresses still 
> > be used if configuration is changed?
> 
> Also going along with what Pavel said (that's it more a policy
> decision, not a device property), I feel like this node should be added
> by the bootloader then. And indeed U-Boot has support for that already.
> From skimming over the code in cmd/pstore.c: if you enable
> CONFIG_CMD_PSTORE and set CONFIG_CMD_PSTORE_MEM_ADDR to your chosen
> address, then the U-Boot code will insert a reserved memory node on the
> fly. Would that solve your problem?
>

I've tried pstore command in u-boot in the past to make sure it's
working there as well. I didn't know, that it adds reserved-memory
node as well. Thanks, Andre. That is very helpful.

I've tried it again without patching a kernel as you
suggested. Unfortunately it's not working on A64.

If there is no reserved-memory defined, u-boot adds a new one with
following properties:
    
    reserved-memory {
         #address-cells = <2>;
         #size-cells = <2>;
         ranges;
    }
    

But with these default address-cells and size-cells values, pstore
isn't working on A64. Root node for A64 defines 'address-cells' and 'size-cells' as 1.
    
dtc complains if reserved-memory has different address-cells and
size-cells.

```
     Warning (ranges_format): /reserved-memory:ranges: empty "ranges" property but its #address-cells (2) differs from / (1)
```

If empty reserved-memory is added to
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi in the kernel, then
u-boot adds working pstore subnode.

```
       reserved-memory {
               #address-cells = <1>;
               #size-cells = <1>;
               ranges;

               /* bootloader will add new entries here
                * for example, for pstore.
                */
       };
```

It looks like a bug in u-boot for me. IMHO, it should look at
#address-cells/#size-cells of the root-node for default values. I have
tried that and this way pstore is working without any changes to the
kernel dts. What do you think? Should I submit fix to u-boot instead?

-- 
Best regards,
Andrey Skvortsov

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

* Re: [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64
@ 2023-08-25 10:36           ` Andrey Skvortsov
  0 siblings, 0 replies; 17+ messages in thread
From: Andrey Skvortsov @ 2023-08-25 10:36 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Jernej Škrabec, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chen-Yu Tsai, Samuel Holland, Kees Cook, Tony Luck,
	Guilherme G. Piccoli, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-hardening, Jarrah Gosbell, Arnaud Ferraris,
	Pavel Machek

Hi Andre,

On 23-08-24 14:50, Andre Przywara wrote:
> On Wed, 23 Aug 2023 21:36:51 +0200
> Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
> 
> 
> Hi Andrey,
> 
> > send new revision as standalone e-mail, not as reply to old discussion.
> > 
> > Dne torek, 22. avgust 2023 ob 11:23:58 CEST je Andrey Skvortsov napisal(a):
> > > This patch reserves some memory in the DTS and sets up a
> > > pstore device tree node to enable pstore support.
> > > 
> > > In general any DRAM address, that isn't overwritten during a boot is
> > > suitable for pstore.
> > > 
> > > Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
> > > internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
> > > later in the boot process. Ramdisk start address is 0x4FF00000,
> > > initramfs for kernel with some hacking features and debug info enabled
> > > can take more than 100Mb and final address will be around 0x58000000.
> > > Address 0x61000000 will most likely not overlap with that.  
> > 
> > There are other bootloaders as U-Boot, especially on PinePhone. Are you sure 
> > it works there too? What about U-Boot configuration, will those addresses still 
> > be used if configuration is changed?
> 
> Also going along with what Pavel said (that's it more a policy
> decision, not a device property), I feel like this node should be added
> by the bootloader then. And indeed U-Boot has support for that already.
> From skimming over the code in cmd/pstore.c: if you enable
> CONFIG_CMD_PSTORE and set CONFIG_CMD_PSTORE_MEM_ADDR to your chosen
> address, then the U-Boot code will insert a reserved memory node on the
> fly. Would that solve your problem?
>

I've tried pstore command in u-boot in the past to make sure it's
working there as well. I didn't know, that it adds reserved-memory
node as well. Thanks, Andre. That is very helpful.

I've tried it again without patching a kernel as you
suggested. Unfortunately it's not working on A64.

If there is no reserved-memory defined, u-boot adds a new one with
following properties:
    
    reserved-memory {
         #address-cells = <2>;
         #size-cells = <2>;
         ranges;
    }
    

But with these default address-cells and size-cells values, pstore
isn't working on A64. Root node for A64 defines 'address-cells' and 'size-cells' as 1.
    
dtc complains if reserved-memory has different address-cells and
size-cells.

```
     Warning (ranges_format): /reserved-memory:ranges: empty "ranges" property but its #address-cells (2) differs from / (1)
```

If empty reserved-memory is added to
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi in the kernel, then
u-boot adds working pstore subnode.

```
       reserved-memory {
               #address-cells = <1>;
               #size-cells = <1>;
               ranges;

               /* bootloader will add new entries here
                * for example, for pstore.
                */
       };
```

It looks like a bug in u-boot for me. IMHO, it should look at
#address-cells/#size-cells of the root-node for default values. I have
tried that and this way pstore is working without any changes to the
kernel dts. What do you think? Should I submit fix to u-boot instead?

-- 
Best regards,
Andrey Skvortsov

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-08-25 10:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 21:34 [PATCH] arm64: dts: pinephone: Add pstore support for PinePhone A64 Andrey Skvortsov
2023-07-27 14:57 ` Andre Przywara
2023-07-27 14:57   ` Andre Przywara
2023-07-28 20:25   ` Andrey Skvortsov
2023-07-28 20:25     ` Andrey Skvortsov
2023-08-21 16:08 ` Pavel Machek
2023-08-21 16:08   ` Pavel Machek
2023-08-22  9:23   ` [PATCH v2] " Andrey Skvortsov
2023-08-22  9:23     ` Andrey Skvortsov
2023-08-23 19:36     ` Jernej Škrabec
2023-08-23 19:36       ` Jernej Škrabec
2023-08-24 13:50       ` Andre Przywara
2023-08-24 13:50         ` Andre Przywara
2023-08-25 10:36         ` Andrey Skvortsov
2023-08-25 10:36           ` Andrey Skvortsov
2023-08-22  9:26   ` [PATCH] " Andrey Skvortsov
2023-08-22  9:26     ` Andrey Skvortsov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.