Skip to content

Commit 9679be1

Browse files
author
Ard Biesheuvel
committed
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 <[email protected]> Acked-by: Will Deacon <[email protected]> Tested-by: Leif Lindholm <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 3033b84 commit 9679be1

File tree

5 files changed

+1
-48
lines changed

5 files changed

+1
-48
lines changed

arch/arm64/include/asm/efi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
#ifdef CONFIG_EFI
88
extern void efi_init(void);
9-
extern void efi_idmap_init(void);
109
extern void efi_virtmap_init(void);
1110
#else
1211
#define efi_init()
13-
#define efi_idmap_init()
1412
#define efi_virtmap_init()
1513
#endif
1614

arch/arm64/include/asm/mmu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ extern void paging_init(void);
3131
extern void setup_mm_for_reboot(void);
3232
extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
3333
extern void init_mem_pgprot(void);
34-
/* create an identity mapping for memory (or io if map_io is true) */
35-
extern void create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io);
3634
extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
3735
unsigned long virt, phys_addr_t size,
3836
pgprot_t prot);

arch/arm64/kernel/efi.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,6 @@ static int __init is_normal_ram(efi_memory_desc_t *md)
5454
return 0;
5555
}
5656

57-
static 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-
7857
/*
7958
* Translate a EFI virtual address into a physical address: this is necessary,
8059
* as some data members of the EFI system table are virtually remapped after
@@ -236,16 +215,6 @@ void __init efi_init(void)
236215
reserve_regions();
237216
}
238217

239-
void __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-
249218
/*
250219
* Enable the UEFI Runtime Services if all prerequisites are in place, i.e.,
251220
* non-early mapping of the UEFI system table and virtual mappings for all
@@ -386,4 +355,5 @@ void __init efi_virtmap_init(void)
386355
create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, prot);
387356
}
388357
set_bit(EFI_VIRTMAP, &efi.flags);
358+
early_memunmap(memmap.map, memmap.map_end - memmap.map);
389359
}

arch/arm64/kernel/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ void __init setup_arch(char **cmdline_p)
402402
request_standard_resources();
403403

404404
efi_virtmap_init();
405-
efi_idmap_init();
406405
early_ioremap_reset();
407406

408407
unflatten_device_tree();

arch/arm64/mm/mmu.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,6 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt,
271271
size, PAGE_KERNEL_EXEC);
272272
}
273273

274-
void __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-
286274
void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
287275
unsigned long virt, phys_addr_t size,
288276
pgprot_t prot)

0 commit comments

Comments
 (0)