Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/bouyer-xenpvh]: src/sys/arch/xen/x86 Don't try to attach hypervisor on n...



details:   https://anonhg.NetBSD.org/src/rev/544c2c042b25
branches:  bouyer-xenpvh
changeset: 982939:544c2c042b25
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Apr 16 17:46:44 2020 +0000

description:
Don't try to attach hypervisor on non Xen; no more error messages about
hypervisor when booting on bare metal.

diffstat:

 sys/arch/xen/x86/xen_mainbus.c |  37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)

diffs (61 lines):

diff -r 01a482630ced -r 544c2c042b25 sys/arch/xen/x86/xen_mainbus.c
--- a/sys/arch/xen/x86/xen_mainbus.c    Thu Apr 16 17:44:54 2020 +0000
+++ b/sys/arch/xen/x86/xen_mainbus.c    Thu Apr 16 17:46:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xen_mainbus.c,v 1.6.12.1 2020/04/16 08:46:35 bouyer Exp $      */
+/*     $NetBSD: xen_mainbus.c,v 1.6.12.2 2020/04/16 17:46:44 bouyer Exp $      */
 /*     NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp         */
 /*     NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp       */
 
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.6.12.1 2020/04/16 08:46:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.6.12.2 2020/04/16 17:46:44 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -121,20 +121,31 @@
 {
        union xen_mainbus_attach_args mba;
 
+       switch(vm_guest) {
+       case VM_GUEST_XENPV:
 #if NIPMI > 0 && defined(XENPV)
-       memset(&mba.mba_ipmi, 0, sizeof(mba.mba_ipmi));
-       mba.mba_ipmi.iaa_iot = x86_bus_space_io;
-       mba.mba_ipmi.iaa_memt = x86_bus_space_mem;
-       if (ipmi_probe(&mba.mba_ipmi))
-               config_found_ia(self, "ipmibus", &mba.mba_ipmi, 0);
+               memset(&mba.mba_ipmi, 0, sizeof(mba.mba_ipmi));
+               mba.mba_ipmi.iaa_iot = x86_bus_space_io;
+               mba.mba_ipmi.iaa_memt = x86_bus_space_mem;
+               if (ipmi_probe(&mba.mba_ipmi))
+                       config_found_ia(self, "ipmibus", &mba.mba_ipmi, 0);
 #endif
-
-       mba.mba_haa.haa_busname = "hypervisor";
-       config_found_ia(self, "hypervisorbus", &mba.mba_haa, xen_mainbus_print);
+       /* FALLTHROUGH */
+       case VM_GUEST_XENHVM:
+               mba.mba_haa.haa_busname = "hypervisor";
+               config_found_ia(self, "hypervisorbus",
+                   &mba.mba_haa, xen_mainbus_print);
+               break;
+       default:
+               return;
+       }
 
-       /* save/restore for Xen */
-       if (!pmf_device_register(self, NULL, NULL))
-               aprint_error_dev(self, "couldn't establish power handler\n");
+       if (vm_guest == VM_GUEST_XENPV) {
+               /* save/restore for Xen */
+               if (!pmf_device_register(self, NULL, NULL))
+                       aprint_error_dev(self,
+                           "couldn't establish power handler\n");
+       }
 }
 
 static int



Home | Main Index | Thread Index | Old Index