]> git.baikalelectronics.ru Git - kernel.git/commit
efi/libstub: Simplify efi_high_alloc() and rename to efi_allocate_pages()
authorArd Biesheuvel <ardb@kernel.org>
Mon, 10 Feb 2020 16:02:35 +0000 (17:02 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Sun, 23 Feb 2020 20:57:15 +0000 (21:57 +0100)
commitfa80a4bf650833294c7468a522178f372a64630a
tree3cbd64c9e1231d595d656d95c051fbd65ec56b12
parent96217438d25a85a7f80f9f0ff24b452c551dac73
efi/libstub: Simplify efi_high_alloc() and rename to efi_allocate_pages()

The implementation of efi_high_alloc() uses a complicated way of
traversing the memory map to find an available region that is located
as close as possible to the provided upper limit, and calls AllocatePages
subsequently to create the allocation at that exact address.

This is precisely what the EFI_ALLOCATE_MAX_ADDRESS allocation type
argument to AllocatePages() does, and considering that EFI_ALLOC_ALIGN
only exceeds EFI_PAGE_SIZE on arm64, let's use AllocatePages() directly
and implement the alignment using code that the compiler can remove if
it does not exceed EFI_PAGE_SIZE.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/efi-stub-helper.c
drivers/firmware/efi/libstub/fdt.c
drivers/firmware/efi/libstub/mem.c
include/linux/efi.h