summaryrefslogtreecommitdiff
path: root/drivers/watchdog
AgeCommit message (Collapse)Author
12 hoursMerge branch 'watchdog-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
12 hoursMerge branch 'mm-nonmm-stable' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm # Conflicts: # arch/s390/kernel/traps.c
48 hourswatchdog: mediatek: Apply the driver's mode to a watchdog left runningRyan Brue
When the bootloader leaves the watchdog enabled, probe only marks it running and sets the timeout, so WDT_MODE keeps whatever the bootloader wrote. The Amazon Fire HD 10 (2017) bootloader leaves dual mode with the bark IRQ enabled, and no pretimeout is configured, so each timeout only raises the IRQ and restarts the count: with the 20 s timeout systemd sets, a hung system was reset after 37.95-39.76 s, and after 18.25-20.92 s once IRQ_EN was cleared by hand. Program the mode as mtk_wdt_start() does, which also applies mediatek,disable-extrst and mediatek,reset-by-toprgu to a running watchdog; read those two properties first. Fixes: bbece05c0d3a ("watchdog: mtk_wdt: Remove mtk_wdt_stop() in probe() to prevent the system freeze and it doesn't reboot by watchdog problem") Assisted-by: LLM Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com> Link: https://patch.msgid.link/20260923-rbrue-suez-upstreaming-mtk-wdt-dual-mode-v1-1-0970852315e4@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8 dayspanic: restore variable arguments to nmi_panic()Bradley Morgan
nmi_panic() used to accept variable arguments until commit ebc41f20d77f ("panic: change nmi_panic from macro to function") flattened it to a final message string. vpanic() did not exist back then, so the function had to format through panic("%s", msg). Bring the variable arguments back and format with vpanic() directly. The next patch makes nmi_panic() try the panic_force_cpu= redirect before claiming panic_cpu. panic_try_force_cpu() needs to print the message but it is used also by panic() which accepts variable argument list. The string could be formatted only when a CPU gets assigned to process the redirection. Otherwise, there might be a race when writing to the `panic_force_buf`. No current caller passes a string with format specifiers. The closest one is hpwdt_pretimeout(), which builds panic_msg with hex_byte_pack() and has only two variants, both plain strings. But the new __printf() annotation on nmi_panic() would warn with -Wformat-security there because the buffer is passed directly as the format argument, so switch it to nmi_panic(regs, "%s", panic_msg). [pmladek@suse.com: changelog fix] Link: https://lore.kernel.org/arJxFybmtD7OBIcL@pathway.suse.cz Link: https://lore.kernel.org/20260916182957.7788-5-brads@mainlining.org Signed-off-by: Bradley Morgan <brads@mainlining.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Suggested-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Cc: Guenetr Roeck <linux@roeck-us.net> Cc: Sashiko <sashiko-bot@kernel.org> Cc: Wang Jinchao <wangjinchao600@gmail.com> Cc: Wim Van Sebroeck <wim@linux-watchdog.org> Cc: <stable@vger.kernel.org>
2026-09-25watchdog: mediatek: Apply the driver's mode to a watchdog left runningRyan Brue
When the bootloader leaves the watchdog enabled, probe only marks it running and sets the timeout, so WDT_MODE keeps whatever the bootloader wrote. The Amazon Fire HD 10 (2017) bootloader leaves dual mode with the bark IRQ enabled, and no pretimeout is configured, so each timeout only raises the IRQ and restarts the count: with the 20 s timeout systemd sets, a hung system was reset after 37.95-39.76 s, and after 18.25-20.92 s once IRQ_EN was cleared by hand. Program the mode as mtk_wdt_start() does, which also applies mediatek,disable-extrst and mediatek,reset-by-toprgu to a running watchdog; read those two properties first. Fixes: bbece05c0d3a ("watchdog: mtk_wdt: Remove mtk_wdt_stop() in probe() to prevent the system freeze and it doesn't reboot by watchdog problem") Assisted-by: LLM Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com> Link: https://patch.msgid.link/20260923-rbrue-suez-upstreaming-mtk-wdt-dual-mode-v1-1-0970852315e4@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-22watchdog: Replace __MODULE_STRING() with __stringify()Petr Pavlu
__MODULE_STRING() has been an alias for __stringify() since "[PATCH] MODULE_PARM support for older modules" [1] in 2002-12. That change also moved it to the graveyard section at the end of linux/module.h Replace the remaining uses of __MODULE_STRING() with __stringify() in preparation for its removal. Link: https://git.kernel.org/tglx/history/c/136839a1b4 [1] Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://patch.msgid.link/20260922-module-string-v1-1-c18766690185@suse.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: use assign_bit() where applicablePeng Fan
Convert open-coded if/else with set_bit/clear_bit and their non-atomic __set_bit/__clear_bit variants to the assign_bit/__assign_bit API. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://patch.msgid.link/20260918141915.3023207-1-peng.fan@oss.nxp.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: mediatek: Add support for mt8167 toprgu/watchdogLuca Leonardo Scorcia
Add support for the Top Reset Generation Unit/Watchdog Timer found on mt8167. Since according to its data sheet mt8167 toprgu reset bits are not contiguous, add support for a reset table to the driver. This lets us define reset identifiers as contiguous indexes in the binding headers. Also address a preexisting Sashiko finding that noticed that the has_swsysrst_en configuration was set after the reset controller registration. Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com> Link: https://patch.msgid.link/20260908174259.9009-5-l.scorcia@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: sp805_wdt: fix suspend/resume handling of HW_RUNNING watchdogLi Jun
sp805_wdt_suspend() and sp805_wdt_resume() only check watchdog_active(), when the watchdog is left running by the driver sets WDOG_HW_RUNNING in sp805_wdt_probe() but userspace never opens the device, so WDOG_ACTIVE remains cleared, the wdt_disable() will not be executed in sp805_wdt_suspend. In this case, the suspend callback is a no-op and the watchdog keeps counting during system suspend, leading to an unexpected system reset. Check WDOG_HW_RUNNING and wdt->wdd,can fix this issue. Signed-off-by: Li Jun <lijun01@kylinos.cn> Link: https://patch.msgid.link/20260911030531.837140-1-lijun01@kylinos.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: PM: use DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr for dev_pm_opsLi Jun
Replace the deprecated SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS. This also drops the __maybe_unused annotations on the suspend/resume callbacks, since pm_sleep_ptr() inside the new macro already handles the case where CONFIG_PM_SLEEP is disabled. Wrap the dev_pm_ops assignment with pm_sleep_ptr() so the entire dev_pm_ops structure is dropped when CONFIG_PM_SLEEP is disabled, instead of leaving it as a dead struct with NULL callbacks. Signed-off-by: Li Jun <lijun01@kylinos.cn> Link: https://patch.msgid.link/20260910124730.1127847-1-lijun01@kylinos.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: mediatek: Add wdt/toprgu resets for mt6589Luca Leonardo Scorcia
According to Android sources, mt6589 has 12 reset bits in the WDT_SWSYSRST register. Populate toprgu_sw_rst_num to allow toprgu resets in device trees of the many compatible devices. Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com> Link: https://patch.msgid.link/20260908174259.9009-2-l.scorcia@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: msc313e: Replace commas with semicolons in probe()Tzung-Bi Shih
Replace commas at the end of statements with semicolons in probe(). Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260828161348.13212-10-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: sp805: Replace SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPSLi Jun
Replace the deprecated SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS. This also drops the __maybe_unused annotations on the suspend/resume callbacks, since pm_sleep_ptr() inside the new macro already handles the case where CONFIG_PM_SLEEP is disabled. Additionally, wrap the &sp805_wdt_dev_pm_ops assignment with pm_sleep_ptr() so the entire dev_pm_ops structure is dropped when CONFIG_PM_SLEEP is disabled, instead of leaving it as a dead struct with NULL callbacks. Signed-off-by: Li Jun <lijun01@kylinos.cn> Link: https://patch.msgid.link/20260908104905.3388262-1-lijun01@kylinos.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: fix repeated words in commentsHemanth Selam
Drop words accidentally written twice, reported by checkpatch.pl as a possible repeated word. Only touches comments, no code changes. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Link: https://patch.msgid.link/20260904113744.19872-3-hemanth.selam@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: fix typos in commentsHemanth Selam
Fix typos in comments, reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches comments, no code changes. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Link: https://patch.msgid.link/20260904113744.19872-2-hemanth.selam@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: i6300esb: do not stop an already running watchdogJan Kiszka
esb_initdevice() unconditionally disabled the WDT, stopping a watchdog that firmware had left running instead of taking over its care. Detect the enable bit in the lock register, set WDOG_HW_RUNNING like the other watchdog drivers do, and simply reset the timeout to the configured value. Assisted-by: opencode:Qwen3.8-27B Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Link: https://patch.msgid.link/ea413e5d-9f37-46b8-8d93-863aa065a784@siemens.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: Differentiate scenarios when watchdog is closedCharles Haithcock
Presently, when a watchdog device is closed, we print "watchdog did not stop" in a few different scenarios; 1. When nowayout is set 2. When the watchdog is able to close, has received the magic character to stop, but fails to close in device-specific code paths 3. When userspace deliberately closes it without stopping it For 1, we explicitly print we can not close because of nowayout. Nothing differentiates the other two however. This change adds a print to indicate the watchdog was closed while still running. Suggested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Charles Haithcock <chaithco@redhat.com> Link: https://patch.msgid.link/20260901214251.760184-1-chaithco@redhat.com [groeck: Fixed multi-line alignment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: mediatek: acknowledge pretimeout interruptWanming Gao
The MediaTek watchdog pretimeout interrupt is level-triggered and does not have a separate acknowledge register. The interrupt is cleared by changing WDT_MODE_IRQ_LEVEL_EN and then restoring it to its original state. Without this transition, the interrupt may remain asserted and cause an interrupt storm. After changing WDT_MODE_IRQ_LEVEL_EN, wait 70 us before restoring it. This is longer than two 32 kHz watchdog clock cycles, allowing the level change to propagate across the clock domain. WDT_MODE is also updated by the watchdog start, stop, and pretimeout operations. Protect its read-modify-write sequences and the complete IRQ acknowledge sequence with the watchdog spinlock so that concurrent updates cannot overwrite the temporary IRQ level state. Signed-off-by: Wanming Gao <wanming.gao@mediatek.com> Tested-by: Tzung-Bi Shih <tzungbi@kernel.org> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260827092616.2724197-1-wanming.gao@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: s3c2410_wdt: Add exynos5515-wdt compatible dataAiden Isik
Add driver data for the Exynos5515 SoC's watchdog timer. Unlike similar SoCs such as GS101 or Exynos990, Exynos5515's PMU does not require explicit counter enablement for the watchdog to tick. Signed-off-by: Aiden Isik <aidenisik@member.fsf.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20260821-for-next-lucky7-watchdog-v4-2-d070cee5009f@member.fsf.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: sbsa_gwdt: add early_enable module parameterZexin Wang
On SBSA platforms using standard UEFI firmware (such as EDK II), the watchdog timer is often enabled during early boot stages but explicitly disabled by the firmware before handing over control to the OS (e.g., during ExitBootServices). This is done to prevent unintended resets while the OS is loading, assuming the OS watchdog driver will take over. However, this leaves a protection gap. If the system hangs between the firmware handover and the userspace watchdog daemon startup, the hardware watchdog will not fire to recover the system. For safety-critical systems that require continuous hardware watchdog protection from the earliest possible moment, this gap is problematic. Add an 'early_enable' module parameter to allow the kernel driver to re-enable the watchdog immediately during probe if it was left disabled by the firmware. By setting the WDOG_HW_RUNNING status bit, the watchdog core is instructed that the hardware is active. As a result, the core's pre-userspace handler (controlled by 'handle_boot_enabled') will automatically issue periodic keepalives until userspace opens the device. This bridges the protection gap seamlessly without requiring firmware modifications and without risking unintended resets during kernel boot. The parameter defaults to false to preserve the traditional behavior. Signed-off-by: Zexin Wang <ot_zexin.wang@mediatek.com> Link: https://patch.msgid.link/20260817023838.6459-1-ot_zexin.wang@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-21watchdog: sp5100_tco: allow unreserved MMIO on GA-78LMT-USB3Christoph Berliner
The Gigabyte GA-78LMT-USB3 firmware programs the legacy SP5100 watchdog MMIO window at 0xfec000f0. This address falls inside the IOAPIC resource, so sp5100_tco fails to reserve it and aborts probing. Do not relocate or reprogram the watchdog. Instead, add a narrowly scoped DMI quirk for this board which permits use of the firmware-provided MMIO address without reserving it. The exception is limited to the legacy SP5100 register layout, the GA-78LMT-USB3 DMI identity, and the firmware address 0xfec000f0. All other systems retain the existing resource reservation behavior. On the affected system the watchdog initializes successfully and /dev/watchdog0 is registered while the firmware-programmed watchdog base remains unchanged at 0xfec000f0 during load and unload. Tested on a Gigabyte GA-78LMT-USB3 with AMD SBx00 SMBus controller (PCI 1002:4385, revision 0x3c). Signed-off-by: Christoph Berliner <caberliner@gmail.com> Link: https://patch.msgid.link/20260821142511.49934-1-caberliner@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-18watchdog: da9063: fix suspend/resume handling of HW_RUNNING watchdogLi Jun
da9063_wdt_suspend() and da9063_wdt_resume() only check watchdog_active(), when the watchdog is left running by the driver sets WDOG_HW_RUNNING in da9063_wdt_probe() but userspace never opens the device, so WDOG_ACTIVE remains cleared, the wdt_disable() will not be executed in da9063_wdt_suspend. In this case, the suspend callback is a no-op and the watchdog keeps counting during system suspend, leading to an unexpected system reset. Check WDOG_HW_RUNNING and wdd,can fix this issue. Fixes: a7ceca4398bc8 ("watchdog: da9063: optionally disable watchdog during suspend") Cc: stable@vger.kernel.org Signed-off-by: Li Jun <lijun01@kylinos.cn> Link: https://patch.msgid.link/20260917013710.2754679-1-lijun01@kylinos.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: starfive-wdt: Fix runtime PM leak in starfive_wdt_pm_start()Wentao Liang
starfive_wdt_pm_start() takes a runtime PM reference with pm_runtime_get_sync(), which increments the usage counter even when it fails, and returns the error without dropping it again. The watchdog core does not invoke the stop callback when start fails, so the reference taken on the error path is leaked. Use pm_runtime_resume_and_get() instead, which keeps the usage counter balanced when the resume fails. Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260916170704.2086331-1-vulab@iscas.ac.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: da9062: fix suspend/resume handling of HW_RUNNING watchdogLi Jun
da9062_wdt_suspend() and da9062_wdt_resume() only check watchdog_active(), when the watchdog is left running by the driver sets WDOG_HW_RUNNING in da9062_wdt_probe() but userspace never opens the device, so WDOG_ACTIVE remains cleared, the wdt_disable() will not be executed in da9062_wdt_suspend. In this case, the suspend callback is a no-op and the watchdog keeps counting during system suspend, leading to an unexpected system reset. Check WDOG_HW_RUNNING and wdt->wdd,can fix this issue. Fixes: f6c98b08381c7 ("watchdog: da9062: add power management ops") Cs: stable@vger.kernel.org Signed-off-by: Li Jun <lijun01@kylinos.cn> Link: https://patch.msgid.link/20260914062353.582205-1-lijun01@kylinos.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: msc313e: Fix premature reset during timeout updateTzung-Bi Shih
Updating the 32-bit hardware timeout requires writing to two 16-bit registers sequentially. If the watchdog is actively running, this non-atomic update might trigger a premature system reset. Clear the watchdog counter before updating the registers to prevent the timer from timing out prematurely against an intermediate threshold. Fixes: e9800b799464 ("watchdog: Add Mstar MSC313e WDT driver") Cc: stable@vger.kernel.org Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260913065126.8350-1-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: msc313e: Propagate error code in resume()Tzung-Bi Shih
If msc313e_wdt_start() fails during system resume, the error is currently ignored. Consequently, the watchdog isn't running without the user's knowledge. Propagate the error code and print a message if msc313e_wdt_start() fails. Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Fixes: e9800b7994642 ("watchdog: Add Mstar MSC313e WDT driver") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260912163334.28636-1-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: rzv2h: Avoid division by zeroTzung-Bi Shih
clk_get_rate() could return 0. Avoid a division by zero panic. Fixes: f6febd0a30b6 ("watchdog: Add Watchdog Timer driver for RZ/V2H(P)") Cc: stable@vger.kernel.org Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260913064851.8239-4-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: rtd119x: Avoid division by zeroTzung-Bi Shih
clk_get_rate() could return 0. Avoid a division by zero panic. Fixes: 2bdf6acbfead ("watchdog: Add Realtek RTD1295") Cc: stable@vger.kernel.org Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260913064851.8239-3-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: digicolor: Avoid division by zeroTzung-Bi Shih
clk_get_rate() could return 0. Avoid a division by zero panic. Since get_timeleft() cannot propagate errors, check the clock rate early in probe() and cache the rate in the driver data as it is unlikely to change at runtime. Fixes: 336694a01dae ("watchdog: digicolor: driver for Conexant Digicolor CX92755 SoC") Cc: stable@vger.kernel.org Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Acked-by: Baruch Siach <baruch@tkos.co.il> Link: https://patch.msgid.link/20260913064851.8239-2-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-16watchdog: sp5100_tco: Fix pci_dev reference leak in sp5100_tco_init()Wentao Liang
sp5100_tco_init() stores the PCI device matched by for_each_pci_dev() in the global sp5100_tco_pci and keeps its reference for the lifetime of the driver, but neither sp5100_tco_exit() nor the error paths of sp5100_tco_init() call pci_dev_put(), leaking the reference on driver registration failure and on every module load/unload cycle. Drop the reference when the platform driver or device registration fails and when the module is unloaded. Fixes: 15e28bf13008 ("watchdog: Add support for sp5100 chipset TCO") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260916170511.2086199-1-vulab@iscas.ac.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-09watchdog: msc313e: Sync timeout value if WDT was running at bootTzung-Bi Shih
If WDT was running at boot, the hardware timeout might be set to values other than the final software timeout. To be consistent, set the hardware timeout to match the final software timeout (i.e., after watchdog_init_timeout()) if WDT was running. Fixes: ffd264bd152c ("watchdog: msc313e: Check if the WDT was running at boot") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260828161348.13212-8-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-09watchdog: msc313e: Fix undefined behaviorTzung-Bi Shih
readw() returns a u16. Left shifting a u16 by 16 bits yields undefined behavior. Cast to u32 explicitly before the shift. Fixes: ffd264bd152c ("watchdog: msc313e: Check if the WDT was running at boot") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260828161348.13212-7-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-09watchdog: msc313e: Fix spurious reset on suspendTzung-Bi Shih
If the hardware watchdog was started by the bootloader and the device is suspended before userspace opens it, the ping worker (from watchdog core) is frozen and the active hardware timer continues running. This leads to a spurious system reset. Check both watchdog_active() and watchdog_hw_running() when deciding whether to start or stop the watchdog during suspend and resume. Additionally, call watchdog_stop_ping_on_suspend() to ensure the ping worker be correctly paused and restarted during suspend and resume. Fixes: ffd264bd152c ("watchdog: msc313e: Check if the WDT was running at boot") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260828161348.13212-6-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-09watchdog: msc313e: Enable clock before accessing hardware registersTzung-Bi Shih
msc313e_wdt_probe() reads from hardware registers without ensuring the required clock is enabled. Furthermore, if the bootloader leaves the watchdog running, msc313e_wdt_probe() sets WDOG_HW_RUNNING without increasing the clock's reference count. While the clock is currently supplied as a fixed clock by the device tree (`xtal_div2` in arch/arm/boot/dts/sigmastar/mstar-v7.dtsi) which masks the physical issue, this still violates the API usage. Call clk_prepare_enable() before reading WDT registers. If the WDT is running, leave the clock enabled so the CCF reference counter is balanced. Fixes: ffd264bd152c ("watchdog: msc313e: Check if the WDT was running at boot") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260828161348.13212-5-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-09watchdog: msc313e: Fix clock leak and spurious timer in settimeout()Tzung-Bi Shih
msc313e_wdt_settimeout() unconditionally calls msc313e_wdt_start() which introduces two severe bugs: 1. If the watchdog is already active, calling start() again will increase the reference count of the clock again. However stop() is only called once, the reference count is unbalance. 2. If the watchdog is stopped, calling settimeout() will start the hardware timer accidentally. Factor out the register-writing logic into a helper function. Only call it in settimeout() if the watchdog is running. Otherwise, simply update `wdev->timeout`. Fixes: e9800b799464 ("watchdog: Add Mstar MSC313e WDT driver") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260828161348.13212-4-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-09watchdog: msc313e: Avoid division by zeroTzung-Bi Shih
clk_get_rate() could return 0. Avoid a division by zero panic. Fixes: e9800b799464 ("watchdog: Add Mstar MSC313e WDT driver") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260828161348.13212-3-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-09-09watchdog: fix hrtimer start when pretimeout is zeroDavid Arcari
Per the watchdog API, a pretimeout value of 0 disables the feature. However, watchdog_hrtimer_pretimeout_start() fails to verify if the pretimeout is non-zero before arming the timer. This omission inadvertently starts the software pretimeout timer, which could result in the pretimeout handler executing incorrectly when the watchdog timeout is reached. Fix this by adding a check for wdd->pretimeout before calling hrtimer_start(), ensuring the disabled state is respected. Fixes: 7b7d2fdc8c3e ("watchdog: Add hrtimer-based pretimeout feature") Signed-off-by: David Arcari <darcari@redhat.com> Link: https://patch.msgid.link/20260903182029.936030-1-darcari@redhat.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-30watchdog: msc313e: Fix NULL pointer dereference in PM callbacksTzung-Bi Shih
msc313e_wdt_probe() doesn't set the driver data for the platform device. As a result, dev_get_drvdata() in msc313e_wdt_suspend() and msc313e_wdt_resume() will return NULL, leading to a NULL pointer dereference afterward. Set the platform device driver data in msc313e_wdt_probe(). Fixes: e9800b799464 ("watchdog: Add Mstar MSC313e WDT driver") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/20260827044700.554333-2-tzungbi@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-30watchdog: sunxi_wdt: preserve boot-enabled watchdogJames Hilliard
sunxi_wdt_probe() unconditionally stops the watchdog even when firmware left it running. This opens an unprotected interval during boot and prevents CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED from taking over the active watchdog. Detect an enabled watchdog and decode its programmed interval. Preserve representable timeouts, and round the 0.5-second interval up to the minimum representable one-second timeout. Use the configured timeout for reserved interval encodings. Set the Linux reset mode and ping the watchdog without clearing its enable bit, then mark it hardware-running before registration so the watchdog core services it until userspace takes control. Leave disabled watchdogs untouched. Fixes: d00680ed0026 ("watchdog: sunxi: New watchdog driver for Allwinner A10/A13") Cc: stable@vger.kernel.org Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Link: https://patch.msgid.link/20260827-submit-sunxi-wdt-boot-enabled-v1-v2-1-610d37dccc97@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-27Merge tag 'mfd-next-7.3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "New Support & Features: - MediaTek MT6397: Add mt6323 AUXADC support - MediaTek MT6397: Add mt6323 EFUSE support - Spreadtrum SC27xx: Add SC2730 regulator cell Improvements & Fixes: - Apple SMC: Fix key count endianness annotation - Azoteq IQS62x: Reject zero-length firmware records - ChromeOS EC: Introduce cros_ec_read_features helper and read features during probe to catch transfer errors - Cirrus Logic CS42L43: Fix regmap defaults ordering - Cirrus Logic CS42L43: Remove redundant NULL checks on SoundWire - Congatec Board Controller: Fix teardown ordering in cgbc_remove() - HP iPAQ Micro: Fix out-of-bounds stack read in ipaq_micro_str - Marvell 88PM886: Initialize the battery page - QNAP MCU: Keep the reply buffer alive past a command timeout - RAVE SP: Validate received frame payload lengths - Silicon Labs Si476x: Drop duplicate NULL checks - Silicon Labs Si476x: Modernize GPIO handling - Silicon Motion SM501: Fix potential memory leaks during remove - UCB1x00: Convert Assabet gpio-keys to use software nodes and register software node for GPIO controller - Viperboard: Fix native fields type in structures as little-endian - Viperboard: Remove redundant NULL check before kfree() - X-Powers AXP20x: Preserve other control bits when powering off Cleanups & Refactoring: - Core: Drop unused assignment of spi_device_id driver data - Core: Initialize spi_device_id arrays using member names - Core: Unify style of spi_device_id arrays - Maintainers: Add Intel LPSS section to follow the changes - Maintainers: Add a mailing list entry to MFD - Cirrus Logic CS42L43: Format sdw_device_id table - Cirrus Logic CS42L43: Use new SoundWire enumeration helper - ROHM PMIC: Factor out power button registration and convert gpio-keys to use software nodes - ST-Ericsson DB8500: Fold dbx500 header into db8500 Device Tree Binding Updates: - Core: Add techvision vendor prefix - Marvell 88PM886: Allow vbus regulator - MediaTek MT8195 SCP: Add support for MT8189 SoC - Qualcomm SPMI PMIC: Document PMG1110 - Qualcomm SPMI PMIC: Document haptics device - Qualcomm TCSR: Add compatible for Hawi and Maili SoCs - Qualcomm TCSR: Add compatible for Shikra - Qualcomm TCSR: Document the IPQ9650 TCSR block - STMicroelectronics STMPE: Fix typo st,stmpe601 (should be st,stmpe610) - Syscon: Add ESWIN EIC7700 compatible - Syscon: Allow syscon compatible for Loongson-2K0300 chip id - Syscon: Disallow simple-bus with syscon - Syscon: Drop custom select for older dtschema - TI OMAP USBHS TLL: Convert to DT schema" * tag 'mfd-next-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (45 commits) mfd: cs42l43: Fix regmap defaults ordering dt-bindings: mfd: syscon: Allow syscon compatible for Loongson-2K0300 chip id dt-bindings: mfd: syscon: Add ESWIN EIC7700 compatible mfd: qnap-mcu: keep the reply buffer alive past a command timeout dt-bindings: mfd: qcom,tcsr: Document the IPQ9650 TCSR block mfd: macsmc: Fix key count endianness annotation dt-bindings: mfd: qcom,spmi-pmic: Document haptics device mfd: iqs62x: Reject zero-length firmware records mfd: rave-sp: validate received frame payload lengths mfd: sm501: Fix potential memory leaks during remove mfd: viperboard: Fix native fields type in structures as little-endian mfd: si476x-i2c: Get rid of duplicate NULL checks dt-bindings: mfd: Convert OMAP USB TLL to DT schema mfd: cgbc: Fix teardown ordering in cgbc_remove() mfd: mt6397-core: Add mt6323 AUXADC support dt-bindings: mfd: qcom,tcsr: Add compatible for Hawi and Maili SoCs mfd: rohm: Factor out power button registration mfd: ucb1x00: Convert Assabet gpio-keys to use software nodes mfd: ucb1x00: Register software node for GPIO controller mfd: cs42l43: Tidy up formatting on sdw_device_id table ...
2026-08-19Merge tag 'watchdog-for-v7.3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull watchdog updates from Guenter Roeck: "New Drivers: - Nuvoton MA35D1 - Lenovo SE30G2 and SE60 Added support to existing drivers: - snps,dw-wdt: Add RV1106 compatible - apple,wdt: Add t6030, t6031, and t8132 compatibles Other notable changes: - New "dump" pretimeout governor - Propagate errors from optional IRQ lookup - Remove redundant dev_err() and dev_err_probe() messages - npcm, qcom: Improved bootstatus reports - realtek-otto: Change to use regmap API - w83627hf_wdt: Report running watchdog, identify NCT6126 Various other minor fixes and improvements" * tag 'watchdog-for-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (40 commits) watchdog: orion_wdt: Propagate errors from optional IRQ lookup watchdog: qcom: Propagate errors from optional IRQ lookup watchdog: aspeed: Propagate errors from optional IRQ lookup watchdog: stm32_iwdg: Propagate errors from optional IRQ lookup watchdog: dw_wdt: Propagate errors from optional IRQ lookup watchdog: mediatek: Propagate errors from optional IRQ lookup watchdog: apple: Constify some structures watchdog: pretimeout: Convert dump pretimeout governor to tristate nmi: Export CPU backtrace APIs for loadable modules watchdog: booke_wdt: Document unused parameter of __booke_wdt_disable() watchdog: wdat_wdt: map registers that fall inside ACPI NVS watchdog: Add Nuvoton MA35D1 watchdog driver support dt-bindings: watchdog: Add MA35D1 Watchdog watchdog: qcom: report bootstatus on IPQ9574 and IPQ5332 watchdog: qcom: report WDIOF_POWERUNDER in bootstatus watchdog: sprd: Remove redundant dev_err() watchdog: sama5d4: Remove redundant dev_err() watchdog: realtek_otto: Remove redundant dev_err_probe() watchdog: orion: Remove redundant dev_err() watchdog: marvell_gti: Remove redundant dev_err_probe() ...
2026-08-18Merge tag 'powerpc-7.3-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc updates from Madhavan Srinivasan: - Enable Rust for ppc64le - ppc4xx gpio driver updates - Add power12 base enablement support - Validate arch_compat against host compatibility mode - Simplify bootx_scan_dt_build_struct() in powermac platform - Implement get_direction() in cpm2 - Use cpu_relax() in ps3_create_spu() - Add NULL guard for cause_ipi in smp_muxed_ipi_message_pass - Fixes to handle pseries watchdogs in kdump path - Fix missing r2 clobber in PCREL inline assembly - Set GPIO chip parent on ppc44x - KVM: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl - KVM: Use generic xfer to guest work function - Enable to run posix cpu timers in task context - Misc fixes and cleanups Thanks to Aditya Gupta, Alice Ryhl, Amit Machhiwal, Andrew Morton, Anushree Mathur, Athira Rajeev, Bartosz Golaszewski, Cédric Le Goater, Christian König, Christophe Leroy (CS GROUP), Gary Guo, Gaurav Batra, Gautam Menghani, Gou Hao, Hari Bathini, Harsh Prateek Bora, jiazhenyuan, Jinjie Ruan, Link Mauve, Linus Walleij, Mahesh Kumar G Mahesh Salgaonkar, Michael Walle, Michal Suchánek, Mukesh Kumar Chaurasiya (IBM), Nicholas Piggin, Nikhil Kumar Singh, Praveen K Pandey, Ritesh Harjani (IBM), Rosen Penev, Saket Kumar Bhaskar, Shrikanth Hegde, Sourabh Jain, Thorsten Blum, Vaibhav Jain, Venkat Rao Bagalkote, Vishal Chourasia, Wentao Guan, and Yanfei Xu. * tag 'powerpc-7.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (62 commits) powerpc/pseries/iommu: switch to Default DMA window during kdump powerpc/configs: enable CONFIG_RAS to fix EDAC support KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctl KVM: PPC: Book3S HV: Add support for compat CPU capabilities for KVM on PowerNV KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl gpio: ppc44x: use dev_name() for chip label gpio: ppc44x: fix undefined behavior in GPIO_MASK2 macro gpio: ppc44x: drop PPC-specific IO helpers gpio: ppc44x: Convert GPIO to generic MMIO gpio: ppc44x: Use platform resource helper for GPIO MMIO gpio: ppc44x: Use module platform driver helper for GPIO gpio: ppc44x: update all 4xx to 44x gpio: move ppc4xx gpio driver from arch/powerpc to drivers/gpio KVM: PPC: Use min() in kvm_vm_ioctl_check_extension() KVM: PPC: booke: Use min() in watchdog_next_timeout() powerpc/perf: Add power12 Base Performance Monitoring support powerpc: Add Power12 architected mode powerpc: Add Power12 raw mode powerpc/pseries: Limit PVR list to 16 entries for CAS negotiation ...
2026-08-10watchdog: orion_wdt: Propagate errors from optional IRQ lookupbui duc phuc
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated. Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing probe without the IRQ. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://lore.kernel.org/r/20260810082606.42623-1-phucduc.bui@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10watchdog: qcom: Propagate errors from optional IRQ lookupbui duc phuc
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated. Instead of only checking for -EPROBE_DEFER, propagate all error codes returned by platform_get_irq_optional() other than -ENXIO, so that failures are properly reported to the caller. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://lore.kernel.org/r/20260810105101.55945-1-phucduc.bui@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10watchdog: aspeed: Propagate errors from optional IRQ lookupbui duc phuc
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated. Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing probe without the IRQ. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://lore.kernel.org/r/20260807081652.38692-4-phucduc.bui@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10watchdog: stm32_iwdg: Propagate errors from optional IRQ lookupbui duc phuc
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated. Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing probe without the IRQ. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://lore.kernel.org/r/20260807080447.35479-2-phucduc.bui@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10watchdog: dw_wdt: Propagate errors from optional IRQ lookupbui duc phuc
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated. Instead of only checking for -EPROBE_DEFER, propagate all error codes returned by platform_get_irq_optional() other than -ENXIO, so that failures are properly reported to the caller. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://lore.kernel.org/r/20260807081652.38692-3-phucduc.bui@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10watchdog: mediatek: Propagate errors from optional IRQ lookupbui duc phuc
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated. Instead of only checking for -EPROBE_DEFER, propagate all error codes returned by platform_get_irq_optional() other than -ENXIO, so that failures are properly reported to the caller. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://lore.kernel.org/r/20260807081652.38692-2-phucduc.bui@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10watchdog: apple: Constify some structuresChristophe JAILLET
'struct watchdog_ops' and 'struct watchdog_info' are not modified in this driver. Constifying these structure moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 7319 1768 0 9087 237f drivers/watchdog/apple_wdt.o After: ===== text data bss dec hex filename 7543 1544 0 9087 237f drivers/watchdog/apple_wdt.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/99019b7e560c2d9c087be340e68f9cce4db1988e.1786283336.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10watchdog: pretimeout: Convert dump pretimeout governor to tristateMayank Rungta
Commit 645ad41da8b2 ("watchdog: pretimeout: Add "dump" pretimeout governor") added the "dump" watchdog pretimeout governor, but restricted it to built-in code because trigger_all_cpu_backtrace() was not exported to loadable modules. Now that CPU backtrace APIs are supported for loadable kernel modules via cpumask_backtrace(), convert WATCHDOG_PRETIMEOUT_GOV_DUMP to tristate. This allows kernels to deliver the pretimeout governor as a loadable kernel module. Signed-off-by: Mayank Rungta <mrungta@google.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Link: https://lore.kernel.org/r/20260730-export-cpu-backtrace-apis-v1-2-bace8e1cb817@google.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>