[PATCH v2] arm64/efi: prefer AllocatePages() over efi_low_alloc() for vmlinux

Matt Fleming matt at codeblueprint.co.uk
Tue Jul 28 14:17:52 PDT 2015


On Fri, 24 Jul, at 01:38:27PM, Ard Biesheuvel wrote:
> When allocating memory for the kernel image, try the AllocatePages()
> boot service to obtain memory at the preferred offset of
> 'dram_base + TEXT_OFFSET', and only revert to efi_low_alloc() if that
> fails. This is the only way to allocate at the base of DRAM if DRAM
> starts at 0x0, since efi_low_alloc() refuses to allocate at 0x0.
> 
> Tested-by: Haojian Zhuang <haojian.zhuang at linaro.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
> ---
> v2:
> - reshuffle code flow to make it more logical, and have only a single
>   memcpy() invocation at the end of the function
> ---
>  arch/arm64/kernel/efi-stub.c | 41 ++++++++++++++++++++++++++++++++---------
>  1 file changed, 32 insertions(+), 9 deletions(-)

Would it be easier if we allow efi_low_alloc() to return 0x0 for some
uses? If you don't need the preference for low allocations, probably
not, but I don't want to see us working around limitations in
efi_low_alloc() instead of just fixing it.

-- 
Matt Fleming, Intel Open Source Technology Center



More information about the linux-arm-kernel mailing list