Linux Watchdog driver development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "René Rebe" <rene@exactco.de>
Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v4] fix it87_wdt early reboot by reporting running timer
Date: Mon, 17 Nov 2025 07:24:33 -0800	[thread overview]
Message-ID: <e8b8940a-2cfe-4dea-99be-e1902f19b922@roeck-us.net> (raw)
In-Reply-To: <20251117.131124.1452225967649047223.rene@exactco.de>

On 11/17/25 04:11, René Rebe wrote:
> 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 time or turn it off. As this makes installing
> Linux rather difficult, change the it87_wdt to report it running to
> the watchdog core.
> 
> Signed-off-by: René Rebe <rene@exactco.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> v1:
> - just clear hw timer register
> v2:
> - detect running hw timer and report to watchdog core
> v3:
> - multiply TOV1 in _wdt_get_timeout
> - don't wrongly and superfluously set .max_hw_heartbeat_ms
> - don't call set_timeout manually
> v4:
> - simplify to wdt_running
> - move code up to not move superio_exit
> 
> diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c
> index 3b8488c86a2f..8ba7e03857ca 100644
> --- a/drivers/watchdog/it87_wdt.c
> +++ b/drivers/watchdog/it87_wdt.c
> @@ -188,6 +188,12 @@ static void _wdt_update_timeout(unsigned int t)
>   		superio_outb(t >> 8, WDTVALMSB);
>   }
>   
> +/* Internal function, should be called after superio_select(GPIO) */
> +static bool _wdt_running(void)
> +{
> +	return superio_inb(WDTVALLSB) || (max_units > 255 && superio_inb(WDTVALMSB));
> +}
> +
>   static int wdt_update_timeout(unsigned int t)
>   {
>   	int ret;
> @@ -374,6 +381,12 @@ static int __init it87_wdt_init(void)
>   		}
>   	}
>   
> +	/* wdt already left running by firmware? */
> +	if (_wdt_running()) {
> +		pr_info("Left running by firmware.\n");
> +		set_bit(WDOG_HW_RUNNING, &wdt_dev.status);
> +	}
> +
>   	superio_exit();
>   
>   	if (timeout < 1 || timeout > max_units * 60) {
> 


  reply	other threads:[~2025-11-17 15:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 12:11 [PATCH v4] fix it87_wdt early reboot by reporting running timer René Rebe
2025-11-17 15:24 ` Guenter Roeck [this message]
2025-12-12 20:21 ` James Hilliard
     [not found] ` <CADvTj4po1bx6AVfGKoxF38pzKURxryC17Up5Z7Ne+P5XBMZFmQ@mail.gmail.com>
2025-12-12 21:50   ` Guenter Roeck
2025-12-12 22:04     ` James Hilliard
2025-12-12 22:16       ` René Rebe
2025-12-12 22:28         ` James Hilliard
2025-12-12 22:34           ` René Rebe
2025-12-12 22:41             ` James Hilliard
2025-12-12 22:44               ` René Rebe
2025-12-12 23:00                 ` James Hilliard
2025-12-13 16:01                   ` Guenter Roeck

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=e8b8940a-2cfe-4dea-99be-e1902f19b922@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=rene@exactco.de \
    --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