summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2015-12-12 12:33:50 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2015-12-12 12:33:50 +0000
commit2022ba9abb541f1e704dc8d75e56b3e0a6539f40 (patch)
treebeb4d6762e3aa94c26b4fcbda146605643bbbd69 /sys/arch/i386
parent7ce171203f18247f94d49bb995188ba2a8d5c87f (diff)
Identify hypervisors before configuring other children of the mainbus
(bios, CPU, interrupt handlers, pvbus). This splits the pvbus attach function into two parts: pvbus_identify() to scan the CPUID registers for supported hypervisors and pvbus_attach() to attach the bus, print information, and configure the children. This will be needed for Xen and KVM, as discussed with mikeb@ and sf@ OK mlarkin@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/machdep.c7
-rw-r--r--sys/arch/i386/i386/mainbus.c9
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 755d4d09048..bd1fba43bcc 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.577 2015/12/07 06:34:14 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.578 2015/12/12 12:33:49 reyk Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2042,11 +2042,6 @@ identifycpu(struct cpu_info *ci)
if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMAP)
replacesmap();
#endif
-
-#if NPVBUS > 0
- if (cpu_ecxfeature & CPUIDECX_HV)
- has_hv_cpuid = 1;
-#endif
}
#ifndef SMALL_KERNEL
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index 218c856f042..c32a41348c4 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.53 2015/08/20 04:41:46 mlarkin Exp $ */
+/* $OpenBSD: mainbus.c,v 1.54 2015/12/12 12:33:49 reyk Exp $ */
/* $NetBSD: mainbus.c,v 1.21 1997/06/06 23:14:20 thorpej Exp $ */
/*
@@ -36,6 +36,7 @@
#include <sys/device.h>
#include <machine/bus.h>
+#include <machine/specialreg.h>
#include <dev/isa/isavar.h>
#include <dev/eisa/eisavar.h>
@@ -142,6 +143,12 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
+#if NPVBUS > 0
+ /* Detect hypervisors early, attach the paravirtual bus later */
+ if (cpu_ecxfeature & CPUIDECX_HV)
+ pvbus_identify();
+#endif
+
#if NBIOS > 0
{
mba.mba_bios.ba_name = "bios";