xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [RFC] xen/pvh: detect PVH after kexec
Date: Mon, 20 Mar 2017 19:20:42 +0100	[thread overview]
Message-ID: <20170320182042.6103-1-vkuznets@redhat.com> (raw)

PVH guests after kexec boot like normal HVM guests and we're not entering
xen_prepare_pvh() but we still want to know that we're PVH. This hack does
the job by using XEN_IOPORT_MAGIC but I didn't find any straitforward way
to do it. Did I miss something? Or shall we introduce a CPUID leaf or
something like that?

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/xen/enlighten.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index ec1d5c4..4a30886 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -51,6 +51,7 @@
 #include <xen/hvm.h>
 #include <xen/hvc-console.h>
 #include <xen/acpi.h>
+#include <xen/platform_pci.h>
 
 #include <asm/paravirt.h>
 #include <asm/apic.h>
@@ -1765,6 +1766,20 @@ void __init xen_prepare_pvh(void)
 
 	x86_init.oem.arch_setup = xen_pvh_arch_setup;
 }
+
+static void xen_detect_pvh(void)
+{
+	short magic;
+
+	if (xen_pvh)
+		return;
+
+	magic = inw(XEN_IOPORT_MAGIC);
+	if (magic != XEN_IOPORT_MAGIC_VAL) {
+		xen_pvh = 1;
+		xen_pvh_arch_setup();
+	}
+}
 #endif
 
 void __ref xen_hvm_init_shared_info(void)
@@ -1912,6 +1927,9 @@ static void __init xen_hvm_guest_init(void)
 
 	init_hvm_pv_info();
 
+	/* Detect PVH booting after kexec */
+	xen_detect_pvh();
+
 	xen_hvm_init_shared_info();
 
 	xen_panic_handler_init();
-- 
2.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

             reply	other threads:[~2017-03-20 18:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 18:20 Vitaly Kuznetsov [this message]
2017-03-20 20:21 ` [RFC] xen/pvh: detect PVH after kexec Boris Ostrovsky
2017-03-21  9:21   ` Vitaly Kuznetsov
2017-03-21 10:01     ` Roger Pau Monne
2017-03-21 10:07       ` Roger Pau Monne
2017-03-21 10:07       ` Jan Beulich
2017-03-21 10:21         ` Roger Pau Monne
2017-03-21 10:42           ` Jan Beulich
2017-03-21 10:59             ` Roger Pau Monne
2017-03-21 11:00             ` Andrew Cooper
2017-03-21 11:53       ` Vitaly Kuznetsov
2017-03-21 12:13         ` Roger Pau Monne
2017-03-21 14:05           ` Boris Ostrovsky
2017-03-21 14:16             ` Roger Pau Monne
2017-03-21 15:01               ` Boris Ostrovsky
2017-03-21 14:35             ` Vitaly Kuznetsov
2017-03-21 14:44         ` Vitaly Kuznetsov
2017-03-21 15:14           ` Boris Ostrovsky
2017-03-21 17:10             ` Vitaly Kuznetsov
2017-03-21 17:28               ` Roger Pau Monne

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=20170320182042.6103-1-vkuznets@redhat.com \
    --to=vkuznets@redhat.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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;
as well as URLs for NNTP newsgroup(s).