[PATCH 2/2] watchdog: sbsa_gwdt: Enable the WDOG_STOP_ON_PANIC
From: George Cherian
Date: Thu Feb 20 2025 - 21:36:46 EST
Enable the watchdog stop on panic feature if the module
parameter panicnotify is set. sbsa_gwdt.panicnotify=1 will
disable the watchdog in panic situations.
This helps in avoiding watchdog reset while booting kdump kernel.
Signed-off-by: George Cherian <george.cherian@xxxxxxxxxxx>
---
Documentation/watchdog/watchdog-parameters.rst | 3 +++
drivers/watchdog/sbsa_gwdt.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/Documentation/watchdog/watchdog-parameters.rst b/Documentation/watchdog/watchdog-parameters.rst
index 0a0119edfa82..3d7a02d12dc3 100644
--- a/Documentation/watchdog/watchdog-parameters.rst
+++ b/Documentation/watchdog/watchdog-parameters.rst
@@ -523,6 +523,9 @@ sbsa_gwdt:
nowayout:
Watchdog cannot be stopped once started
(default=kernel config parameter)
+ panicnotify:
+ Watchdog to be stopped after kernel panic
+ (default=0, don't stop watchdog on panic)
-------------------------------------------------
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index 5f23913ce3b4..f289a0b32d30 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -116,6 +116,9 @@ MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+static int panicnotify;
+module_param(panicnotify, int, 0);
+MODULE_PARM_DESC(panicnotify, "after kernel panic, do: 0 = don't stop wd(*) 1 = stop wd");
/*
* Arm Base System Architecture 1.0 introduces watchdog v1 which
* increases the length watchdog offset register to 48 bits.
@@ -307,6 +310,9 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
if (status & SBSA_GWDT_WCS_EN)
set_bit(WDOG_HW_RUNNING, &wdd->status);
+ if (!nowayout && panicnotify)
+ watchdog_stop_on_panic(wdd);
+
if (action) {
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
--
2.34.1