From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Zhenzhong Duan <zhenzhong.duan@oracle.com>, linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xenproject.org, jgross@suse.com,
sstabellini@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de
Subject: Re: [PATCH v5 4/4] x86/xen: Add "nopv" support for HVM guest
Date: Fri, 5 Jul 2019 09:06:53 -0400 [thread overview]
Message-ID: <7f5f42fd-de85-91f4-3274-055df28a27f6@oracle.com> (raw)
In-Reply-To: <1562116778-5846-5-git-send-email-zhenzhong.duan@oracle.com>
On 7/2/19 9:19 PM, Zhenzhong Duan wrote:
> PVH guest needs PV extentions to work, so "nopv" parameter should be
> ignored for PVH but not for HVM guest.
>
> If PVH guest boots up via the Xen-PVH boot entry, xen_pvh is set early,
> we know it's PVH guest and ignore "nopv" parameter directly.
>
> If PVH guest boots up via the normal boot entry same as HVM guest, it's
> hard to distinguish PVH and HVM guest at that time.
>
> To handle that case, add a new function xen_hvm_nopv_guest_late_init()
> to detect PVH at a late time and panic itself if nopv enabled for a
> PVH guest.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> ---
> arch/x86/xen/enlighten_hvm.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
> index 1756cf7..09a010a 100644
> --- a/arch/x86/xen/enlighten_hvm.c
> +++ b/arch/x86/xen/enlighten_hvm.c
> @@ -231,11 +231,37 @@ bool __init xen_hvm_need_lapic(void)
> return true;
> }
>
> +static __init void xen_hvm_nopv_guest_late_init(void)
> +{
> +#ifdef CONFIG_XEN_PVH
> + if (x86_platform.legacy.rtc || !x86_platform.legacy.no_vga)
> + return;
> +
> + /* PVH detected. */
> + xen_pvh = true;
> +
> + panic("\"nopv\" and \"xen_nopv\" parameters are unsupported in PVH guest.");
> +#endif
> +}
Can't all of this be done in xen_hvm_guest_late_init()? It has the same
tests already and it seems to me you should be able to panic from there.
-boris
> +
> +
> static uint32_t __init xen_platform_hvm(void)
> {
> if (xen_pv_domain())
> return 0;
>
> + if (xen_pvh_domain() && nopv) {
> + /* Guest booting via the Xen-PVH boot entry goes here */
> + pr_info("\"nopv\" parameter is ignored in PVH guest\n");
> + nopv = false;
> + } else if (nopv) {
> + /*
> + * Guest booting via normal boot entry (like via grub2) goes
> + * here.
> + */
> + x86_init.hyper.guest_late_init = xen_hvm_nopv_guest_late_init;
> + return 0;
> + }
> return xen_cpuid_base();
> }
>
> @@ -268,4 +294,5 @@ static __init void xen_hvm_guest_late_init(void)
> .init.init_mem_mapping = xen_hvm_init_mem_mapping,
> .init.guest_late_init = xen_hvm_guest_late_init,
> .runtime.pin_vcpu = xen_pin_vcpu,
> + .ignore_nopv = true,
> };
next prev parent reply other threads:[~2019-07-05 13:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 1:19 [PATCH v5 0/4] misc fixes to PV extentions code Zhenzhong Duan
2019-07-03 1:19 ` [PATCH v5 1/4] x86/xen: Mark xen_hvm_need_lapic() and xen_x2apic_para_available() as __init Zhenzhong Duan
2019-07-03 1:19 ` [PATCH v5 2/4] x86: Add "nopv" parameter to disable PV extensions Zhenzhong Duan
2019-07-03 1:19 ` [PATCH v5 3/4] xen: Map "xen_nopv" parameter to "nopv" and mark it obsolete Zhenzhong Duan
2019-07-05 13:01 ` Boris Ostrovsky
2019-07-03 1:19 ` [PATCH v5 4/4] x86/xen: Add "nopv" support for HVM guest Zhenzhong Duan
2019-07-05 13:06 ` Boris Ostrovsky [this message]
2019-07-08 8:33 ` Zhenzhong Duan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7f5f42fd-de85-91f4-3274-055df28a27f6@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=xen-devel@lists.xenproject.org \
--cc=zhenzhong.duan@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®