Skip to contentSkip to conversation

arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region

PATCH Superseded Martino Dell'Ambrogio 2 participants 2 messages Sep 15

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region

Reserve 1 MiB of RAM just below the ARM Trusted Firmware secmon region (0x42f00000-0x43000000) for persistent kernel log storage via pstore/ramoops, allowing post-panic console output and oops dumps to be recovered after a reboot. Without it, kernel crash logs on this board are lost when the SoC warm-resets and the on-chip console buffer is reinitialised.

With record-size=128 KiB, console-size=256 KiB, ftrace-size=64 KiB and pmsg-size=64 KiB, ramoops_probe() carves the post-console remainder (640 KiB) into five 128 KiB kmsg records, with the requested ecc-size=16 reserving a small Reed-Solomon parity block from each zone's own allocation (per persistent_ram_new()). The ECC lets pstore recover dumps even when the panic path truncates writes mid-record.

The no-map property is required so the reserved region is kept out of the kernel linear map. ramoops remaps the carve-out write-combine via ioremap_wc(); on arm64, leaving the same physical RAM mapped cacheable in the linear map at the same time is an attribute-mismatch and risks losing panic data to dirty cache evictions from the linear alias.

The carve-out sits immediately below the ATF region already declared at 0x43000000 in mt7988a.dtsi, so no other reserved-memory child is moved or resized. BPI-R4 ships with at least 4 GiB of DRAM starting at 0x40000000, so the region is well within installed memory on every variant.

For the carve-out to actually preserve content across a reset, the boot loader must also avoid touching this region on warm reset; on standard BPI-R4 boards with the stock OpenWrt U-Boot fork this already holds.

---
Changes in v3:
- Resend; no functional change. Rebased on v7.3-rc3, where the v2 diff still applies unmodified.
- v2 drew no review comments. It was also sent, in error, as a reply to the BPI-R3 patch's thread rather than its own, so it is likely to have been read as a duplicate of that board's patch. This version starts a fresh thread to avoid repeating that.

The matching BPI-R3 (mt7986a) patch is being resent as v3 at the same time.

v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/

 .../boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi  | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi +13 -0
index 0ff69da..6a8dc89 100644
@@ -80,6 +80,19 @@
 	};
 };
 
+&{/reserved-memory} {
+	ramoops@42f00000 {
+		compatible = "ramoops";
+		reg = <0 0x42f00000 0 0x100000>;
+		no-map;
+		record-size = <0x20000>;
+		console-size = <0x40000>;
+		ftrace-size = <0x10000>;
+		pmsg-size = <0x10000>;
+		ecc-size = <16>;
+	};
+};
+
 &cci {
 	proc-supply = <&rt5190_buck3>;
 };
Signature · 1 line
2.47.3
#1 lore raw
Quoted 51 lines · Martino Dell'Ambrogio

Reserve 1 MiB of RAM just below the ARM Trusted Firmware secmon region (0x42f00000-0x43000000) for persistent kernel log storage via pstore/ramoops, allowing post-panic console output and oops dumps to be recovered after a reboot. Without it, kernel crash logs on this board are lost when the SoC warm-resets and the on-chip console buffer is reinitialised.

With record-size=128 KiB, console-size=256 KiB, ftrace-size=64 KiB and pmsg-size=64 KiB, ramoops_probe() carves the post-console remainder (640 KiB) into five 128 KiB kmsg records, with the requested ecc-size=16 reserving a small Reed-Solomon parity block from each zone's own allocation (per persistent_ram_new()). The ECC lets pstore recover dumps even when the panic path truncates writes mid-record.

The no-map property is required so the reserved region is kept out of the kernel linear map. ramoops remaps the carve-out write-combine via ioremap_wc(); on arm64, leaving the same physical RAM mapped cacheable in the linear map at the same time is an attribute-mismatch and risks losing panic data to dirty cache evictions from the linear alias.

The carve-out sits immediately below the ATF region already declared at 0x43000000 in mt7988a.dtsi, so no other reserved-memory child is moved or resized. BPI-R4 ships with at least 4 GiB of DRAM starting at 0x40000000, so the region is well within installed memory on every variant.

For the carve-out to actually preserve content across a reset, the boot loader must also avoid touching this region on warm reset; on standard BPI-R4 boards with the stock OpenWrt U-Boot fork this already holds.

---
Changes in v3:
- Resend; no functional change. Rebased on v7.3-rc3, where the v2 diff still applies unmodified.
- v2 drew no review comments. It was also sent, in error, as a reply to the BPI-R3 patch's thread rather than its own, so it is likely to have been read as a duplicate of that board's patch. This version starts a fresh thread to avoid repeating that.

The matching BPI-R3 (mt7986a) patch is being resent as v3 at the same time.

v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/

  .../boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi  | 13 +++++++++++++
  1 file changed, 13 insertions(+)
arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi +0 -0
index 0ff69da..6a8dc89 100644

arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi line 83

Quoted 4 lines
arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi +1 -0
@@ -80,6 +80,19 @@
  	};
  };
 
+&{/reserved-memory} {

It's just

	reserved-memory {

Sorry about missing your patch for all this time; the comment applies to both btw.

Cheers,
Angelo

Quoted 15 lines
arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi +12 -0
+	ramoops@42f00000 {
+		compatible = "ramoops";
+		reg = <0 0x42f00000 0 0x100000>;
+		no-map;
+		record-size = <0x20000>;
+		console-size = <0x40000>;
+		ftrace-size = <0x10000>;
+		pmsg-size = <0x10000>;
+		ecc-size = <16>;
+	};
+};
+
  &cci {
  	proc-supply = <&rt5190_buck3>;
  };