* [PATCH v2] ARM: mmu: skip cacheable page flushes for empty ranges
@ 2026-06-20 5:04 Ahmad Fatoum
2026-06-22 6:19 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-06-20 5:04 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
If we end here with a size of zero, region_end will become -1 and
is a sure way to lead into confusing issues.
__arch_remap_range() skips 0-sized regions, so do likewise here, so
all of arch_remap_range() is 0-size-region safe.
Reported-by: Ben Pye # Matrix
Fixes: b71103970c9b ("ARM: mmu: skip TLB invalidation if remapping zero bytes")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- early exit instead of panic
- Add Fixes: tag
---
arch/arm/cpu/flush_cacheable_pages.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/cpu/flush_cacheable_pages.h b/arch/arm/cpu/flush_cacheable_pages.h
index a03e10810dc7..a5c54864d446 100644
--- a/arch/arm/cpu/flush_cacheable_pages.h
+++ b/arch/arm/cpu/flush_cacheable_pages.h
@@ -28,6 +28,9 @@ static void flush_cacheable_pages(void *start, size_t size)
size_t block_size;
mmu_addr_t *ttb;
+ if (!size)
+ return;
+
region_start = PAGE_ALIGN_DOWN((ulong)start);
region_end = PAGE_ALIGN(region_start + size) - 1;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ARM: mmu: skip cacheable page flushes for empty ranges
2026-06-20 5:04 [PATCH v2] ARM: mmu: skip cacheable page flushes for empty ranges Ahmad Fatoum
@ 2026-06-22 6:19 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-06-22 6:19 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Sat, 20 Jun 2026 07:04:56 +0200, Ahmad Fatoum wrote:
> If we end here with a size of zero, region_end will become -1 and
> is a sure way to lead into confusing issues.
>
> __arch_remap_range() skips 0-sized regions, so do likewise here, so
> all of arch_remap_range() is 0-size-region safe.
>
>
> [...]
Applied, thanks!
[1/1] ARM: mmu: skip cacheable page flushes for empty ranges
https://git.pengutronix.de/cgit/barebox/commit/?id=95ff4d5058ac (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:[~2026-06-22 6:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-20 5:04 [PATCH v2] ARM: mmu: skip cacheable page flushes for empty ranges Ahmad Fatoum
2026-06-22 6:19 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox