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

Commit 6632210f authored by Dave Young's avatar Dave Young Committed by Matt Fleming
Browse files

arm64/efi: Do not enter virtual mode if booting with efi=noruntime or noefi



In case efi runtime disabled via noefi kernel cmdline
arm64_enter_virtual_mode should error out.

At the same time move early_memunmap(memmap.map, mapsize) to the
beginning of the function or it will leak early mem.

Signed-off-by: default avatarDave Young <dyoung@redhat.com>
Reviewed-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent 88f8abd5
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -392,11 +392,16 @@ static int __init arm64_enter_virtual_mode(void)
		return -1;
	}

	pr_info("Remapping and enabling EFI services.\n");

	/* replace early memmap mapping with permanent mapping */
	mapsize = memmap.map_end - memmap.map;
	early_memunmap(memmap.map, mapsize);

	if (efi_runtime_disabled()) {
		pr_info("EFI runtime services will be disabled.\n");
		return -1;
	}

	pr_info("Remapping and enabling EFI services.\n");
	/* replace early memmap mapping with permanent mapping */
	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
						   mapsize);
	memmap.map_end = memmap.map + mapsize;