Skip to content

Commit 3ea8649

Browse files
Ard Biesheuvelwildea01
authored andcommitted
efi/arm: preserve early mapping of UEFI memory map longer for BGRT
The BGRT code validates the contents of the table against the UEFI memory map, and so it expects it to be mapped when the code runs. On ARM, this is currently not the case, since we tear down the early mapping after efi_init() completes, and only create the permanent mapping in arm_enable_runtime_services(), which executes as an early initcall, but still leaves a window where the UEFI memory map is not mapped. So move the call to efi_memmap_unmap() from efi_init() to arm_enable_runtime_services(). Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> [will: fold in EFI_MEMMAP attribute check from Ard] Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 5bcd440 commit 3ea8649

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

drivers/firmware/efi/arm-init.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ void __init efi_init(void)
259259

260260
reserve_regions();
261261
efi_esrt_init();
262-
efi_memmap_unmap();
263262

264263
memblock_reserve(params.mmap & PAGE_MASK,
265264
PAGE_ALIGN(params.mmap_size +

drivers/firmware/efi/arm-runtime.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,13 @@ static int __init arm_enable_runtime_services(void)
110110
{
111111
u64 mapsize;
112112

113-
if (!efi_enabled(EFI_BOOT)) {
113+
if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) {
114114
pr_info("EFI services will not be available.\n");
115115
return 0;
116116
}
117117

118+
efi_memmap_unmap();
119+
118120
if (efi_runtime_disabled()) {
119121
pr_info("EFI runtime services will be disabled.\n");
120122
return 0;

0 commit comments

Comments
 (0)