]>
Commit | Line | Data |
---|---|---|
5bdb2afd GKH |
1 | From 0e63ea48b4d8035dd0e91a3fa6fb79458b47adfb Mon Sep 17 00:00:00 2001 |
2 | From: Ard Biesheuvel <ard.biesheuvel@linaro.org> | |
3 | Date: Thu, 8 Jan 2015 09:54:58 +0000 | |
4 | Subject: arm64/efi: add missing call to early_ioremap_reset() | |
5 | ||
6 | From: Ard Biesheuvel <ard.biesheuvel@linaro.org> | |
7 | ||
8 | commit 0e63ea48b4d8035dd0e91a3fa6fb79458b47adfb upstream. | |
9 | ||
10 | The early ioremap support introduced by patch bf4b558eba92 | |
11 | ("arm64: add early_ioremap support") failed to add a call to | |
12 | early_ioremap_reset() at an appropriate time. Without this call, | |
13 | invocations of early_ioremap etc. that are done too late will go | |
14 | unnoticed and may cause corruption. | |
15 | ||
16 | This is exactly what happened when the first user of this feature | |
17 | was added in patch f84d02755f5a ("arm64: add EFI runtime services"). | |
18 | The early mapping of the EFI memory map is unmapped during an early | |
19 | initcall, at which time the early ioremap support is long gone. | |
20 | ||
21 | Fix by adding the missing call to early_ioremap_reset() to | |
22 | setup_arch(), and move the offending early_memunmap() to right after | |
23 | the point where the early mapping of the EFI memory map is last used. | |
24 | ||
25 | Fixes: f84d02755f5a ("arm64: add EFI runtime services") | |
26 | Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> | |
27 | Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> | |
28 | Signed-off-by: Will Deacon <will.deacon@arm.com> | |
29 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
30 | ||
31 | --- | |
32 | arch/arm64/kernel/efi.c | 2 +- | |
33 | arch/arm64/kernel/setup.c | 1 + | |
34 | 2 files changed, 2 insertions(+), 1 deletion(-) | |
35 | ||
36 | --- a/arch/arm64/kernel/efi.c | |
37 | +++ b/arch/arm64/kernel/efi.c | |
38 | @@ -327,6 +327,7 @@ void __init efi_idmap_init(void) | |
39 | ||
40 | /* boot time idmap_pg_dir is incomplete, so fill in missing parts */ | |
41 | efi_setup_idmap(); | |
42 | + early_memunmap(memmap.map, memmap.map_end - memmap.map); | |
43 | } | |
44 | ||
45 | static int __init remap_region(efi_memory_desc_t *md, void **new) | |
46 | @@ -381,7 +382,6 @@ static int __init arm64_enter_virtual_mo | |
47 | } | |
48 | ||
49 | mapsize = memmap.map_end - memmap.map; | |
50 | - early_memunmap(memmap.map, mapsize); | |
51 | ||
52 | if (efi_runtime_disabled()) { | |
53 | pr_info("EFI runtime services will be disabled.\n"); | |
54 | --- a/arch/arm64/kernel/setup.c | |
55 | +++ b/arch/arm64/kernel/setup.c | |
56 | @@ -394,6 +394,7 @@ void __init setup_arch(char **cmdline_p) | |
57 | request_standard_resources(); | |
58 | ||
59 | efi_idmap_init(); | |
60 | + early_ioremap_reset(); | |
61 | ||
62 | unflatten_device_tree(); | |
63 |