[PATCH 1/1] efi_loader: stop watchdogs in ExitBootServices()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Tue Nov 9 11:19:01 CET 2021


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 at arm.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at 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



More information about the U-Boot mailing list