All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi_loader: stop watchdogs in ExitBootServices()
@ 2023-01-28  8:57 Heinrich Schuchardt
  2023-01-30 18:13 ` Tom Rini
  0 siblings, 1 reply; 34+ messages in thread
From: Heinrich Schuchardt @ 2023-01-28  8:57 UTC (permalink / raw)
  To: Ilias Apalodimas; +Cc: u-boot, Heinrich Schuchardt, Andre Przywara

The UEFI specification requires for ExitBootServices() that "the boot
services watchdog timer is disabled". We already disable the software
watchdog. We should additionally disable the hardware watchdogs.

Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/efi_boottime.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index ba28989f36..71215af9d2 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -19,6 +19,7 @@
 #include <u-boot/crc.h>
 #include <usb.h>
 #include <watchdog.h>
+#include <wdt.h>
 #include <asm/global_data.h>
 #include <asm/setjmp.h>
 #include <linux/libfdt_env.h>
@@ -2171,6 +2172,11 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 			list_del(&evt->link);
 	}
 
+	/* Disable watchdogs */
+	efi_set_watchdog(0);
+	if IS_ENABLED(CONFIG_WDT)
+		wdt_stop_all();
+
 	if (!efi_st_keep_devices) {
 		bootm_disable_interrupts();
 		if (IS_ENABLED(CONFIG_USB_DEVICE))
@@ -2196,10 +2202,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
 	/* Recalculate CRC32 */
 	efi_update_table_header_crc32(&systab.hdr);
-
-	/* Give the payload some time to boot */
-	efi_set_watchdog(0);
-	schedule();
 out:
 	if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
 		if (ret != EFI_SUCCESS)
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread
* [PATCH 1/1] efi_loader: stop watchdogs in ExitBootServices()
@ 2021-11-09 10:19 Heinrich Schuchardt
  2021-11-09 10:19 ` Heinrich Schuchardt
  0 siblings, 1 reply; 34+ messages in thread
From: Heinrich Schuchardt @ 2021-11-09 10:19 UTC (permalink / raw)
  To: u-boot
  Cc: Andre Przywara, Heinrich Schuchardt, Alexander Graf, Heinrich Schuchardt

The UEFI specification requires for ExitBootServices() that "the boot
services watchdog timer is disabled". We already disable the software
watchdog. We should additionally disable the hardware watchdogs.

Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/efi_boottime.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 1823990d9b..e33821c93a 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -19,6 +19,7 @@
 #include <u-boot/crc.h>
 #include <usb.h>
 #include <watchdog.h>
+#include <wdt.h>
 #include <asm/global_data.h>
 #include <asm/setjmp.h>
 #include <linux/libfdt_env.h>
@@ -2166,6 +2167,11 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 	/* Fix up caches for EFI payloads if necessary */
 	efi_exit_caches();
 
+	/* Disable watchdogs */
+	efi_set_watchdog(0);
+	if IS_ENABLED(CONFIG_WDT)
+		wdt_stop_all();
+
 	/* This stops all lingering devices */
 	bootm_disable_interrupts();
 
@@ -2181,9 +2187,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 	/* Recalculate CRC32 */
 	efi_update_table_header_crc32(&systab.hdr);
 
-	/* Give the payload some time to boot */
-	efi_set_watchdog(0);
-	WATCHDOG_RESET();
 out:
 	if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
 		if (ret != EFI_SUCCESS)
-- 
2.32.0


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

end of thread, other threads:[~2023-02-07 15:34 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28  8:57 [PATCH 1/1] efi_loader: stop watchdogs in ExitBootServices() Heinrich Schuchardt
2023-01-30 18:13 ` Tom Rini
2023-01-30 18:30   ` Tom Rini
2023-01-31 12:03     ` Ilias Apalodimas
2023-01-31 14:16       ` Simon Glass
2023-01-31 14:48         ` Heinrich Schuchardt
2023-01-31 15:07       ` Tom Rini
2023-02-01  8:32         ` Rasmus Villemoes
2023-02-01  9:00           ` Heinrich Schuchardt
2023-02-02  8:17             ` Etienne Carriere
2023-02-02 17:12               ` Simon Glass
2023-02-02 17:22                 ` Tom Rini
2023-02-03  2:15                   ` Simon Glass
2023-02-03  7:30                     ` Rasmus Villemoes
2023-02-07 14:59                       ` Michael Walle
2023-02-07 15:08                         ` Heinrich Schuchardt
2023-02-07 15:29                           ` Michael Walle
2023-02-07 15:30                             ` Heinrich Schuchardt
2023-02-07 15:34                               ` Michael Walle
2023-02-03 15:51                     ` Tom Rini
2023-02-04  0:20                       ` Simon Glass
2023-02-01 12:49           ` Mark Kettenis
2023-02-01 15:21             ` Tom Rini
  -- strict thread matches above, loose matches on Subject: below --
2021-11-09 10:19 Heinrich Schuchardt
2021-11-09 10:19 ` Heinrich Schuchardt
2021-11-09 14:20   ` Michael Walle
2021-11-09 14:46     ` Mark Kettenis
2021-11-09 14:54       ` Michael Walle
2021-11-09 17:30         ` Heinrich Schuchardt
2021-11-09 17:55   ` Tom Rini
2021-11-09 18:15     ` Heinrich Schuchardt
2021-11-09 18:18       ` Tom Rini
2021-11-09 21:47         ` Andre Przywara
2021-11-09 23:45     ` Grant Likely

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.