Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933855AbbBIS1v (ORCPT ); Mon, 9 Feb 2015 13:27:51 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:53142 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933792AbbBIS1t (ORCPT ); Mon, 9 Feb 2015 13:27:49 -0500 Date: Mon, 9 Feb 2015 18:27:42 +0000 From: Matt Fleming To: Yinghai Lu Cc: Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , Jonathan Corbet , Matt Fleming , Kees Cook , Junjie Mao , linux-doc@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86, boot: Allow 64bit EFI kernel to be loaded above 4G Message-ID: <20150209182742.GQ6461@codeblueprint.co.uk> References: <1423015400-12629-1-git-send-email-yinghai@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423015400-12629-1-git-send-email-yinghai@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2584 Lines: 69 On Tue, 03 Feb, at 06:03:20PM, Yinghai Lu wrote: > Now could use kexec to place kernel/boot_params/cmd_line/initrd > above 4G, but that is with legacy interface with startup_64 directly. > > This patch will allow 64bit EFI kernel to be loaded above 4G > and use EFI HANDOVER PROTOCOL to start the kernel. > > Current code32_start is used for passing around loading address, > so it will overflow when kernel is loaded abover 4G. > > The patch mainly add ext_code32_start to take address high 32bit. > > After this patch, could use patched grub2-x86_64.efi to place > kernel/boot_params/cmd_line/initrd all above 4G and execute the kernel > above 4G. 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? > Index: linux-2.6/arch/x86/boot/compressed/eboot.c > =================================================================== > --- linux-2.6.orig/arch/x86/boot/compressed/eboot.c > +++ linux-2.6/arch/x86/boot/compressed/eboot.c > @@ -1389,6 +1389,7 @@ struct boot_params *efi_main(struct efi_ > void *handle; > efi_system_table_t *_table; > bool is64; > + unsigned long loaded_addr; > > efi_early = c; > > @@ -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. -- Matt Fleming, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/