From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [RFC v1 4/8] x86/init: add linker table support Date: Wed, 20 Jan 2016 16:00:14 -0500 Message-ID: <20160120210014.GF4769@char.us.oracle.com> References: <1450217797-19295-1-git-send-email-mcgrof@do-not-panic.com> <1450217797-19295-5-git-send-email-mcgrof@do-not-panic.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1450217797-19295-5-git-send-email-mcgrof@do-not-panic.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Luis R. Rodriguez" Cc: peter.senna@gmail.com, ryabinin.a.a@gmail.com, JBeulich@suse.com, hpa@zytor.com, qiuxishi@huawei.com, boris.ostrovsky@oracle.com, xen-devel@lists.xensource.com, joro@8bytes.org, x86@kernel.org, mingo@redhat.com, aryabinin@virtuozzo.com, mchehab@osg.samsung.com, andreyknvl@google.com, mcgrof@suse.com, rusty@rustcorp.com.au, bp@alien8.de, tglx@linutronix.de, mcb30@ipxe.org, valentinrothberg@gmail.com, jgross@suse.com, linux-kernel@vger.kernel.org, luto@amacapital.net, long.wanglong@huawei.com List-Id: xen-devel@lists.xenproject.org > +static bool x86_init_fn_supports_subarch(struct x86_init_fn *fn) > +{ > + if (!fn->supp_hardware_subarch) { > + pr_err("Init sequence fails to declares any supported subarchs: %pF\n", fn->early_init); > + WARN_ON(1); > + } > + if (BIT(boot_params.hdr.hardware_subarch) & fn->supp_hardware_subarch) > + return true; > + return false; > +} So the logic for this working is that boot_params.hdr.hardware_subarch And the macros define two: BIT(X86_SUBARCH_PC) or BIT(X86_SUBARCH_XEN). But hardware_subarch by default is set to zero. Which means if GRUB2, PXELinux, Xen multiboot1 don't set it - then the X86_SUBARCH_PC is choosen right? 1 << 0 & 1 << X86_SUBARCH_PC (which is zero). For this to nicely work with Xen it ought to do this: diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 993b7a7..6cf9afd 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -1676,6 +1676,7 @@ asmlinkage __visible void __init xen_start_kernel(void) boot_params.hdr.ramdisk_image = initrd_start; boot_params.hdr.ramdisk_size = xen_start_info->mod_len; boot_params.hdr.cmd_line_ptr = __pa(xen_start_info->cmd_line); + boot_params.hdr.hardware_subarch = X86_SUBARCH_XEN; if (!xen_initial_domain()) { add_preferred_console("xenboot", 0, NULL); ?