@@ -35,6 +35,8 @@
__f(args); \
})
+int efi_arch_late_enable_runtime_services(void);
+
#define ARCH_EFI_IRQ_FLAGS_MASK \
(PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
PSR_T_BIT | MODE_MASK)
@@ -37,6 +37,8 @@
kernel_neon_end(); \
})
+int efi_arch_late_enable_runtime_services(void);
+
#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
/* arch specific definitions used by the stub code */
@@ -233,6 +233,8 @@ static inline bool efi_is_64bit(void)
extern bool efi_reboot_required(void);
+int __init efi_arch_late_enable_runtime_services(void) {}
+
#else
static inline void parse_efi_setup(u64 phys_addr, u32 data_len) {}
static inline bool efi_reboot_required(void)
@@ -115,7 +115,7 @@ static bool __init efi_virtmap_init(void)
* non-early mapping of the UEFI system table and virtual mappings for all
* EFI_MEMORY_RUNTIME regions.
*/
-static int __init arm_enable_runtime_services(void)
+int __init efi_arch_late_enable_runtime_services(void)
{
u64 mapsize;
@@ -154,7 +154,6 @@ static int __init arm_enable_runtime_services(void)
return 0;
}
-early_initcall(arm_enable_runtime_services);
void efi_virtmap_load(void)
{
@@ -33,6 +33,7 @@
#include <linux/memblock.h>
#include <asm/early_ioremap.h>
+#include <asm/efi.h>
struct efi __read_mostly efi = {
.mps = EFI_INVALID_TABLE_ADDR,
@@ -304,6 +305,8 @@ static int __init efisubsys_init(void)
{
int error;
+ efi_arch_late_enable_runtime_services();
+
if (!efi_enabled(EFI_BOOT))
return 0;
EFI Runtime Services on ARM are enabled very early in the boot process although they aren't used until substantially later. This patch modifies the efi initialization sequence on ARM to enable runtime services just before they are effectively needed (in a subsys target instead of early). The reason behind this change is that eventually, a late Runtime Services initialization could take advantage of KVM's internal virtual machines to sandbox firmware code execution. Since KVM's core is only available starting from the subsys target, this reordering would be compulsory. Signed-off-by: Florent Revest <florent.revest@arm.com> --- arch/arm/include/asm/efi.h | 2 ++ arch/arm64/include/asm/efi.h | 2 ++ arch/x86/include/asm/efi.h | 2 ++ drivers/firmware/efi/arm-runtime.c | 3 +-- drivers/firmware/efi/efi.c | 3 +++ 5 files changed, 10 insertions(+), 2 deletions(-) -- 1.9.1 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.