All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] xen/pvh: detect PVH after kexec
@ 2017-03-20 18:20 Vitaly Kuznetsov
  2017-03-20 20:21 ` Boris Ostrovsky
  0 siblings, 1 reply; 20+ messages in thread
From: Vitaly Kuznetsov @ 2017-03-20 18:20 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, Boris Ostrovsky, Roger Pau Monne

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-03-21 17:29 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-20 18:20 [RFC] xen/pvh: detect PVH after kexec Vitaly Kuznetsov
2017-03-20 20:21 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.