[PATCH] efi_loader: switch to non-secure mode later
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 24 Jan 2021 14:34:12 +0000 (14:34 +0000)
committerVagrant Cascadian <vagrant@debian.org>
Sun, 23 May 2021 04:32:45 +0000 (05:32 +0100)
Some ARMv7 boards using PSCI require to be in secure-mode when booted via
'bootz' or 'bootm'. During distro-boot 'bootefi bootmgr' is called to check
if booting via UEFI is possible.

With the change we change the switch from secure mode to non-secure mode is
moved from the UEFI subsystem setup to just before calling StartImage().

Cc: Jernej Škrabec <jernej.skrabec@gmail.com>
Reported by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Gbp-Pq: Topic upstream
Gbp-Pq: Name 0001-efi_loader-switch-to-non-secure-mode-later.patch

cmd/bootefi.c
lib/efi_loader/efi_setup.c

index fdf909f8da2ca332f4a5dfa009afe8b6dbb45dda..a1ae7de34fdbad977025369fde595b7b17d32a2a 100644 (file)
@@ -8,6 +8,7 @@
 #define LOG_CATEGORY LOGC_EFI
 
 #include <common.h>
+#include <bootm.h>
 #include <charset.h>
 #include <command.h>
 #include <dm.h>
@@ -342,6 +343,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
        efi_uintn_t exit_data_size = 0;
        u16 *exit_data = NULL;
 
+       /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
+       switch_to_non_secure_mode();
+
        /* Call our payload! */
        ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
        if (ret != EFI_SUCCESS) {
index e206b60bb82c7b1fbbba35e80ecb34df712bbe4f..e200a77846950796a1b7e798f812b4e4b9882432 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include <common.h>
-#include <bootm.h>
 #include <efi_loader.h>
 #include <efi_variable.h>
 
@@ -134,9 +133,6 @@ efi_status_t efi_init_obj_list(void)
        /* Allow unaligned memory access */
        allow_unaligned();
 
-       /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
-       switch_to_non_secure_mode();
-
        /* Initialize root node */
        ret = efi_root_node_register();
        if (ret != EFI_SUCCESS)