]> git.baikalelectronics.ru Git - kernel.git/commit
efi: libstub: avoid efi_get_memory_map() for allocating the virt map
authorArd Biesheuvel <ardb@kernel.org>
Thu, 15 Sep 2022 17:45:35 +0000 (19:45 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 26 Sep 2022 20:29:24 +0000 (22:29 +0200)
commit197c4d2bfa3be81fc488fd71871219ceba7c8d5b
tree00514d5a2f28a3d7ae7d4f82b978ae4ae961c559
parent974179125c0799864b93ea794fddf5d0eed99445
efi: libstub: avoid efi_get_memory_map() for allocating the virt map

The virt map is a set of efi_memory_desc_t descriptors that are passed
to SetVirtualAddressMap() to inform the firmware about the desired
virtual mapping of the regions marked as EFI_MEMORY_RUNTIME. The only
reason we currently call the efi_get_memory_map() helper is that it
gives us an allocation that is guaranteed to be of sufficient size.
However, efi_get_memory_map() has grown some additional complexity over
the years, and today, we're actually better off calling the EFI boot
service directly with a zero size, which tells us how much memory should
be enough for the virt map.

While at it, avoid creating the VA map allocation if we will not be
using it anyway, i.e., if efi_novamap is true.

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