mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: cpu: disable interrupts before MMU disabling
@ 2025-12-11 20:43 Ahmad Fatoum
  2025-12-15  8:43 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-12-11 20:43 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




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

* Re: [PATCH] ARM: cpu: disable interrupts before MMU disabling
  2025-12-11 20:43 [PATCH] ARM: cpu: disable interrupts before MMU disabling Ahmad Fatoum
@ 2025-12-15  8:43 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-12-15  8:43 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Thu, 11 Dec 2025 21:43:13 +0100, Ahmad Fatoum wrote:
> 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.
> 
> 
> [...]

Applied, thanks!

[1/1] ARM: cpu: disable interrupts before MMU disabling
      https://git.pengutronix.de/cgit/barebox/commit/?id=c811ba231875 (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-12-15  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-11 20:43 [PATCH] ARM: cpu: disable interrupts before MMU disabling Ahmad Fatoum
2025-12-15  8:43 ` Sascha Hauer

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