Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 571603bf authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Rohit Vaswani
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.

Change-Id: I4adfbd1e664c6cc4420b5100cb32725d97cbf585
Acked-by: default avatarLeif Lindholm <leif.lindholm@linaro.org>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Tested-by: default avatarLeif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Git-commit 9679be103108926cfe9e6fd2f6829cefa77e47b0
[rvaswani@codeaurora.org: fixed merge conflicts]
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarRohit Vaswani <rvaswani@codeaurora.org>
parent ca359208
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -6,10 +6,8 @@

#ifdef CONFIG_EFI
extern void efi_init(void);
extern void efi_idmap_init(void);
#else
#define efi_init()
#define efi_idmap_init()
#endif

#define efi_call_virt(f, ...)						\
+0 −2
Original line number Diff line number Diff line
@@ -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 mem_text_write_kernel_word(u32 *addr, u32 word);
extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
			       unsigned long virt, phys_addr_t size,
+0 −30
Original line number Diff line number Diff line
@@ -47,27 +47,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);
	}
}

static int __init uefi_init(void)
{
	efi_char16_t *c16;
@@ -320,15 +299,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();
}

static int __init remap_region(efi_memory_desc_t *md, void **new)
{
	u64 paddr, vaddr, npages, size;
+1 −1
Original line number Diff line number Diff line
@@ -409,7 +409,7 @@ void __init setup_arch(char **cmdline_p)
	paging_init();
	request_standard_resources();

	efi_idmap_init();
	early_ioremap_reset();

	unflatten_device_tree();

+0 −14
Original line number Diff line number Diff line
@@ -505,20 +505,6 @@ static void __init dma_contiguous_remap(void)
			       dma_mmu_remap[i].size);
}

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,
			 early_alloc,
			 false);
}

void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
			       unsigned long virt, phys_addr_t size,
			       pgprot_t prot)