From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] ARM: cpu: disable interrupts before MMU disabling
Date: Thu, 11 Dec 2025 21:43:13 +0100 [thread overview]
Message-ID: <20251211204313.2613484-1-a.fatoum@pengutronix.de> (raw)
The cache maintenance operations we do in mmu_disable() won't take
kindly to being interrupted by interrupt handlers if we have any.
Thus disable them first thing and also move the #ifdef into the header
while at it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/cpu/cpu.c | 6 +++---
arch/arm/include/asm/mmu.h | 5 +++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/cpu.c b/arch/arm/cpu/cpu.c
index 0293181811b6..0c678f54c023 100644
--- a/arch/arm/cpu/cpu.c
+++ b/arch/arm/cpu/cpu.c
@@ -88,12 +88,12 @@ static void arch_shutdown(void)
if (efi_is_payload())
return;
-#ifdef CONFIG_MMU
+ disable_interrupts();
+
mmu_disable();
-#endif
+
icache_invalidate();
- disable_interrupts();
}
archshutdown_exitcall(arch_shutdown);
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 1fafbf9d77be..bcaa984a40ed 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -10,7 +10,12 @@
struct arm_memory;
+#ifdef CONFIG_MMU
void mmu_disable(void);
+#else
+static inline void mmu_disable(void) {}
+#endif
+
static inline void arm_create_section(unsigned long virt, unsigned long phys, int size_m,
unsigned int flags)
{
--
2.47.3
next reply other threads:[~2025-12-11 20:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 20:43 Ahmad Fatoum [this message]
2025-12-15 8:43 ` 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=20251211204313.2613484-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