From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7F2C28904 for ; Thu, 24 Aug 2023 13:51:35 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4FA2E1007; Thu, 24 Aug 2023 06:52:09 -0700 (PDT) Received: from slackpad.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB0603F762; Thu, 24 Aug 2023 06:51:26 -0700 (PDT) Date: Thu, 24 Aug 2023 14:50:25 +0100 From: Andre Przywara To: Andrey Skvortsov Cc: Jernej =?UTF-8?B?xaBrcmFiZWM=?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Samuel Holland , Kees Cook , Tony Luck , "Guilherme G. Piccoli" , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Jarrah Gosbell , Arnaud Ferraris , Pavel Machek Subject: Re: [PATCH v2] arm64: dts: pinephone: Add pstore support for PinePhone A64 Message-ID: <20230824144952.5b908649@slackpad.lan> In-Reply-To: <2235209.iZASKD2KPV@jernej-laptop> References: <20230821160817.GA2227@bug> <20230822092358.309835-1-andrej.skvortzov@gmail.com> <2235209.iZASKD2KPV@jernej-laptop> Organization: Arm Ltd. X-Mailer: Claws Mail 4.1.1 (GTK 3.24.31; x86_64-slackware-linux-gnu) Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 23 Aug 2023 21:36:51 +0200 Jernej =C5=A0krabec wrote: Hi Andrey, > send new revision as standalone e-mail, not as reply to old discussion. >=20 > 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. > >=20 > > In general any DRAM address, that isn't overwritten during a boot is > > suitable for pstore. > >=20 > > 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. =20 >=20 > There are other bootloaders as U-Boot, especially on PinePhone. Are you s= ure=20 > it works there too? What about U-Boot configuration, will those addresses= still=20 > 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. =46rom 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 >=20 > >=20 > > Signed-off-by: Andrey Skvortsov > > --- > >=20 > > Changes in v2: > > - Update commit description with information about why this base addre= ss is > > used. > >=20 > > .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > >=20 > > 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 =3D &uart0; > > }; > >=20 > > + reserved-memory { > > + #address-cells =3D <1>; > > + #size-cells =3D <1>; > > + ranges; > > + > > + pstore_mem: ramoops@61000000 { > > + compatible =3D "ramoops"; > > + reg =3D <0x61000000 0x100000>; > > + record-size =3D <0x20000>; > > + console-size =3D <0x20000>; > > + ftrace-size =3D <0x20000>; > > + pmsg-size =3D <0x20000>; > > + ecc-size =3D <16>; > > + }; > > + }; > > + > > backlight: backlight { > > compatible =3D "pwm-backlight"; > > pwms =3D <&r_pwm 0 50000 PWM_POLARITY_INVERTED>; =20 >=20 >=20 >=20 >=20 >=20