Repository navigation
Conversation
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
- 7b8a4b1 "uboot-mediatek: mt7988: align pstore region with the kernel" — the message describes only the DT node change and the
CMD_PSTORE_*defconfig matrix, but the diff also prepends retroactivegit format-patchheaders to103-04-mt7988-enable-pstore.patchand450-add-bpi-r4.patch. Undocumented hunks; see the inline note.
Only this commit changed since the last review (bec8224c → 7b8a4b12); 7348c540 ("mediatek: mt7988a: reserve memory for ramoops/pstore") is unmodified. CI on the head commit is green.
Generated by Claude Code
| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
| From: Daniel Golle <[email protected]> | ||
| Date: Sat, 22 Jul 2023 14:50:27 +0000 | ||
| Subject: [PATCH] arm: dts: mt7988: enable pstore | ||
|
|
||
| Downstream OpenWrt patch from the MediaTek pstore/boot-recovery series. | ||
| Git headers added retroactively for git-am compatibility. | ||
| --- |
There was a problem hiding this comment.
nit: this header block (and the equivalent one added at the top of 450-add-bpi-r4.patch) is unrelated to aligning the pstore region — it's a metadata-only change that neither the subject nor the body of this commit mentions. The attributions themselves check out (6ddb5f5a65 Sat Jul 22 15:50:27 2023 +0100 == 14:50:27 +0000 for this patch, 54f99ebe5c Tue Jul 25 02:56:01 2023 +0100 == 01:56:01 +0000 for 450), and the From 0000…0 + --- separator form matches in-tree practice (e.g. 111-mtd-nand-spi-otp-add-NULL-guards-to-OTP-size-functions.patch),`` so the content is fine — it's the packaging that's off.
Two consequences worth considering:
- The three sibling pstore patches from the same origin commit — 103-01,
[103-02](https://github.com/openwrt/openwrt/blob/7b8a4b122094cd2d50de762d348ba759b8b0bcf0/package/boot/uboot-mediatek/patches/103-02-mt7981-enable-pstore.patch#L1),`` 103-03 — stay header-less, so the103-0x-*-enable-pstoreset ends up half-annotated. - Adding headers to
450-add-bpi-r4.patchis entirely independent of mt7988 pstore; a reader bisecting the pstore change gets an unrelated 10-line hunk.
Splitting the retroactive headers into their own preparatory commit (ideally covering 103-01..03 too) would keep this commit to what its message describes. If you'd rather keep it in one commit, please at least mention it in the body.
Generated by Claude Code
There was a problem hiding this comment.
fixed, thanks — solved by calling the retroactive headers out in the commit body rather than splitting them off.
Generated by Claude Code
There was a problem hiding this comment.
This PR no longer touches 103-04, so its retroactive header block is gone too. Only 450-add-bpi-r4.patch still carries one, and the commit message says so.
7b8a4b1 to
a75aaa5
Compare
| + /* 1 MiB reserved for ramoops/pstore */ | ||
| + ramoops@42f00000 { | ||
| + compatible = "ramoops"; | ||
| + reg = <0 0x42f00000 0 0x100000>; |
There was a problem hiding this comment.
This node is SoC-wide, but the realigned CMD_PSTORE_* values only reach the six BPI-R4 defconfigs — mt7988a_arcadyan_mozart, [`mt7988a_asus_zenwifi-bt8`](https://github.com/openwrt/openwrt/blob/a75aaa5ab09b9ee7bec55dd15535eee69a913516/package/boot/uboot-mediatek/patches/461-add-asus-zenwifi-bt8.patch#L67``) and the three mt7988a_bananapi_bpi-r4-pro-8x-* defconfigs keep CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000, and all five drive boot_recovery from pstore check. With this layout 0x42ff0000 is the start of the pmsg zone, so pstore check on those boards stops finding a kmsg record. Is leaving them unaligned intentional?
Generated by Claude Code
There was a problem hiding this comment.
fixed, thanks — solved by scoping the node to the BPI-R4 board file instead of realigning the other five boards.
Generated by Claude Code
a75aaa5 to
b605ef5
Compare
|
Good catch, and no — leaving them unaligned wasn't intentional. You're right that a SoC-wide node plus board-scoped Fixed by moving the node into the BPI-R4 board file instead of To be explicit about why I'd rather scope it than extend the realignment to all of them: I don't have any of those boards, so I can't verify a changed reserved-memory layout or a Two side effects, both simplifications:
This also brings it in line with the version under review upstream, which is board-level for the same reason: https://lore.kernel.org/all/[email protected]/ The workflow-approval gate will need another click for CI to run on the new head, sorry about that. |
b605ef5 to
586fadf
Compare
|
Small follow-up, sorry for the extra churn. The mediatek maintainer reviewed the upstream version of this patch and asked for the node to be declared as a plain
Upstream v4: https://lore.kernel.org/all/[email protected]/ The workflow-approval gate will need another click for CI, which is entirely my fault for pushing twice in a day. |
| + /* 1 MiB reserved for ramoops/pstore. Keep in sync with the | ||
| + * kernel's mt7988a.dtsi node (197-dts-mt7988a-add-ramoops.patch) | ||
| + * so 'pstore check' and the kernel agree on the zone layout. | ||
| + */ |
There was a problem hiding this comment.
Both halves of this pointer are wrong: the kernel node lives in mt7988a-bananapi-bpi-r4.dtsi, not mt7988a.dtsi, and the patch adding it is 191-dts-mt7988a-bpi-r4-add-ramoops.patch, not 197-…. Keeping it to four lines so the @@ -63,6 +63,38 @@ count stays valid.
| + /* 1 MiB reserved for ramoops/pstore. Keep in sync with the | |
| + * kernel's mt7988a.dtsi node (197-dts-mt7988a-add-ramoops.patch) | |
| + * so 'pstore check' and the kernel agree on the zone layout. | |
| + */ | |
| + /* 1 MiB reserved for ramoops/pstore. Keep in sync with the | |
| + * kernel's 191-dts-mt7988a-bpi-r4-add-ramoops.patch so that | |
| + * 'pstore check' and the kernel agree on the zone layout. | |
| + */ |
Generated by Claude Code
There was a problem hiding this comment.
Gone with the move above: this PR no longer touches 103-04. The comment now lives next to the node in the BPI-R4 board dtsi and points at 191-dts-mt7988a-bpi-r4-add-ramoops.patch.
| + * kernel's mt7988a.dtsi node (197-dts-mt7988a-add-ramoops.patch) | ||
| + * so 'pstore check' and the kernel agree on the zone layout. | ||
| + */ | ||
| + ramoops@42f00000 { |
There was a problem hiding this comment.
This node stays SoC-wide in U-Boot's mt7988.dtsi while the kernel node moved to the BPI-R4 board file, so 456-add-arcadyan-mozart.patch:67, [`461-add-asus-zenwifi-bt8.patch:67`](https://github.com/openwrt/openwrt/blob/586fadfc796d61621f005d1110efb908995ec848/package/boot/uboot-mediatek/patches/461-add-asus-zenwifi-bt8.patch#L67``) and 472-add-bpi-r4-pro-8x.patch:70 now build a U-Boot whose own DT declares 0x42f00000/1 MiB while their CONFIG_CMD_PSTORE_MEM_ADDR stays 0x42ff0000 — the two agreed before this PR. That also makes the "keep their existing memory map, unchanged by this PR" claim from the previous round not quite hold for the U-Boot DT. Is leaving the U-Boot side SoC-wide intentional?
Generated by Claude Code
There was a problem hiding this comment.
Not intentional, thanks. mt7988.dtsi is now back to exactly what main has. The 1 MiB node moved to the BPI-R4 U-Boot board dtsi (in 450-add-bpi-r4.patch), which deletes the SoC-wide ramoops@42ff0000 and adds its own. mozart, zenwifi-bt8 and bpi-r4-pro-8x keep a U-Boot DT that matches their CMD_PSTORE_MEM_ADDR. I compiled all nine mt7988 U-Boot DTs before and after, and only the two BPI-R4 DTBs change.
| @@ -98,5 +98,19 @@ | ||
| device_type = "memory"; | ||
| }; | ||
|
|
There was a problem hiding this comment.
nit: this context line is completely empty instead of a single space — 0 of the 137 patches in target/linux/mediatek/patches-6.18/ and 0 of the 143 in package/boot/uboot-mediatek/patches/ carry a bare blank line inside a hunk, so this reads as hand-written rather than refreshed. make target/linux/refresh with the mediatek target selected will normalize it.
Generated by Claude Code
There was a problem hiding this comment.
Fixed. The patch is now the output of make target/linux/refresh (taken from the CI artifact), and the kernel patch check should be green.
| Subject: [PATCH] arm64: dts: mediatek: mt7988a-bananapi-bpi-r4: add ramoops | ||
| region |
There was a problem hiding this comment.
nit: the PR description still says the first commit "adds a 1 MiB ramoops reservation to mt7988a.dtsi" and links the v1 upstream posting (20260528123645); both disagree with the commit as it now stands (BPI-R4 board file, 20260915135722).
Generated by Claude Code
There was a problem hiding this comment.
Updated. The description now names the BPI-R4 board file and links the version that was applied upstream.
586fadf to
32242a0
Compare
|
Upstream status update: the kernel-side change has been accepted upstream. AngeloGioacchino Del Regno applied it to the mediatek tree ( I have realigned
No functional change: the node values, placement and the U-Boot One deliberate omission: I have not pinned the upstream commit hash in the patch header yet. The commit currently lives in a maintainer |
| +CONFIG_CMD_CACHE=y | ||
| +CONFIG_CMD_PSTORE=y | ||
| +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 | ||
| +CONFIG_CMD_PSTORE_MEM_ADDR=0x42f00000 |
There was a problem hiding this comment.
Moving the address breaks the "new kernel + old U-Boot FIP" case the PR body's Compatibility section describes: an unflashed FIP still carries CMD_PSTORE_MEM_ADDR=0x42ff0000, so fdt_fixup_pstore() asks for ramoops@42ff0000, never hits FDT_ERR_EXISTS, and injects a second ramoops node — which libfdt places before the existing subnodes, i.e. ahead of the kernel's ramoops@42f00000. Linux creates platform devices in tree order and rejects the second with "already initialized", so the injected 64 KiB/no-ECC layout wins and the native node is inert. Worth correcting the compatibility claim, or keeping the region at 0x42ff0000 so the names collide and the bail-out actually triggers.
Generated by Claude Code
There was a problem hiding this comment.
You're right, thanks for tracing it through. The name check is the only thing fdt_add_subnode() looks at, so with an old FIP the injected ramoops@42ff0000 goes in first and the native node gets "already initialized". I've corrected the Compatibility section in the description and the commit message.
Keeping the region at 0x42ff0000 isn't possible for 1 MiB, though: it would run into secmon@43000000. The kernel node also has to stay identical to the one applied upstream. The fallback isn't harmful anyway: an old FIP keeps the old 64 KiB layout on both sides, so pstore check still matches, and the new layout arrives with the FIP update.
32242a0 to
617ce15
Compare
|
Pushed a new round:
|
…(EEE now upstreamed, CAPS hunk fix stays valid); mt7530 stats64/unbind openwrt#25383 + EEE openwrt#25058 (already in .53); ramoops openwrt#24279 (BPI-R4, 8x candidate); RSS/LRO still v8; forum: frank asked to move RSS/LRO to openwrt#26071 (last: meehien HWLRO fraction, rmandrad dead hw_lro_stats); R4Pro_RSS still 1 fix behind
Reserve 1 MiB of DRAM just below the ARM Trusted Firmware carve-out for
ramoops/pstore on the BananaPi BPI-R4, so that kernel oops and panic logs
survive a reboot.
The region is split into 128 KiB kmsg records plus console, ftrace and
pmsg zones, with 16 bytes/block of Reed-Solomon ECC. Without ECC a
panic-time partial write regularly leaves the dump unreadable. The layout
matches the CMD_PSTORE configuration the BPI-R4 U-Boot uses for the
`pstore check` boot_recovery path (next commit).
The node goes in the BPI-R4 board file rather than in mt7988a.dtsi: the
carve-out is only correct where U-Boot's CMD_PSTORE_* values agree with
it, and those are carried by the six BPI-R4 defconfigs alone. Scoping it
to the board leaves every other mt7988a board — arcadyan_mozart,
asus_zenwifi-bt8 and the bpi-r4-pro-8x variants — on its existing
layout, which is deliberate: I have none of them to test on, and with a
SoC-wide node their unchanged CMD_PSTORE_MEM_ADDR=0x42ff0000 would land
inside the pmsg zone and stop `pstore check` finding a kmsg record.
Declared as a plain reserved-memory node inside the root node rather than
via an &{/reserved-memory} path reference, matching what the mediatek
maintainer asked for upstream; dtc merges it with the node from mt7988a.dtsi
so the resulting DTB is unchanged.
Accepted upstream: the mediatek maintainer applied the identical node to
v7.3-next/dts64, so this patch can be dropped once the target moves to a
kernel that carries it.
https://lore.kernel.org/all/[email protected]/
Signed-off-by: Martino Dell'Ambrogio <[email protected]>
The mt7988 U-Boot DT reserves 64 KiB at 0x42ff0000 for ramoops, and the
BPI-R4 defconfigs set only CMD_PSTORE_MEM_ADDR, so `pstore check` (used
by boot_recovery in bootcmd) computes its zone offsets from the
built-in CMD_PSTORE defaults.
The kernel now reserves 1 MiB at 0x42f00000 on the BPI-R4 with an
explicit zone split and ECC (previous commit). Mirror that on the U-Boot
side for the same board only:
* the BPI-R4 board dtsi replaces the SoC-wide 64 KiB ramoops node with
the 1 MiB one, so U-Boot keeps its own allocations out of the whole
region; and
* all six BPI-R4 defconfigs set the full CMD_PSTORE_MEM_SIZE /
RECORD_SIZE / CONSOLE_SIZE / FTRACE_SIZE / PMSG_SIZE / ECC_SIZE
matrix, so `pstore check` looks for kmsg records at the offsets the
kernel actually writes them to, and fdt_fixup_pstore() injects the
same layout into a kernel DTB that has no native node.
The SoC-wide node in mt7988.dtsi is left as it is, so the other mt7988
boards (arcadyan_mozart, asus_zenwifi-bt8, bpi-r4-pro-8x) keep a U-Boot
DT that agrees with their unchanged CMD_PSTORE_MEM_ADDR=0x42ff0000.
ECC does not shift the zone boundaries (each zone carves its ECC bytes
from its own allocation) and CMD_PSTORE_ECC_SIZE is not used in
U-Boot's offset math, so U-Boot can read ECC-protected records written
by the kernel.
A board that gets the new kernel but keeps its old FIP is not switched
to the new layout. The old U-Boot's fdt_fixup_pstore() adds
ramoops@42ff0000; the name differs from the kernel's ramoops@42f00000,
so it does not hit FDT_ERR_EXISTS and inserts a second node ahead of
it. Linux probes the first one and rejects the native node ("ramoops:
already initialized"), and logs the two reservations as overlapping.
pstore keeps working with the old 64 KiB layout, which is also the one
the old `pstore check` reads, so boot_recovery still works; the new
layout takes effect once the FIP is updated.
Run-tested on a Bananapi BPI-R4 on the 25.12 branch (U-Boot 2025.10)
with the same layout, including the `pstore check` boot_recovery path
after real panics.
450-add-bpi-r4.patch also gains the `git format-patch` headers it was
missing, attributing it to its original author. That part is packaging
only and changes nothing about what the patch does.
Signed-off-by: Martino Dell'Ambrogio <[email protected]>
617ce15 to
467617b
Compare
|
Rebased onto current main to clear the merge conflict. The only clash was |
|
Gentle ping for review — this has been open for about 3.5 months. CI is green including Check Kernel patches, openwrt-ai's latest pass found no new issues, and the kernel-side change was accepted upstream in |
MT7988 currently has no kernel-side ramoops reservation: unless U-Boot's
pstore FDT fixup injects one, Linux never mounts pstore on these boards, and
the injected default (64 KiB, 4 KiB records, no console/ftrace/pmsg zones, no
ECC) is too small to hold a real panic and, without ECC, regularly yields
unreadable dumps (observed on a BPI-R4 as alternating-character dropout in a
captured panic excerpt).
The first commit adds a 1 MiB ramoops reservation to the BPI-R4 board file
(
mt7988a-bananapi-bpi-r4.dtsi), just below the ATF carve-out: 128 KiB kmsgrecords plus console/ftrace/pmsg zones and Reed-Solomon ECC (16 bytes/block).
It is a backport: the mediatek maintainer applied the identical node to
v7.3-next/dts64, so the patch can be dropped once the target moves to akernel carrying it.
https://lore.kernel.org/all/[email protected]/
The second commit aligns the U-Boot side for the same board only: the BPI-R4
U-Boot board dtsi replaces the SoC-wide 64 KiB node with the same 1 MiB one,
and all six BPI-R4 defconfigs get the full
CMD_PSTORE_*matrix, so thatpstore check(drivingboot_recoveryin bootcmd) looks for kmsg records atthe offsets the kernel actually writes them to. The SoC-wide node in
mt7988.dtsiis untouched, so the other mt7988 boards keep a U-Boot DT thatmatches their own
CMD_PSTORE_MEM_ADDR.Testing
2025.10) with the identical layout: real panics captured, readable after
reboot,
pstore check/boot_recoverypath exercised.2026.07, and all nine mt7988 U-Boot DTs compile. Decompiled against the
unpatched series, only the two BPI-R4 DTBs change (the ramoops node); the
other seven are identical.
Compatibility
DTB already has
ramoops@42f00000, sofdt_fixup_pstore()getsFDT_ERR_EXISTSand leaves it alone.old fixup adds
ramoops@42ff0000, which doesn't collide by name, so it goesin ahead of the native node; Linux uses the first one and rejects the
second ("already initialized"), and warns that the two reservations
overlap. pstore keeps working with the old 64 KiB layout, which is also
what the old
pstore checkreads, so boot_recovery is unaffected. The newlayout applies once the FIP is updated.
works there too, with matching zones.
own allocation), so U-Boot reads ECC-protected records written by the
kernel without needing an RS decoder.