CVS commit: [bouyer-xenpvh] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sat Apr 11 21:21:49 UTC 2020 Modified Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: mainbus.c Log Message: Attach hypervisor earlier, so that ISA/PCI emulated device are disabled before we probe them. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.12.1 src/sys/arch/x86/x86/mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/mainbus.c diff -u src/sys/arch/x86/x86/mainbus.c:1.3 src/sys/arch/x86/x86/mainbus.c:1.3.12.1 --- src/sys/arch/x86/x86/mainbus.c:1.3 Thu Feb 14 08:18:25 2019 +++ src/sys/arch/x86/x86/mainbus.c Sat Apr 11 21:21:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $ */ +/* $NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $"); #include #include @@ -225,17 +225,17 @@ mainbus_attach(device_t parent, device_t #endif /* XENPV */ x86_cpubus_attach(self); -#if defined(__i386__) && !defined(XENPV) - i386_mainbus_attach(parent, self, aux); -#elif defined(__x86_64__) && !defined(XENPV) - amd64_mainbus_attach(parent, self, aux); -#endif #if defined(XENPV) } #endif /* XENPV */ #if defined(XEN) xen_mainbus_attach(parent, self, aux); #endif +#if defined(__i386__) && !defined(XENPV) + i386_mainbus_attach(parent, self, aux); +#elif defined(__x86_64__) && !defined(XENPV) + amd64_mainbus_attach(parent, self, aux); +#endif } int
CVS commit: [bouyer-xenpvh] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sat Apr 11 08:06:16 UTC 2020 Modified Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: x86_machdep.c Log Message: Remove spaces in machdep.hypervisor, suggested by mlelstv@ To generate a diff of this commit: cvs rdiff -u -r1.137.2.1 -r1.137.2.2 src/sys/arch/x86/x86/x86_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/x86_machdep.c diff -u src/sys/arch/x86/x86/x86_machdep.c:1.137.2.1 src/sys/arch/x86/x86/x86_machdep.c:1.137.2.2 --- src/sys/arch/x86/x86/x86_machdep.c:1.137.2.1 Wed Apr 8 17:59:16 2020 +++ src/sys/arch/x86/x86/x86_machdep.c Sat Apr 11 08:06:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_machdep.c,v 1.137.2.1 2020/04/08 17:59:16 bouyer Exp $ */ +/* $NetBSD: x86_machdep.c,v 1.137.2.2 2020/04/11 08:06:16 bouyer Exp $ */ /*- * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.137.2.1 2020/04/08 17:59:16 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.137.2.2 2020/04/11 08:06:16 bouyer Exp $"); #include "opt_modular.h" #include "opt_physmem.h" @@ -1255,10 +1255,10 @@ sysctl_machdep_tsc_enable(SYSCTLFN_ARGS) static const char * const vm_guest_name[VM_LAST] = { [VM_GUEST_NO] = "none", [VM_GUEST_VM] = "generic", - [VM_GUEST_XENPV] = "Xen PV", - [VM_GUEST_XENPVH] = "Xen PVH", - [VM_GUEST_XENHVM] = "Xen HVM", - [VM_GUEST_XENPVHVM] = "Xen PVHVM", + [VM_GUEST_XENPV] = "XenPV", + [VM_GUEST_XENPVH] = "XenPVH", + [VM_GUEST_XENHVM] = "XenHVM", + [VM_GUEST_XENPVHVM] = "XenPVHVM", [VM_GUEST_HV] = "Hyper-V", [VM_GUEST_VMWARE] = "VMware", [VM_GUEST_KVM] = "KVM",
CVS commit: [bouyer-xenpvh] src/sys/arch/x86
Module Name:src Committed By: bouyer Date: Fri Apr 10 14:37:54 UTC 2020 Modified Files: src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h src/sys/arch/x86/x86 [bouyer-xenpvh]: cpu.c patch.c Log Message: Skip cx8_spllower patch if we're running on any form of Xen PV, we can't handle PV interrupts with a single atomic op here. Enable x86_patch() for Xen too. To generate a diff of this commit: cvs rdiff -u -r1.117.4.1 -r1.117.4.2 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.181 -r1.181.4.1 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.37 -r1.37.6.1 src/sys/arch/x86/x86/patch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.117.4.1 src/sys/arch/x86/include/cpu.h:1.117.4.2 --- src/sys/arch/x86/include/cpu.h:1.117.4.1 Wed Apr 8 17:59:16 2020 +++ src/sys/arch/x86/include/cpu.h Fri Apr 10 14:37:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.117.4.1 2020/04/08 17:59:16 bouyer Exp $ */ +/* $NetBSD: cpu.h,v 1.117.4.2 2020/04/10 14:37:54 bouyer Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -507,6 +507,19 @@ typedef enum vm_guest { } vm_guest_t; extern vm_guest_t vm_guest; +static __inline bool __unused +vm_guest_is_xenpv(void) +{ + switch(vm_guest) { + case VM_GUEST_XENPV: + case VM_GUEST_XENPVH: + case VM_GUEST_XENPVHVM: + return true; + default: + return false; + } +} + /* cpu_topology.c */ void x86_cpu_topology(struct cpu_info *); Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.181 src/sys/arch/x86/x86/cpu.c:1.181.4.1 --- src/sys/arch/x86/x86/cpu.c:1.181 Tue Jan 14 01:41:37 2020 +++ src/sys/arch/x86/x86/cpu.c Fri Apr 10 14:37:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.181 2020/01/14 01:41:37 pgoyette Exp $ */ +/* $NetBSD: cpu.c,v 1.181.4.1 2020/04/10 14:37:54 bouyer Exp $ */ /* * Copyright (c) 2000-2012 NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.181 2020/01/14 01:41:37 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.181.4.1 2020/04/10 14:37:54 bouyer Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -720,10 +720,8 @@ cpu_boot_secondary_processors(void) kcpuset_t *cpus; u_long i; -#ifndef XEN /* Now that we know the number of CPUs, patch the text segment. */ x86_patch(false); -#endif #if NACPICA > 0 /* Finished with NUMA info for now. */ Index: src/sys/arch/x86/x86/patch.c diff -u src/sys/arch/x86/x86/patch.c:1.37 src/sys/arch/x86/x86/patch.c:1.37.6.1 --- src/sys/arch/x86/x86/patch.c:1.37 Wed Sep 18 15:07:08 2019 +++ src/sys/arch/x86/x86/patch.c Fri Apr 10 14:37:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: patch.c,v 1.37 2019/09/18 15:07:08 kamil Exp $ */ +/* $NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37 2019/09/18 15:07:08 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $"); #include "opt_lockdebug.h" #ifdef i386 @@ -250,7 +250,8 @@ x86_patch(bool early) #endif /* i386 */ #if !defined(SPLDEBUG) - if (!early && (cpu_feature[0] & CPUID_CX8) != 0) { + if (!early && (cpu_feature[0] & CPUID_CX8) != 0 && + !vm_guest_is_xenpv()) { /* Faster splx(), mutex_spin_exit(). */ patchfunc( cx8_spllower, cx8_spllower_end,