From: "René Rebe" <rene@exactco.de>
To: linux@roeck-us.net
Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org
Subject: [PATCH v2] fix it87_wdt early reboot w/ FW started timer
Date: Sun, 16 Nov 2025 14:59:08 +0100 (CET) [thread overview]
Message-ID: <20251116.145908.308086523429052446.rene@exactcode.com> (raw)
Some products, such as the Ugreen dxp4800 plus NAS, ship with the it87
wdt enabled by the firmware and a broken BIOS option that does not
allow to change the defautl time or turn it off. This makes installing
Linux difficult and annoyingly rebooting early in an installer; unless
one loads and starts a watchdogd in the installer environment.
Change it87_wdt to report a running timer to the watchdog core using
the user supplied or module's default time and set it as the timer
might already be up and trigger soon.
Signed-off-by: René Rebe <rene@exactco.de>
--- a/drivers/watchdog/it87_wdt.c 2025-09-28 23:39:22.000000000 +0200
+++ b/drivers/watchdog/it87_wdt.c 2025-11-16 14:18:24.759115286 +0100
@@ -4,6 +4,7 @@
* for ITE IT87xx Environment Control - Low Pin Count Input / Output
*
* (c) Copyright 2007 Oliver Schuster <olivers137@aol.com>
+ * (c) Copyright 2025 René Rebe <rene@exactco.de>
*
* Based on softdog.c by Alan Cox,
* 83977f_wdt.c by Jose Goncalves,
@@ -188,6 +189,15 @@
superio_outb(t >> 8, WDTVALMSB);
}
+/* Internal function, should be called after superio_select(GPIO) */
+static unsigned int _wdt_get_timeout(void)
+{
+ unsigned int ret = superio_inb(WDTVALLSB);
+ if (max_units > 255)
+ ret |= superio_inb(WDTVALMSB) << 8;
+ return ret;
+}
+
static int wdt_update_timeout(unsigned int t)
{
int ret;
@@ -292,6 +302,7 @@
u8 ctrl;
int quirks = 0;
int rc;
+ unsigned int _timeout;
rc = superio_enter();
if (rc)
@@ -374,8 +385,6 @@
}
}
- superio_exit();
-
if (timeout < 1 || timeout > max_units * 60) {
timeout = DEFAULT_TIMEOUT;
pr_warn("Timeout value out of range, use default %d sec\n",
@@ -388,6 +397,17 @@
wdt_dev.timeout = timeout;
wdt_dev.max_timeout = max_units * 60;
+ /* wdt already left running by fw bios? */
+ _timeout = _wdt_get_timeout();
+ if (_timeout) {
+ pr_warn("Left running by firmware.\n");
+ wdt_dev.max_hw_heartbeat_ms = timeout * 1000;
+ set_bit(WDOG_HW_RUNNING, &wdt_dev.status);
+ _wdt_update_timeout(timeout);
+ }
+
+ superio_exit();
+
watchdog_stop_on_reboot(&wdt_dev);
rc = watchdog_register_device(&wdt_dev);
if (rc)
--
René Rebe, ExactCODE GmbH, Berlin, Germany
https://exactcode.com | https://t2linux.com | https://rene.rebe.de
next reply other threads:[~2025-11-16 13:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-16 13:59 René Rebe [this message]
2025-11-16 16:22 ` [PATCH v2] fix it87_wdt early reboot w/ FW started timer Guenter Roeck
2025-11-16 17:14 ` René Rebe
2025-11-16 18:43 ` Guenter Roeck
2025-11-16 19:42 ` René Rebe
2025-11-16 23:59 ` Guenter Roeck
2025-11-16 20:09 ` [PATCH v3] " René Rebe
2025-11-17 0:16 ` Guenter Roeck
2025-11-17 9:51 ` René Rebe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251116.145908.308086523429052446.rene@exactcode.com \
--to=rene@exactco.de \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox