All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common: board_r: Initialize interrupts before watchdog
@ 2025-02-18 15:55 ` J. Neuschäfer via B4 Relay
  0 siblings, 0 replies; 6+ messages in thread
From: J. Neuschäfer @ 2025-02-18 15:55 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, J. Neuschäfer

On some platforms, initializing the watchdog driver enables a timer
interrupt. This of course requires the interrupt handlers to be
properly initialized, otherwise U-Boot may crash or run the timer
interrupt handler of a previous bootloader stage.

To account for such systems, always initialize interrupts
(arch_initr_trap) before the watchdog (initr_watchdog).

This problem was observed on a PowerPC MPC83xx board.

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
---
NOTE: This approach seems safe and fine to me, but an argument could be
      made that this should be fixed in the platform-specific drivers
      instead.  Please let me know what you think.


Rough stack trace (not sure if it should be part of the commit message):

  initr_watchdog                (drivers/watchdog/wdt-uclass.c)
    device_probe(wdt@200)
      device_probe(timer)
        mpc8xxx_wdt_start       (drivers/watchdog/mpc8xxx_wdt.c)
          set_msr(get_msr() | MSR_EE);

  arch_initr_trap               (arch/powerpc/lib/traps.c)
    trap_init                   (arch/powerpc/cpu/mpc83xx/start.S)
---
 common/board_r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/board_r.c b/common/board_r.c
index 179259b00de81f7ba9802fc5288e7c2b6e6f381a..f711cd237ae76d80ca2413017bfe131656f44180 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -652,11 +652,11 @@ static init_fnc_t init_sequence_r[] = {
 	serial_initialize,
 	initr_announce,
 	dm_announce,
+	arch_initr_trap,
 #if CONFIG_IS_ENABLED(WDT)
 	initr_watchdog,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
-	arch_initr_trap,
 #if defined(CONFIG_BOARD_EARLY_INIT_R)
 	board_early_init_r,
 #endif

---
base-commit: 064556910e61044f1295162ceaad600582b66cda
change-id: 20250218-init-dab1fc72abd2

Best regards,
-- 
J. Neuschäfer <j.ne@posteo.net>


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

end of thread, other threads:[~2025-02-24 18:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-18 15:55 [PATCH] common: board_r: Initialize interrupts before watchdog J. Neuschäfer
2025-02-18 15:55 ` J. Neuschäfer via B4 Relay
2025-02-20 13:49 ` Simon Glass
2025-02-22 18:58   ` J. Neuschäfer
2025-02-24 17:54     ` Simon Glass
2025-02-24 18:48       ` PowerPC MPC83XX timer issues (Re: [PATCH] common: board_r: Initialize interrupts before watchdog) J. Neuschäfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.