All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Perrot (Schneider Electric)" <thomas.perrot@bootlin.com>
Cc: linux-watchdog@vger.kernel.org, conor+dt@kernel.org,
	robh@kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev,
	Frank.Li@kernel.org
Subject: Re: [PATCH v7 5/5] watchdog: aaeon: Add watchdog driver for SRG-IMX8P MCU
Date: Tue, 07 Jul 2026 08:17:02 +0000	[thread overview]
Message-ID: <20260707081703.443B51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707-dev-b4-aaeon-mcu-driver-v7-5-ca6c59abd672@bootlin.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The hardware watchdog is not stopped during system suspend if it was started by the bootloader but not yet opened by userspace, leading to a system reset.
- [High] The watchdog core's ping worker is not stopped on suspend, leading to I2C transactions on a suspended MFD parent.
- [Medium] The driver's `min_timeout` is incorrectly set to 1, violating the API contract for the hardware's fixed 25-second timeout.
--

--- Patch [5]: [PATCH v7 5/5] watchdog: aaeon: Add watchdog driver for SRG-IMX8P MCU ---
commit 7a0cc8bfbb00c11d5c1b8e4bd30df8f3d386356e
Author: Thomas Perrot (Schneider Electric) <thomas.perrot@bootlin.com>

watchdog: aaeon: Add watchdog driver for SRG-IMX8P MCU

Add watchdog driver for the Aaeon SRG-IMX8P embedded controller.
This driver provides system monitoring and recovery capabilities
through the MCU's watchdog timer.

> diff --git a/drivers/watchdog/aaeon_mcu_wdt.c b/drivers/watchdog/aaeon_mcu_wdt.c
> new file mode 100644
> index 0000000000000..9ff559a69fd7b
> --- /dev/null
> +++ b/drivers/watchdog/aaeon_mcu_wdt.c
[ ... ]
> +static int aaeon_mcu_wdt_probe(struct platform_device *pdev)
> +{
[ ... ]
> +	wdt->timeout = AAEON_MCU_WDT_TIMEOUT;
> +	wdt->min_timeout = AAEON_MCU_WDT_MIN_TIMEOUT;

[Severity: Medium]
Is it correct to set min_timeout to 1 here?

Since the hardware has a fixed 25-second timeout, the watchdog core's ping
worker can only extend timeouts, not shorten them. If a user requests a
timeout shorter than 25 seconds, the core will accept it, but the system
will still take the full 25 seconds to reboot.

Should min_timeout be set to 25 to reject impossible configurations?

> +	wdt->max_hw_heartbeat_ms = AAEON_MCU_WDT_HEARTBEAT_MS;
> +	watchdog_init_timeout(wdt, timeout, dev->parent);
> +
> +	watchdog_set_drvdata(wdt, data);

[Severity: High]
Does this driver need to call watchdog_stop_ping_on_suspend() here?

Because max_hw_heartbeat_ms is set, the watchdog core spawns a kthread
worker to periodically ping the hardware. Without registering the PM
notifier to stop the ping worker on suspend, the unfrozen kthread could
call aaeon_mcu_wdt_ping() while the parent I2C/MFD device is already
suspended.

Could this lead to I2C bus lockups or transfer failures during sleep?

> +	watchdog_stop_on_reboot(wdt);
> +	dev_set_drvdata(dev, wdt);
> +
> +	ret = aaeon_mcu_wdt_status(wdt, &enabled);
> +	if (ret)
> +		return ret;
> +
> +	if (enabled)
> +		set_bit(WDOG_HW_RUNNING, &wdt->status);
> +
> +	return devm_watchdog_register_device(dev, wdt);
> +}
> +
> +static int aaeon_mcu_wdt_suspend(struct device *dev)
> +{
> +	struct watchdog_device *wdt = dev_get_drvdata(dev);
> +
> +	if (watchdog_active(wdt))
> +		return aaeon_mcu_wdt_stop(wdt);

[Severity: High]
Will this properly handle the case where the bootloader started the watchdog
but userspace hasn't opened it yet?

In that scenario, watchdog_active() is false but WDOG_HW_RUNNING is set.
This suspend routine would return early, leaving the 25-second hardware
timer running. This might trigger an unintended system reset while the
system is asleep.

Should this also check watchdog_hw_running()?

> +
> +	return 0;
> +}
> +
> +static int aaeon_mcu_wdt_resume(struct device *dev)
> +{
> +	struct watchdog_device *wdt = dev_get_drvdata(dev);
> +
> +	if (watchdog_active(wdt))
> +		return aaeon_mcu_wdt_start(wdt);

[Severity: High]
Similar to the suspend callback, if the watchdog was solely in the
WDOG_HW_RUNNING state, it won't be restarted on resume.

Would checking watchdog_hw_running() ensure it resumes correctly?

> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707-dev-b4-aaeon-mcu-driver-v7-0-ca6c59abd672@bootlin.com?part=5

      reply	other threads:[~2026-07-07  8:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  8:01 [PATCH v7 0/5] Add support for AAEON SRG-IMX8P MCU Thomas Perrot (Schneider Electric)
2026-07-07  8:01 ` [PATCH v7 1/5] dt-bindings: vendor-prefixes: Add AAEON vendor prefix Thomas Perrot (Schneider Electric)
2026-07-07  8:01 ` [PATCH v7 2/5] dt-bindings: mfd: Add AAEON embedded controller Thomas Perrot (Schneider Electric)
2026-07-07  8:01 ` [PATCH v7 3/5] mfd: aaeon: Add SRG-IMX8P MCU driver Thomas Perrot (Schneider Electric)
2026-07-07  8:13   ` sashiko-bot
2026-07-07  8:01 ` [PATCH v7 4/5] gpio: aaeon: Add GPIO driver for SRG-IMX8P MCU Thomas Perrot (Schneider Electric)
2026-07-07  8:10   ` sashiko-bot
2026-07-07  8:01 ` [PATCH v7 5/5] watchdog: aaeon: Add watchdog " Thomas Perrot (Schneider Electric)
2026-07-07  8:17   ` sashiko-bot [this message]

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=20260707081703.443B51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.perrot@bootlin.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.