Re: [RFC v1 4/8] x86/init: add linker table support

From: Luis R. Rodriguez
Date: Thu Jan 21 2016 - 14:46:35 EST

On Thu, Jan 21, 2016 at 11:25 AM, H. Peter Anvin <hpa@xxxxxxxxx> 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)

The PV init code would kick in early and could parse the
boot_params.hdr.hardware_subarch_data pointer as it sees fit.