Commit 9679be10 authored by Ard Biesheuvel's avatar Ard Biesheuvel
Browse files

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: default avatarLeif Lindholm <>
Acked-by: default avatarWill Deacon <>
Tested-by: default avatarLeif Lindholm <>
Signed-off-by: default avatarArd Biesheuvel <>
parent 3033b845
......@@ -6,11 +6,9 @@
extern void efi_init(void);
extern void efi_idmap_init(void);
extern void efi_virtmap_init(void);
#define efi_init()
#define efi_idmap_init()
#define efi_virtmap_init()
......@@ -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);
......@@ -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))
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)
void __init efi_idmap_init(void)
if (!efi_enabled(EFI_BOOT))
/* boot time idmap_pg_dir is incomplete, so fill in missing parts */
early_memunmap(, memmap.map_end -;
* 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_end -;
......@@ -402,7 +402,6 @@ void __init setup_arch(char **cmdline_p)
......@@ -271,18 +271,6 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt,
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);
__create_mapping(&init_mm, &idmap_pg_dir[pgd_index(addr)],
addr, addr, size,
map_io ? __pgprot(PROT_DEVICE_nGnRE)
void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
unsigned long virt, phys_addr_t size,
pgprot_t prot)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment