]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
arm64/efi: remove idmap manipulations from UEFI code
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 20 Oct 2014 14:41:38 +0000 (16:41 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 12 Jan 2015 16:29:32 +0000 (16:29 +0000)
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>
arch/arm64/include/asm/efi.h
arch/arm64/include/asm/mmu.h
arch/arm64/kernel/efi.c
arch/arm64/kernel/setup.c
arch/arm64/mm/mmu.c

index effef3713c5a89667b360e2830bbb2abf5ed7bfa..7baf2cc04e1e0c7be2b1732ce1f92a807f0940ab 100644 (file)
@@ -6,11 +6,9 @@
 
 #ifdef CONFIG_EFI
 extern void efi_init(void);
-extern void efi_idmap_init(void);
 extern void efi_virtmap_init(void);
 #else
 #define efi_init()
-#define efi_idmap_init()
 #define efi_virtmap_init()
 #endif
 
index 5fd40c43be8050d43ff5d459c719247b5758f8ce..3d311761e3c27459de2457d035062baacae1903d 100644 (file)
@@ -31,8 +31,6 @@ extern void paging_init(void);
 extern void setup_mm_for_reboot(void);
 extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
 extern void init_mem_pgprot(void);
-/* create an identity mapping for memory (or io if map_io is true) */
-extern void create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io);
 extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
                               unsigned long virt, phys_addr_t size,
                               pgprot_t prot);
index 4a5d7343dddd01c53632ff3006bde5104d6767e6..a98415b5979c2cff26d35d47d9ab3d57300b77d7 100644 (file)
@@ -54,27 +54,6 @@ static int __init is_normal_ram(efi_memory_desc_t *md)
        return 0;
 }
 
-static void __init efi_setup_idmap(void)
-{
-       struct memblock_region *r;
-       efi_memory_desc_t *md;
-       u64 paddr, npages, size;
-
-       for_each_memblock(memory, r)
-               create_id_mapping(r->base, r->size, 0);
-
-       /* map runtime io spaces */
-       for_each_efi_memory_desc(&memmap, md) {
-               if (!(md->attribute & EFI_MEMORY_RUNTIME) || is_normal_ram(md))
-                       continue;
-               paddr = md->phys_addr;
-               npages = md->num_pages;
-               memrange_efi_to_native(&paddr, &npages);
-               size = npages << PAGE_SHIFT;
-               create_id_mapping(paddr, size, 1);
-       }
-}
-
 /*
  * Translate a EFI virtual address into a physical address: this is necessary,
  * as some data members of the EFI system table are virtually remapped after
@@ -236,16 +215,6 @@ void __init efi_init(void)
        reserve_regions();
 }
 
-void __init efi_idmap_init(void)
-{
-       if (!efi_enabled(EFI_BOOT))
-               return;
-
-       /* boot time idmap_pg_dir is incomplete, so fill in missing parts */
-       efi_setup_idmap();
-       early_memunmap(memmap.map, memmap.map_end - memmap.map);
-}
-
 /*
  * Enable the UEFI Runtime Services if all prerequisites are in place, i.e.,
  * non-early mapping of the UEFI system table and virtual mappings for all
@@ -386,4 +355,5 @@ void __init efi_virtmap_init(void)
                create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, prot);
        }
        set_bit(EFI_VIRTMAP, &efi.flags);
+       early_memunmap(memmap.map, memmap.map_end - memmap.map);
 }
index beac8188fdbd253f50b3aa6c5ad5accf350e4e65..199d1b7809d7fad8f9d667d3487b38465d221d52 100644 (file)
@@ -402,7 +402,6 @@ void __init setup_arch(char **cmdline_p)
        request_standard_resources();
 
        efi_virtmap_init();
-       efi_idmap_init();
        early_ioremap_reset();
 
        unflatten_device_tree();
index 3f3d5aa4a8b11dad3bb3e6da52089203d78bb04d..3286385488714c5ab3c07bf11d85b1d3ad058421 100644 (file)
@@ -271,18 +271,6 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt,
                         size, PAGE_KERNEL_EXEC);
 }
 
-void __init create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io)
-{
-       if ((addr >> PGDIR_SHIFT) >= ARRAY_SIZE(idmap_pg_dir)) {
-               pr_warn("BUG: not creating id mapping for %pa\n", &addr);
-               return;
-       }
-       __create_mapping(&init_mm, &idmap_pg_dir[pgd_index(addr)],
-                        addr, addr, size,
-                        map_io ? __pgprot(PROT_DEVICE_nGnRE)
-                               : PAGE_KERNEL_EXEC);
-}
-
 void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
                               unsigned long virt, phys_addr_t size,
                               pgprot_t prot)