[PATCH] drivers: wdat: Do not start unless BIOS enabled it

31 views
Skip to first unread message

Jan Kiszka

unread,
Jun 19, 2024, 2:22:57 PM6/19/24
to efibootguard-dev
From: Jan Kiszka <jan.k...@siemens.com>

Linux won't use a disabled WDAT watchdog either.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
drivers/watchdog/wdat.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/watchdog/wdat.c b/drivers/watchdog/wdat.c
index f5cb5e4..0875a50 100644
--- a/drivers/watchdog/wdat.c
+++ b/drivers/watchdog/wdat.c
@@ -33,6 +33,8 @@
#define ACPI_SIG_XSDT (CHAR8 *)"XSDT"
#define ACPI_SIG_WDAT (CHAR8 *)"WDAT"

+#define ACPI_WDAT_ENABLED 1
+
#pragma pack(1)

/* --------------------------------------------------------------------------
@@ -437,6 +439,9 @@ static EFI_STATUS init(EFI_PCI_IO __attribute__((unused)) * pci_io,
if (EFI_ERROR(status)) {
return status;
}
+ if (!(wdat_table->flags & ACPI_WDAT_ENABLED)) {
+ return EFI_UNSUPPORTED;
+ }
INFO(L"Detected WDAT watchdog\n");

/* Check if the boot was caused by the watchdog */
--
2.43.0

Jan Kiszka

unread,
Jun 21, 2024, 6:29:33 AM6/21/24
to efibootguard-dev
On 19.06.24 20:22, Jan Kiszka wrote:
> From: Jan Kiszka <jan.k...@siemens.com>
>
> Linux won't use a disabled WDAT watchdog either.
>

FWIW, we have a similar issue with iTCO where Linux is more picky than
EBG (or has less hard-coded addresses) and does not start the watchdog
in some cases. But aligning the iTCO code more to the kernel driver will
come with some regression risks I don't want to take anymore before the
next release. I also suspect that issue is only triggered by broken
device firmware, thus not a primary problem.

Jan

--
Siemens AG, Technology
Linux Expert Center

Christopher Obbard

unread,
Jun 24, 2024, 4:35:58 AM6/24/24
to Jan Kiszka, efibootguard-dev
Hi Jan,

On Wed, 2024-06-19 at 20:22 +0200, 'Jan Kiszka' via EFI Boot Guard wrote:
> From: Jan Kiszka <jan.k...@siemens.com>
>
> Linux won't use a disabled WDAT watchdog either.
>
> Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
> ---
>  drivers/watchdog/wdat.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/watchdog/wdat.c b/drivers/watchdog/wdat.c
> index f5cb5e4..0875a50 100644
> --- a/drivers/watchdog/wdat.c
> +++ b/drivers/watchdog/wdat.c
> @@ -33,6 +33,8 @@
>  #define ACPI_SIG_XSDT (CHAR8 *)"XSDT"
>  #define ACPI_SIG_WDAT (CHAR8 *)"WDAT"
>  
> +#define ACPI_WDAT_ENABLED 1
> +
>  #pragma pack(1)
>  
>  /* ------------------------------------------------------------------------
> --
> @@ -437,6 +439,9 @@ static EFI_STATUS init(EFI_PCI_IO
> __attribute__((unused)) * pci_io,
>   if (EFI_ERROR(status)) {
>   return status;
>   }
> + if (!(wdat_table->flags & ACPI_WDAT_ENABLED)) {

Could we add an debug message to show why it failed; something similar to

ERROR(L"WDAT is not enabled in BIOS\n");


With that considered,

Reviewed-by: Christopher Obbard <chris....@collabora.com>

Jan Kiszka

unread,
Jun 24, 2024, 7:08:31 AM6/24/24
to Christopher Obbard, efibootguard-dev
I was too fast with merging into master - follow-up patch just sent.
Reply all
Reply to author
Forward
0 new messages