Linux Watchdog driver development
 help / color / mirror / Atom feed
* [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
@ 2023-11-12 17:32 Stefan Wahren
  2023-11-13 14:31 ` Guenter Roeck
  2023-11-13 16:33 ` Florian Fainelli
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Wahren @ 2023-11-12 17:32 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: Florian Fainelli, bcm-kernel-feedback-list, Phil Elwell, Ray Jui,
	Scott Branden, linux-watchdog, linux-arm-kernel, Stefan Wahren

Users report about the unexpected behavior for setting timeouts above
15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl
WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations.
But looking at the code shows that max_timeout based on the
register value PM_WDOG_TIME_SET, which is the maximum.

Since 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat
in watchdog core") the watchdog core is able to handle this problem.

This fix has been tested with watchdog-test from selftests.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374
Fixes: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/watchdog/bcm2835_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
index 7a855289ff5e..bb001c5d7f17 100644
--- a/drivers/watchdog/bcm2835_wdt.c
+++ b/drivers/watchdog/bcm2835_wdt.c
@@ -42,6 +42,7 @@

 #define SECS_TO_WDOG_TICKS(x) ((x) << 16)
 #define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
+#define WDOG_TICKS_TO_MSECS(x) ((x) * 1000 >> 16)

 struct bcm2835_wdt {
 	void __iomem		*base;
@@ -140,7 +141,7 @@ static struct watchdog_device bcm2835_wdt_wdd = {
 	.info =		&bcm2835_wdt_info,
 	.ops =		&bcm2835_wdt_ops,
 	.min_timeout =	1,
-	.max_timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
+	.max_hw_heartbeat_ms =	WDOG_TICKS_TO_MSECS(PM_WDOG_TIME_SET),
 	.timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
 };

--
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
  2023-11-12 17:32 [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling Stefan Wahren
@ 2023-11-13 14:31 ` Guenter Roeck
  2023-11-30 11:57   ` Stefan Wahren
  2023-11-13 16:33 ` Florian Fainelli
  1 sibling, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2023-11-13 14:31 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Wim Van Sebroeck, Florian Fainelli, bcm-kernel-feedback-list,
	Phil Elwell, Ray Jui, Scott Branden, linux-watchdog,
	linux-arm-kernel

On Sun, Nov 12, 2023 at 06:32:51PM +0100, Stefan Wahren wrote:
> Users report about the unexpected behavior for setting timeouts above
> 15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl
> WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations.
> But looking at the code shows that max_timeout based on the
> register value PM_WDOG_TIME_SET, which is the maximum.
> 
> Since 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat
> in watchdog core") the watchdog core is able to handle this problem.
> 
> This fix has been tested with watchdog-test from selftests.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374
> Fixes: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

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

> ---
>  drivers/watchdog/bcm2835_wdt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
> index 7a855289ff5e..bb001c5d7f17 100644
> --- a/drivers/watchdog/bcm2835_wdt.c
> +++ b/drivers/watchdog/bcm2835_wdt.c
> @@ -42,6 +42,7 @@
> 
>  #define SECS_TO_WDOG_TICKS(x) ((x) << 16)
>  #define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
> +#define WDOG_TICKS_TO_MSECS(x) ((x) * 1000 >> 16)
> 
>  struct bcm2835_wdt {
>  	void __iomem		*base;
> @@ -140,7 +141,7 @@ static struct watchdog_device bcm2835_wdt_wdd = {
>  	.info =		&bcm2835_wdt_info,
>  	.ops =		&bcm2835_wdt_ops,
>  	.min_timeout =	1,
> -	.max_timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
> +	.max_hw_heartbeat_ms =	WDOG_TICKS_TO_MSECS(PM_WDOG_TIME_SET),
>  	.timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
>  };
> 
> --
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
  2023-11-12 17:32 [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling Stefan Wahren
  2023-11-13 14:31 ` Guenter Roeck
@ 2023-11-13 16:33 ` Florian Fainelli
  1 sibling, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2023-11-13 16:33 UTC (permalink / raw)
  To: Stefan Wahren, Wim Van Sebroeck, Guenter Roeck
  Cc: bcm-kernel-feedback-list, Phil Elwell, Ray Jui, Scott Branden,
	linux-watchdog, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]

On 11/12/23 09:32, Stefan Wahren wrote:
> Users report about the unexpected behavior for setting timeouts above
> 15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl
> WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations.
> But looking at the code shows that max_timeout based on the
> register value PM_WDOG_TIME_SET, which is the maximum.
> 
> Since 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat
> in watchdog core") the watchdog core is able to handle this problem.
> 
> This fix has been tested with watchdog-test from selftests.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374
> Fixes: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
  2023-11-13 14:31 ` Guenter Roeck
@ 2023-11-30 11:57   ` Stefan Wahren
  2023-12-17 15:34     ` Wim Van Sebroeck
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Wahren @ 2023-11-30 11:57 UTC (permalink / raw)
  To: Guenter Roeck, Florian Fainelli
  Cc: Wim Van Sebroeck, bcm-kernel-feedback-list, Phil Elwell, Ray Jui,
	Scott Branden, linux-watchdog, linux-arm-kernel

Hi,

Am 13.11.23 um 15:31 schrieb Guenter Roeck:
> On Sun, Nov 12, 2023 at 06:32:51PM +0100, Stefan Wahren wrote:
>> Users report about the unexpected behavior for setting timeouts above
>> 15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl
>> WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations.
>> But looking at the code shows that max_timeout based on the
>> register value PM_WDOG_TIME_SET, which is the maximum.
>>
>> Since 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat
>> in watchdog core") the watchdog core is able to handle this problem.
>>
>> This fix has been tested with watchdog-test from selftests.
>>
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374
>> Fixes: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core")
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
who takes care of this patch?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
  2023-11-30 11:57   ` Stefan Wahren
@ 2023-12-17 15:34     ` Wim Van Sebroeck
  0 siblings, 0 replies; 5+ messages in thread
From: Wim Van Sebroeck @ 2023-12-17 15:34 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Guenter Roeck, Florian Fainelli, Wim Van Sebroeck,
	bcm-kernel-feedback-list, Phil Elwell, Ray Jui, Scott Branden,
	linux-watchdog, linux-arm-kernel

Hi Stefan,

> Hi,
> 
> Am 13.11.23 um 15:31 schrieb Guenter Roeck:
> >On Sun, Nov 12, 2023 at 06:32:51PM +0100, Stefan Wahren wrote:
> >>Users report about the unexpected behavior for setting timeouts above
> >>15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl
> >>WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations.
> >>But looking at the code shows that max_timeout based on the
> >>register value PM_WDOG_TIME_SET, which is the maximum.
> >>
> >>Since 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat
> >>in watchdog core") the watchdog core is able to handle this problem.
> >>
> >>This fix has been tested with watchdog-test from selftests.
> >>
> >>Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374
> >>Fixes: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core")
> >>Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> >Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> who takes care of this patch?

I did.

Kind regards,
Wim.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-17 15:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-12 17:32 [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling Stefan Wahren
2023-11-13 14:31 ` Guenter Roeck
2023-11-30 11:57   ` Stefan Wahren
2023-12-17 15:34     ` Wim Van Sebroeck
2023-11-13 16:33 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox