* [PATCH master] ARM: mmu: fix hang when reserved memory at start of RAM
@ 2025-11-07 18:27 Ahmad Fatoum
2025-11-10 8:14 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-11-07 18:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
If the memory bank starts at address 0 and the start of the SDRAM is a
reserved region, remap_range_end_sans_text() is called with start = 0,
end = 0, which is interpreted by the function to mean that it spans
the whole of RAM.
Fix the issue by not calling remap_range_end_sans_text() for empty
ranges. This fixes an early hang observed on the Raspberry Pi 3.
In the unlikely case, there is no reserved memory region and the first
bank is indeed 4G of size, we also end up with start = 0, end = 0, but
this is already being handled correctly.
Of course, this fix introduces a corner case in return: A reserved memory
entry spanning the whole lower 4G becomes unsupported on 32-bit, but
that should be a non-issue as such a system would be fairly useless and
64-bit is not affected...
A wholesale replacement of this function is under way, so we'll
hopefully get rid of this error prone code altogether in v2026.01.0.
Fixes: 3e2d06afabe1 ("range: fix corner cases when exclusive end is zero")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/cpu/mmu-common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/mmu-common.c b/arch/arm/cpu/mmu-common.c
index 92e06b06077f..b3d9e9579686 100644
--- a/arch/arm/cpu/mmu-common.c
+++ b/arch/arm/cpu/mmu-common.c
@@ -149,7 +149,8 @@ static void mmu_remap_memory_banks(void)
/* Skip reserved regions */
for_each_reserved_region(bank, rsv) {
- remap_range_end_sans_text(pos, rsv->start, MAP_CACHED);
+ if (pos != rsv->start)
+ remap_range_end_sans_text(pos, rsv->start, MAP_CACHED);
pos = rsv->end + 1;
}
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH master] ARM: mmu: fix hang when reserved memory at start of RAM
2025-11-07 18:27 [PATCH master] ARM: mmu: fix hang when reserved memory at start of RAM Ahmad Fatoum
@ 2025-11-10 8:14 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-11-10 8:14 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Fri, 07 Nov 2025 19:27:41 +0100, Ahmad Fatoum wrote:
> If the memory bank starts at address 0 and the start of the SDRAM is a
> reserved region, remap_range_end_sans_text() is called with start = 0,
> end = 0, which is interpreted by the function to mean that it spans
> the whole of RAM.
>
> Fix the issue by not calling remap_range_end_sans_text() for empty
> ranges. This fixes an early hang observed on the Raspberry Pi 3.
>
> [...]
Applied, thanks!
[1/1] ARM: mmu: fix hang when reserved memory at start of RAM
https://git.pengutronix.de/cgit/barebox/commit/?id=ee135d98586b (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-10 8:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-07 18:27 [PATCH master] ARM: mmu: fix hang when reserved memory at start of RAM Ahmad Fatoum
2025-11-10 8:14 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox