aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-01-15 07:01:06 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2015-01-16 11:18:16 -0500
commit7fe5d2b1daf6fd82857a8d0ee47547d7852ebe7b (patch)
treed2448d75cf793ea55c849d23bf8beade944e3736 /arch/arm64/kernel
parentd67703a8a69eecc8367bb9f848640b9efd430337 (diff)
arm64/efi: handle potential failure to remap memory map
When remapping the UEFI memory map using ioremap_cache(), we have to deal with potential failure. Note that, even if the common case is for ioremap_cache() to return the existing linear mapping of the memory map, we cannot rely on that to be always the case, e.g., in the presence of a mem= kernel parameter. At the same time, remove a stale comment and move the memmap code together. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Mark Salter <msalter@redhat.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r--arch/arm64/kernel/efi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index a98415b5979c..c9cb0fbe7aa4 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -229,19 +229,21 @@ static int __init arm64_enable_runtime_services(void)
229 return -1; 229 return -1;
230 } 230 }
231 231
232 mapsize = memmap.map_end - memmap.map;
233
234 if (efi_runtime_disabled()) { 232 if (efi_runtime_disabled()) {
235 pr_info("EFI runtime services will be disabled.\n"); 233 pr_info("EFI runtime services will be disabled.\n");
236 return -1; 234 return -1;
237 } 235 }
238 236
239 pr_info("Remapping and enabling EFI services.\n"); 237 pr_info("Remapping and enabling EFI services.\n");
240 /* replace early memmap mapping with permanent mapping */ 238
239 mapsize = memmap.map_end - memmap.map;
241 memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map, 240 memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
242 mapsize); 241 mapsize);
242 if (!memmap.map) {
243 pr_err("Failed to remap EFI memory map\n");
244 return -1;
245 }
243 memmap.map_end = memmap.map + mapsize; 246 memmap.map_end = memmap.map + mapsize;
244
245 efi.memmap = &memmap; 247 efi.memmap = &memmap;
246 248
247 efi.systab = (__force void *)ioremap_cache(efi_system_table, 249 efi.systab = (__force void *)ioremap_cache(efi_system_table,