From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751618AbcAUTvC (ORCPT ); Thu, 21 Jan 2016 14:51:02 -0500 Received: from terminus.zytor.com ([198.137.202.10]:58151 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750866AbcAUTvA (ORCPT ); Thu, 21 Jan 2016 14:51:00 -0500 Subject: Re: [RFC v1 4/8] x86/init: add linker table support To: "Luis R. Rodriguez" References: <1450217797-19295-1-git-send-email-mcgrof@do-not-panic.com> <1450217797-19295-5-git-send-email-mcgrof@do-not-panic.com> <20160120210014.GF4769@char.us.oracle.com> <56A0990C.9090601@citrix.com> <56A0E0FB.6020809@oracle.com> <56A130B5.8060701@zytor.com> Cc: Boris Ostrovsky , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Konrad Rzeszutek Wilk , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Rusty Russell , Andy Lutomirski , mcb30@ipxe.org, Juergen Gross , Jan Beulich , joro@8bytes.org, Andrey Ryabinin , andreyknvl@google.com, long.wanglong@huawei.com, qiuxishi@huawei.com, aryabinin@virtuozzo.com, Mauro Carvalho Chehab , Valentin Rothberg , Peter Senna Tschudin , X86 ML , "xen-devel@lists.xensource.com" , "linux-kernel@vger.kernel.org" From: "H. Peter Anvin" Message-ID: <56A1366C.6070702@zytor.com> Date: Thu, 21 Jan 2016 11:50:04 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/21/16 11:46, Luis R. Rodriguez wrote: > On Thu, Jan 21, 2016 at 11:25 AM, H. Peter Anvin wrote: >>> And that's exactly what HVMlite does. Most of this shim layer is setting >>> up boot_params, after which we jump to standard x86 boot path (i.e. >>> startup_{32|64}). With hardware_subarch set to zero. >> >> Which is the way to do it as long as the early code can be the same. > > To be clear, with the subarchand linker table suggested in my patch > series, it should be possible to have the same exact entry point, the > Xen PV setup code could run early in the order. For instance in the > linker table we could use the reserved order levels 01-09 for PV > hypervisor code: > > +/* Init order levels, we can start at 01 but reserve 01-09 for now */ > +#define X86_INIT_ORDER_EARLY 10 > +#define X86_INIT_ORDER_NORMAL 30 > +#define X86_INIT_ORDER_LATE 50 > > So perhaps X86_INIT_ORDER_PV as 05 later. > > The standard x86 init would just then be: > > asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) > { > x86_init_fn_init_tables(); > x86_init_fn_early_init(); > } > > The PV init code would kick in early and could parse the > boot_params.hdr.hardware_subarch_data pointer as it sees fit. > Right... we already do that. I don't even think you need to initialize any tables. At least on i386, we have to do this in assembly code. However, it is just a simple table walk. :) -hpa From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: [RFC v1 4/8] x86/init: add linker table support Date: Thu, 21 Jan 2016 11:50:04 -0800 Message-ID: <56A1366C.6070702@zytor.com> References: <1450217797-19295-1-git-send-email-mcgrof@do-not-panic.com> <1450217797-19295-5-git-send-email-mcgrof@do-not-panic.com> <20160120210014.GF4769@char.us.oracle.com> <56A0990C.9090601@citrix.com> <56A0E0FB.6020809@oracle.com> <56A130B5.8060701@zytor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: "Luis R. Rodriguez" Cc: Boris Ostrovsky , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Konrad Rzeszutek Wilk , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Rusty Russell , Andy Lutomirski , mcb30@ipxe.org, Juergen Gross , Jan Beulich , joro@8bytes.org, Andrey Ryabinin , andreyknvl@google.com, long.wanglong@huawei.com, qiuxishi@huawei.com, aryabinin@virtuozzo.com, Mauro Carvalho Chehab , Valentin Rothberg , Peter Senna Tschudin , X86 ML , "xen-devel@lists.xensource.com" , linux-kernel@vger.kern List-Id: xen-devel@lists.xenproject.org On 01/21/16 11:46, Luis R. Rodriguez wrote: > On Thu, Jan 21, 2016 at 11:25 AM, H. Peter Anvin wrote: >>> And that's exactly what HVMlite does. Most of this shim layer is setting >>> up boot_params, after which we jump to standard x86 boot path (i.e. >>> startup_{32|64}). With hardware_subarch set to zero. >> >> Which is the way to do it as long as the early code can be the same. > > To be clear, with the subarchand linker table suggested in my patch > series, it should be possible to have the same exact entry point, the > Xen PV setup code could run early in the order. For instance in the > linker table we could use the reserved order levels 01-09 for PV > hypervisor code: > > +/* Init order levels, we can start at 01 but reserve 01-09 for now */ > +#define X86_INIT_ORDER_EARLY 10 > +#define X86_INIT_ORDER_NORMAL 30 > +#define X86_INIT_ORDER_LATE 50 > > So perhaps X86_INIT_ORDER_PV as 05 later. > > The standard x86 init would just then be: > > asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) > { > x86_init_fn_init_tables(); > x86_init_fn_early_init(); > } > > The PV init code would kick in early and could parse the > boot_params.hdr.hardware_subarch_data pointer as it sees fit. > Right... we already do that. I don't even think you need to initialize any tables. At least on i386, we have to do this in assembly code. However, it is just a simple table walk. :) -hpa