efi/libstub: Add API function to allocate aligned memory
authorArd Biesheuvel <ardb@kernel.org>
Fri, 27 Mar 2020 15:09:40 +0000 (16:09 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 24 Apr 2020 12:52:16 +0000 (14:52 +0200)
commit43b1df0e013c25abb536699f46d0e9f291b586a0
treecc2415ae3b79cb9494824ba9a5ce1e7a25e39d5c
parent5d12da9dd6c155f7a09dfcaa2b9827764c939b2a
efi/libstub: Add API function to allocate aligned memory

Break out the code to create an aligned page allocation from mem.c
and move it into a function efi_allocate_pages_aligned() in alignedmem.c.
Update efi_allocate_pages() to invoke it unless the minimum alignment
equals the EFI page size (4 KB), in which case the ordinary page
allocator is sufficient. This way, efi_allocate_pages_aligned() will
only be pulled into the build if it is actually being used (which will
be on arm64 only in the immediate future)

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/Makefile
drivers/firmware/efi/libstub/alignedmem.c [new file with mode: 0644]
drivers/firmware/efi/libstub/efistub.h
drivers/firmware/efi/libstub/mem.c