Re: [PATCH] x86, boot: Allow 64bit EFI kernel to be loaded above 4G

From: Yinghai Lu
Date: Mon Feb 09 2015 - 15:23:21 EST

On Mon, Feb 9, 2015 at 10:27 AM, Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 03 Feb, at 06:03:20PM, Yinghai Lu wrote:
> The first thing that comes to mind is the issues we experienced last
> year when adding support for loading initrds above 4GB to the EFI boot
> stub, c.f. commit 47226ad4f4cf ("x86/efi: Only load initrd above 4g on
> second try").
> Are things going to work correctly this time?

That should be addressed the grub2.

I was thinking that we may need to add mem_limit command together with
linuxefi and initrdefi.
or add linuxefi64/initrdefi64?

BTW, I tested loading kernel above grub2 on
virutalbox, qemu/kvm/OVMF, and real servers (ami ...) all work without problem.

wonder if we need have one black list for 64bit UEFI that does not
support access
memory above 4G.

>> @@ -1430,9 +1431,12 @@ struct boot_params *efi_main(struct efi_
>> * If the kernel isn't already loaded at the preferred load
>> * address, relocate it.
>> */
>> - if (hdr->pref_address != hdr->code32_start) {
>> - unsigned long bzimage_addr = hdr->code32_start;
>> - status = efi_relocate_kernel(sys_table, &bzimage_addr,
>> + loaded_addr = hdr->code32_start;
>> + loaded_addr |= (unsigned long)hdr->ext_code32_start << 32;
> Please compile this for CONFIG_X86_32 and fix any compiler warnings.


>> @@ -738,6 +742,13 @@ Offset/size: 0x264/4
>> See EFI HANDOVER PROTOCOL below for more details.
>> +Field name: ext_code32_start
>> +Type: modify (optional, reloc)
>> +Offset/size: 0x268/4
>> +Protocol: 2.14+
>> +
>> + The address is used with code32_start to compare pref_address
>> + to support EFI 64bit kernel get loaded above 4G.
> It would be good to mention that this new field contains the upper
> 32-bits of the 64-bit address.

ok. that is: upper 32bits of the 64bit address of startup_32 when kernel
loaded above 4G.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at