Always patch spllower with cx8_spllower; it works fine for Xen now Include x86/x86/patch.c is !xenpv While there, defopt XENPVdiff -r1.37.6.1 -r1.37.6.2 src/sys/arch/x86/x86/patch.c
(bouyer)
--- src/sys/arch/x86/x86/patch.c 2020/04/10 14:37:54 1.37.6.1
+++ src/sys/arch/x86/x86/patch.c 2020/04/14 16:53:57 1.37.6.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $ */ | 1 | /* $NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Andrew Doran. | 8 | * by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Patch kernel code at boot time, depending on available CPU features. | 33 | * Patch kernel code at boot time, depending on available CPU features. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $"); | |
38 | 38 | |||
39 | #include "opt_lockdebug.h" | 39 | #include "opt_lockdebug.h" | |
40 | #ifdef i386 | 40 | #ifdef i386 | |
41 | #include "opt_spldebug.h" | 41 | #include "opt_spldebug.h" | |
42 | #endif | 42 | #endif | |
43 | 43 | |||
44 | #include <sys/types.h> | 44 | #include <sys/types.h> | |
45 | #include <sys/systm.h> | 45 | #include <sys/systm.h> | |
46 | 46 | |||
47 | #include <machine/cpu.h> | 47 | #include <machine/cpu.h> | |
48 | #include <machine/cpufunc.h> | 48 | #include <machine/cpufunc.h> | |
49 | #include <machine/specialreg.h> | 49 | #include <machine/specialreg.h> | |
50 | #include <machine/frameasm.h> | 50 | #include <machine/frameasm.h> | |
@@ -240,28 +240,27 @@ x86_patch(bool early) | @@ -240,28 +240,27 @@ x86_patch(bool early) | |||
240 | * Patch early and late. Second time around the 'lock' prefix | 240 | * Patch early and late. Second time around the 'lock' prefix | |
241 | * may be gone. | 241 | * may be gone. | |
242 | */ | 242 | */ | |
243 | if ((cpu_feature[0] & CPUID_CX8) != 0) { | 243 | if ((cpu_feature[0] & CPUID_CX8) != 0) { | |
244 | patchfunc( | 244 | patchfunc( | |
245 | _atomic_cas_cx8, _atomic_cas_cx8_end, | 245 | _atomic_cas_cx8, _atomic_cas_cx8_end, | |
246 | _atomic_cas_64, _atomic_cas_64_end, | 246 | _atomic_cas_64, _atomic_cas_64_end, | |
247 | NULL | 247 | NULL | |
248 | ); | 248 | ); | |
249 | } | 249 | } | |
250 | #endif /* i386 */ | 250 | #endif /* i386 */ | |
251 | 251 | |||
252 | #if !defined(SPLDEBUG) | 252 | #if !defined(SPLDEBUG) | |
253 | if (!early && (cpu_feature[0] & CPUID_CX8) != 0 && | 253 | if (!early && (cpu_feature[0] & CPUID_CX8) != 0) { | |
254 | !vm_guest_is_xenpv()) { | |||
255 | /* Faster splx(), mutex_spin_exit(). */ | 254 | /* Faster splx(), mutex_spin_exit(). */ | |
256 | patchfunc( | 255 | patchfunc( | |
257 | cx8_spllower, cx8_spllower_end, | 256 | cx8_spllower, cx8_spllower_end, | |
258 | spllower, spllower_end, | 257 | spllower, spllower_end, | |
259 | cx8_spllower_patch | 258 | cx8_spllower_patch | |
260 | ); | 259 | ); | |
261 | #if defined(i386) && !defined(LOCKDEBUG) | 260 | #if defined(i386) && !defined(LOCKDEBUG) | |
262 | patchfunc( | 261 | patchfunc( | |
263 | i686_mutex_spin_exit, i686_mutex_spin_exit_end, | 262 | i686_mutex_spin_exit, i686_mutex_spin_exit_end, | |
264 | mutex_spin_exit, mutex_spin_exit_end, | 263 | mutex_spin_exit, mutex_spin_exit_end, | |
265 | i686_mutex_spin_exit_patch | 264 | i686_mutex_spin_exit_patch | |
266 | ); | 265 | ); | |
267 | #endif /* i386 && !LOCKDEBUG */ | 266 | #endif /* i386 && !LOCKDEBUG */ |
--- src/sys/arch/xen/conf/files.xen 2020/04/11 18:26:07 1.180.2.1
+++ src/sys/arch/xen/conf/files.xen 2020/04/14 16:53:57 1.180.2.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.xen,v 1.180.2.1 2020/04/11 18:26:07 bouyer Exp $ | 1 | # $NetBSD: files.xen,v 1.180.2.2 2020/04/14 16:53:57 bouyer Exp $ | |
2 | # NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp | 2 | # NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp | |
3 | # NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp | 3 | # NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp | |
4 | 4 | |||
5 | ifdef i386 | 5 | ifdef i386 | |
6 | maxpartitions 8 | 6 | maxpartitions 8 | |
7 | else | 7 | else | |
8 | maxpartitions 16 | 8 | maxpartitions 16 | |
9 | endif | 9 | endif | |
10 | 10 | |||
11 | maxusers 2 16 128 | 11 | maxusers 2 16 128 | |
12 | 12 | |||
13 | defparam opt_kernbase.h KERNBASE | 13 | defparam opt_kernbase.h KERNBASE | |
14 | 14 | |||
@@ -140,26 +140,27 @@ file dev/md_root.c memory_disk_hooks | @@ -140,26 +140,27 @@ file dev/md_root.c memory_disk_hooks | |||
140 | file arch/x86/x86/bus_dma.c machdep | 140 | file arch/x86/x86/bus_dma.c machdep | |
141 | file arch/x86/x86/core_machdep.c coredump | 141 | file arch/x86/x86/core_machdep.c coredump | |
142 | file arch/xen/x86/xen_bus_dma.c machdep & xenpv | 142 | file arch/xen/x86/xen_bus_dma.c machdep & xenpv | |
143 | file arch/x86/x86/bus_space.c machdep | 143 | file arch/x86/x86/bus_space.c machdep | |
144 | file arch/xen/x86/consinit.c machdep & xenpv | 144 | file arch/xen/x86/consinit.c machdep & xenpv | |
145 | file arch/x86/x86/consinit.c machdep & xenpvhvm | 145 | file arch/x86/x86/consinit.c machdep & xenpvhvm | |
146 | file arch/x86/x86/identcpu.c machdep | 146 | file arch/x86/x86/identcpu.c machdep | |
147 | file arch/xen/x86/pintr.c machdep & dom0ops & xenpv | 147 | file arch/xen/x86/pintr.c machdep & dom0ops & xenpv | |
148 | file arch/xen/x86/xen_ipi.c multiprocessor & xenpv | 148 | file arch/xen/x86/xen_ipi.c multiprocessor & xenpv | |
149 | file arch/x86/x86/idt.c machdep | 149 | file arch/x86/x86/idt.c machdep | |
150 | file arch/x86/x86/intr.c machdep & xenpvhvm | 150 | file arch/x86/x86/intr.c machdep & xenpvhvm | |
151 | file arch/x86/x86/x86_softintr.c machdep | 151 | file arch/x86/x86/x86_softintr.c machdep | |
152 | file arch/x86/x86/ipi.c xenpvhvm | 152 | file arch/x86/x86/ipi.c xenpvhvm | |
153 | file arch/x86/x86/patch.c machdep & ! xenpv | |||
153 | file arch/x86/x86/pmap.c machdep | 154 | file arch/x86/x86/pmap.c machdep | |
154 | file arch/x86/x86/x86_tlb.c machdep | 155 | file arch/x86/x86/x86_tlb.c machdep | |
155 | file arch/x86/x86/procfs_machdep.c procfs | 156 | file arch/x86/x86/procfs_machdep.c procfs | |
156 | file arch/x86/x86/sys_machdep.c machdep | 157 | file arch/x86/x86/sys_machdep.c machdep | |
157 | file arch/x86/x86/tsc.c machdep | 158 | file arch/x86/x86/tsc.c machdep | |
158 | file arch/x86/x86/vm_machdep.c machdep | 159 | file arch/x86/x86/vm_machdep.c machdep | |
159 | file arch/x86/x86/x86_autoconf.c machdep & xenpvhvm | 160 | file arch/x86/x86/x86_autoconf.c machdep & xenpvhvm | |
160 | file arch/x86/x86/x86_machdep.c machdep | 161 | file arch/x86/x86/x86_machdep.c machdep | |
161 | file arch/x86/x86/platform.c machdep | 162 | file arch/x86/x86/platform.c machdep | |
162 | 163 | |||
163 | include "arch/xen/conf/files.compat" | 164 | include "arch/xen/conf/files.compat" | |
164 | 165 | |||
165 | # BIOS32 routines | 166 | # BIOS32 routines | |
@@ -380,27 +381,27 @@ include "dev/cardbus/files.cardbus" | @@ -380,27 +381,27 @@ include "dev/cardbus/files.cardbus" | |||
380 | ifdef i386 | 381 | ifdef i386 | |
381 | file arch/i386/i386/rbus_machdep.c cardbus | 382 | file arch/i386/i386/rbus_machdep.c cardbus | |
382 | elifdef amd64 | 383 | elifdef amd64 | |
383 | file arch/amd64/amd64/rbus_machdep.c cardbus | 384 | file arch/amd64/amd64/rbus_machdep.c cardbus | |
384 | endif | 385 | endif | |
385 | 386 | |||
386 | # this wants to be probed as late as possible. | 387 | # this wants to be probed as late as possible. | |
387 | # | 388 | # | |
388 | # Machine-independent PCMCIA drivers | 389 | # Machine-independent PCMCIA drivers | |
389 | # | 390 | # | |
390 | include "dev/pcmcia/files.pcmcia" | 391 | include "dev/pcmcia/files.pcmcia" | |
391 | 392 | |||
392 | # Domain-0 operations | 393 | # Domain-0 operations | |
393 | defflag opt_xen.h DOM0OPS | 394 | defflag opt_xen.h DOM0OPS XENPV | |
394 | file arch/xen/xen/privcmd.c dom0ops | 395 | file arch/xen/xen/privcmd.c dom0ops | |
395 | file arch/xen/x86/xen_shm_machdep.c dom0ops | 396 | file arch/xen/x86/xen_shm_machdep.c dom0ops | |
396 | file arch/x86/pci/pci_machdep.c (xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm ) | 397 | file arch/x86/pci/pci_machdep.c (xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm ) | |
397 | file arch/x86/pci/pci_intr_machdep.c (xenpvhvm | hypervisor) & pci | 398 | file arch/x86/pci/pci_intr_machdep.c (xenpvhvm | hypervisor) & pci | |
398 | file arch/x86/pci/pci_msi_machdep.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix | 399 | file arch/x86/pci/pci_msi_machdep.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix | |
399 | file arch/x86/pci/msipic.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix | 400 | file arch/x86/pci/msipic.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix | |
400 | file arch/x86/isa/isa_machdep.c (xenpvhvm | hypervisor) & ( dom0ops | xenpvhvm ) | 401 | file arch/x86/isa/isa_machdep.c (xenpvhvm | hypervisor) & ( dom0ops | xenpvhvm ) | |
401 | file arch/xen/xen/xenevt.c xenevt & (dom0ops | xenpvhvm) | 402 | file arch/xen/xen/xenevt.c xenevt & (dom0ops | xenpvhvm) | |
402 | file arch/xen/xen/xennetback_xenbus.c xvif | 403 | file arch/xen/xen/xennetback_xenbus.c xvif | |
403 | file arch/xen/xen/xennet_checksum.c xvif | xennet | 404 | file arch/xen/xen/xennet_checksum.c xvif | xennet | |
404 | file arch/xen/xen/xbdback_xenbus.c xbdback | 405 | file arch/xen/xen/xbdback_xenbus.c xbdback | |
405 | 406 | |||
406 | ifdef i386 | 407 | ifdef i386 |