Skip to content

Commit

Permalink
efi/arm: Revert deferred unmap of early memmap mapping
Browse files Browse the repository at this point in the history
Commit:

  3ea8649 ("efi/arm: preserve early mapping of UEFI memory map longer for BGRT")

deferred the unmap of the early mapping of the UEFI memory map to
accommodate the ACPI BGRT code, which looks up the memory type that
backs the BGRT table to validate it against the requirements of the UEFI spec.

Unfortunately, this causes problems on ARM, which does not permit
early mappings to persist after paging_init() is called, resulting
in a WARN() splat. Since we don't support the BGRT table on ARM anway,
let's revert ARM to the old behaviour, which is to take down the
early mapping at the end of efi_init().

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Fixes: 3ea8649 ("efi/arm: preserve early mapping of UEFI memory ...")
Link: http://lkml.kernel.org/r/20181114175544.12860-3-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ard Biesheuvel authored and Ingo Molnar committed Nov 15, 2018
1 parent ef1491e commit 33412b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions drivers/firmware/efi/arm-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ void __init efi_init(void)
(params.mmap & ~PAGE_MASK)));

init_screen_info();

/* ARM does not permit early mappings to persist across paging_init() */
if (IS_ENABLED(CONFIG_ARM))
efi_memmap_unmap();
}

static int __init register_gop_device(void)
Expand Down
2 changes: 1 addition & 1 deletion drivers/firmware/efi/arm-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int __init arm_enable_runtime_services(void)
{
u64 mapsize;

if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) {
if (!efi_enabled(EFI_BOOT)) {
pr_info("EFI services will not be available.\n");
return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/firmware/efi/memmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ int __init efi_memmap_init_early(struct efi_memory_map_data *data)

void __init efi_memmap_unmap(void)
{
if (!efi_enabled(EFI_MEMMAP))
return;

if (!efi.memmap.late) {
unsigned long size;

Expand Down

0 comments on commit 33412b8

Please sign in to comment.