Re: [PATCH] [v2] arm64: efi: make sure vmlinux load address aligned on 2MB

Ard Biesheuvel
2015-10-29T15:08:55Z

> On 29 okt. 2015, at 15:54, Timur Tabi <timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> wrote:
>
> On 10/29/2015 08:48 AM, Ard Biesheuvel wrote:
>>> >There is another (existing) problem I spotted, in that we'll sometimes
>>> >move the kernel to a worse address. If the kernel was loaded at a valid
>>> >address (i.e. image_addr % SZ_2MB == TEXT_OFFSET), but not at the
>>> >preferred offset, we try to relocate it, even if it's already at the
>>> >lowest possible address.
>>> >
>
>> Indeed. Unlikely to occur in practice, since UEFI mostly allocates top
>> down, but it would indeed be better to drop the new allocation and
>> simply use the existing one if it is not an improvement.
>
> So you're saying that if we modify our UEFI so that it always loads the kernel at dram_base + TEXT_OFFSET, then one day in the future the kernel will skip the relocation?
>

In fact, it does that already. The case Mark describes is when the Image is correctly aligned, but not at the base of DRAM, and the allocation produced by the firmware turns out to be even higher up in memory than the existing Image. In that particular case, the Image should simply be kept at the original offset, but currently we will prefer the suboptimal reallocation.

> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the
> Code Aurora Forum, a Linux Foundation Collaborative Project.