]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.3/arm64-efi-add-missing-call-to-early_ioremap_reset.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 3.18.3 / arm64-efi-add-missing-call-to-early_ioremap_reset.patch
CommitLineData
5bdb2afd
GKH
1From 0e63ea48b4d8035dd0e91a3fa6fb79458b47adfb Mon Sep 17 00:00:00 2001
2From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3Date: Thu, 8 Jan 2015 09:54:58 +0000
4Subject: arm64/efi: add missing call to early_ioremap_reset()
5
6From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7
8commit 0e63ea48b4d8035dd0e91a3fa6fb79458b47adfb upstream.
9
10The early ioremap support introduced by patch bf4b558eba92
11("arm64: add early_ioremap support") failed to add a call to
12early_ioremap_reset() at an appropriate time. Without this call,
13invocations of early_ioremap etc. that are done too late will go
14unnoticed and may cause corruption.
15
16This is exactly what happened when the first user of this feature
17was added in patch f84d02755f5a ("arm64: add EFI runtime services").
18The early mapping of the EFI memory map is unmapped during an early
19initcall, at which time the early ioremap support is long gone.
20
21Fix by adding the missing call to early_ioremap_reset() to
22setup_arch(), and move the offending early_memunmap() to right after
23the point where the early mapping of the EFI memory map is last used.
24
25Fixes: f84d02755f5a ("arm64: add EFI runtime services")
26Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
27Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
28Signed-off-by: Will Deacon <will.deacon@arm.com>
29Signed-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