* [PATCH] arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region
@ 2026-05-28 9:28 Martino Dell'Ambrogio
2026-05-28 10:13 ` sashiko-bot
2026-05-28 12:36 ` [PATCH v2] arm64: dts: mediatek: mt7986a-bananapi-bpi-r3: " Martino Dell'Ambrogio
0 siblings, 2 replies; 4+ messages in thread
From: Martino Dell'Ambrogio @ 2026-05-28 9:28 UTC (permalink / raw)
To: matthias.bgg, angelogioacchino.delregno
Cc: kees, tony.luck, gpiccoli, linux-mediatek, linux-arm-kernel,
devicetree, linux-kernel, 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.
The record sizes (128 KiB kmsg records, 256 KiB rolling console, 64 KiB
ftrace, 64 KiB pmsg) sum to 512 KiB; the remainder of the 1 MiB carve-out
is used for the ECC parity blocks (ecc-size=16, one Reed-Solomon block per
record) which significantly improves dump readability when the panic path
truncates writes mid-record.
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.
Signed-off-by: Martino Dell'Ambrogio <tillo@tillo.ch>
---
.../boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
index 0ff69da..f7d4944 100644
--- a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
@@ -80,6 +80,18 @@ sfp1: sfp1 {
};
};
+&{/reserved-memory} {
+ ramoops@42f00000 {
+ compatible = "ramoops";
+ reg = <0 0x42f00000 0 0x100000>;
+ record-size = <0x20000>;
+ console-size = <0x40000>;
+ ftrace-size = <0x10000>;
+ pmsg-size = <0x10000>;
+ ecc-size = <16>;
+ };
+};
+
&cci {
proc-supply = <&rt5190_buck3>;
};
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region
2026-05-28 9:28 [PATCH] arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region Martino Dell'Ambrogio
@ 2026-05-28 10:13 ` sashiko-bot
2026-05-28 12:36 ` [PATCH v2] arm64: dts: mediatek: mt7986a-bananapi-bpi-r3: " Martino Dell'Ambrogio
1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-05-28 10:13 UTC (permalink / raw)
To: Martino Dell'Ambrogio; +Cc: devicetree, conor+dt, robh
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The `ramoops` reserved-memory node is missing the `no-map` property, which causes an architecture violation on arm64 due to mismatched memory attributes.
- [High] The `ramoops` memory partitioning and ECC configuration severely misinterpret the subsystem bindings, contradicting the commit message's claims and failing to provide the intended ECC protection.
--
commit 9de1ef047c96e12c7b888c596f5eb04dcab13d7d
Author: Martino Dell'Ambrogio <tillo@tillo.ch>
arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region
Reserve 1 MiB of RAM for persistent kernel log storage via pstore/ramoops.
This preserves console output and oops dumps across warm resets. The carve-out
is placed just below the ARM Trusted Firmware secmon region.
> The record sizes (128 KiB kmsg records, 256 KiB rolling console, 64 KiB
> ftrace, 64 KiB pmsg) sum to 512 KiB; the remainder of the 1 MiB carve-out
> is used for the ECC parity blocks (ecc-size=16, one Reed-Solomon block per
> record) which significantly improves dump readability when the panic path
> truncates writes mid-record.
[Severity: High]
Does the ramoops driver allocate ECC memory from the remaining space in the
carve-out as described here?
Looking at ramoops_probe() in fs/pstore/ram.c, the remaining space for oops
records is calculated as the total size minus the console, ftrace, and pmsg
sizes (1024 - 256 - 64 - 64 = 640 KiB). The subsystem then divides this
remaining space by the record-size (128 KiB) to create 5 separate kmsg
records, rather than a single record.
Furthermore, persistent_ram_new() carves the ECC parity blocks from within
the allocated size of each individual record. This amounts to roughly 14 KiB
of ECC per record, instead of the 512 KiB of dedicated ECC parity blocks
mentioned above.
> diff --git a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
> --- a/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
[ ... ]
> +&{/reserved-memory} {
> + ramoops@42f00000 {
> + compatible = "ramoops";
[Severity: High]
Does this node need the no-map property?
Without no-map, this 1 MiB carve-out remains in the kernel's linear mapping
where it is mapped as Normal Cacheable memory. The ramoops driver remaps this
region using vmap() with a default mem-type of 0 (Write-Combine, translating
to Normal Non-Cacheable on arm64).
Mapping the same physical memory with conflicting cache attributes is an
architectural violation on arm64 and can lead to cache incoherency. Dirty
cache lines from the linear map could evict and overwrite the panic logs
written via the non-cacheable mapping.
> + reg = <0 0x42f00000 0 0x100000>;
> + record-size = <0x20000>;
> + console-size = <0x40000>;
> + ftrace-size = <0x10000>;
> + pmsg-size = <0x10000>;
> + ecc-size = <16>;
> + };
> +};
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260528092807.1936177-1-tillo@tillo.ch?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] arm64: dts: mediatek: mt7986a-bananapi-bpi-r3: add ramoops region
2026-05-28 9:28 [PATCH] arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region Martino Dell'Ambrogio
2026-05-28 10:13 ` sashiko-bot
@ 2026-05-28 12:36 ` Martino Dell'Ambrogio
2026-07-05 18:55 ` Martino Dell'Ambrogio
1 sibling, 1 reply; 4+ messages in thread
From: Martino Dell'Ambrogio @ 2026-05-28 12:36 UTC (permalink / raw)
To: matthias.bgg, angelogioacchino.delregno
Cc: kees, tony.luck, gpiccoli, linux-mediatek, linux-arm-kernel,
devicetree, linux-kernel, Martino Dell'Ambrogio
Reserve 64 KiB of RAM just below the ARM Trusted Firmware secmon region
(0x42ff0000-0x43000000) for persistent kernel log storage via pstore/ramoops,
allowing post-panic console output and oops dumps to be recovered after a
warm reset. Without it, kernel crash logs on this board are lost when the
SoC reboots.
The zone sizes (record-size=8 KiB, console-size=32 KiB, ftrace-size=8 KiB,
pmsg-size=8 KiB) consume the full 64 KiB carve-out. The requested ecc-size=16
reserves a small Reed-Solomon parity block from each zone's own allocation
in persistent_ram_new(), which 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 region sits immediately below the ATF block already declared at
0x43000000 in mt7986a.dtsi, so no other reserved-memory child is moved or
resized. BPI-R3 ships with 2 GiB of DRAM starting at 0x40000000, well above
0x43000000, so the region is always within installed memory.
For the carve-out to actually preserve content across a reset, the boot
loader must avoid touching this region on warm reset; on standard BPI-R3
boards with the stock OpenWrt U-Boot fork this already holds.
Signed-off-by: Martino Dell'Ambrogio <tillo@tillo.ch>
---
Changes in v2:
- Add no-map; to keep the carve-out out of the kernel linear map and
avoid the cacheable/write-combine attribute mismatch on arm64.
(sashiko-bot, gemini-3.1-pro)
- Rewrite the ECC paragraph in the commit log: the zone sizes already
fill the 64 KiB region, so there is no remainder; ecc-size is carved
from each zone in persistent_ram_new(). (sashiko-bot, gemini-3.1-pro)
v1: https://lore.kernel.org/all/20260528092807.1936177-1-tillo@tillo.ch/
.../boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts
index 19f538d..31ee189 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts
+++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts
@@ -140,6 +140,19 @@ sfp2: sfp-2 {
};
};
+&{/reserved-memory} {
+ ramoops@42ff0000 {
+ compatible = "ramoops";
+ reg = <0 0x42ff0000 0 0x10000>;
+ no-map;
+ record-size = <0x2000>;
+ console-size = <0x8000>;
+ ftrace-size = <0x2000>;
+ pmsg-size = <0x2000>;
+ ecc-size = <16>;
+ };
+};
+
&cpu_thermal {
cooling-maps {
map-cpu-active-high {
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] arm64: dts: mediatek: mt7986a-bananapi-bpi-r3: add ramoops region
2026-05-28 12:36 ` [PATCH v2] arm64: dts: mediatek: mt7986a-bananapi-bpi-r3: " Martino Dell'Ambrogio
@ 2026-07-05 18:55 ` Martino Dell'Ambrogio
0 siblings, 0 replies; 4+ messages in thread
From: Martino Dell'Ambrogio @ 2026-07-05 18:55 UTC (permalink / raw)
To: matthias.bgg, angelogioacchino.delregno
Cc: kees, tony.luck, gpiccoli, linux-mediatek, linux-arm-kernel,
devicetree, linux-kernel, Martino Dell'Ambrogio
Gentle ping - is there anything I should improve on this one?
The matching BPI-R4 (mt7988a) patch is at:
https://lore.kernel.org/all/20260528123645.2650085-1-tillo@tillo.ch/
Thanks!
Martino
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-05 18:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28 9:28 [PATCH] arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops region Martino Dell'Ambrogio
2026-05-28 10:13 ` sashiko-bot
2026-05-28 12:36 ` [PATCH v2] arm64: dts: mediatek: mt7986a-bananapi-bpi-r3: " Martino Dell'Ambrogio
2026-07-05 18:55 ` Martino Dell'Ambrogio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox