mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! ARM: always call cache_invalidate_stale before enabling D-Cache
Date: Fri, 28 Aug 2026 21:27:08 +0200	[thread overview]
Message-ID: <20260828192715.1669104-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2026-08-28 19:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 19:27 Ahmad Fatoum [this message]
2026-08-31  7:10 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260828192715.1669104-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox