mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fixup! ARM: always call cache_invalidate_stale before enabling D-Cache
@ 2026-08-28 19:27 Ahmad Fatoum
  2026-08-31  7:10 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-08-28 19:27 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The invalidate was removed from __barebox_arm_entry, so it precedes MMU
setup. This was missed for ARM64 and it happened even when the MMU was
already enabled.

Additionally, the invalidate was done even if MMU was already enabled.
We have this check for barebox as EFI payload, where we shouldn't really
do any cache maintenance ourselves, so move it after the check.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/mmu_32.c | 4 ++--
 arch/arm/cpu/mmu_64.c | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/mmu_32.c b/arch/arm/cpu/mmu_32.c
index 7b49643fd79b..6821088c4340 100644
--- a/arch/arm/cpu/mmu_32.c
+++ b/arch/arm/cpu/mmu_32.c
@@ -613,11 +613,11 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
 
 	pr_debug("enabling MMU, ttb @ 0x%p\n", ttb);
 
-	cache_invalidate_stale();
-
 	if (get_cr() & CR_M)
 		return;
 
+	cache_invalidate_stale();
+
 	set_ttbr(ttb);
 
 	set_domain(DOMAIN_CLIENT);
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index bf44cc7bccf2..a49beac350d3 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -392,6 +392,8 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
 	if (get_cr() & CR_M)
 		return;
 
+	cache_invalidate_stale();
+
 	pr_debug("enabling MMU, ttb @ 0x%08lx\n", ttb);
 
 	el = current_el();
-- 
2.47.3




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-31  7:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28 19:27 [PATCH] fixup! ARM: always call cache_invalidate_stale before enabling D-Cache Ahmad Fatoum
2026-08-31  7:10 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox