Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64/efi: mark UEFI reserved regions as MEMBLOCK_NOMAP

Change the EFI memory reservation logic to use memblock_mark_nomap()
rather than memblock_reserve() to mark UEFI reserved regions as
occupied. In addition to reserving them against allocations done by
memblock, this will also prevent them from being covered by the linear
mapping.

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

Ard Biesheuvel and committed by
Will Deacon
4dffbfc4 68709f45

+4 -3
+4 -3
arch/arm64/kernel/efi.c
··· 187 187 early_init_dt_add_memory_arch(paddr, size); 188 188 189 189 if (is_reserve_region(md)) { 190 - memblock_reserve(paddr, size); 190 + memblock_mark_nomap(paddr, size); 191 191 if (efi_enabled(EFI_DBG)) 192 192 pr_cont("*"); 193 193 } ··· 209 209 210 210 efi_system_table = params.system_table; 211 211 212 - memblock_reserve(params.mmap & PAGE_MASK, 213 - PAGE_ALIGN(params.mmap_size + (params.mmap & ~PAGE_MASK))); 214 212 memmap.phys_map = params.mmap; 215 213 memmap.map = early_memremap(params.mmap, params.mmap_size); 216 214 if (memmap.map == NULL) { ··· 228 230 229 231 reserve_regions(); 230 232 early_memunmap(memmap.map, params.mmap_size); 233 + memblock_mark_nomap(params.mmap & PAGE_MASK, 234 + PAGE_ALIGN(params.mmap_size + 235 + (params.mmap & ~PAGE_MASK))); 231 236 } 232 237 233 238 static bool __init efi_virtmap_init(void)