aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2014-10-20 10:41:38 -0400
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2015-01-12 11:29:32 -0500
commit9679be103108926cfe9e6fd2f6829cefa77e47b0 (patch)
tree1456199ed7f9038ffc664cebb31bad9e0c35414d
parent3033b84596eaec0093b68c5711c265738eb0745d (diff)
arm64/efi: remove idmap manipulations from UEFI code
Now that we have moved the call to SetVirtualAddressMap() to the stub, UEFI has no use for the ID map, so we can drop the code that installs ID mappings for UEFI memory regions. Acked-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r--arch/arm64/include/asm/efi.h2
-rw-r--r--arch/arm64/include/asm/mmu.h2
-rw-r--r--arch/arm64/kernel/efi.c32
-rw-r--r--arch/arm64/kernel/setup.c1
-rw-r--r--arch/arm64/mm/mmu.c12
5 files changed, 1 insertions, 48 deletions
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index effef3713c5a..7baf2cc04e1e 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -6,11 +6,9 @@
6 6
7#ifdef CONFIG_EFI 7#ifdef CONFIG_EFI
8extern void efi_init(void); 8extern void efi_init(void);
9extern void efi_idmap_init(void);
10extern void efi_virtmap_init(void); 9extern void efi_virtmap_init(void);
11#else 10#else
12#define efi_init() 11#define efi_init()
13#define efi_idmap_init()
14#define efi_virtmap_init() 12#define efi_virtmap_init()
15#endif 13#endif
16 14
diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h
index 5fd40c43be80..3d311761e3c2 100644
--- a/arch/arm64/include/asm/mmu.h
+++ b/arch/arm64/include/asm/mmu.h
@@ -31,8 +31,6 @@ extern void paging_init(void);
31extern void setup_mm_for_reboot(void); 31extern void setup_mm_for_reboot(void);
32extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt); 32extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
33extern void init_mem_pgprot(void); 33extern void init_mem_pgprot(void);
34/* create an identity mapping for memory (or io if map_io is true) */
35extern void create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io);
36extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, 34extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
37 unsigned long virt, phys_addr_t size, 35 unsigned long virt, phys_addr_t size,
38 pgprot_t prot); 36 pgprot_t prot);
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 4a5d7343dddd..a98415b5979c 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -54,27 +54,6 @@ static int __init is_normal_ram(efi_memory_desc_t *md)
54 return 0; 54 return 0;
55} 55}
56 56
57static void __init efi_setup_idmap(void)
58{
59 struct memblock_region *r;
60 efi_memory_desc_t *md;
61 u64 paddr, npages, size;
62
63 for_each_memblock(memory, r)
64 create_id_mapping(r->base, r->size, 0);
65
66 /* map runtime io spaces */
67 for_each_efi_memory_desc(&memmap, md) {
68 if (!(md->attribute & EFI_MEMORY_RUNTIME) || is_normal_ram(md))
69 continue;
70 paddr = md->phys_addr;
71 npages = md->num_pages;
72 memrange_efi_to_native(&paddr, &npages);
73 size = npages << PAGE_SHIFT;
74 create_id_mapping(paddr, size, 1);
75 }
76}
77
78/* 57/*
79 * Translate a EFI virtual address into a physical address: this is necessary, 58 * Translate a EFI virtual address into a physical address: this is necessary,
80 * as some data members of the EFI system table are virtually remapped after 59 * as some data members of the EFI system table are virtually remapped after
@@ -236,16 +215,6 @@ void __init efi_init(void)
236 reserve_regions(); 215 reserve_regions();
237} 216}
238 217
239void __init efi_idmap_init(void)
240{
241 if (!efi_enabled(EFI_BOOT))
242 return;
243
244 /* boot time idmap_pg_dir is incomplete, so fill in missing parts */
245 efi_setup_idmap();
246 early_memunmap(memmap.map, memmap.map_end - memmap.map);
247}
248
249/* 218/*
250 * Enable the UEFI Runtime Services if all prerequisites are in place, i.e., 219 * Enable the UEFI Runtime Services if all prerequisites are in place, i.e.,
251 * non-early mapping of the UEFI system table and virtual mappings for all 220 * non-early mapping of the UEFI system table and virtual mappings for all
@@ -386,4 +355,5 @@ void __init efi_virtmap_init(void)
386 create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, prot); 355 create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, prot);
387 } 356 }
388 set_bit(EFI_VIRTMAP, &efi.flags); 357 set_bit(EFI_VIRTMAP, &efi.flags);
358 early_memunmap(memmap.map, memmap.map_end - memmap.map);
389} 359}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index beac8188fdbd..199d1b7809d7 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -402,7 +402,6 @@ void __init setup_arch(char **cmdline_p)
402 request_standard_resources(); 402 request_standard_resources();
403 403
404 efi_virtmap_init(); 404 efi_virtmap_init();
405 efi_idmap_init();
406 early_ioremap_reset(); 405 early_ioremap_reset();
407 406
408 unflatten_device_tree(); 407 unflatten_device_tree();
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 3f3d5aa4a8b1..328638548871 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -271,18 +271,6 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt,
271 size, PAGE_KERNEL_EXEC); 271 size, PAGE_KERNEL_EXEC);
272} 272}
273 273
274void __init create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io)
275{
276 if ((addr >> PGDIR_SHIFT) >= ARRAY_SIZE(idmap_pg_dir)) {
277 pr_warn("BUG: not creating id mapping for %pa\n", &addr);
278 return;
279 }
280 __create_mapping(&init_mm, &idmap_pg_dir[pgd_index(addr)],
281 addr, addr, size,
282 map_io ? __pgprot(PROT_DEVICE_nGnRE)
283 : PAGE_KERNEL_EXEC);
284}
285
286void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, 274void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
287 unsigned long virt, phys_addr_t size, 275 unsigned long virt, phys_addr_t size,
288 pgprot_t prot) 276 pgprot_t prot)