Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] powerpc/booke: use IS_ENABLED(CONFIG_BOOKE_WDT) for WatchdogException
@ 2026-12-04  2:35 Pengpeng Hou
  2026-12-04  2:44 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-12-04  2:35 UTC (permalink / raw)
  To: Madhavan Srinivasan
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Ritesh Harjani (IBM), Shrikanth Hegde, linuxppc-dev, kvm,
	Pengpeng Hou, Wim Van Sebroeck, Guenter Roeck, linux-watchdog

A modular Book E watchdog driver can enable watchdog interrupts, but the
exception vectors and kernel handler currently depend on the built-in
spelling of the driver option.

Include the matching exception handling for module configurations too.
Keep the vector, C handler and KVM dispatch guards consistent.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: 609af38f8fc0 ("powerpc/booke64: Critical and machine check exception support")
Fixes: 6328e593c3df ("booke/bookehv: Add host crit-watchdog exception support")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
The patch was prepared with Gemini and revised with Codex assistance
(Assisted-by: gpt 5).

Built the PowerPC watchdog exception paths with Clang 18.1.3 and
BOOKE_WDT=m. On 44x, traps.o and head_44x.o gained WatchdogException; on
85xx the change was visible in traps.o, kvm/booke.o and the preprocessed
head_85xx.s; on 64e it was visible in traps.o and exceptions-64e.o. It
was absent in those checks before the patch. No watchdog interrupt was
triggered.

 arch/powerpc/kernel/exceptions-64e.S | 2 +-
 arch/powerpc/kernel/head_44x.S       | 2 +-
 arch/powerpc/kernel/head_85xx.S      | 2 +-
 arch/powerpc/kernel/traps.c          | 2 +-
 arch/powerpc/kvm/booke.c             | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 63f6b9f513a43c6c07078918af141bd9b55f19b8..4a47ad68e825a35a4f2cd1d1e5eecfcd6cb5358f 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -648,7 +648,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 	bl	special_reg_save
 	CHECK_NAPPING();
 	addi	r3,r1,STACK_INT_FRAME_REGS
-#ifdef CONFIG_BOOKE_WDT
+#if IS_ENABLED(CONFIG_BOOKE_WDT)
 	bl	WatchdogException
 #else
 	bl	unknown_nmi_exception
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 25642e802ed3da4397ce18537e828d0149bc0d69..3b3c4837bb74140fc010dbd5882a462252adab33 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -294,7 +294,7 @@ interrupt_base:
 
 	/* Watchdog Timer Interrupt */
 	/* TODO: Add watchdog support */
-#ifdef CONFIG_BOOKE_WDT
+#if IS_ENABLED(CONFIG_BOOKE_WDT)
 	CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, WatchdogException)
 #else
 	CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, unknown_exception)
diff --git a/arch/powerpc/kernel/head_85xx.S b/arch/powerpc/kernel/head_85xx.S
index 8867596d35adc8197f07bb04971c16aa8f6485a2..8e17c8642b2f549e58a0c0121b855e49b6ce44f7 100644
--- a/arch/powerpc/kernel/head_85xx.S
+++ b/arch/powerpc/kernel/head_85xx.S
@@ -404,7 +404,7 @@ interrupt_base:
 	EXCEPTION(0x3100, FIT, FixedIntervalTimer, unknown_exception)
 
 	/* Watchdog Timer Interrupt */
-#ifdef CONFIG_BOOKE_WDT
+#if IS_ENABLED(CONFIG_BOOKE_WDT)
 	CRITICAL_EXCEPTION(0x3200, WATCHDOG, WatchdogTimer, WatchdogException)
 #else
 	CRITICAL_EXCEPTION(0x3200, WATCHDOG, WatchdogTimer, unknown_exception)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 3a8f5416e3f6e1edbb654a763dc82060682549ae..bc780c7c198d8541a9fffc4158b142082dc3a71e 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -2240,7 +2240,7 @@ void __noreturn unrecoverable_exception(struct pt_regs *regs)
 		;
 }
 
-#ifdef CONFIG_BOOKE_WDT
+#if IS_ENABLED(CONFIG_BOOKE_WDT)
 DEFINE_INTERRUPT_HANDLER_NMI(WatchdogException)
 {
 	printk (KERN_EMERG "PowerPC Book-E Watchdog Exception\n");
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index bda86a076f7217e785c566d3f625fa41f86c650c..46cedbfe5268e5e62f91c1c6e2d923e29510061b 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -960,7 +960,7 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
 		break;
 	case BOOKE_INTERRUPT_WATCHDOG:
 		kvmppc_fill_pt_regs(&regs);
-#ifdef CONFIG_BOOKE_WDT
+#if IS_ENABLED(CONFIG_BOOKE_WDT)
 		WatchdogException(&regs);
 #else
 		unknown_exception(&regs);

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106


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

end of thread, other threads:[~2026-12-04  2:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  2:35 [PATCH] powerpc/booke: use IS_ENABLED(CONFIG_BOOKE_WDT) for WatchdogException Pengpeng Hou
2026-12-04  2:44 ` sashiko-bot

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