Skip to content

Commit

Permalink
arm64/efi: add missing call to early_ioremap_reset()
Browse files Browse the repository at this point in the history
The early ioremap support introduced by patch bf4b558
("arm64: add early_ioremap support") failed to add a call to
early_ioremap_reset() at an appropriate time. Without this call,
invocations of early_ioremap etc. that are done too late will go
unnoticed and may cause corruption.

This is exactly what happened when the first user of this feature
was added in patch f84d027 ("arm64: add EFI runtime services").
The early mapping of the EFI memory map is unmapped during an early
initcall, at which time the early ioremap support is long gone.

Fix by adding the missing call to early_ioremap_reset() to
setup_arch(), and move the offending early_memunmap() to right after
the point where the early mapping of the EFI memory map is last used.

Fixes: f84d027 ("arm64: add EFI runtime services")
Cc: <stable@vger.kernel.org>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
Ard Biesheuvel authored and Will Deacon committed Jan 8, 2015
1 parent 59c6832 commit 0e63ea4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm64/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ void __init efi_idmap_init(void)

/* boot time idmap_pg_dir is incomplete, so fill in missing parts */
efi_setup_idmap();
early_memunmap(memmap.map, memmap.map_end - memmap.map);
}

static int __init remap_region(efi_memory_desc_t *md, void **new)
Expand Down Expand Up @@ -380,7 +381,6 @@ static int __init arm64_enter_virtual_mode(void)
}

mapsize = memmap.map_end - memmap.map;
early_memunmap(memmap.map, mapsize);

if (efi_runtime_disabled()) {
pr_info("EFI runtime services will be disabled.\n");
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ void __init setup_arch(char **cmdline_p)
request_standard_resources();

efi_idmap_init();
early_ioremap_reset();

unflatten_device_tree();

Expand Down

0 comments on commit 0e63ea4

Please sign in to comment.