• Ard Biesheuvel's avatar
    efi: libstub: avoid efi_get_memory_map() for allocating the virt map · f80d2604
    Ard Biesheuvel authored
    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: default avatarArd Biesheuvel <ardb@kernel.org>
    f80d2604
efi-stub.c 12 KB