Thu Apr 16 08:46:36 2020 UTC ()
Reorganise sources to make it possible to include Xen PVHVM support in
native kernels. Among others:
- move xen/include/amd64/hypercall.h to amd64/include/xen and
  xen/include/i386/hypercall.h to i386/include/xen
- exclude some native files from the build for xenpv
- add xen to "machine" config statement for amd64 and i386
- split arch/xen/conf/files.xen to arch/xen/conf/files.xen (for pv drivers)
  and arch/xen/conf/files.xen.pv (for full pv support)
- add GENERIC_XENHVM kernel config which includes GENERIC and add Xen PV
  drivers.


(bouyer)
diff -r1.73.6.3 -r1.73.6.4 src/sys/arch/amd64/amd64/vector.S
diff -r0 -r1.1.2.1 src/sys/arch/amd64/conf/GENERIC_XENHVM
diff -r1.82 -r1.82.2.1 src/sys/arch/amd64/conf/Makefile.amd64
diff -r1.175.4.1 -r1.175.4.2 src/sys/arch/amd64/conf/XEN3_DOM0
diff -r1.115 -r1.115.4.1 src/sys/arch/amd64/conf/files.amd64
diff -r1.11 -r1.11.26.1 src/sys/arch/amd64/conf/std.amd64
diff -r1.11 -r1.11.10.1 src/sys/arch/amd64/conf/std.xen
diff -r0 -r1.1.2.1 src/sys/arch/amd64/include/xen/hypercalls.h
diff -r0 -r1.1.2.1 src/sys/arch/i386/conf/GENERIC_XENHVM
diff -r1.194 -r1.194.10.1 src/sys/arch/i386/conf/Makefile.i386
diff -r1.21.2.1 -r1.21.2.2 src/sys/arch/i386/conf/XEN3PAE_DOM0
diff -r1.401 -r1.401.6.1 src/sys/arch/i386/conf/files.i386
diff -r1.35 -r1.35.26.1 src/sys/arch/i386/conf/std.i386
diff -r1.825.4.1 -r1.825.4.2 src/sys/arch/i386/i386/machdep.c
diff -r1.85.6.4 -r1.85.6.5 src/sys/arch/i386/i386/vector.S
diff -r0 -r1.1.2.1 src/sys/arch/i386/include/xen/hypercalls.h
diff -r1.107.10.1 -r1.107.10.2 src/sys/arch/x86/conf/files.x86
diff -r1.61.6.2 -r1.61.6.3 src/sys/arch/x86/include/intr.h
diff -r1.12 -r1.12.10.1 src/sys/arch/x86/x86/cpu_ucode.c
diff -r1.10 -r1.10.6.1 src/sys/arch/x86/x86/cpu_ucode_amd.c
diff -r1.17 -r1.17.8.1 src/sys/arch/x86/x86/cpu_ucode_intel.c
diff -r1.76.6.1 -r1.76.6.2 src/sys/arch/x86/x86/lapic.c
diff -r1.3.12.1 -r1.3.12.2 src/sys/arch/x86/x86/mainbus.c
diff -r1.48 -r1.48.10.1 src/sys/arch/xen/conf/Makefile.xen
diff -r1.180.2.2 -r1.180.2.3 src/sys/arch/xen/conf/files.xen
diff -r0 -r1.1.2.1 src/sys/arch/xen/conf/files.xen.pv
diff -r1.10 -r1.10.10.1 src/sys/arch/xen/conf/std.xen
diff -r1.49.10.1 -r1.49.10.2 src/sys/arch/xen/include/hypervisor.h
diff -r1.53.6.1 -r1.53.6.2 src/sys/arch/xen/include/intr.h
diff -r1.42 -r1.42.6.1 src/sys/arch/xen/include/xenpmap.h
diff -r1.12 -r0 src/sys/arch/xen/include/amd64/hypercalls.h
diff -r1.19 -r0 src/sys/arch/xen/include/i386/hypercalls.h
diff -r1.36.8.1 -r1.36.8.2 src/sys/arch/xen/x86/hypervisor_machdep.c
diff -r1.21.2.4 -r1.21.2.5 src/sys/arch/xen/x86/xen_intr.c
diff -r1.35.6.2 -r1.35.6.3 src/sys/arch/xen/x86/xen_ipi.c
diff -r1.6 -r1.6.12.1 src/sys/arch/xen/x86/xen_mainbus.c
diff -r1.88.2.3 -r1.88.2.4 src/sys/arch/xen/xen/evtchn.c
diff -r1.109 -r1.109.2.1 src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -r1.97 -r1.97.2.1 src/sys/arch/xen/xen/xbd_xenbus.c
diff -r1.22 -r1.22.10.1 src/sys/arch/xen/xen/xen_machdep.c
diff -r1.48 -r1.48.10.1 src/sys/arch/xen/xen/xencons.c
diff -r1.21 -r1.21.10.1 src/sys/arch/xen/xenbus/xenbus_comms.c
diff -r1.17 -r1.17.2.1 src/sys/arch/xen/xenbus/xenbus_dev.c

cvs diff -r1.73.6.3 -r1.73.6.4 src/sys/arch/amd64/amd64/vector.S (expand / switch to unified diff)

--- src/sys/arch/amd64/amd64/vector.S 2020/04/12 17:25:52 1.73.6.3
+++ src/sys/arch/amd64/amd64/vector.S 2020/04/16 08:46:34 1.73.6.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vector.S,v 1.73.6.3 2020/04/12 17:25:52 bouyer Exp $ */ 1/* $NetBSD: vector.S,v 1.73.6.4 2020/04/16 08:46:34 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2007, 2008 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 Charles M. Hannum and by Andrew Doran. 8 * by Charles M. Hannum and 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.
@@ -74,50 +74,51 @@ @@ -74,50 +74,51 @@
74#define ALIGN_TEXT .align 16,0x90 74#define ALIGN_TEXT .align 16,0x90
75 75
76#include <machine/i8259.h> 76#include <machine/i8259.h>
77#include <machine/i82093reg.h> 77#include <machine/i82093reg.h>
78#include <machine/i82489reg.h> 78#include <machine/i82489reg.h>
79#include <machine/frameasm.h> 79#include <machine/frameasm.h>
80#include <machine/segments.h> 80#include <machine/segments.h>
81#include <machine/trap.h> 81#include <machine/trap.h>
82#include <machine/specialreg.h> 82#include <machine/specialreg.h>
83 83
84#include "ioapic.h" 84#include "ioapic.h"
85#include "lapic.h" 85#include "lapic.h"
86#include "assym.h" 86#include "assym.h"
87#ifndef XEN 87#ifndef XENPV
88#include "hyperv.h" 88#include "hyperv.h"
89#endif 89#endif
90 90
91 .text 91 .text
92 92
93/* 93/*
94 * Macros for interrupt entry, call to handler, and exit. 94 * Macros for interrupt entry, call to handler, and exit.
95 * 95 *
96 * XXX 96 * XXX
97 * The interrupt frame is set up to look like a trap frame. This may be a 97 * The interrupt frame is set up to look like a trap frame. This may be a
98 * waste. The only handler which needs a frame is the clock handler, and it 98 * waste. The only handler which needs a frame is the clock handler, and it
99 * only needs a few bits. Xdoreti() needs a trap frame for handling ASTs, but 99 * only needs a few bits. Xdoreti() needs a trap frame for handling ASTs, but
100 * it could easily convert the frame on demand. 100 * it could easily convert the frame on demand.
101 * 101 *
102 * The direct costs of setting up a trap frame are two pushq's (error code and 102 * The direct costs of setting up a trap frame are two pushq's (error code and
103 * trap number), an addl to get rid of these, and pushing and popping the 103 * trap number), an addl to get rid of these, and pushing and popping the
104 * callee-saved registers %esi, %edi, %ebx, and %ebp twice. 104 * callee-saved registers %esi, %edi, %ebx, and %ebp twice.
105 * 105 *
106 * If the interrupt frame is made more flexible, INTR can push %eax first and 106 * If the interrupt frame is made more flexible, INTR can push %eax first and
107 * decide the ipending case with less overhead, e.g., by avoiding loading the 107 * decide the ipending case with less overhead, e.g., by avoiding loading the
108 * segment registers. 108 * segment registers.
109 */ 109 */
110 110
 111#ifndef XENPV
111#if NLAPIC > 0 112#if NLAPIC > 0
112#ifdef MULTIPROCESSOR 113#ifdef MULTIPROCESSOR
113IDTVEC(recurse_lapic_ipi) 114IDTVEC(recurse_lapic_ipi)
114 INTR_RECURSE_HWFRAME 115 INTR_RECURSE_HWFRAME
115 pushq $0 116 pushq $0
116 pushq $T_ASTFLT 117 pushq $T_ASTFLT
117 INTR_RECURSE_ENTRY 118 INTR_RECURSE_ENTRY
118 jmp 1f 119 jmp 1f
119IDTVEC_END(recurse_lapic_ipi) 120IDTVEC_END(recurse_lapic_ipi)
120IDTVEC(handle_x2apic_ipi) 121IDTVEC(handle_x2apic_ipi)
121 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx 122 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
122 xorl %eax,%eax 123 xorl %eax,%eax
123 xorl %edx,%edx 124 xorl %edx,%edx
@@ -299,27 +300,26 @@ IDTVEC_END(resume_hyperv_hypercall) @@ -299,27 +300,26 @@ IDTVEC_END(resume_hyperv_hypercall)
299 300
300 TEXT_USER_BEGIN 301 TEXT_USER_BEGIN
301IDTVEC(intr_hyperv_hypercall) 302IDTVEC(intr_hyperv_hypercall)
302 pushq $0 303 pushq $0
303 pushq $T_ASTFLT 304 pushq $T_ASTFLT
304 INTRENTRY 305 INTRENTRY
305 jmp _C_LABEL(Xhandle_hyperv_hypercall) 306 jmp _C_LABEL(Xhandle_hyperv_hypercall)
306IDTVEC_END(intr_hyperv_hypercall) 307IDTVEC_END(intr_hyperv_hypercall)
307 TEXT_USER_END 308 TEXT_USER_END
308#endif /* NHYPERV > 0 */ 309#endif /* NHYPERV > 0 */
309 310
310#endif /* NLAPIC > 0 */ 311#endif /* NLAPIC > 0 */
311 312
312#ifndef XENPV 
313/* 313/*
314 * TLB shootdown handler. 314 * TLB shootdown handler.
315 */ 315 */
316IDTVEC(handle_lapic_tlb) 316IDTVEC(handle_lapic_tlb)
317 movq _C_LABEL(local_apic_va),%rax 317 movq _C_LABEL(local_apic_va),%rax
318 movl $0,LAPIC_EOI(%rax) 318 movl $0,LAPIC_EOI(%rax)
319 KCOV_DISABLE 319 KCOV_DISABLE
320 callq _C_LABEL(pmap_tlb_intr) 320 callq _C_LABEL(pmap_tlb_intr)
321 KCOV_ENABLE 321 KCOV_ENABLE
322 INTRFASTEXIT 322 INTRFASTEXIT
323IDTVEC_END(handle_lapic_tlb) 323IDTVEC_END(handle_lapic_tlb)
324IDTVEC(handle_x2apic_tlb) 324IDTVEC(handle_x2apic_tlb)
325 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx 325 movl $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx

File Added: src/sys/arch/amd64/conf/Attic/GENERIC_XENHVM
# $NetBSD: GENERIC_XENHVM,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $

include "arch/amd64/conf/GENERIC"

options 	XENPVHVM
options 	XEN
no options 	SVS		# Separate Virtual Space
options 	MAXPHYS=32768	#xbd doesn't handle 64k transfers
hypervisor*	at mainbus?		# Xen hypervisor
#vcpu*		at hypervisor?		# Xen virtual CPUs
xenbus*	 	at hypervisor?		# Xen virtual bus
xencons*	at hypervisor?		# Xen virtual console
xennet*	 	at xenbus?		# Xen virtual network interface
xbd*		at xenbus?		# Xen virtual block device

cvs diff -r1.82 -r1.82.2.1 src/sys/arch/amd64/conf/Makefile.amd64 (expand / switch to unified diff)

--- src/sys/arch/amd64/conf/Makefile.amd64 2020/04/04 07:03:57 1.82
+++ src/sys/arch/amd64/conf/Makefile.amd64 2020/04/16 08:46:34 1.82.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile.amd64,v 1.82 2020/04/04 07:03:57 maxv Exp $ 1# $NetBSD: Makefile.amd64,v 1.82.2.1 2020/04/16 08:46:34 bouyer Exp $
2 2
3# Makefile for NetBSD 3# Makefile for NetBSD
4# 4#
5# This makefile is constructed from a machine description: 5# This makefile is constructed from a machine description:
6# config machineid 6# config machineid
7# Most changes should be made in the machine description 7# Most changes should be made in the machine description
8# /sys/arch/amd64/conf/``machineid'' 8# /sys/arch/amd64/conf/``machineid''
9# after which you should do 9# after which you should do
10# config machineid 10# config machineid
11# Machine generic makefile changes should be made in 11# Machine generic makefile changes should be made in
12# /sys/arch/amd64/conf/Makefile.amd64 12# /sys/arch/amd64/conf/Makefile.amd64
13# after which config should be rerun for all machines of that type. 13# after which config should be rerun for all machines of that type.
14# 14#
@@ -67,26 +67,28 @@ KCSANFLAGS= -fsanitize=thread @@ -67,26 +67,28 @@ KCSANFLAGS= -fsanitize=thread
67KCSANFLAGS.${f}= # empty 67KCSANFLAGS.${f}= # empty
68.endfor 68.endfor
69CFLAGS+= ${KCSANFLAGS.${.IMPSRC:T}:U${KCSANFLAGS}} 69CFLAGS+= ${KCSANFLAGS.${.IMPSRC:T}:U${KCSANFLAGS}}
70.endif 70.endif
71 71
72.if ${KMSAN:U0} > 0 && ${HAVE_LLVM:Uno} == "yes" 72.if ${KMSAN:U0} > 0 && ${HAVE_LLVM:Uno} == "yes"
73KMSANFLAGS= -fsanitize=kernel-memory 73KMSANFLAGS= -fsanitize=kernel-memory
74.for f in subr_msan.c 74.for f in subr_msan.c
75KMSANFLAGS.${f}= # empty 75KMSANFLAGS.${f}= # empty
76.endfor 76.endfor
77CFLAGS+= ${KMSANFLAGS.${.IMPSRC:T}:U${KMSANFLAGS}} 77CFLAGS+= ${KMSANFLAGS.${.IMPSRC:T}:U${KMSANFLAGS}}
78.endif 78.endif
79 79
 80EXTRA_INCLUDES= -I$S/external/mit/xen-include-public/dist/
 81
80## 82##
81## (3) libkern and compat 83## (3) libkern and compat
82## 84##
83OPT_MODULAR= %MODULAR% 85OPT_MODULAR= %MODULAR%
84 86
85## 87##
86## (4) local objects, compile rules, and dependencies 88## (4) local objects, compile rules, and dependencies
87## 89##
88 90
89## 91##
90## (5) link settings 92## (5) link settings
91## 93##
92TEXTADDR?= 0xffffffff80200000 94TEXTADDR?= 0xffffffff80200000

cvs diff -r1.175.4.1 -r1.175.4.2 src/sys/arch/amd64/conf/XEN3_DOM0 (expand / switch to unified diff)

--- src/sys/arch/amd64/conf/XEN3_DOM0 2020/04/12 21:20:16 1.175.4.1
+++ src/sys/arch/amd64/conf/XEN3_DOM0 2020/04/16 08:46:34 1.175.4.2
@@ -1,28 +1,28 @@ @@ -1,28 +1,28 @@
1# $NetBSD: XEN3_DOM0,v 1.175.4.1 2020/04/12 21:20:16 bouyer Exp $ 1# $NetBSD: XEN3_DOM0,v 1.175.4.2 2020/04/16 08:46:34 bouyer Exp $
2 2
3include "arch/amd64/conf/std.xen" 3include "arch/amd64/conf/std.xen"
4 4
5options XENPV # PV dom0 support 5options XENPV # PV dom0 support
6#options MULTIPROCESSOR # (not yet - dom0 stuff is not MP-safe) 6#options MULTIPROCESSOR # (not yet - dom0 stuff is not MP-safe)
7options NO_PREEMPTION 7options NO_PREEMPTION
8 8
9options INCLUDE_CONFIG_FILE # embed config file in kernel binary 9options INCLUDE_CONFIG_FILE # embed config file in kernel binary
10 10
11#options UVMHIST 11#options UVMHIST
12#options UVMHIST_PRINT 12#options UVMHIST_PRINT
13#options SYSCALL_DEBUG 13#options SYSCALL_DEBUG
14 14
15#ident "XEN3_DOM0-$Revision: 1.175.4.1 $" 15#ident "XEN3_DOM0-$Revision: 1.175.4.2 $"
16 16
17maxusers 32 # estimated number of users 17maxusers 32 # estimated number of users
18 18
19# 19#
20options DOM0OPS 20options DOM0OPS
21 21
22# boot messages with MPBIOS, acpi and ioapic can be quite large 22# boot messages with MPBIOS, acpi and ioapic can be quite large
23options MSGBUFSIZE=24576 23options MSGBUFSIZE=24576
24 24
25# CPU features 25# CPU features
26est0 at cpu0 # Intel Enhanced SpeedStep (non-ACPI) 26est0 at cpu0 # Intel Enhanced SpeedStep (non-ACPI)
27powernow0 at cpu0 # AMD PowerNow! and Cool'n'Quiet (non-ACPI) 27powernow0 at cpu0 # AMD PowerNow! and Cool'n'Quiet (non-ACPI)
28 28
@@ -214,26 +214,27 @@ acpiec* at acpi? # ACPI Embedded Contr @@ -214,26 +214,27 @@ acpiec* at acpi? # ACPI Embedded Contr
214acpiecdt* at acpi? # ACPI Embedded Controller (early) 214acpiecdt* at acpi? # ACPI Embedded Controller (early)
215acpilid* at acpi? # ACPI Lid Switch 215acpilid* at acpi? # ACPI Lid Switch
216acpitz* at acpi? # ACPI Thermal Zone 216acpitz* at acpi? # ACPI Thermal Zone
217aibs* at acpi? # ASUSTeK AI Booster hardware monitor 217aibs* at acpi? # ASUSTeK AI Booster hardware monitor
218hpqlb* at acpi? # HP Quick Launch Buttons 218hpqlb* at acpi? # HP Quick Launch Buttons
219pckbc* at acpi? # PC keyboard controller 219pckbc* at acpi? # PC keyboard controller
220pcppi* at acpi? # AT-style speaker sound 220pcppi* at acpi? # AT-style speaker sound
221 221
222# PCI bus support 222# PCI bus support
223pci* at hypervisor? bus ? 223pci* at hypervisor? bus ?
224pci* at pchb? bus ? 224pci* at pchb? bus ?
225ppb* at pci? dev ? function ? # PCI-PCI bridges 225ppb* at pci? dev ? function ? # PCI-PCI bridges
226pci* at ppb? bus ? 226pci* at ppb? bus ?
 227options NO_PCI_MSI_MSIX
227 228
228# pci backend devices, used for PCI pass-through. To export a PCI device 229# pci backend devices, used for PCI pass-through. To export a PCI device
229# to a domU, the device has to be attached to the pciback driver in the dom0. 230# to a domU, the device has to be attached to the pciback driver in the dom0.
230# you can force a device to attach to the pciback driver in dom0 passing 231# you can force a device to attach to the pciback driver in dom0 passing
231# pciback.hide=(bus:dev.fun)(bus:dev.func) to the dom0 kernel boot parameters. 232# pciback.hide=(bus:dev.fun)(bus:dev.func) to the dom0 kernel boot parameters.
232# bus and dev are 2-digits hex number, func is a single-digit number: 233# bus and dev are 2-digits hex number, func is a single-digit number:
233# pciback.hide=(00:1a.0)(00:1a.1)(00:1a.7) 234# pciback.hide=(00:1a.0)(00:1a.1)(00:1a.7)
234pciback* at pci? # pci backend device 235pciback* at pci? # pci backend device
235 236
236# PCI bridges 237# PCI bridges
237ichlpcib* at pci? dev ? function ? # Intel ICH PCI-ISA w/ timecounter, 238ichlpcib* at pci? dev ? function ? # Intel ICH PCI-ISA w/ timecounter,
238 # watchdog and SpeedStep support 239 # watchdog and SpeedStep support
239pcib* at pci? dev ? function ? # PCI-ISA bridges 240pcib* at pci? dev ? function ? # PCI-ISA bridges

cvs diff -r1.115 -r1.115.4.1 src/sys/arch/amd64/conf/files.amd64 (expand / switch to unified diff)

--- src/sys/arch/amd64/conf/files.amd64 2020/01/09 00:42:24 1.115
+++ src/sys/arch/amd64/conf/files.amd64 2020/04/16 08:46:34 1.115.4.1
@@ -1,20 +1,18 @@ @@ -1,20 +1,18 @@
1# $NetBSD: files.amd64,v 1.115 2020/01/09 00:42:24 manu Exp $ 1# $NetBSD: files.amd64,v 1.115.4.1 2020/04/16 08:46:34 bouyer Exp $
2# 2#
3# new style config file for amd64 architecture 3# new style config file for amd64 architecture
4# 4#
5 5
6ifndef xen 
7 
8# maxpartitions must be first item in files.${ARCH}.newconf 6# maxpartitions must be first item in files.${ARCH}.newconf
9maxpartitions 16 7maxpartitions 16
10 8
11maxusers 2 16 128 9maxusers 2 16 128
12 10
13# delay before cpu_reset() for reboot. 11# delay before cpu_reset() for reboot.
14defparam CPURESET_DELAY 12defparam CPURESET_DELAY
15 13
16# The REAL{BASE,EXT}MEM options 14# The REAL{BASE,EXT}MEM options
17defparam opt_realmem.h REALBASEMEM REALEXTMEM 15defparam opt_realmem.h REALBASEMEM REALEXTMEM
18 16
19# The PHYSMEM_MAX_{SIZE,ADDR} optionms 17# The PHYSMEM_MAX_{SIZE,ADDR} optionms
20defparam opt_physmem.h PHYSMEM_MAX_ADDR PHYSMEM_MAX_SIZE 18defparam opt_physmem.h PHYSMEM_MAX_ADDR PHYSMEM_MAX_SIZE
@@ -27,47 +25,47 @@ defflag opt_spectre.h SPECTRE_V2_GCC_MIT @@ -27,47 +25,47 @@ defflag opt_spectre.h SPECTRE_V2_GCC_MIT
27# with the i386 (they include the opt_*.h for these) 25# with the i386 (they include the opt_*.h for these)
28# 26#
29 27
30defflag USER_LDT 28defflag USER_LDT
31defflag eisa.h EISA 29defflag eisa.h EISA
32 30
33# Start code 31# Start code
34file arch/amd64/amd64/locore.S machdep 32file arch/amd64/amd64/locore.S machdep
35file arch/amd64/amd64/vector.S machdep 33file arch/amd64/amd64/vector.S machdep
36file arch/amd64/amd64/copy.S machdep 34file arch/amd64/amd64/copy.S machdep
37file arch/amd64/amd64/spl.S machdep 35file arch/amd64/amd64/spl.S machdep
38 36
39file arch/amd64/amd64/amd64_trap.S machdep 37file arch/amd64/amd64/amd64_trap.S machdep
40file arch/amd64/amd64/autoconf.c machdep 38file arch/amd64/amd64/autoconf.c machdep & !xenpv
41file arch/amd64/amd64/busfunc.S machdep 39file arch/amd64/amd64/busfunc.S machdep
42file arch/amd64/amd64/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum 40file arch/amd64/amd64/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum
43file arch/amd64/amd64/cpufunc.S machdep 41file arch/amd64/amd64/cpufunc.S machdep
44file arch/amd64/amd64/db_disasm.c ddb 42file arch/amd64/amd64/db_disasm.c ddb
45file arch/amd64/amd64/db_interface.c ddb 43file arch/amd64/amd64/db_interface.c ddb
46file arch/amd64/amd64/db_machdep.c ddb 44file arch/amd64/amd64/db_machdep.c ddb
47file arch/amd64/amd64/kobj_machdep.c modular 45file arch/amd64/amd64/kobj_machdep.c modular
48file kern/subr_disk_mbr.c disk 46file kern/subr_disk_mbr.c disk
49file arch/amd64/amd64/gdt.c machdep 47file arch/amd64/amd64/gdt.c machdep
50file arch/amd64/amd64/machdep.c machdep 48file arch/amd64/amd64/machdep.c machdep
51file arch/amd64/amd64/prekern.c kaslr 49file arch/amd64/amd64/prekern.c kaslr
52file arch/amd64/amd64/process_machdep.c machdep 50file arch/amd64/amd64/process_machdep.c machdep
53file arch/amd64/amd64/trap.c machdep 51file arch/amd64/amd64/trap.c machdep
54file arch/x86/x86/fpu.c machdep 52file arch/x86/x86/fpu.c machdep
55file arch/x86/x86/dbregs.c machdep 53file arch/x86/x86/dbregs.c machdep
56file arch/x86/x86/spectre.c machdep 54file arch/x86/x86/spectre.c machdep & !xenpv
57file arch/amd64/amd64/lock_stubs.S machdep 55file arch/amd64/amd64/lock_stubs.S machdep
58file dev/cons.c machdep 56file dev/cons.c machdep
59 57
60file arch/amd64/amd64/mptramp.S multiprocessor 58file arch/amd64/amd64/mptramp.S multiprocessor & !xenpv
61 59
62# 60#
63# Stack-less Just-In-Time compiler 61# Stack-less Just-In-Time compiler
64# 62#
65 63
66include "external/bsd/sljit/conf/files.sljit" 64include "external/bsd/sljit/conf/files.sljit"
67 65
68# 66#
69# Machine-independent SCSI drivers 67# Machine-independent SCSI drivers
70# 68#
71 69
72include "dev/scsipi/files.scsipi" 70include "dev/scsipi/files.scsipi"
73 71
@@ -81,29 +79,30 @@ include "dev/ata/files.ata" @@ -81,29 +79,30 @@ include "dev/ata/files.ata"
81file dev/md_root.c memory_disk_hooks 79file dev/md_root.c memory_disk_hooks
82 80
83# 81#
84# Machine-independent I2O drivers 82# Machine-independent I2O drivers
85# 83#
86 84
87include "dev/i2o/files.i2o" 85include "dev/i2o/files.i2o"
88 86
89# 87#
90# System bus types 88# System bus types
91# 89#
92 90
93# XXX BIOS32 only if something that uses it is configured! 91# XXX BIOS32 only if something that uses it is configured!
94device mainbus: isabus, pcibus, bios32, acpibus, cpubus, ioapicbus, ipmibus 92device mainbus: isabus, pcibus, bios32, acpibus, cpubus, ioapicbus,
 93 ipmibus, hypervisorbus
95attach mainbus at root 94attach mainbus at root
96file arch/amd64/amd64/amd64_mainbus.c mainbus 95file arch/amd64/amd64/amd64_mainbus.c mainbus & !xenpv
97file arch/x86/x86/mainbus.c mainbus 96file arch/x86/x86/mainbus.c mainbus
98 97
99# 98#
100# PCI-only drivers 99# PCI-only drivers
101# XXX MUST BE INCLUDED BEFORE files.isa, as long as files.isa attaches 100# XXX MUST BE INCLUDED BEFORE files.isa, as long as files.isa attaches
102# XXX devices to 'pci'. 101# XXX devices to 'pci'.
103# 102#
104 103
105include "dev/pci/files.pci" 104include "dev/pci/files.pci"
106defparam PCI_CONF_MODE 105defparam PCI_CONF_MODE
107include "dev/pci/files.agp" 106include "dev/pci/files.agp"
108 107
109# x86 specific PCI hardware 108# x86 specific PCI hardware
@@ -176,23 +175,22 @@ file arch/amd64/amd64/rbus_machdep.c car @@ -176,23 +175,22 @@ file arch/amd64/amd64/rbus_machdep.c car
176# Machine-independent PCMCIA drivers 175# Machine-independent PCMCIA drivers
177# 176#
178include "dev/pcmcia/files.pcmcia" 177include "dev/pcmcia/files.pcmcia"
179 178
180include "dev/usb/files.usb" 179include "dev/usb/files.usb"
181 180
182include "dev/bluetooth/files.bluetooth" 181include "dev/bluetooth/files.bluetooth"
183 182
184include "dev/sdmmc/files.sdmmc" 183include "dev/sdmmc/files.sdmmc"
185 184
186include "dev/ieee1394/files.ieee1394" 185include "dev/ieee1394/files.ieee1394"
187include "dev/apm/files.apm" 186include "dev/apm/files.apm"
188include "dev/acpi/files.acpi" 187include "dev/acpi/files.acpi"
189file arch/amd64/acpi/acpi_wakeup_low.S acpi 188file arch/amd64/acpi/acpi_wakeup_low.S acpi & !xenpv
190 189
191# Microsoft Hyper-V 190# Microsoft Hyper-V
192include "dev/hyperv/files.hyperv" 191include "dev/hyperv/files.hyperv"
193 192
194attach vmbus at acpinodebus with vmbus_acpi 193attach vmbus at acpinodebus with vmbus_acpi
195file dev/acpi/vmbus_acpi.c vmbus_acpi 194file dev/acpi/vmbus_acpi.c vmbus_acpi
196 195
197include "arch/amd64/conf/majors.amd64" 196include "arch/amd64/conf/majors.amd64"
198endif #xen 

cvs diff -r1.11 -r1.11.26.1 src/sys/arch/amd64/conf/std.amd64 (expand / switch to unified diff)

--- src/sys/arch/amd64/conf/std.amd64 2017/01/12 05:24:36 1.11
+++ src/sys/arch/amd64/conf/std.amd64 2020/04/16 08:46:34 1.11.26.1
@@ -1,22 +1,24 @@ @@ -1,22 +1,24 @@
1# $NetBSD: std.amd64,v 1.11 2017/01/12 05:24:36 ryo Exp $ 1# $NetBSD: std.amd64,v 1.11.26.1 2020/04/16 08:46:34 bouyer Exp $
2# 2#
3# standard, required NetBSD/amd64 'options' 3# standard, required NetBSD/amd64 'options'
4 4
5machine amd64 x86 5machine amd64 x86 xen
6include "conf/std" # MI standard options 6include "conf/std" # MI standard options
7 7
8options CPU_IN_CKSUM 8options CPU_IN_CKSUM
9options EXEC_ELF64 # exec ELF binaries 9options EXEC_ELF64 # exec ELF binaries
10options EXEC_SCRIPT # exec #! scripts 10options EXEC_SCRIPT # exec #! scripts
11options MTRR 11options MTRR
12options MULTIPROCESSOR 12options MULTIPROCESSOR
13 13
14options CHILD_MAX=1024 # 160 is too few 14options CHILD_MAX=1024 # 160 is too few
15options OPEN_MAX=1024 # 128 is too few 15options OPEN_MAX=1024 # 128 is too few
16 16
 17options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface
 18
17mainbus0 at root 19mainbus0 at root
18cpu* at mainbus? 20cpu* at mainbus?
19ioapic* at mainbus? apid ? 21ioapic* at mainbus? apid ?
20 22
21# Atheros HAL options 23# Atheros HAL options
22include "external/isc/atheros_hal/conf/std.ath_hal" 24include "external/isc/atheros_hal/conf/std.ath_hal"

cvs diff -r1.11 -r1.11.10.1 src/sys/arch/amd64/conf/std.xen (expand / switch to unified diff)

--- src/sys/arch/amd64/conf/std.xen 2019/02/04 18:14:53 1.11
+++ src/sys/arch/amd64/conf/std.xen 2020/04/16 08:46:34 1.11.10.1
@@ -1,19 +1,20 @@ @@ -1,19 +1,20 @@
1# $NetBSD: std.xen,v 1.11 2019/02/04 18:14:53 cherry Exp $ 1# $NetBSD: std.xen,v 1.11.10.1 2020/04/16 08:46:34 bouyer Exp $
2# NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp  2# NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp
3# 3#
4# standard, required NetBSD/i386 'options' 4# standard, required NetBSD/i386 'options'
5 5
6machine xen amd64 6machine xen amd64 x86
7include "conf/std" # MI standard options 7include "conf/std" # MI standard options
 8include "arch/xen/conf/files.xen.pv"
8 9
9options XEN #Xen support 10options XEN #Xen support
10options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface 11options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface
11#options __XEN_INTERFACE_VERSION__=0x00030205 # Xen 3.1 interface 12#options __XEN_INTERFACE_VERSION__=0x00030205 # Xen 3.1 interface
12 13
13options CPU_IN_CKSUM 14options CPU_IN_CKSUM
14options EXEC_ELF64 # exec ELF binaries 15options EXEC_ELF64 # exec ELF binaries
15options EXEC_SCRIPT # exec #! scripts 16options EXEC_SCRIPT # exec #! scripts
16options MTRR 17options MTRR
17 18
18options CHILD_MAX=1024 # 160 is too few 19options CHILD_MAX=1024 # 160 is too few
19options OPEN_MAX=1024 # 128 is too few 20options OPEN_MAX=1024 # 128 is too few

File Added: src/sys/arch/amd64/include/xen/hypercalls.h
/* $NetBSD: hypercalls.h,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $ */
/******************************************************************************
 * hypercall.h
 * 
 * Linux-specific hypervisor handling.
 * 
 * Copyright (c) 2002-2004, K A Fraser
 * 
 * 64-bit updates:
 *   Benjamin Liu <benjamin.liu@intel.com>
 *   Jun Nakajima <jun.nakajima@intel.com>
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation; or, when distributed
 * separately from the Linux kernel or incorporated into other
 * software packages, subject to the following license:
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this source file (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#ifndef __HYPERCALL_H__
#define __HYPERCALL_H__

#define __STR(x) #x
#define STR(x) __STR(x)

#define HYPERCALL_STR(name)					\
	"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"

#define _hypercall0(type, name)			\
({						\
	long __res;				\
	asm volatile (				\
		HYPERCALL_STR(name)		\
		: "=a" (__res)			\
		:				\
		: "memory" );			\
	(type)__res;				\
})

#define _hypercall1(type, name, a1)				\
({								\
	long __res, __ign1;					\
	asm volatile (						\
		HYPERCALL_STR(name)				\
		: "=a" (__res), "=D" (__ign1)			\
		: "1" ((long)(a1))				\
		: "memory" );					\
	(type)__res;						\
})

#define _hypercall2(type, name, a1, a2)				\
({								\
	long __res, __ign1, __ign2;				\
	asm volatile (						\
		HYPERCALL_STR(name)				\
		: "=a" (__res), "=D" (__ign1), "=S" (__ign2)	\
		: "1" ((long)(a1)), "2" ((long)(a2))		\
		: "memory" );					\
	(type)__res;						\
})

#define _hypercall3(type, name, a1, a2, a3)			\
({								\
	long __res, __ign1, __ign2, __ign3;			\
	asm volatile (						\
		HYPERCALL_STR(name)				\
		: "=a" (__res), "=D" (__ign1), "=S" (__ign2), 	\
		"=d" (__ign3)					\
		: "1" ((long)(a1)), "2" ((long)(a2)),		\
		"3" ((long)(a3))				\
		: "memory" );					\
	(type)__res;						\
})

#define _hypercall4(type, name, a1, a2, a3, a4)			\
({								\
	long __res, __ign1, __ign2, __ign3;			\
	asm volatile (						\
		"movq %7,%%r10; "				\
		HYPERCALL_STR(name)				\
		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
		"=d" (__ign3)					\
		: "1" ((long)(a1)), "2" ((long)(a2)),		\
		"3" ((long)(a3)), "g" ((long)(a4))		\
		: "memory", "r10" );				\
	(type)__res;						\
})

#define _hypercall5(type, name, a1, a2, a3, a4, a5)		\
({								\
	long __res, __ign1, __ign2, __ign3;			\
	asm volatile (						\
		"movq %7,%%r10; movq %8,%%r8; "			\
		HYPERCALL_STR(name)				\
		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),	\
		"=d" (__ign3)					\
		: "1" ((long)(a1)), "2" ((long)(a2)),		\
		"3" ((long)(a3)), "g" ((long)(a4)),		\
		"g" ((long)(a5))				\
		: "memory", "r10", "r8" );			\
	(type)__res;						\
})

static inline int
HYPERVISOR_set_trap_table(
	trap_info_t *table)
{
	return _hypercall1(int, set_trap_table, table);
}

static inline int
HYPERVISOR_mmu_update(
	mmu_update_t *req, int count, int *success_count, domid_t domid)
{
	return _hypercall4(int, mmu_update, req, count, success_count, domid);
}

static inline int
HYPERVISOR_mmuext_op(
	struct mmuext_op *op, int count, int *success_count, domid_t domid)
{
	return _hypercall4(int, mmuext_op, op, count, success_count, domid);
}

static inline int
HYPERVISOR_set_gdt(
	unsigned long *frame_list, int entries)
{
	return _hypercall2(int, set_gdt, frame_list, entries);
}

static inline int
HYPERVISOR_stack_switch(
	unsigned long ss, unsigned long esp)
{
	return _hypercall2(int, stack_switch, ss, esp);
}

static inline int
HYPERVISOR_set_callbacks(
	unsigned long event_address, unsigned long failsafe_address, 
	unsigned long syscall_address)
{
	return _hypercall3(int, set_callbacks,
			   event_address, failsafe_address, syscall_address);
}

static inline int
HYPERVISOR_fpu_taskswitch(
	int set)
{
	return _hypercall1(int, fpu_taskswitch, set);
}

static inline int
HYPERVISOR_sched_op_compat(
	int cmd, unsigned long arg)
{
	return _hypercall2(int, sched_op_compat, cmd, arg);
}

static inline int
HYPERVISOR_sched_op(
	int cmd, void *arg)
{
	return _hypercall2(int, sched_op, cmd, arg);
}

static inline long
HYPERVISOR_set_timer_op(
	u64 timeout)
{
	return _hypercall1(long, set_timer_op, timeout);
}

static inline int
HYPERVISOR_platform_op(
	struct xen_platform_op *platform_op)
{
	platform_op->interface_version = XENPF_INTERFACE_VERSION;
	return _hypercall1(int, platform_op, platform_op);
}

static inline int
HYPERVISOR_set_debugreg(
	int reg, unsigned long value)
{
	return _hypercall2(int, set_debugreg, reg, value);
}

static inline unsigned long
HYPERVISOR_get_debugreg(
	int reg)
{
	return _hypercall1(unsigned long, get_debugreg, reg);
}

static inline int
HYPERVISOR_update_descriptor(
	unsigned long ma, unsigned long word)
{
	return _hypercall2(int, update_descriptor, ma, word);
}

static inline int
HYPERVISOR_memory_op(
	unsigned int cmd, void *arg)
{
	return _hypercall2(int, memory_op, cmd, arg);
}

static inline int
HYPERVISOR_multicall(
	multicall_entry_t *call_list, int nr_calls)
{
	return _hypercall2(int, multicall, call_list, nr_calls);
}

static inline int
HYPERVISOR_update_va_mapping(
	unsigned long va, unsigned long new_val, unsigned long flags)
{
	return _hypercall3(int, update_va_mapping, va, new_val, flags);
}

static inline int
HYPERVISOR_event_channel_op(evtchn_op_t *op)
{
	KASSERT(op != NULL);
#if __XEN_INTERFACE_VERSION__ < 0x00030202
	return _hypercall1(int, event_channel_op, op);
#else
	return _hypercall2(int, event_channel_op, op->cmd, &op->u);
#endif
}

static inline int
HYPERVISOR_acm_op(
	int cmd, void *arg)
{
	return _hypercall2(int, acm_op, cmd, arg);
}

static inline int
HYPERVISOR_xen_version(
	int cmd, void *arg)
{
	return _hypercall2(int, xen_version, cmd, arg);
}

static inline int
HYPERVISOR_console_io(
	int cmd, int count, char *str)
{
	return _hypercall3(int, console_io, cmd, count, str);
}

static inline int
HYPERVISOR_physdev_op(void *op)
{
	return _hypercall1(int, physdev_op_compat, op);
}

static inline int
HYPERVISOR_grant_table_op(
	unsigned int cmd, void *uop, unsigned int count)
{
	return _hypercall3(int, grant_table_op, cmd, uop, count);
}

static inline int
HYPERVISOR_update_va_mapping_otherdomain(
	unsigned long va, unsigned long new_val, unsigned long flags,
	domid_t domid)
{
	return _hypercall4(int, update_va_mapping_otherdomain, va,
			   new_val, flags, domid);
}

static inline int
HYPERVISOR_vm_assist(
	unsigned int cmd, unsigned int type)
{
	return _hypercall2(int, vm_assist, cmd, type);
}

static inline int
HYPERVISOR_vcpu_op(
	int cmd, int vcpuid, void *extra_args)
{
	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
}

static inline int
HYPERVISOR_set_segment_base(
	int reg, unsigned long value)
{
	return _hypercall2(int, set_segment_base, reg, value);
}

static inline int
HYPERVISOR_suspend(
	unsigned long srec)
{
#if __XEN_INTERFACE_VERSION__ >= 0x00030201

	struct sched_shutdown shutdown_reason = {
		.reason = SHUTDOWN_suspend,
	};

	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
	    &shutdown_reason, srec);
#else
	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
				 SHUTDOWN_suspend, srec);
#endif
}

static inline long
HYPERVISOR_yield(
	void)
{
	return _hypercall2(int, sched_op, SCHEDOP_yield, 0);
}

static inline long
HYPERVISOR_block(
	void)
{
	return _hypercall2(int, sched_op, SCHEDOP_block, 0);
}

static inline long
HYPERVISOR_shutdown(
	void)
{
#if __XEN_INTERFACE_VERSION__ >= 0x00030201

	struct sched_shutdown shutdown_reason = {
		.reason = SHUTDOWN_poweroff,
	};

	return _hypercall2(int, sched_op, SCHEDOP_shutdown,
	    &shutdown_reason);
#else
-	return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_poweroff);
#endif
}

static inline long
HYPERVISOR_crash(
	void)
{
#if __XEN_INTERFACE_VERSION__ >= 0x00030201

	struct sched_shutdown shutdown_reason = {
		.reason = SHUTDOWN_crash,
	};

	return _hypercall2(int, sched_op, SCHEDOP_shutdown,
	    &shutdown_reason);
#else
	return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_crash);
#endif
}

static inline long
HYPERVISOR_reboot(
	void)
{
#if __XEN_INTERFACE_VERSION__ >= 0x00030201

	struct sched_shutdown shutdown_reason = {
		.reason = SHUTDOWN_reboot,
	};

	return _hypercall2(int, sched_op, SCHEDOP_shutdown,
	    &shutdown_reason);
#else
	return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_reboot);
#endif
}

static inline int
HYPERVISOR_nmi_op(
	unsigned long op, void *arg)
{
	return _hypercall2(int, nmi_op, op, arg);
}

static inline long
HYPERVISOR_hvm_op(
    int op, void *arg)
{
    return _hypercall2(long, hvm_op, op, arg);
}

static inline int
HYPERVISOR_callback_op(
	int cmd, void *arg)
{
	return _hypercall2(int, callback_op, cmd, arg);
}

static inline int
HYPERVISOR_xenoprof_op(
	int op, void *arg)
{
	return _hypercall2(int, xenoprof_op, op, arg);
}

static inline int
HYPERVISOR_kexec_op(
	unsigned long op, void *args)
{
	return _hypercall2(int, kexec_op, op, args);
}

#if __XEN_INTERFACE_VERSION__ < 0x00030204
static inline int
HYPERVISOR_dom0_op(
	dom0_op_t *dom0_op)
{
	dom0_op->interface_version = DOM0_INTERFACE_VERSION;
	return _hypercall1(int, dom0_op, dom0_op);
}
#endif	/* __XEN_INTERFACE_VERSION__ */

#include <xen/include/public/arch-x86/xen-mca.h>

static inline int
HYPERVISOR_machine_check(struct xen_mc *mc)
{
	mc->interface_version = XEN_MCA_INTERFACE_VERSION;
	return _hypercall1(int, mca, mc);
}

static inline int
HYPERVISOR_sysctl(void *sysctl)
{
	return _hypercall1(int, sysctl, sysctl);
}

#endif /* __HYPERCALL_H__ */

File Added: src/sys/arch/i386/conf/Attic/GENERIC_XENHVM
# $NetBSD: GENERIC_XENHVM,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $

include "arch/i386/conf/GENERIC"

options 	XENPVHVM
options 	XEN

options 	MAXPHYS=32768	#xbd doesn't handle 64k transfers
hypervisor*	at mainbus?		# Xen hypervisor
#vcpu*		at hypervisor?		# Xen virtual CPUs
xenbus*	 	at hypervisor?		# Xen virtual bus
xencons*	at hypervisor?		# Xen virtual console
xennet*	 	at xenbus?		# Xen virtual network interface
xbd*		at xenbus?		# Xen virtual block device

cvs diff -r1.194 -r1.194.10.1 src/sys/arch/i386/conf/Makefile.i386 (expand / switch to unified diff)

--- src/sys/arch/i386/conf/Makefile.i386 2018/09/22 12:24:02 1.194
+++ src/sys/arch/i386/conf/Makefile.i386 2020/04/16 08:46:34 1.194.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile.i386,v 1.194 2018/09/22 12:24:02 rin Exp $ 1# $NetBSD: Makefile.i386,v 1.194.10.1 2020/04/16 08:46:34 bouyer Exp $
2 2
3# Makefile for NetBSD 3# Makefile for NetBSD
4# 4#
5# This makefile is constructed from a machine description: 5# This makefile is constructed from a machine description:
6# config machineid 6# config machineid
7# Most changes should be made in the machine description 7# Most changes should be made in the machine description
8# /sys/arch/i386/conf/``machineid'' 8# /sys/arch/i386/conf/``machineid''
9# after which you should do 9# after which you should do
10# config machineid 10# config machineid
11# Machine generic makefile changes should be made in 11# Machine generic makefile changes should be made in
12# /sys/arch/i386/conf/Makefile.i386 12# /sys/arch/i386/conf/Makefile.i386
13# after which config should be rerun for all machines of that type. 13# after which config should be rerun for all machines of that type.
14# 14#
@@ -34,26 +34,27 @@ GENASSYM_CONF= ${I386}/i386/genassym.cf @@ -34,26 +34,27 @@ GENASSYM_CONF= ${I386}/i386/genassym.cf
34## 34##
35## (2) compile settings 35## (2) compile settings
36## 36##
37DEFCOPTS= -O2 -fno-omit-frame-pointer 37DEFCOPTS= -O2 -fno-omit-frame-pointer
38CPPFLAGS+= -Di386 38CPPFLAGS+= -Di386
39CFLAGS+= -msoft-float 39CFLAGS+= -msoft-float
40## no-sse implies no-sse2 but not no-avx 40## no-sse implies no-sse2 but not no-avx
41CFLAGS+= -mno-mmx -mno-sse -mno-avx 41CFLAGS+= -mno-mmx -mno-sse -mno-avx
42 42
43.if ${SPECTRE_V2_GCC_MITIGATION:U0} > 0 && ${HAVE_GCC:U0} > 0 43.if ${SPECTRE_V2_GCC_MITIGATION:U0} > 0 && ${HAVE_GCC:U0} > 0
44CFLAGS+= -mindirect-branch=thunk 44CFLAGS+= -mindirect-branch=thunk
45CFLAGS+= -mindirect-branch-register 45CFLAGS+= -mindirect-branch-register
46.endif 46.endif
 47EXTRA_INCLUDES= -I$S/external/mit/xen-include-public/dist/
47 48
48## 49##
49## (3) libkern and compat 50## (3) libkern and compat
50## 51##
51OPT_MODULAR= %MODULAR% 52OPT_MODULAR= %MODULAR%
52 53
53## 54##
54## (4) local objects, compile rules, and dependencies 55## (4) local objects, compile rules, and dependencies
55## 56##
56MD_OBJS= locore.o copy.o spl.o vector.o lock_stubs.o 57MD_OBJS= locore.o copy.o spl.o vector.o lock_stubs.o
57MD_CFILES= 58MD_CFILES=
58MD_SFILES= ${I386}/i386/locore.S ${I386}/i386/copy.S ${I386}/i386/spl.S \ 59MD_SFILES= ${I386}/i386/locore.S ${I386}/i386/copy.S ${I386}/i386/spl.S \
59 ${I386}/i386/vector.S ${I386}/i386/lock_stubs.S 60 ${I386}/i386/vector.S ${I386}/i386/lock_stubs.S

cvs diff -r1.21.2.1 -r1.21.2.2 src/sys/arch/i386/conf/XEN3PAE_DOM0 (expand / switch to unified diff)

--- src/sys/arch/i386/conf/XEN3PAE_DOM0 2020/04/08 17:56:08 1.21.2.1
+++ src/sys/arch/i386/conf/XEN3PAE_DOM0 2020/04/16 08:46:34 1.21.2.2
@@ -1,21 +1,22 @@ @@ -1,21 +1,22 @@
1# $NetBSD: XEN3PAE_DOM0,v 1.21.2.1 2020/04/08 17:56:08 bouyer Exp $ 1# $NetBSD: XEN3PAE_DOM0,v 1.21.2.2 2020/04/16 08:46:34 bouyer Exp $
2# 2#
3# XEN3_0: Xen 3.0 domain0 kernel 3# XEN3_0: Xen 3.0 domain0 kernel
4 4
5include "arch/xen/conf/std.xen" 5include "arch/xen/conf/std.xen"
6 6
7options XENPV # PV dom0 support 7options XENPV # PV dom0 support
8#options MULTIPROCESSOR # (not yet - dom0 stuff is not MP-safe) 8#options MULTIPROCESSOR # (not yet - dom0 stuff is not MP-safe)
 9options NO_PREEMPTION
9 10
10options INCLUDE_CONFIG_FILE # embed config file in kernel binary 11options INCLUDE_CONFIG_FILE # embed config file in kernel binary
11 12
12#options UVMHIST 13#options UVMHIST
13#options UVMHIST_PRINT 14#options UVMHIST_PRINT
14#options SYSCALL_DEBUG 15#options SYSCALL_DEBUG
15 16
16maxusers 32 # estimated number of users 17maxusers 32 # estimated number of users
17 18
18# 19#
19options XEN 20options XEN
20options PAE 21options PAE
21#options __XEN_INTERFACE_VERSION__=0x00030205 # Xen 3.1 interface 22#options __XEN_INTERFACE_VERSION__=0x00030205 # Xen 3.1 interface
@@ -202,26 +203,27 @@ xenbus* at hypervisor? # Xen virtual b @@ -202,26 +203,27 @@ xenbus* at hypervisor? # Xen virtual b
202 203
203xencons* at hypervisor? # Xen virtual console 204xencons* at hypervisor? # Xen virtual console
204#xennet* at hypervisor? # Xen virtual network interface 205#xennet* at hypervisor? # Xen virtual network interface
205balloon* at xenbus? # Xen balloon device 206balloon* at xenbus? # Xen balloon device
206 207
207#xbd* at hypervisor? # Xen virtual block device 208#xbd* at hypervisor? # Xen virtual block device
208#wd* at hypervisor? # Xen vbd (wd identity) 209#wd* at hypervisor? # Xen vbd (wd identity)
209#sd* at hypervisor? # Xen vbd (sd identity) 210#sd* at hypervisor? # Xen vbd (sd identity)
210#cd* at hypervisor? # Xen vbd (cd identity) 211#cd* at hypervisor? # Xen vbd (cd identity)
211 212
212# PCI bus support 213# PCI bus support
213pci* at hypervisor? bus ? 214pci* at hypervisor? bus ?
214pci* at pchb? bus ? 215pci* at pchb? bus ?
 216options NO_PCI_MSI_MSIX
215 217
216# PCI bridges 218# PCI bridges
217ichlpcib* at pci? dev ? function ? # Intel ICH PCI-ISA w/ timecounter, 219ichlpcib* at pci? dev ? function ? # Intel ICH PCI-ISA w/ timecounter,
218 # watchdog and SpeedStep support 220 # watchdog and SpeedStep support
219pcib* at pci? dev ? function ? # PCI-ISA bridges 221pcib* at pci? dev ? function ? # PCI-ISA bridges
220pchb* at pci? dev ? function ? # PCI-Host bridges 222pchb* at pci? dev ? function ? # PCI-Host bridges
221options AGP_X86 223options AGP_X86
222ppb* at pci? dev ? function ? # PCI-PCI bridges 224ppb* at pci? dev ? function ? # PCI-PCI bridges
223# XXX 'puc's aren't really bridges, but there's no better place for them here 225# XXX 'puc's aren't really bridges, but there's no better place for them here
224puc* at pci? dev ? function ? # PCI "universal" comm. cards 226puc* at pci? dev ? function ? # PCI "universal" comm. cards
225 227
226agp* at pchb? 228agp* at pchb?
227 229

cvs diff -r1.401 -r1.401.6.1 src/sys/arch/i386/conf/files.i386 (expand / switch to unified diff)

--- src/sys/arch/i386/conf/files.i386 2019/10/18 01:38:28 1.401
+++ src/sys/arch/i386/conf/files.i386 2020/04/16 08:46:34 1.401.6.1
@@ -1,20 +1,18 @@ @@ -1,20 +1,18 @@
1# $NetBSD: files.i386,v 1.401 2019/10/18 01:38:28 manu Exp $ 1# $NetBSD: files.i386,v 1.401.6.1 2020/04/16 08:46:34 bouyer Exp $
2# 2#
3# new style config file for i386 architecture 3# new style config file for i386 architecture
4# 4#
5 5
6ifndef xen 
7 
8# maxpartitions must be first item in files.${ARCH}.newconf 6# maxpartitions must be first item in files.${ARCH}.newconf
9maxpartitions 8 7maxpartitions 8
10 8
11maxusers 2 16 128 9maxusers 2 16 128
12 10
13defparam opt_kernbase.h KERNBASE 11defparam opt_kernbase.h KERNBASE
14 12
15# delay before cpu_reset() for reboot. 13# delay before cpu_reset() for reboot.
16defparam CPURESET_DELAY 14defparam CPURESET_DELAY
17 15
18# Obsolete Xbox support 16# Obsolete Xbox support
19obsolete defflag XBOX 17obsolete defflag XBOX
20 18
@@ -43,51 +41,51 @@ defflag opt_spectre.h SPECTRE_V2_GCC_MIT @@ -43,51 +41,51 @@ defflag opt_spectre.h SPECTRE_V2_GCC_MIT
43 41
44# Beep on halt 42# Beep on halt
45defflag opt_beep.h BEEP_ONHALT 43defflag opt_beep.h BEEP_ONHALT
46defparam opt_beep.h BEEP_ONHALT_COUNT=3 44defparam opt_beep.h BEEP_ONHALT_COUNT=3
47defparam opt_beep.h BEEP_ONHALT_PITCH=1500 45defparam opt_beep.h BEEP_ONHALT_PITCH=1500
48defparam opt_beep.h BEEP_ONHALT_PERIOD=250 46defparam opt_beep.h BEEP_ONHALT_PERIOD=250
49 47
50# Multiboot support 48# Multiboot support
51defflag opt_multiboot.h MULTIBOOT 49defflag opt_multiboot.h MULTIBOOT
52obsolete defparam MULTIBOOT_SYMTAB_SPACE 50obsolete defparam MULTIBOOT_SYMTAB_SPACE
53file arch/i386/i386/multiboot.c multiboot 51file arch/i386/i386/multiboot.c multiboot
54file arch/x86/x86/multiboot2.c multiboot 52file arch/x86/x86/multiboot2.c multiboot
55 53
56file arch/i386/i386/autoconf.c 54file arch/i386/i386/autoconf.c !xenpv
57file arch/i386/i386/aout_machdep.c exec_aout 55file arch/i386/i386/aout_machdep.c exec_aout
58file arch/i386/i386/busfunc.S 56file arch/i386/i386/busfunc.S
59file arch/i386/i386/cpufunc.S 57file arch/i386/i386/cpufunc.S
60file arch/i386/i386/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum 58file arch/i386/i386/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum
61file arch/i386/i386/db_disasm.c ddb 59file arch/i386/i386/db_disasm.c ddb
62file arch/i386/i386/db_interface.c ddb 60file arch/i386/i386/db_interface.c ddb
63file arch/i386/i386/db_machdep.c ddb 61file arch/i386/i386/db_machdep.c ddb
64file arch/i386/i386/dumpsys.c 62file arch/i386/i386/dumpsys.c
65file kern/subr_disk_mbr.c disk 63file kern/subr_disk_mbr.c disk
66file kern/subr_spldebug.c spldebug 64file kern/subr_spldebug.c spldebug
67file arch/i386/i386/gdt.c 65file arch/i386/i386/gdt.c
68file arch/i386/i386/i386func.S 66file arch/i386/i386/i386func.S !xenpv
69file arch/i386/i386/kobj_machdep.c modular 67file arch/i386/i386/kobj_machdep.c modular
70file arch/i386/i386/machdep.c 68file arch/i386/i386/machdep.c
71file arch/i386/i386/longrun.c 69file arch/i386/i386/longrun.c
72file arch/i386/i386/mtrr_k6.c mtrr 70file arch/i386/i386/mtrr_k6.c mtrr
73file arch/i386/i386/process_machdep.c 71file arch/i386/i386/process_machdep.c
74file arch/i386/i386/trap.c 72file arch/i386/i386/trap.c
75file dev/cons.c 73file dev/cons.c
76file arch/x86/x86/fpu.c 74file arch/x86/x86/fpu.c
77file arch/x86/x86/dbregs.c 75file arch/x86/x86/dbregs.c
78file arch/x86/x86/spectre.c 76file arch/x86/x86/spectre.c
79 77
80file arch/i386/i386/mptramp.S multiprocessor 78file arch/i386/i386/mptramp.S multiprocessor & ! xenpv
81 79
82file crypto/des/arch/i386/des_enc.S des 80file crypto/des/arch/i386/des_enc.S des
83file crypto/des/arch/i386/des_cbc.S des 81file crypto/des/arch/i386/des_cbc.S des
84 82
85file crypto/blowfish/arch/i386/bf_enc.S blowfish 83file crypto/blowfish/arch/i386/bf_enc.S blowfish
86file crypto/blowfish/arch/i386/bf_cbc.S blowfish & !i386_cpu 84file crypto/blowfish/arch/i386/bf_cbc.S blowfish & !i386_cpu
87 85
88# 86#
89# Stack-less Just-In-Time compiler 87# Stack-less Just-In-Time compiler
90# 88#
91 89
92include "external/bsd/sljit/conf/files.sljit" 90include "external/bsd/sljit/conf/files.sljit"
93 91
@@ -118,29 +116,29 @@ define bioscall @@ -118,29 +116,29 @@ define bioscall
118file arch/i386/i386/bioscall.S bioscall needs-flag 116file arch/i386/i386/bioscall.S bioscall needs-flag
119 117
120# i386 specific mainbus attributes 118# i386 specific mainbus attributes
121define apmbus {} 119define apmbus {}
122define pnpbiosbus {} 120define pnpbiosbus {}
123 121
124# 122#
125# System bus types 123# System bus types
126# 124#
127 125
128# XXX BIOS32 only if something that uses it is configured! 126# XXX BIOS32 only if something that uses it is configured!
129device mainbus: isabus, eisabus, mcabus, pcibus, bios32, acpibus, 127device mainbus: isabus, eisabus, mcabus, pcibus, bios32, acpibus,
130 cpubus, ioapicbus, apmbus, pnpbiosbus, ipmibus, 128 cpubus, ioapicbus, apmbus, pnpbiosbus, ipmibus,
131 bioscall 129 bioscall, hypervisorbus
132attach mainbus at root 130attach mainbus at root
133file arch/i386/i386/i386_mainbus.c mainbus 131file arch/i386/i386/i386_mainbus.c mainbus & !xenpv
134file arch/x86/x86/mainbus.c mainbus 132file arch/x86/x86/mainbus.c mainbus
135 133
136# 134#
137# PCI-only drivers 135# PCI-only drivers
138# XXX MUST BE INCLUDED BEFORE files.isa, as long as files.isa attaches 136# XXX MUST BE INCLUDED BEFORE files.isa, as long as files.isa attaches
139# XXX devices to 'pci'. 137# XXX devices to 'pci'.
140# 138#
141include "dev/pci/files.pci" 139include "dev/pci/files.pci"
142include "dev/pci/files.agp" 140include "dev/pci/files.agp"
143file arch/i386/pci/pcibios.c pcibios 141file arch/i386/pci/pcibios.c pcibios
144file arch/i386/pci/pci_intr_fixup.c pcibios & pci_intr_fixup 142file arch/i386/pci/pci_intr_fixup.c pcibios & pci_intr_fixup
145file arch/i386/pci/piix.c pcibios & pci_intr_fixup 143file arch/i386/pci/piix.c pcibios & pci_intr_fixup
146file arch/i386/pci/opti82c558.c pcibios & pci_intr_fixup 144file arch/i386/pci/opti82c558.c pcibios & pci_intr_fixup
@@ -394,33 +392,32 @@ include "dev/pcmcia/files.pcmcia" @@ -394,33 +392,32 @@ include "dev/pcmcia/files.pcmcia"
394 392
395 393
396include "dev/usb/files.usb" 394include "dev/usb/files.usb"
397 395
398include "dev/bluetooth/files.bluetooth" 396include "dev/bluetooth/files.bluetooth"
399 397
400include "dev/sdmmc/files.sdmmc" 398include "dev/sdmmc/files.sdmmc"
401 399
402include "dev/ieee1394/files.ieee1394" 400include "dev/ieee1394/files.ieee1394"
403 401
404include "arch/i386/pnpbios/files.pnpbios" 402include "arch/i386/pnpbios/files.pnpbios"
405 403
406include "dev/acpi/files.acpi" 404include "dev/acpi/files.acpi"
407file arch/i386/acpi/acpi_wakeup_low.S acpi 405file arch/i386/acpi/acpi_wakeup_low.S acpi & !xenpv
408 406
409# Microsoft Hyper-V 407# Microsoft Hyper-V
410include "dev/hyperv/files.hyperv" 408include "dev/hyperv/files.hyperv"
411 409
412attach vmbus at acpinodebus with vmbus_acpi 410attach vmbus at acpinodebus with vmbus_acpi
413file dev/acpi/vmbus_acpi.c vmbus_acpi 411file dev/acpi/vmbus_acpi.c vmbus_acpi
414 412
415# Obsolete vesabios/vesafb flags 413# Obsolete vesabios/vesafb flags
416obsolete defflag opt_vesabios.h VESABIOSVERBOSE 414obsolete defflag opt_vesabios.h VESABIOSVERBOSE
417obsolete defparam opt_vesafb.h VESAFB_WIDTH VESAFB_HEIGHT VESAFB_DEPTH 415obsolete defparam opt_vesafb.h VESAFB_WIDTH VESAFB_HEIGHT VESAFB_DEPTH
418obsolete defflag opt_vesafb.h VESAFB_PM 416obsolete defflag opt_vesafb.h VESAFB_PM
419 417
420# AMD Geode LX Security Block 418# AMD Geode LX Security Block
421device glxsb: opencrypto 419device glxsb: opencrypto
422attach glxsb at pci 420attach glxsb at pci
423file arch/i386/pci/glxsb.c glxsb 421file arch/i386/pci/glxsb.c glxsb
424 422
425include "arch/i386/conf/majors.i386" 423include "arch/i386/conf/majors.i386"
426endif #xen 

cvs diff -r1.35 -r1.35.26.1 src/sys/arch/i386/conf/std.i386 (expand / switch to unified diff)

--- src/sys/arch/i386/conf/std.i386 2017/01/12 05:24:36 1.35
+++ src/sys/arch/i386/conf/std.i386 2020/04/16 08:46:34 1.35.26.1
@@ -1,27 +1,28 @@ @@ -1,27 +1,28 @@
1# $NetBSD: std.i386,v 1.35 2017/01/12 05:24:36 ryo Exp $ 1# $NetBSD: std.i386,v 1.35.26.1 2020/04/16 08:46:34 bouyer Exp $
2# 2#
3# standard, required NetBSD/i386 'options' 3# standard, required NetBSD/i386 'options'
4 4
5machine i386 x86 5machine i386 x86 xen
6include "conf/std" # MI standard options 6include "conf/std" # MI standard options
7 7
8options CPU_IN_CKSUM 8options CPU_IN_CKSUM
9options EXEC_AOUT # exec a.out binaries 9options EXEC_AOUT # exec a.out binaries
10options EXEC_ELF32 # exec ELF binaries 10options EXEC_ELF32 # exec ELF binaries
11options EXEC_SCRIPT # exec #! scripts 11options EXEC_SCRIPT # exec #! scripts
12#options CRYPTO_MD_DES_ENC # machine-dependent code for DES 12#options CRYPTO_MD_DES_ENC # machine-dependent code for DES
13#options CRYPTO_MD_DES_CBC # machine-dependent DES CBC code 13#options CRYPTO_MD_DES_CBC # machine-dependent DES CBC code
14#options CRYPTO_MD_BF_ENC # machine-dependent code for BF_encrypt 14#options CRYPTO_MD_BF_ENC # machine-dependent code for BF_encrypt
15#options CRYPTO_MD_BF_CBC # careful: uses bswapl, requires 486 15#options CRYPTO_MD_BF_CBC # careful: uses bswapl, requires 486
16options MULTIPROCESSOR # multiprocessor support 16options MULTIPROCESSOR # multiprocessor support
17options MPBIOS # configure CPUs and APICs using MPBIOS 17options MPBIOS # configure CPUs and APICs using MPBIOS
18 18
19options CHILD_MAX=1024 # 160 is too few 19options CHILD_MAX=1024 # 160 is too few
20options OPEN_MAX=1024 # 128 is too few 20options OPEN_MAX=1024 # 128 is too few
 21options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface
21 22
22mainbus0 at root 23mainbus0 at root
23cpu* at mainbus? 24cpu* at mainbus?
24ioapic* at mainbus? 25ioapic* at mainbus?
25 26
26# Atheros HAL options 27# Atheros HAL options
27include "external/isc/atheros_hal/conf/std.ath_hal" 28include "external/isc/atheros_hal/conf/std.ath_hal"

cvs diff -r1.825.4.1 -r1.825.4.2 src/sys/arch/i386/i386/machdep.c (expand / switch to unified diff)

--- src/sys/arch/i386/i386/machdep.c 2020/04/09 16:12:50 1.825.4.1
+++ src/sys/arch/i386/i386/machdep.c 2020/04/16 08:46:34 1.825.4.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.825.4.1 2020/04/09 16:12:50 bouyer Exp $ */ 1/* $NetBSD: machdep.c,v 1.825.4.2 2020/04/16 08:46:34 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017 4 * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
5 * The NetBSD Foundation, Inc. 5 * The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Charles M. Hannum, by Jason R. Thorpe of the Numerical Aerospace 9 * by Charles M. Hannum, by Jason R. Thorpe of the Numerical Aerospace
10 * Simulation Facility NASA Ames Research Center, by Julio M. Merino Vidal, 10 * Simulation Facility NASA Ames Research Center, by Julio M. Merino Vidal,
11 * by Andrew Doran, and by Maxime Villard. 11 * by Andrew Doran, and by Maxime Villard.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -57,27 +57,27 @@ @@ -57,27 +57,27 @@
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE. 64 * SUCH DAMAGE.
65 * 65 *
66 * @(#)machdep.c 7.4 (Berkeley) 6/3/91 66 * @(#)machdep.c 7.4 (Berkeley) 6/3/91
67 */ 67 */
68 68
69#include <sys/cdefs.h> 69#include <sys/cdefs.h>
70__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825.4.1 2020/04/09 16:12:50 bouyer Exp $"); 70__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825.4.2 2020/04/16 08:46:34 bouyer Exp $");
71 71
72#include "opt_beep.h" 72#include "opt_beep.h"
73#include "opt_compat_freebsd.h" 73#include "opt_compat_freebsd.h"
74#include "opt_compat_netbsd.h" 74#include "opt_compat_netbsd.h"
75#include "opt_cpureset_delay.h" 75#include "opt_cpureset_delay.h"
76#include "opt_ddb.h" 76#include "opt_ddb.h"
77#include "opt_kgdb.h" 77#include "opt_kgdb.h"
78#include "opt_mtrr.h" 78#include "opt_mtrr.h"
79#include "opt_modular.h" 79#include "opt_modular.h"
80#include "opt_multiboot.h" 80#include "opt_multiboot.h"
81#include "opt_multiprocessor.h" 81#include "opt_multiprocessor.h"
82#include "opt_physmem.h" 82#include "opt_physmem.h"
83#include "opt_realmem.h" 83#include "opt_realmem.h"
@@ -978,27 +978,27 @@ initgdt(union descriptor *tgdt) @@ -978,27 +978,27 @@ initgdt(union descriptor *tgdt)
978#endif 978#endif
979 979
980 /* make gdt gates and memory segments */ 980 /* make gdt gates and memory segments */
981 setsegment(&gdtstore[GCODE_SEL].sd, 0, 0xfffff, 981 setsegment(&gdtstore[GCODE_SEL].sd, 0, 0xfffff,
982 SDT_MEMERA, SEL_KPL, 1, 1); 982 SDT_MEMERA, SEL_KPL, 1, 1);
983 setsegment(&gdtstore[GDATA_SEL].sd, 0, 0xfffff, 983 setsegment(&gdtstore[GDATA_SEL].sd, 0, 0xfffff,
984 SDT_MEMRWA, SEL_KPL, 1, 1); 984 SDT_MEMRWA, SEL_KPL, 1, 1);
985 setsegment(&gdtstore[GUCODE_SEL].sd, 0, x86_btop(I386_MAX_EXE_ADDR) - 1, 985 setsegment(&gdtstore[GUCODE_SEL].sd, 0, x86_btop(I386_MAX_EXE_ADDR) - 1,
986 SDT_MEMERA, SEL_UPL, 1, 1); 986 SDT_MEMERA, SEL_UPL, 1, 1);
987 setsegment(&gdtstore[GUCODEBIG_SEL].sd, 0, 0xfffff, 987 setsegment(&gdtstore[GUCODEBIG_SEL].sd, 0, 0xfffff,
988 SDT_MEMERA, SEL_UPL, 1, 1); 988 SDT_MEMERA, SEL_UPL, 1, 1);
989 setsegment(&gdtstore[GUDATA_SEL].sd, 0, 0xfffff, 989 setsegment(&gdtstore[GUDATA_SEL].sd, 0, 0xfffff,
990 SDT_MEMRWA, SEL_UPL, 1, 1); 990 SDT_MEMRWA, SEL_UPL, 1, 1);
991#if NBIOSCALL > 0 991#if NBIOSCALL > 0 && !defined(XENPV)
992 /* bios trampoline GDT entries */ 992 /* bios trampoline GDT entries */
993 setsegment(&gdtstore[GBIOSCODE_SEL].sd, 0, 0xfffff, 993 setsegment(&gdtstore[GBIOSCODE_SEL].sd, 0, 0xfffff,
994 SDT_MEMERA, SEL_KPL, 0, 0); 994 SDT_MEMERA, SEL_KPL, 0, 0);
995 setsegment(&gdtstore[GBIOSDATA_SEL].sd, 0, 0xfffff, 995 setsegment(&gdtstore[GBIOSDATA_SEL].sd, 0, 0xfffff,
996 SDT_MEMRWA, SEL_KPL, 0, 0); 996 SDT_MEMRWA, SEL_KPL, 0, 0);
997#endif 997#endif
998 setsegment(&gdtstore[GCPU_SEL].sd, &cpu_info_primary, 998 setsegment(&gdtstore[GCPU_SEL].sd, &cpu_info_primary,
999 sizeof(struct cpu_info) - 1, SDT_MEMRWA, SEL_KPL, 1, 0); 999 sizeof(struct cpu_info) - 1, SDT_MEMRWA, SEL_KPL, 1, 0);
1000 1000
1001#ifndef XENPV 1001#ifndef XENPV
1002 setregion(&region, gdtstore, NGDT * sizeof(gdtstore[0]) - 1); 1002 setregion(&region, gdtstore, NGDT * sizeof(gdtstore[0]) - 1);
1003 lgdt(&region); 1003 lgdt(&region);
1004#else /* !XENPV */ 1004#else /* !XENPV */
@@ -1124,31 +1124,31 @@ init_bootspace(void) @@ -1124,31 +1124,31 @@ init_bootspace(void)
1124 /* Virtual address of the top level page */ 1124 /* Virtual address of the top level page */
1125 bootspace.pdir = (vaddr_t)(PDPpaddr + KERNBASE); 1125 bootspace.pdir = (vaddr_t)(PDPpaddr + KERNBASE);
1126} 1126}
1127 1127
1128void 1128void
1129init386(paddr_t first_avail) 1129init386(paddr_t first_avail)
1130{ 1130{
1131 extern void consinit(void); 1131 extern void consinit(void);
1132 int x; 1132 int x;
1133#ifndef XENPV 1133#ifndef XENPV
1134 extern paddr_t local_apic_pa; 1134 extern paddr_t local_apic_pa;
1135 union descriptor *tgdt; 1135 union descriptor *tgdt;
1136 struct region_descriptor region; 1136 struct region_descriptor region;
1137#endif 
1138#if NBIOSCALL > 0 1137#if NBIOSCALL > 0
1139 extern int biostramp_image_size; 1138 extern int biostramp_image_size;
1140 extern u_char biostramp_image[]; 1139 extern u_char biostramp_image[];
1141#endif 1140#endif
 1141#endif /* !XENPV */
1142 struct pcb *pcb; 1142 struct pcb *pcb;
1143 1143
1144 KASSERT(first_avail % PAGE_SIZE == 0); 1144 KASSERT(first_avail % PAGE_SIZE == 0);
1145 1145
1146#ifdef XENPV 1146#ifdef XENPV
1147 KASSERT(HYPERVISOR_shared_info != NULL); 1147 KASSERT(HYPERVISOR_shared_info != NULL);
1148 cpu_info_primary.ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[0]; 1148 cpu_info_primary.ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[0];
1149#endif 1149#endif
1150 1150
1151 uvm_lwp_setuarea(&lwp0, lwp0uarea); 1151 uvm_lwp_setuarea(&lwp0, lwp0uarea);
1152 1152
1153 cpu_probe(&cpu_info_primary); 1153 cpu_probe(&cpu_info_primary);
1154 cpu_init_msrs(&cpu_info_primary, true); 1154 cpu_init_msrs(&cpu_info_primary, true);

cvs diff -r1.85.6.4 -r1.85.6.5 src/sys/arch/i386/i386/vector.S (expand / switch to unified diff)

--- src/sys/arch/i386/i386/vector.S 2020/04/12 17:25:52 1.85.6.4
+++ src/sys/arch/i386/i386/vector.S 2020/04/16 08:46:34 1.85.6.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vector.S,v 1.85.6.4 2020/04/12 17:25:52 bouyer Exp $ */ 1/* $NetBSD: vector.S,v 1.85.6.5 2020/04/16 08:46:34 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 (c) Wasabi Systems, Inc. 4 * Copyright 2002 (c) Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Frank van der Linden for Wasabi Systems, Inc. 7 * Written by Frank van der Linden for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -55,47 +55,47 @@ @@ -55,47 +55,47 @@
55 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 55 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64 * POSSIBILITY OF SUCH DAMAGE. 64 * POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#include <machine/asm.h> 67#include <machine/asm.h>
68__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.4 2020/04/12 17:25:52 bouyer Exp $"); 68__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.5 2020/04/16 08:46:34 bouyer Exp $");
69 69
70#include "opt_ddb.h" 70#include "opt_ddb.h"
71#include "opt_multiprocessor.h" 71#include "opt_multiprocessor.h"
72#include "opt_xen.h" 72#include "opt_xen.h"
73#include "opt_dtrace.h" 73#include "opt_dtrace.h"
74 74
75#include <machine/i8259.h> 75#include <machine/i8259.h>
76#include <machine/i82093reg.h> 76#include <machine/i82093reg.h>
77#include <machine/i82489reg.h> 77#include <machine/i82489reg.h>
78#include <machine/frameasm.h> 78#include <machine/frameasm.h>
79#include <machine/segments.h> 79#include <machine/segments.h>
80#include <machine/specialreg.h> 80#include <machine/specialreg.h>
81#include <machine/trap.h> 81#include <machine/trap.h>
82#ifdef XEN 82#ifdef XEN
83#include <xen/xen.h> 83#include <xen/xen.h>
84#endif 84#endif
85 85
86#include "ioapic.h" 86#include "ioapic.h"
87#include "lapic.h" 87#include "lapic.h"
88#ifndef XEN 88#ifndef XENPV
89#include "hyperv.h" 89#include "hyperv.h"
90#endif 90#endif
91 91
92#include "assym.h" 92#include "assym.h"
93 93
94/* 94/*
95 * Macros for interrupt entry, call to handler, and exit. 95 * Macros for interrupt entry, call to handler, and exit.
96 * 96 *
97 * XXX 97 * XXX
98 * The interrupt frame is set up to look like a trap frame. This may be a 98 * The interrupt frame is set up to look like a trap frame. This may be a
99 * waste. The only handler which needs a frame is the clock handler, and it 99 * waste. The only handler which needs a frame is the clock handler, and it
100 * only needs a few bits. Xdoreti() needs a trap frame for handling ASTs, but 100 * only needs a few bits. Xdoreti() needs a trap frame for handling ASTs, but
101 * it could easily convert the frame on demand. 101 * it could easily convert the frame on demand.

File Added: src/sys/arch/i386/include/xen/hypercalls.h
/*	$NetBSD: hypercalls.h,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $	*/

/*
 * Copyright (c) 2006 Manuel Bouyer.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

/*
 * 
 * Communication to/from hypervisor.
 * 
 * Copyright (c) 2002-2004, K A Fraser
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this source file (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */


#ifndef _XENI386_HYPERVISOR_H_
#define _XENI386_HYPERVISOR_H_
/*
 * Assembler stubs for hyper-calls.
 */

#include <machine/pte.h> /* pt_entry_t */

/* hypercall via the hypercall call page */
#define __str(x) #x
#define _str(x) __str(x)
#define _hypercall(name, input_const, output_const) \
	__asm volatile ( \
	    "call hypercall_page + ("_str(name)" * 32)" \
	    : output_const \
	    : input_const \
	    : "memory" )

#define _harg(...) __VA_ARGS__
	

static __inline int
HYPERVISOR_set_trap_table(trap_info_t *table)
{
    int ret;
    unsigned long ign1;

	_hypercall(__HYPERVISOR_set_trap_table, _harg("1" (table)),
	    _harg("=a" (ret), "=b" (ign1)));

    return ret;
}

static __inline int
HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_set_gdt, _harg("1" (frame_list), "2" (entries)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline int
HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_stack_switch, _harg("1" (ss), "2" (esp)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline int
HYPERVISOR_set_callbacks(
    unsigned long event_selector, unsigned long event_address,
    unsigned long failsafe_selector, unsigned long failsafe_address)
{
    int ret;
    unsigned long ign1, ign2, ign3, ign4;

    _hypercall(__HYPERVISOR_set_callbacks,
	_harg("1" (event_selector),"2" (event_address),
	    "3" (failsafe_selector), "4" (failsafe_address)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));

    return ret;
}

#if __XEN_INTERFACE_VERSION__ < 0x00030204
static __inline int
HYPERVISOR_dom0_op(dom0_op_t *dom0_op)
{
    int ret;
    unsigned long ign1;

    dom0_op->interface_version = DOM0_INTERFACE_VERSION;
    _hypercall(__HYPERVISOR_dom0_op, _harg("1" (dom0_op)),
	_harg("=a" (ret), "=b" (ign1)));

    return ret;
}
#endif	/* __XEN_INTERFACE_VERSION__ */

static __inline int
HYPERVISOR_set_debugreg(int reg, unsigned long value)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_set_debugreg, _harg("1" (reg), "2" (value)),
	 _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline unsigned long
HYPERVISOR_get_debugreg(int reg)
{
    unsigned long ret;
    unsigned long ign1;

    _hypercall(__HYPERVISOR_get_debugreg, _harg("1" (reg)),
	_harg("=a" (ret), "=b" (ign1)));

    return ret;
}

#include <xen/include/public/arch-x86/xen-mca.h>

static __inline int
HYPERVISOR_machine_check(struct xen_mc *mc)
{
     int ret;
     unsigned long ign1;
  
     mc->interface_version = XEN_MCA_INTERFACE_VERSION;
     _hypercall(__HYPERVISOR_mca, _harg("1" (mc)),
	  _harg("=a" (ret), "=b" (ign1)));
  
     return ret;
}

static __inline int
HYPERVISOR_hvm_op(int cmd, void *arg)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_hvm_op, _harg("1" (cmd), "2" (arg)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline int
HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count,
    domid_t domid)
{
    int ret;
    unsigned long ign1, ign2, ign3, ign4;

    _hypercall(__HYPERVISOR_mmu_update,
	_harg("1" (req), "2" (count), "3" (success_count), "4" (domid)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));

    return ret;
}

static __inline int
HYPERVISOR_mmuext_op(struct mmuext_op *op, int count, int *success_count,
    domid_t domid)
{
    int ret;
    unsigned long ign1, ign2, ign3, ign4;

    _hypercall(__HYPERVISOR_mmuext_op,
	_harg("1" (op), "2" (count), "3" (success_count), "4" (domid)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));

    return ret;
}

static __inline int
HYPERVISOR_fpu_taskswitch(int set)
{
    long ret;
    long ign1;

    _hypercall(__HYPERVISOR_fpu_taskswitch, _harg("1" (set)),
	_harg("=a" (ret), "=b" (ign1)));

    return ret;
}

static __inline int
HYPERVISOR_update_descriptor(uint64_t ma, uint32_t word1, uint32_t word2)
{
    int ret;
    unsigned long ign1, ign2, ign3, ign4;
    int ma1 = ma & 0xffffffff;
    int ma2 = (ma >> 32) & 0xffffffff;

    _hypercall(__HYPERVISOR_update_descriptor,
	_harg("1" (ma1), "2" (ma2), "3" (word1), "4" (word2)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));

    return ret;
}

static __inline int
HYPERVISOR_memory_op(unsigned int cmd, void *arg)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_memory_op, _harg("1" (cmd), "2" (arg)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

#ifdef XENPV
static __inline int
HYPERVISOR_update_va_mapping(unsigned long page_nr, pt_entry_t new_val,
    unsigned long flags)
{
    int ret;
    unsigned long ign1, ign2, ign3, ign4;
    unsigned long pte_low, pte_hi;

    pte_low = new_val & 0xffffffff;
    pte_hi = new_val >> 32;

    _hypercall(__HYPERVISOR_update_va_mapping,
	_harg("1" (page_nr), "2" (pte_low), "3" (pte_hi), "4" (flags)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)));

#ifdef notdef
    if (__predict_false(ret < 0))
        panic("Failed update VA mapping: %08lx, %08lx, %08lx",
              page_nr, new_val, flags);
#endif

    return ret;
}

static __inline int
HYPERVISOR_update_va_mapping_otherdomain(unsigned long page_nr,
    pt_entry_t new_val, unsigned long flags, domid_t domid)
{
    int ret;
    unsigned long ign1, ign2, ign3, ign4, ign5;
    unsigned long pte_low, pte_hi;

    pte_low = new_val & 0xffffffff;
    pte_hi = new_val >> 32;

    _hypercall(__HYPERVISOR_update_va_mapping_otherdomain,
	_harg("1" (page_nr), "2" (pte_low), "3" (pte_hi), "4" (flags), "5" (domid)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
	    "=D" (ign5)));

    return ret;
}
#endif /* XENPV */

static __inline int
HYPERVISOR_xen_version(int cmd, void *arg)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_xen_version, _harg("1" (cmd), "2" (arg)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline int
HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
{
    int ret;
    unsigned long ign1, ign2, ign3;

    _hypercall(__HYPERVISOR_grant_table_op,
	_harg("1" (cmd), "2" (uop), "3" (count)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));

    return ret;
}


static __inline int
HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
{
    long ret;
    unsigned long ign1, ign2, ign3;

    _hypercall(__HYPERVISOR_vcpu_op,
	_harg("1" (cmd), "2" (vcpuid), "3" (extra_args)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));

    return ret;
}

static __inline long
HYPERVISOR_yield(void)
{
    long ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_sched_op, _harg("1" (SCHEDOP_yield), "2" (0)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline long
HYPERVISOR_block(void)
{
    long ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_sched_op, _harg("1" (SCHEDOP_block), "2" (0)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline long
HYPERVISOR_shutdown(void)
{
    long ret;
    unsigned long ign1, ign2;

#if __XEN_INTERFACE_VERSION__ >= 0x00030201

    struct sched_shutdown shutdown_reason = {
	    .reason = SHUTDOWN_poweroff
    };

    _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
#else
     _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_poweroff)),
 	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

#endif	

    return ret;
}

static __inline long
HYPERVISOR_crash(void)
{
    long ret;
    unsigned long ign1, ign2;

#if __XEN_INTERFACE_VERSION__ >= 0x00030201

    struct sched_shutdown shutdown_reason = {
	    .reason = SHUTDOWN_crash
    };

    _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
#else
    _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_crash)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
#endif

    return ret;
}

static __inline long
HYPERVISOR_reboot(void)
{
    long ret;
    unsigned long ign1, ign2;

#if __XEN_INTERFACE_VERSION__ >= 0x00030201

    struct sched_shutdown shutdown_reason = {
	    .reason = SHUTDOWN_reboot
    };

    _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
#else
    _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_reboot)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
#endif

    return ret;
}

static __inline long
HYPERVISOR_suspend(unsigned long srec)
{
    long ret;
    unsigned long ign1, ign2, ign3;

#if __XEN_INTERFACE_VERSION__ >= 0x00030201

    struct sched_shutdown shutdown_reason = {
	    .reason = SHUTDOWN_suspend
    };

    _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2"  (&shutdown_reason), "3" (srec)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
#else
    _hypercall(__HYPERVISOR_sched_op,
	_harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_suspend), "3" (srec)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));
#endif

    return ret;
}

static __inline long
HYPERVISOR_set_timer_op(uint64_t timeout)
{
    long ret;
    unsigned long timeout_hi = (unsigned long)(timeout>>32);
    unsigned long timeout_lo = (unsigned long)timeout;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_set_timer_op,
	 _harg("1" (timeout_lo), "2" (timeout_hi)),
	 _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline int
HYPERVISOR_platform_op(struct xen_platform_op *platform_op)
{
    int ret;
    unsigned long ign1;

    platform_op->interface_version = XENPF_INTERFACE_VERSION;
    _hypercall(__HYPERVISOR_platform_op, _harg("1" (platform_op)),
	_harg("=a" (ret), "=b" (ign1)));

    return ret;
}

static __inline int
HYPERVISOR_multicall(void *call_list, int nr_calls)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_multicall,
	 _harg("1" (call_list), "2" (nr_calls)),
	 _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}


static __inline int
HYPERVISOR_event_channel_op(evtchn_op_t *op)
{
    int ret;
    unsigned long ign1;

#if __XEN_INTERFACE_VERSION__ < 0x00030202
    _hypercall(__HYPERVISOR_event_channel_op, _harg("1" (op)),
	_harg("=a" (ret), "=b" (ign1)));
#else
    unsigned long ign2;

    _hypercall(__HYPERVISOR_event_channel_op, _harg("1" (op->cmd), "2" (&op->u)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
#endif
    return ret;
}

static __inline int
HYPERVISOR_console_io(int cmd, int count, char *str)
{
    int ret;
    unsigned long ign1, ign2, ign3;

    _hypercall(__HYPERVISOR_console_io,
	_harg("1" (cmd), "2" (count), "3" (str)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)));

    return ret;
}

static __inline int
HYPERVISOR_physdev_op(void *physdev_op)
{
    int ret;
    unsigned long ign1;

    _hypercall(__HYPERVISOR_physdev_op, _harg("1" (physdev_op)),
	_harg("=a" (ret), "=b" (ign1)));

    return ret;
}

static __inline int
HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
{
    int ret;
    unsigned long ign1, ign2;

    _hypercall(__HYPERVISOR_vm_assist, _harg("1" (cmd), "2" (type)),
	_harg("=a" (ret), "=b" (ign1), "=c" (ign2)));

    return ret;
}

static __inline int
HYPERVISOR_sysctl(void *sysctl)
{
    int ret;
    unsigned long ign1;

    _hypercall(__HYPERVISOR_sysctl, _harg("1" (sysctl)),
	_harg("=a" (ret), "=b" (ign1)));

    return ret;
}
#endif /* _XENI386_HYPERVISOR_H_ */

cvs diff -r1.107.10.1 -r1.107.10.2 src/sys/arch/x86/conf/files.x86 (expand / switch to unified diff)

--- src/sys/arch/x86/conf/files.x86 2020/04/11 18:26:07 1.107.10.1
+++ src/sys/arch/x86/conf/files.x86 2020/04/16 08:46:34 1.107.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files.x86,v 1.107.10.1 2020/04/11 18:26:07 bouyer Exp $ 1# $NetBSD: files.x86,v 1.107.10.2 2020/04/16 08:46:34 bouyer Exp $
2 2
3# options for MP configuration through the MP spec 3# options for MP configuration through the MP spec
4defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI 4defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI
5defparam opt_mpbios.h MPVERBOSE 5defparam opt_mpbios.h MPVERBOSE
6 6
7# MTRR support 7# MTRR support
8defflag MTRR 8defflag MTRR
9 9
10# Interrupt debug 10# Interrupt debug
11defflag opt_intrdebug.h INTRDEBUG 11defflag opt_intrdebug.h INTRDEBUG
12 12
13# PCI fixup options 13# PCI fixup options
14defflag opt_pcifixup.h PCI_ADDR_FIXUP PCI_BUS_FIXUP 14defflag opt_pcifixup.h PCI_ADDR_FIXUP PCI_BUS_FIXUP
@@ -25,28 +25,28 @@ defflag SVS @@ -25,28 +25,28 @@ defflag SVS
25define cpubus { [apid = -1] } 25define cpubus { [apid = -1] }
26define cpufeaturebus {} 26define cpufeaturebus {}
27define ioapicbus { [apid = -1] } 27define ioapicbus { [apid = -1] }
28 28
29# BIOS32 routines 29# BIOS32 routines
30define bios32 30define bios32
31file arch/x86/x86/bios32.c bios32 needs-flag 31file arch/x86/x86/bios32.c bios32 needs-flag
32 32
33# 33#
34# CPU features 34# CPU features
35# 35#
36device cpu: cpufeaturebus 36device cpu: cpufeaturebus
37attach cpu at cpubus 37attach cpu at cpubus
38file arch/x86/x86/cpu.c cpu 38file arch/x86/x86/cpu.c cpu & !xenpv
39file arch/x86/x86/cpu_rng.c cpu 39file arch/x86/x86/cpu_rng.c cpu | vcpu
40 40
41device acpicpu: acpi 41device acpicpu: acpi
42attach acpicpu at cpufeaturebus 42attach acpicpu at cpufeaturebus
43file dev/acpi/acpi_cpu.c acpicpu 43file dev/acpi/acpi_cpu.c acpicpu
44file dev/acpi/acpi_cpu_cstate.c acpicpu 44file dev/acpi/acpi_cpu_cstate.c acpicpu
45file dev/acpi/acpi_cpu_pstate.c acpicpu 45file dev/acpi/acpi_cpu_pstate.c acpicpu
46file dev/acpi/acpi_cpu_tstate.c acpicpu 46file dev/acpi/acpi_cpu_tstate.c acpicpu
47file arch/x86/acpi/acpi_cpu_md.c acpicpu 47file arch/x86/acpi/acpi_cpu_md.c acpicpu
48 48
49device coretemp: sysmon_envsys 49device coretemp: sysmon_envsys
50attach coretemp at cpufeaturebus 50attach coretemp at cpufeaturebus
51file arch/x86/x86/coretemp.c coretemp 51file arch/x86/x86/coretemp.c coretemp
52 52
@@ -72,54 +72,54 @@ attach viac7temp at cpufeaturebus @@ -72,54 +72,54 @@ attach viac7temp at cpufeaturebus
72file arch/x86/x86/viac7temp.c viac7temp 72file arch/x86/x86/viac7temp.c viac7temp
73 73
74device vmt: sysmon_power, sysmon_taskq 74device vmt: sysmon_power, sysmon_taskq
75attach vmt at cpufeaturebus 75attach vmt at cpufeaturebus
76file arch/x86/x86/vmt.c vmt 76file arch/x86/x86/vmt.c vmt
77 77
78device hyperv 78device hyperv
79attach hyperv at cpufeaturebus 79attach hyperv at cpufeaturebus
80file arch/x86/x86/hyperv.c hyperv needs-flag 80file arch/x86/x86/hyperv.c hyperv needs-flag
81 81
82file arch/x86/x86/apic.c ioapic | lapic 82file arch/x86/x86/apic.c ioapic | lapic
83file arch/x86/x86/bus_dma.c machdep 83file arch/x86/x86/bus_dma.c machdep
84file arch/x86/x86/bus_space.c machdep 84file arch/x86/x86/bus_space.c machdep
85file arch/x86/x86/consinit.c machdep 85file arch/x86/x86/consinit.c machdep & !xenpv
86file arch/x86/x86/core_machdep.c coredump 86file arch/x86/x86/core_machdep.c coredump
87file arch/x86/x86/cpu_topology.c machdep 87file arch/x86/x86/cpu_topology.c machdep
88file arch/x86/x86/db_memrw.c ddb | kgdb 88file arch/x86/x86/db_memrw.c ddb | kgdb
89file arch/x86/x86/db_trace.c ddb 89file arch/x86/x86/db_trace.c ddb
90file arch/x86/x86/efi.c machdep 90file arch/x86/x86/efi.c machdep
91file arch/x86/x86/errata.c machdep 91file arch/x86/x86/errata.c machdep
92file arch/x86/x86/genfb_machdep.c machdep 92file arch/x86/x86/genfb_machdep.c machdep
93file arch/x86/x86/identcpu.c machdep 93file arch/x86/x86/identcpu.c machdep
94file arch/x86/x86/i8259.c machdep 94file arch/x86/x86/i8259.c machdep & (!xenpv | dom0ops)
95file arch/x86/x86/intr.c machdep 95file arch/x86/x86/intr.c machdep & !xenpv
96file arch/x86/x86/x86_softintr.c machdep 96file arch/x86/x86/x86_softintr.c machdep
97file arch/x86/x86/kgdb_machdep.c kgdb 97file arch/x86/x86/kgdb_machdep.c kgdb
98file arch/x86/x86/nmi.c machdep 98file arch/x86/x86/nmi.c machdep
99file arch/x86/x86/idt.c machdep 99file arch/x86/x86/idt.c machdep
100file arch/x86/x86/ipi.c machdep 100file arch/x86/x86/ipi.c machdep & ( !xenpv | dom0ops )
101file arch/x86/x86/mtrr_i686.c mtrr 101file arch/x86/x86/mtrr_i686.c mtrr & !xenpv
102file arch/x86/x86/patch.c machdep 102file arch/x86/x86/patch.c machdep & !xenpv
103file arch/x86/x86/platform.c machdep 103file arch/x86/x86/platform.c machdep
104file arch/x86/x86/pmap.c machdep 104file arch/x86/x86/pmap.c machdep
105file arch/x86/x86/x86_tlb.c machdep 105file arch/x86/x86/x86_tlb.c machdep
106file arch/x86/x86/procfs_machdep.c procfs 106file arch/x86/x86/procfs_machdep.c procfs
107file arch/x86/x86/svs.c machdep & svs 107file arch/x86/x86/svs.c machdep & svs
108file arch/x86/x86/sys_machdep.c machdep 108file arch/x86/x86/sys_machdep.c machdep
109file arch/x86/x86/syscall.c machdep 109file arch/x86/x86/syscall.c machdep
110file arch/x86/x86/tsc.c machdep 110file arch/x86/x86/tsc.c machdep
111file arch/x86/x86/vm_machdep.c machdep 111file arch/x86/x86/vm_machdep.c machdep
112file arch/x86/x86/x86_autoconf.c machdep 112file arch/x86/x86/x86_autoconf.c machdep & !xenpv
113file arch/x86/x86/x86_userconf.c userconf 113file arch/x86/x86/x86_userconf.c userconf
114file arch/x86/x86/x86_machdep.c machdep 114file arch/x86/x86/x86_machdep.c machdep
115 115
116file uvm/pmap/pmap_pvt.c machdep 116file uvm/pmap/pmap_pvt.c machdep
117 117
118file arch/x86/x86/cpu_ucode.c cpu_ucode needs-flag 118file arch/x86/x86/cpu_ucode.c cpu_ucode needs-flag
119file arch/x86/x86/cpu_ucode_amd.c cpu_ucode needs-flag 119file arch/x86/x86/cpu_ucode_amd.c cpu_ucode needs-flag
120file arch/x86/x86/cpu_ucode_intel.c cpu_ucode needs-flag 120file arch/x86/x86/cpu_ucode_intel.c cpu_ucode needs-flag
121file arch/x86/x86/compat_60_cpu_ucode.c compat_60 & cpu_ucode 121file arch/x86/x86/compat_60_cpu_ucode.c compat_60 & cpu_ucode
122 122
123define lapic 123define lapic
124file arch/x86/x86/lapic.c lapic needs-flag 124file arch/x86/x86/lapic.c lapic needs-flag
125 125
@@ -127,34 +127,34 @@ device ioapic: lapic @@ -127,34 +127,34 @@ device ioapic: lapic
127attach ioapic at ioapicbus 127attach ioapic at ioapicbus
128file arch/x86/x86/ioapic.c ioapic needs-flag 128file arch/x86/x86/ioapic.c ioapic needs-flag
129 129
130# MP configuration using Intel SMP specification 1.4 130# MP configuration using Intel SMP specification 1.4
131file arch/x86/x86/mpbios.c mpbios 131file arch/x86/x86/mpbios.c mpbios
132 132
133# MP configuration using either ACPI or Intel SMP specification 1.4 133# MP configuration using either ACPI or Intel SMP specification 1.4
134file arch/x86/x86/mp.c acpi | mpbios 134file arch/x86/x86/mp.c acpi | mpbios
135 135
136# MP configuration using ACPI 136# MP configuration using ACPI
137file arch/x86/x86/mpacpi.c acpi 137file arch/x86/x86/mpacpi.c acpi
138 138
139file arch/x86/acpi/acpi_pdc.c acpi 139file arch/x86/acpi/acpi_pdc.c acpi
140file arch/x86/acpi/acpi_wakeup.c acpi 140file arch/x86/acpi/acpi_wakeup.c acpi & !xenpv
141file arch/x86/acpi/acpi_machdep.c acpi 141file arch/x86/acpi/acpi_machdep.c acpi
142 142
143file arch/x86/isa/isa_machdep.c 143file arch/x86/isa/isa_machdep.c isa
144 144
145# PC clock 145# PC clock
146file arch/x86/isa/clock.c 146file arch/x86/isa/clock.c !xenpv
147file arch/x86/isa/rtc.c 147file arch/x86/isa/rtc.c isa
148 148
149# Stubs for x86 routines not included in the system 149# Stubs for x86 routines not included in the system
150file arch/x86/x86/x86_stub.c 150file arch/x86/x86/x86_stub.c
151 151
152# IPMI device 152# IPMI device
153file arch/x86/x86/x86_ipmi.c ipmi needs-flag 153file arch/x86/x86/x86_ipmi.c ipmi needs-flag
154 154
155file arch/x86/x86/vga_post.c vga_post 155file arch/x86/x86/vga_post.c vga_post
156 156
157file arch/x86/pci/pci_machdep.c pci 157file arch/x86/pci/pci_machdep.c pci
158#file arch/x86/pci/pci_ranges.c pci 158#file arch/x86/pci/pci_ranges.c pci
159file arch/x86/pci/pci_intr_machdep.c pci 159file arch/x86/pci/pci_intr_machdep.c pci
160file arch/x86/pci/pci_msi_machdep.c pci & ! no_pci_msi_msix 160file arch/x86/pci/pci_msi_machdep.c pci & ! no_pci_msi_msix

cvs diff -r1.61.6.2 -r1.61.6.3 src/sys/arch/x86/include/intr.h (expand / switch to unified diff)

--- src/sys/arch/x86/include/intr.h 2020/04/11 18:26:07 1.61.6.2
+++ src/sys/arch/x86/include/intr.h 2020/04/16 08:46:35 1.61.6.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intr.h,v 1.61.6.2 2020/04/11 18:26:07 bouyer Exp $ */ 1/* $NetBSD: intr.h,v 1.61.6.3 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2001, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2001, 2006, 2007, 2008, 2019 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 Charles M. Hannum, and by Jason R. Thorpe. 8 * by Charles M. Hannum, and by Jason R. Thorpe.
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.
@@ -37,26 +37,31 @@ @@ -37,26 +37,31 @@
37#define __HAVE_PREEMPTION 37#define __HAVE_PREEMPTION
38#endif /* !defined(NO_PREEMPTION) */ 38#endif /* !defined(NO_PREEMPTION) */
39 39
40#ifdef _KERNEL 40#ifdef _KERNEL
41#include <sys/types.h> 41#include <sys/types.h>
42#else 42#else
43#include <stdbool.h> 43#include <stdbool.h>
44#endif 44#endif
45 45
46#include <sys/evcnt.h> 46#include <sys/evcnt.h>
47#include <sys/queue.h> 47#include <sys/queue.h>
48#include <machine/intrdefs.h> 48#include <machine/intrdefs.h>
49 49
 50#ifdef XEN
 51#include <xen/include/public/xen.h>
 52#include <xen/include/public/event_channel.h>
 53#endif /* XEN */
 54
50#ifndef _LOCORE 55#ifndef _LOCORE
51#include <machine/pic.h> 56#include <machine/pic.h>
52 57
53/* 58/*
54 * Struct describing an interrupt source for a CPU. struct cpu_info 59 * Struct describing an interrupt source for a CPU. struct cpu_info
55 * has an array of MAX_INTR_SOURCES of these. The index in the array 60 * has an array of MAX_INTR_SOURCES of these. The index in the array
56 * is equal to the stub number of the stubcode as present in vector.s 61 * is equal to the stub number of the stubcode as present in vector.s
57 * 62 *
58 * The primary CPU's array of interrupt sources has its first 16 63 * The primary CPU's array of interrupt sources has its first 16
59 * entries reserved for legacy ISA irq handlers. This means that 64 * entries reserved for legacy ISA irq handlers. This means that
60 * they have a 1:1 mapping for arrayindex:irq_num. This is not 65 * they have a 1:1 mapping for arrayindex:irq_num. This is not
61 * true for interrupts that come in through IO APICs, to find 66 * true for interrupts that come in through IO APICs, to find
62 * their source, go through ci->ci_isources[index].is_pic 67 * their source, go through ci->ci_isources[index].is_pic

cvs diff -r1.12 -r1.12.10.1 src/sys/arch/x86/x86/cpu_ucode.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/cpu_ucode.c 2019/02/11 14:59:33 1.12
+++ src/sys/arch/x86/x86/cpu_ucode.c 2020/04/16 08:46:35 1.12.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu_ucode.c,v 1.12 2019/02/11 14:59:33 cherry Exp $ */ 1/* $NetBSD: cpu_ucode.c,v 1.12.10.1 2020/04/16 08:46:35 bouyer Exp $ */
2/* 2/*
3 * Copyright (c) 2012 The NetBSD Foundation, Inc. 3 * Copyright (c) 2012 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Christoph Egger. 7 * by Christoph Egger.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.12 2019/02/11 14:59:33 cherry Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.12.10.1 2020/04/16 08:46:35 bouyer Exp $");
33 33
34#if defined(_KERNEL_OPT) 34#if defined(_KERNEL_OPT)
35#include "opt_cpu_ucode.h" 35#include "opt_cpu_ucode.h"
36#include "opt_xen.h" 36#include "opt_xen.h"
37#endif 37#endif
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/cpuio.h> 40#include <sys/cpuio.h>
41#include <sys/cpu.h> 41#include <sys/cpu.h>
42 42
43#include <dev/firmload.h> 43#include <dev/firmload.h>
44 44
45#include <machine/cpuvar.h> 45#include <machine/cpuvar.h>
@@ -148,14 +148,14 @@ cpu_ucode_apply(const struct cpu_ucode * @@ -148,14 +148,14 @@ cpu_ucode_apply(const struct cpu_ucode *
148 148
149 op.cmd = XENPF_microcode_update; 149 op.cmd = XENPF_microcode_update;
150 set_xen_guest_handle(op.u.microcode.data, sc->sc_blob); 150 set_xen_guest_handle(op.u.microcode.data, sc->sc_blob);
151 op.u.microcode.length = sc->sc_blobsize; 151 op.u.microcode.length = sc->sc_blobsize;
152 152
153 error = -HYPERVISOR_platform_op(&op); 153 error = -HYPERVISOR_platform_op(&op);
154 154
155 if (sc->sc_blob) 155 if (sc->sc_blob)
156 firmware_free(sc->sc_blob, sc->sc_blobsize); 156 firmware_free(sc->sc_blob, sc->sc_blobsize);
157 sc->sc_blob = NULL; 157 sc->sc_blob = NULL;
158 sc->sc_blobsize = 0; 158 sc->sc_blobsize = 0;
159 return error; 159 return error;
160} 160}
161#endif 161#endif /* XEN */

cvs diff -r1.10 -r1.10.6.1 src/sys/arch/x86/x86/cpu_ucode_amd.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/cpu_ucode_amd.c 2019/10/15 00:13:52 1.10
+++ src/sys/arch/x86/x86/cpu_ucode_amd.c 2020/04/16 08:46:35 1.10.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu_ucode_amd.c,v 1.10 2019/10/15 00:13:52 chs Exp $ */ 1/* $NetBSD: cpu_ucode_amd.c,v 1.10.6.1 2020/04/16 08:46:35 bouyer Exp $ */
2/* 2/*
3 * Copyright (c) 2012 The NetBSD Foundation, Inc. 3 * Copyright (c) 2012 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Christoph Egger. 7 * by Christoph Egger.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.10 2019/10/15 00:13:52 chs Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.10.6.1 2020/04/16 08:46:35 bouyer Exp $");
33 33
34#ifdef _KERNEL_OPT 34#ifdef _KERNEL_OPT
35#include "opt_xen.h" 35#include "opt_xen.h"
36#include "opt_cpu_ucode.h" 36#include "opt_cpu_ucode.h"
37#endif 37#endif
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/conf.h> 40#include <sys/conf.h>
41#include <sys/cpuio.h> 41#include <sys/cpuio.h>
42#include <sys/cpu.h> 42#include <sys/cpu.h>
43#include <sys/kmem.h> 43#include <sys/kmem.h>
44#include <sys/xcall.h> 44#include <sys/xcall.h>
45 45
@@ -128,27 +128,27 @@ cpu_ucode_amd_firmware_open(firmware_han @@ -128,27 +128,27 @@ cpu_ucode_amd_firmware_open(firmware_han
128 if (fwname != NULL && fwname[0] != '\0') 128 if (fwname != NULL && fwname[0] != '\0')
129 return firmware_open(fw_path, fwname, fwh); 129 return firmware_open(fw_path, fwname, fwh);
130 130
131 snprintf(_fwname, sizeof(_fwname), "microcode_amd_fam%xh.bin", 131 snprintf(_fwname, sizeof(_fwname), "microcode_amd_fam%xh.bin",
132 amd_cpufamily()); 132 amd_cpufamily());
133 133
134 error = firmware_open(fw_path, _fwname, fwh); 134 error = firmware_open(fw_path, _fwname, fwh);
135 if (error == 0) 135 if (error == 0)
136 return 0; 136 return 0;
137 137
138 return firmware_open(fw_path, "microcode_amd.bin", fwh); 138 return firmware_open(fw_path, "microcode_amd.bin", fwh);
139} 139}
140 140
141#ifndef XEN 141#ifndef XENPV
142struct mc_buf { 142struct mc_buf {
143 uint8_t *mc_buf; 143 uint8_t *mc_buf;
144 uint32_t mc_equiv_cpuid; 144 uint32_t mc_equiv_cpuid;
145 struct mpbhdr *mc_mpbuf; 145 struct mpbhdr *mc_mpbuf;
146 struct microcode_amd *mc_amd; 146 struct microcode_amd *mc_amd;
147 int mc_error; 147 int mc_error;
148}; 148};
149 149
150static void 150static void
151cpu_apply_cb(void *arg0, void *arg1) 151cpu_apply_cb(void *arg0, void *arg1)
152{ 152{
153 int error = 0; 153 int error = 0;
154 const struct cpu_ucode_softc *sc = arg0; 154 const struct cpu_ucode_softc *sc = arg0;

cvs diff -r1.17 -r1.17.8.1 src/sys/arch/x86/x86/cpu_ucode_intel.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/cpu_ucode_intel.c 2019/05/10 18:21:01 1.17
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c 2020/04/16 08:46:35 1.17.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu_ucode_intel.c,v 1.17 2019/05/10 18:21:01 maxv Exp $ */ 1/* $NetBSD: cpu_ucode_intel.c,v 1.17.8.1 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2012, 2019 The NetBSD Foundation, Inc. 4 * Copyright (c) 2012, 2019 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 Matthias Drochner and Maxime Villard. 8 * by Matthias Drochner and Maxime Villard.
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.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.17 2019/05/10 18:21:01 maxv Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.17.8.1 2020/04/16 08:46:35 bouyer Exp $");
34 34
35#ifdef _KERNEL_OPT 35#ifdef _KERNEL_OPT
36#include "opt_xen.h" 36#include "opt_xen.h"
37#include "opt_cpu_ucode.h" 37#include "opt_cpu_ucode.h"
38#endif 38#endif
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/conf.h> 41#include <sys/conf.h>
42#include <sys/cpuio.h> 42#include <sys/cpuio.h>
43#include <sys/cpu.h> 43#include <sys/cpu.h>
44#include <sys/kmem.h> 44#include <sys/kmem.h>
45 45
46#include <machine/cpufunc.h> 46#include <machine/cpufunc.h>
@@ -96,27 +96,27 @@ cpu_ucode_intel_firmware_open(firmware_h @@ -96,27 +96,27 @@ cpu_ucode_intel_firmware_open(firmware_h
96 return firmware_open(fw_path, fwname, fwh); 96 return firmware_open(fw_path, fwname, fwh);
97 97
98 cpu_signature = curcpu()->ci_signature; 98 cpu_signature = curcpu()->ci_signature;
99 if (CPUID_TO_FAMILY(cpu_signature) < 6) 99 if (CPUID_TO_FAMILY(cpu_signature) < 6)
100 return EOPNOTSUPP; 100 return EOPNOTSUPP;
101 101
102 intel_getcurrentucode(&ucodeversion, &platformid); 102 intel_getcurrentucode(&ucodeversion, &platformid);
103 snprintf(cpuspec, sizeof(cpuspec), "%08x-%d", cpu_signature, 103 snprintf(cpuspec, sizeof(cpuspec), "%08x-%d", cpu_signature,
104 platformid); 104 platformid);
105 105
106 return firmware_open(fw_path, cpuspec, fwh); 106 return firmware_open(fw_path, cpuspec, fwh);
107} 107}
108 108
109#ifndef XEN 109#ifndef XENPV
110static int 110static int
111cpu_ucode_intel_verify(struct cpu_ucode_softc *sc, 111cpu_ucode_intel_verify(struct cpu_ucode_softc *sc,
112 struct intel1_ucode_header *buf) 112 struct intel1_ucode_header *buf)
113{ 113{
114 uint32_t data_size, total_size, payload_size, ext_size; 114 uint32_t data_size, total_size, payload_size, ext_size;
115 uint32_t sum; 115 uint32_t sum;
116 int i; 116 int i;
117 117
118 if ((buf->uh_header_ver != 1) || (buf->uh_loader_rev != 1)) 118 if ((buf->uh_header_ver != 1) || (buf->uh_loader_rev != 1))
119 return EINVAL; 119 return EINVAL;
120 120
121 /* 121 /*
122 * Data size. 122 * Data size.

cvs diff -r1.76.6.1 -r1.76.6.2 src/sys/arch/x86/x86/lapic.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/lapic.c 2020/04/08 17:59:16 1.76.6.1
+++ src/sys/arch/x86/x86/lapic.c 2020/04/16 08:46:35 1.76.6.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lapic.c,v 1.76.6.1 2020/04/08 17:59:16 bouyer Exp $ */ 1/* $NetBSD: lapic.c,v 1.76.6.2 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000, 2008 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 RedBack Networks Inc. 8 * by RedBack Networks Inc.
9 * 9 *
10 * Author: Bill Sommerfeld 10 * Author: Bill Sommerfeld
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -22,35 +22,37 @@ @@ -22,35 +22,37 @@
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.76.6.1 2020/04/08 17:59:16 bouyer Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.76.6.2 2020/04/16 08:46:35 bouyer Exp $");
36 36
37#include "acpica.h" 37#include "acpica.h"
38#include "ioapic.h" 38#include "ioapic.h"
39#include "opt_acpi.h" 39#include "opt_acpi.h"
40#include "opt_ddb.h" 40#include "opt_ddb.h"
41#include "opt_mpbios.h" /* for MPDEBUG */ 41#include "opt_mpbios.h" /* for MPDEBUG */
42#include "opt_multiprocessor.h" 42#include "opt_multiprocessor.h"
43#include "opt_ntp.h" 43#include "opt_ntp.h"
 44#include "opt_xen.h"
 45
44 46
45#include <sys/param.h> 47#include <sys/param.h>
46#include <sys/proc.h> 48#include <sys/proc.h>
47#include <sys/systm.h> 49#include <sys/systm.h>
48#include <sys/device.h> 50#include <sys/device.h>
49#include <sys/timetc.h> 51#include <sys/timetc.h>
50 52
51#include <uvm/uvm_extern.h> 53#include <uvm/uvm_extern.h>
52 54
53#include <dev/ic/i8253reg.h> 55#include <dev/ic/i8253reg.h>
54 56
55#include <machine/cpu.h> 57#include <machine/cpu.h>
56#include <machine/cpu_counter.h> 58#include <machine/cpu_counter.h>
@@ -60,26 +62,27 @@ __KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1. @@ -60,26 +62,27 @@ __KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.
60#include <machine/vmparam.h> 62#include <machine/vmparam.h>
61#include <machine/mpacpi.h> 63#include <machine/mpacpi.h>
62#include <machine/mpbiosvar.h> 64#include <machine/mpbiosvar.h>
63#include <machine/pcb.h> 65#include <machine/pcb.h>
64#include <machine/specialreg.h> 66#include <machine/specialreg.h>
65#include <machine/segments.h> 67#include <machine/segments.h>
66#include <x86/x86/tsc.h> 68#include <x86/x86/tsc.h>
67#include <x86/i82093var.h> 69#include <x86/i82093var.h>
68 70
69#include <machine/apicvar.h> 71#include <machine/apicvar.h>
70#include <machine/i82489reg.h> 72#include <machine/i82489reg.h>
71#include <machine/i82489var.h> 73#include <machine/i82489var.h>
72 74
 75#ifndef XENPV
73#if NACPICA > 0 76#if NACPICA > 0
74#include <dev/acpi/acpica.h> 77#include <dev/acpi/acpica.h>
75#include <dev/acpi/acpivar.h> 78#include <dev/acpi/acpivar.h>
76#endif 79#endif
77 80
78#ifdef DDB 81#ifdef DDB
79#include <machine/db_machdep.h> 82#include <machine/db_machdep.h>
80#ifdef MULTIPROCESSOR 83#ifdef MULTIPROCESSOR
81#ifdef __x86_64__ 84#ifdef __x86_64__
82typedef void (vector)(void); 85typedef void (vector)(void);
83extern vector Xintr_x2apic_ddbipi; 86extern vector Xintr_x2apic_ddbipi;
84extern int ddb_vec; 87extern int ddb_vec;
85#endif 88#endif
@@ -953,13 +956,19 @@ lapic_dump(void) @@ -953,13 +956,19 @@ lapic_dump(void)
953 apic_format_redir(device_xname(ci->ci_dev), where, (idx), \ 956 apic_format_redir(device_xname(ci->ci_dev), where, (idx), \
954 APIC_VECTYPE_LAPIC_LVT, 0, lapic_readreg(lvtreg)) 957 APIC_VECTYPE_LAPIC_LVT, 0, lapic_readreg(lvtreg))
955 958
956 APIC_LVT_PRINT(ci, "cmci", 0, LAPIC_LVT_CMCI); 959 APIC_LVT_PRINT(ci, "cmci", 0, LAPIC_LVT_CMCI);
957 APIC_LVT_PRINT(ci, "timer", 0, LAPIC_LVT_TIMER); 960 APIC_LVT_PRINT(ci, "timer", 0, LAPIC_LVT_TIMER);
958 APIC_LVT_PRINT(ci, "thermal", 0, LAPIC_LVT_THERM); 961 APIC_LVT_PRINT(ci, "thermal", 0, LAPIC_LVT_THERM);
959 APIC_LVT_PRINT(ci, "pcint", 0, LAPIC_LVT_PCINT); 962 APIC_LVT_PRINT(ci, "pcint", 0, LAPIC_LVT_PCINT);
960 APIC_LVT_PRINT(ci, "lint", 0, LAPIC_LVT_LINT0); 963 APIC_LVT_PRINT(ci, "lint", 0, LAPIC_LVT_LINT0);
961 APIC_LVT_PRINT(ci, "lint", 1, LAPIC_LVT_LINT1); 964 APIC_LVT_PRINT(ci, "lint", 1, LAPIC_LVT_LINT1);
962 APIC_LVT_PRINT(ci, "err", 0, LAPIC_LVT_ERR); 965 APIC_LVT_PRINT(ci, "err", 0, LAPIC_LVT_ERR);
963 966
964#undef APIC_LVT_PRIINT 967#undef APIC_LVT_PRIINT
965} 968}
 969#else /* XENPV */
 970void
 971lapic_boot_init(paddr_t lapic_base)
 972{
 973}
 974#endif /* XENPV */

cvs diff -r1.3.12.1 -r1.3.12.2 src/sys/arch/x86/x86/mainbus.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/mainbus.c 2020/04/11 21:21:49 1.3.12.1
+++ src/sys/arch/x86/x86/mainbus.c 2020/04/16 08:46:35 1.3.12.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $ */ 1/* $NetBSD: mainbus.c,v 1.3.12.2 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -18,38 +18,39 @@ @@ -18,38 +18,39 @@
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30 30
31__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3.12.2 2020/04/16 08:46:35 bouyer Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/reboot.h> 36#include <sys/reboot.h>
37 37
38#include <dev/pci/pcivar.h> 38#include <dev/pci/pcivar.h>
39 39
40#include <machine/cpuvar.h> 40#include <machine/cpuvar.h>
41#include <machine/mpbiosvar.h> 41#include <machine/mpbiosvar.h>
42#include <machine/mpacpi.h> 42#include <machine/mpacpi.h>
 43#include <xen/hypervisor.h>
43 44
44#include "pci.h" 45#include "pci.h"
45#include "isa.h" 46#include "isa.h"
46#include "isadma.h" 47#include "isadma.h"
47#include "acpica.h" 48#include "acpica.h"
48#include "ipmi.h" 49#include "ipmi.h"
49 50
50#include "opt_acpi.h" 51#include "opt_acpi.h"
51#include "opt_mpbios.h" 52#include "opt_mpbios.h"
52#include "opt_pcifixup.h" 53#include "opt_pcifixup.h"
53 54
54#if NACPICA > 0 55#if NACPICA > 0
55#include <dev/acpi/acpivar.h> 56#include <dev/acpi/acpivar.h>
@@ -86,30 +87,26 @@ CFATTACH_DECL2_NEW(mainbus, sizeof(struc @@ -86,30 +87,26 @@ CFATTACH_DECL2_NEW(mainbus, sizeof(struc
86 NULL, NULL, 87 NULL, NULL,
87 mainbus_rescan, mainbus_childdetached); 88 mainbus_rescan, mainbus_childdetached);
88 89
89#if defined(__i386__) && !defined(XENPV) 90#if defined(__i386__) && !defined(XENPV)
90void i386_mainbus_childdetached(device_t, device_t); 91void i386_mainbus_childdetached(device_t, device_t);
91int i386_mainbus_rescan(device_t, const char *, const int *); 92int i386_mainbus_rescan(device_t, const char *, const int *);
92void i386_mainbus_attach(device_t, device_t, void *); 93void i386_mainbus_attach(device_t, device_t, void *);
93#endif 94#endif
94 95
95#if defined(__x86_64__) && !defined(XENPV) 96#if defined(__x86_64__) && !defined(XENPV)
96void amd64_mainbus_attach(device_t, device_t, void *); 97void amd64_mainbus_attach(device_t, device_t, void *);
97#endif 98#endif
98 99
99#if defined(XEN) 
100void xen_mainbus_attach(device_t, device_t, void *); 
101#endif 
102 
103static int 100static int
104mainbus_cpu_print(void *aux, const char *busname) 101mainbus_cpu_print(void *aux, const char *busname)
105{ 102{
106 char *cpuname = aux; 103 char *cpuname = aux;
107 104
108 if (busname) 105 if (busname)
109 aprint_normal("%s at %s", cpuname, busname); 106 aprint_normal("%s at %s", cpuname, busname);
110 return UNCONF; 107 return UNCONF;
111} 108}
112 109
113/* 110/*
114 * On x86, CPUs can be enumerated and attached to mainbus in mainly two ways 111 * On x86, CPUs can be enumerated and attached to mainbus in mainly two ways
115 * depending on the platform (configuration): via MP BIOS tables, and via 112 * depending on the platform (configuration): via MP BIOS tables, and via

cvs diff -r1.48 -r1.48.10.1 src/sys/arch/xen/conf/Makefile.xen (expand / switch to unified diff)

--- src/sys/arch/xen/conf/Makefile.xen 2019/02/02 12:32:54 1.48
+++ src/sys/arch/xen/conf/Makefile.xen 2020/04/16 08:46:35 1.48.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile.xen,v 1.48 2019/02/02 12:32:54 cherry Exp $ 1# $NetBSD: Makefile.xen,v 1.48.10.1 2020/04/16 08:46:35 bouyer Exp $
2# NetBSD: Makefile.i386,v 1.132 2003/07/05 16:56:10 simonb Exp  2# NetBSD: Makefile.i386,v 1.132 2003/07/05 16:56:10 simonb Exp
3 3
4# Makefile for NetBSD 4# Makefile for NetBSD
5# 5#
6# This makefile is constructed from a machine description: 6# This makefile is constructed from a machine description:
7# config machineid 7# config machineid
8# Most changes should be made in the machine description 8# Most changes should be made in the machine description
9# /sys/arch/xen/conf/``machineid'' 9# /sys/arch/xen/conf/``machineid''
10# after which you should do 10# after which you should do
11# config machineid 11# config machineid
12# Machine generic makefile changes should be made in 12# Machine generic makefile changes should be made in
13# /sys/arch/xen/conf/Makefile.xen 13# /sys/arch/xen/conf/Makefile.xen
14# after which config should be rerun for all machines of that type. 14# after which config should be rerun for all machines of that type.
@@ -57,55 +57,57 @@ CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mno @@ -57,55 +57,57 @@ CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mno
57DEFCOPTS= -O2 -fno-omit-frame-pointer 57DEFCOPTS= -O2 -fno-omit-frame-pointer
58CFLAGS+= -msoft-float 58CFLAGS+= -msoft-float
59CFLAGS+= -mno-mmx -mno-sse -mno-avx 59CFLAGS+= -mno-mmx -mno-sse -mno-avx
60.endif 60.endif
61 61
62## 62##
63## (3) libkern and compat 63## (3) libkern and compat
64## 64##
65OPT_MODULAR= %MODULAR% 65OPT_MODULAR= %MODULAR%
66 66
67## 67##
68## (4) local objects, compile rules, and dependencies 68## (4) local objects, compile rules, and dependencies
69## 69##
70MD_OBJS= locore.o spl.o copy.o vector.o 70
71.if ${XEN_BUILD} == amd64 71MD_OBJS=
72MD_OBJS+= amd64_trap.o 72.if ${XEN_BUILD} == i386
 73MD_OBJS+= locore.o spl.o copy.o vector.o lock_stubs.o
73.endif 74.endif
74MD_CFILES= 75MD_CFILES=
75 76
76MD_SFILES= $S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S \ 77MD_SFILES=
 78.if ${XEN_BUILD} == i386
 79MD_SFILES+= $S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S \
77 $S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S \ 80 $S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S \
78 $S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S \ 81 $S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S \
79 $S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S 82 $S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S \
 83 $S/arch/${XEN_BUILD}/${XEN_BUILD}/lock_stubs.S
80 84
81.if ${XEN_BUILD} == amd64 
82MD_SFILES+= $S/arch/${XEN_BUILD}/${XEN_BUILD}/amd64_trap.S 
83.endif 85.endif
84 86
 87.if ${XEN_BUILD} == i386
85copy.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S assym.h 88copy.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/copy.S assym.h
86 ${NORMAL_S} 89 ${NORMAL_S}
87 90
88locore.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S assym.h 91locore.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/locore.S assym.h
89 ${NORMAL_S} 92 ${NORMAL_S}
90 93
91spl.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S assym.h 94spl.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/spl.S assym.h
92 ${NORMAL_S} 95 ${NORMAL_S}
93 96
94vector.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S assym.h 97vector.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/vector.S assym.h
95 ${NORMAL_S} 98 ${NORMAL_S}
96 99
97.if ${XEN_BUILD} == amd64 100lock_stubs.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/lock_stubs.S assym.h
98amd64_trap.o: $S/arch/${XEN_BUILD}/${XEN_BUILD}/amd64_trap.S assym.h 
99 ${NORMAL_S} 101 ${NORMAL_S}
100.endif 102.endif
101 103
102.ifndef noBEGIN 104.ifndef noBEGIN
103.if !make(obj) && !make(clean) && !make(cleandir) 105.if !make(obj) && !make(clean) && !make(cleandir)
104.BEGIN:: 106.BEGIN::
105.for A in ${XEN_MACHINE_ARCHS} 107.for A in ${XEN_MACHINE_ARCHS}
106 -@rm -f ${A} && \ 108 -@rm -f ${A} && \
107 ln -s $S/arch/${A}/include ${A} 109 ln -s $S/arch/${A}/include ${A}
108.endfor 110.endfor
109 -@rm -rf xen-ma && \ 111 -@rm -rf xen-ma && \
110 mkdir xen-ma && ln -s ../${XEN_BUILD} xen-ma/machine 112 mkdir xen-ma && ln -s ../${XEN_BUILD} xen-ma/machine
111 -@rm -f machine && \ 113 -@rm -f machine && \

cvs diff -r1.180.2.2 -r1.180.2.3 src/sys/arch/xen/conf/files.xen (expand / switch to unified diff)

--- src/sys/arch/xen/conf/files.xen 2020/04/14 16:53:57 1.180.2.2
+++ src/sys/arch/xen/conf/files.xen 2020/04/16 08:46:35 1.180.2.3
@@ -1,411 +1,46 @@ @@ -1,411 +1,46 @@
1# $NetBSD: files.xen,v 1.180.2.2 2020/04/14 16:53:57 bouyer Exp $ 1# $NetBSD: files.xen,v 1.180.2.3 2020/04/16 08:46:35 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  
4 2
5ifdef i386 3defflag opt_xen.h XEN XENPVH XENPVHVM
6maxpartitions 8 
7else 
8maxpartitions 16 
9endif 
10 4
11maxusers 2 16 128 5file arch/xen/x86/hypervisor_machdep.c xen
 6file arch/xen/x86/xen_intr.c xen
 7file arch/xen/xen/xen_machdep.c xen
 8file arch/xen/xen/evtchn.c xen
 9file arch/xen/xen/xengnt.c xen
 10file arch/xen/x86/xen_ipi.c multiprocessor & xen
 11file arch/xen/x86/xen_mainbus.c xen
12 12
13defparam opt_kernbase.h KERNBASE 
14 13
15# options for MP configuration through the MP spec 
16defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI 
17 
18# Interrupt debug 
19defflag opt_intrdebug.h INTRDEBUG 
20 
21# delay before cpu_reset() for reboot. 
22defparam CPURESET_DELAY 
23 
24# splraise()/spllower() debug 
25defflag opt_spldebug.h SPLDEBUG 
26 
27# Beep on halt 
28defflag opt_beep.h BEEP_ONHALT 
29defparam opt_beep.h BEEP_ONHALT_COUNT=3 
30defparam opt_beep.h BEEP_ONHALT_PITCH=1500 
31defparam opt_beep.h BEEP_ONHALT_PERIOD=250 
32 
33# PCI fixup options 
34defflag opt_pcifixup.h PCI_ADDR_FIXUP PCI_BUS_FIXUP 
35 PCI_INTR_FIXUP PCI_INTR_FIXUP_FORCE 
36 
37defparam PCI_CONF_MODE 
38 
39file arch/xen/x86/autoconf.c xenpv 
40ifdef i386 
41file arch/i386/i386/autoconf.c xenpvhvm 
42file arch/i386/i386/aout_machdep.c exec_aout 
43file arch/i386/i386/i386func.S machdep & xenpvhvm 
44file arch/i386/i386/busfunc.S 
45file arch/i386/i386/cpufunc.S 
46file arch/i386/i386/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum 
47file arch/i386/i386/db_disasm.c ddb 
48file arch/i386/i386/db_interface.c ddb 
49file arch/i386/i386/db_machdep.c ddb 
50file arch/i386/i386/dumpsys.c 
51file arch/i386/i386/gdt.c 
52file arch/i386/i386/kobj_machdep.c modular 
53file arch/i386/i386/machdep.c 
54file arch/i386/i386/longrun.c 
55file arch/i386/i386/mtrr_k6.c mtrr 
56file arch/i386/i386/process_machdep.c 
57file arch/i386/i386/trap.c 
58file arch/i386/i386/lock_stubs.S 
59 
60file crypto/des/arch/i386/des_enc.S des 
61file crypto/des/arch/i386/des_cbc.S des 
62 
63file crypto/blowfish/arch/i386/bf_enc.S blowfish 
64file crypto/blowfish/arch/i386/bf_cbc.S blowfish 
65 
66elifdef amd64 
67file arch/amd64/amd64/autoconf.c xenpvhvm 
68file arch/amd64/amd64/busfunc.S 
69file arch/amd64/amd64/cpufunc.S 
70file arch/amd64/amd64/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum 
71file arch/amd64/amd64/db_disasm.c ddb 
72file arch/amd64/amd64/db_interface.c ddb 
73file arch/amd64/amd64/db_machdep.c ddb 
74file arch/amd64/amd64/kobj_machdep.c modular 
75file arch/amd64/amd64/gdt.c 
76file arch/amd64/amd64/machdep.c 
77file arch/amd64/amd64/process_machdep.c 
78file arch/amd64/amd64/trap.c 
79file arch/amd64/amd64/lock_stubs.S 
80endif 
81 
82file kern/subr_disk_mbr.c disk 
83file uvm/pmap/pmap_pvt.c 
84file arch/x86/x86/db_memrw.c ddb | kgdb 
85file arch/x86/x86/db_trace.c ddb 
86file arch/x86/x86/efi.c machdep 
87file arch/x86/x86/errata.c machdep 
88file arch/x86/x86/fpu.c 
89file arch/x86/x86/dbregs.c 
90file arch/xen/x86/hypervisor_machdep.c 
91file arch/x86/x86/kgdb_machdep.c kgdb 
92file arch/x86/x86/mtrr_i686.c mtrr & (dom0ops | xenpvhvm) 
93file arch/x86/x86/syscall.c 
94file arch/xen/x86/x86_xpmap.c xenpv 
95file arch/xen/x86/xen_pmap.c xenpv 
96file arch/xen/x86/xen_intr.c 
97file arch/xen/x86/xenfunc.c xenpv 
98 
99file arch/x86/x86/cpu_ucode.c dom0ops & cpu_ucode needs-flag 
100file arch/x86/x86/cpu_ucode_amd.c dom0ops & cpu_ucode needs-flag 
101file arch/x86/x86/cpu_ucode_intel.c dom0ops & cpu_ucode needs-flag 
102file arch/x86/x86/compat_60_cpu_ucode.c compat_60 & dom0ops & cpu_ucode 
103 
104 
105file arch/xen/xen/xen_machdep.c 
106 
107file arch/xen/xen/clock.c xenpv 
108file arch/x86/isa/clock.c xenpvhvm 
109file arch/x86/isa/rtc.c dom0ops | xenpvhvm 
110file arch/xen/xen/evtchn.c 
111 
112file arch/xen/xen/xengnt.c 
113 
114file arch/x86/x86/cpu_rng.c 
115 
116file dev/cons.c 
117 
118 
119# 
120# Stack-less Just-In-Time compiler 
121# 
122 
123include "external/bsd/sljit/conf/files.sljit" 
124 
125# 
126# Machine-independent SCSI drivers 
127# 
128 
129include "dev/scsipi/files.scsipi" 
130 
131# 
132# Machine-independent ATA drivers 
133# 
134 
135include "dev/ata/files.ata" 
136 
137# Memory Disk for install floppy 
138file dev/md_root.c memory_disk_hooks 
139 
140file arch/x86/x86/bus_dma.c machdep 
141file arch/x86/x86/core_machdep.c coredump 
142file arch/xen/x86/xen_bus_dma.c machdep & xenpv 
143file arch/x86/x86/bus_space.c machdep 
144file arch/xen/x86/consinit.c machdep & xenpv 
145file arch/x86/x86/consinit.c machdep & xenpvhvm 
146file arch/x86/x86/identcpu.c machdep 
147file arch/xen/x86/pintr.c machdep & dom0ops & xenpv 
148file arch/xen/x86/xen_ipi.c multiprocessor & xenpv 
149file arch/x86/x86/idt.c machdep 
150file arch/x86/x86/intr.c machdep & xenpvhvm 
151file arch/x86/x86/x86_softintr.c machdep 
152file arch/x86/x86/ipi.c xenpvhvm 
153file arch/x86/x86/patch.c machdep & ! xenpv 
154file arch/x86/x86/pmap.c machdep 
155file arch/x86/x86/x86_tlb.c machdep 
156file arch/x86/x86/procfs_machdep.c procfs 
157file arch/x86/x86/sys_machdep.c machdep 
158file arch/x86/x86/tsc.c machdep 
159file arch/x86/x86/vm_machdep.c machdep 
160file arch/x86/x86/x86_autoconf.c machdep & xenpvhvm 
161file arch/x86/x86/x86_machdep.c machdep 
162file arch/x86/x86/platform.c machdep 
163 
164include "arch/xen/conf/files.compat" 
165 
166# BIOS32 routines 
167define bios32 
168file arch/x86/x86/bios32.c bios32 needs-flag 
169 
170# xen specific mainbus attributes 
171define cpubus { [apid = -1] } 
172define cpufeaturebus {} 
173define ioapicbus { [apid = -1] } 
174define apmbus {} 
175define pnpbiosbus {} 
176define hypervisorbus {} 14define hypervisorbus {}
177define xendevbus {} 15define xendevbus {}
178 16
179# 
180# System bus types 
181# 
182 
183device mainbus: isabus, pcibus, cpubus, ioapicbus, hypervisorbus, bios32, ipmibus, acpibus 
184attach mainbus at root 
185file arch/xen/x86/xen_mainbus.c mainbus 
186ifdef amd64 
187file arch/amd64/amd64/amd64_mainbus.c mainbus & xenpvhvm 
188elifdef i386 
189file arch/i386/i386/i386_mainbus.c mainbus & xenpvhvm 
190file dev/eisa/eisabusprint.c xenpvhvm 
191endif 
192file arch/x86/x86/mainbus.c mainbus 
193 
194# Xen hypervisor 17# Xen hypervisor
195device hypervisor { [apid = -1]}: isabus, pcibus, sysmon_power, xendevbus, acpibus 18device hypervisor { [apid = -1]}: isabus, pcibus, sysmon_power, xendevbus, acpibus
196attach hypervisor at hypervisorbus 19attach hypervisor at hypervisorbus
197file arch/xen/xen/hypervisor.c hypervisor needs-flag 20file arch/xen/xen/hypervisor.c hypervisor needs-flag
198file arch/xen/xen/shutdown_xenbus.c hypervisor 21file arch/xen/xen/shutdown_xenbus.c hypervisor
199 22
200# Xenbus 23# Xenbus
201device xenbus {[id = -1]} 24device xenbus {[id = -1]}
202attach xenbus at xendevbus 25attach xenbus at xendevbus
203file arch/xen/xenbus/xenbus_client.c xenbus needs-flag 26file arch/xen/xenbus/xenbus_client.c xenbus needs-flag
204file arch/xen/xenbus/xenbus_comms.c xenbus needs-flag 27file arch/xen/xenbus/xenbus_comms.c xenbus needs-flag
205file arch/xen/xenbus/xenbus_dev.c xenbus needs-flag 28file arch/xen/xenbus/xenbus_dev.c xenbus needs-flag
206file arch/xen/xenbus/xenbus_probe.c xenbus needs-flag 29file arch/xen/xenbus/xenbus_probe.c xenbus needs-flag
207file arch/xen/xenbus/xenbus_xs.c xenbus needs-flag 30file arch/xen/xenbus/xenbus_xs.c xenbus needs-flag
208 31
209# Xen console support 32# Xen console support
210device xencons: tty 33device xencons: tty
211attach xencons at xendevbus 34attach xencons at xendevbus
212file arch/xen/xen/xencons.c xencons needs-flag 35file arch/xen/xen/xencons.c xencons needs-flag
213 36
214# Xen event peudo-device 
215defpseudo xenevt 
216defpseudo xvif 
217defpseudo xbdback 
218 
219# Xen Network driver 37# Xen Network driver
220device xennet: arp, ether, ifnet 38device xennet: arp, ether, ifnet
221attach xennet at xenbus 39attach xennet at xenbus
222file arch/xen/xen/if_xennet_xenbus.c xennet needs-flag 40file arch/xen/xen/if_xennet_xenbus.c xennet needs-flag
 41file arch/xen/xen/xennet_checksum.c xvif | xennet
223 42
224# Xen Block device driver and wd/sd/cd identities 43# Xen Block device driver and wd/sd/cd identities
225device xbd: disk 44device xbd: disk
226attach xbd at xenbus 45attach xbd at xenbus
227file arch/xen/xen/xbd_xenbus.c xbd 46file arch/xen/xen/xbd_xenbus.c xbd
228 
229# PCI frontend 
230device xpci: pcibus 
231attach xpci at xenbus with xpci_xenbus 
232file arch/xen/xen/xpci_xenbus.c xpci_xenbus 
233 
234# Xen Balloon driver 
235device balloon 
236attach balloon at xenbus 
237file arch/xen/xen/balloon.c balloon 
238 
239# Non-Xen specific devices and options 
240 
241include "dev/pckbport/files.pckbport" 
242 
243# 
244# Machine-independent PCI devices 
245# 
246include "dev/i2o/files.i2o" 
247include "dev/pci/files.pci" 
248include "dev/pci/files.agp" 
249file arch/x86/pci/pciide_machdep.c pciide_common 
250 
251device pciback {unit = -1} 
252attach pciback at pci 
253file arch/xen/xen/pciback.c pciback 
254 
255 
256# x86 specific PCI hardware 
257include "arch/x86/pci/files.pci" 
258 
259# 
260# Machine-independent ISA devices 
261# 
262include "dev/isa/files.isa" 
263 
264include "dev/usb/files.usb" 
265 
266include "dev/ieee1394/files.ieee1394" 
267 
268device fdc {drive = -1} #XXX 
269 
270include "dev/apm/files.apm" 
271 
272include "dev/acpi/files.acpi" 
273file arch/xen/xen/xen_acpi_machdep.c acpi & xenpv 
274file arch/x86/x86/mpacpi.c acpi 
275file arch/x86/x86/i8259.c xenpvhvm | dom0ops 
276 
277# Stubs for x86 routines not included in the system 
278file arch/x86/x86/x86_stub.c 
279 
280# MP configuration using Intel SMP specification 1.4 
281file arch/x86/x86/mpbios.c mpbios 
282 
283# MP configuration using either ACPI or Intel SMP specification 1.4 
284file arch/x86/x86/mp.c acpi | mpbios 
285 
286file arch/x86/pci/pci_bus_fixup.c pci_bus_fixup 
287file arch/x86/pci/pci_addr_fixup.c pci_addr_fixup 
288 
289file arch/x86/x86/apic.c ioapic 
290file arch/x86/x86/nmi.c 
291 
292file arch/x86/acpi/acpi_machdep.c acpi 
293file arch/x86/acpi/acpi_pdc.c acpi 
294 
295device ioapic 
296attach ioapic at ioapicbus 
297file arch/x86/x86/ioapic.c ioapic needs-flag 
298 
299#IPMI device 
300file arch/x86/x86/x86_ipmi.c ipmi needs-flag 
301 
302# CPUs 
303# 
304device cpu: cpufeaturebus 
305attach cpu at cpubus 
306 
307device vcpu 
308attach vcpu at xendevbus 
309file arch/xen/x86/cpu.c xenpv & vcpu 
310file arch/x86/x86/cpu.c xenpvhvm 
311 
312# CPU features 
313# 
314device est 
315attach est at cpufeaturebus 
316file arch/x86/x86/est.c est 
317file arch/x86/x86/intel_busclock.c est 
318 
319device powernow 
320attach powernow at cpufeaturebus 
321file arch/x86/x86/powernow.c powernow 
322 
323# 
324# Compatibility modules 
325# 
326 
327ifdef i386 
328 
329# Binary compatibility with previous NetBSD releases (COMPAT_XX) 
330file arch/i386/i386/compat_13_machdep.c compat_13 
331file arch/i386/i386/compat_16_machdep.c compat_16 
332 
333# Linux binary compatibility (COMPAT_LINUX) 
334include "compat/linux/files.linux" 
335include "compat/linux/arch/i386/files.linux_i386" 
336file arch/i386/i386/linux_sigcode.S compat_linux 
337file arch/i386/i386/linux_syscall.c compat_linux 
338file arch/x86/x86/linux_trap.c compat_linux 
339 
340# FreeBSD binary compatibility (COMPAT_FREEBSD) 
341include "compat/freebsd/files.freebsd" 
342 
343elifdef amd64 
344 
345# Binary compatibility with previous NetBSD releases (COMPAT_XX) 
346file arch/amd64/amd64/compat_16_machdep.c compat_16 
347 
348# NetBSD/i386 32-bit binary compatibility (COMPAT_NETBSD32) 
349include "compat/netbsd32/files.netbsd32" 
350file arch/amd64/amd64/netbsd32_machdep.c compat_netbsd32 
351file arch/amd64/amd64/netbsd32_machdep_13.c compat_netbsd32 & compat_13 
352file arch/amd64/amd64/netbsd32_machdep_16.c compat_netbsd32 & compat_16 
353file arch/amd64/amd64/netbsd32_sigcode.S compat_netbsd32 & compat_16 
354file arch/amd64/amd64/netbsd32_syscall.c compat_netbsd32 
355 
356# Linux compatibility (COMPAT_LINUX) 
357include "compat/linux/files.linux" 
358include "compat/linux/arch/amd64/files.linux_amd64" 
359file arch/amd64/amd64/linux_sigcode.S compat_linux 
360file arch/amd64/amd64/linux_syscall.c compat_linux 
361file arch/x86/x86/linux_trap.c compat_linux 
362# Linux 32 bit compatibility (COMPAT_LINUX32) 
363include "compat/linux32/files.linux32" 
364include "compat/linux32/arch/amd64/files.linux32_amd64" 
365file arch/amd64/amd64/linux32_sigcode.S compat_linux32 
366file arch/amd64/amd64/linux32_syscall.c compat_linux32 
367endif 
368 
369# OSS audio driver compatibility 
370include "compat/ossaudio/files.ossaudio" 
371 
372# Bluetooth 
373include "dev/bluetooth/files.bluetooth" 
374 
375include "dev/sdmmc/files.sdmmc" 
376 
377# 
378# CARDBUS 
379# 
380include "dev/cardbus/files.cardbus" 
381ifdef i386 
382file arch/i386/i386/rbus_machdep.c cardbus 
383elifdef amd64 
384file arch/amd64/amd64/rbus_machdep.c cardbus 
385endif 
386 
387# this wants to be probed as late as possible. 
388# 
389# Machine-independent PCMCIA drivers 
390# 
391include "dev/pcmcia/files.pcmcia" 
392 
393# Domain-0 operations 
394defflag opt_xen.h DOM0OPS XENPV 
395file arch/xen/xen/privcmd.c dom0ops 
396file arch/xen/x86/xen_shm_machdep.c dom0ops 
397file arch/x86/pci/pci_machdep.c (xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm ) 
398file arch/x86/pci/pci_intr_machdep.c (xenpvhvm | hypervisor) & pci 
399file arch/x86/pci/pci_msi_machdep.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix 
400file arch/x86/pci/msipic.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix 
401file arch/x86/isa/isa_machdep.c (xenpvhvm | hypervisor) & ( dom0ops | xenpvhvm ) 
402file arch/xen/xen/xenevt.c xenevt & (dom0ops | xenpvhvm) 
403file arch/xen/xen/xennetback_xenbus.c xvif 
404file arch/xen/xen/xennet_checksum.c xvif | xennet 
405file arch/xen/xen/xbdback_xenbus.c xbdback 
406 
407ifdef i386 
408include "arch/i386/conf/majors.i386" 
409elifdef amd64 
410include "arch/amd64/conf/majors.amd64" 
411endif 

File Added: src/sys/arch/xen/conf/files.xen.pv
#	$NetBSD: files.xen.pv,v 1.1.2.1 2020/04/16 08:46:35 bouyer Exp $

file	arch/xen/x86/autoconf.c		xenpv
file	arch/xen/x86/x86_xpmap.c	xenpv
file	arch/xen/x86/xen_pmap.c		xenpv
file	arch/xen/x86/xenfunc.c		xenpv
file	arch/xen/xen/xen_acpi_machdep.c	acpi & xenpv

file	arch/xen/xen/clock.c		xenpv
file	arch/xen/x86/xen_bus_dma.c	machdep & xenpv
file	arch/xen/x86/consinit.c		machdep & xenpv
file	arch/xen/x86/pintr.c		machdep & dom0ops & xenpv

#
# System bus types
#

# Xen event peudo-device
defpseudo xenevt
defpseudo xvif
defpseudo xbdback

# PCI frontend
device xpci: pcibus
attach xpci at xenbus with xpci_xenbus
file	arch/xen/xen/xpci_xenbus.c	xpci_xenbus

# Xen Balloon driver
device	balloon
attach	balloon at xenbus
file	arch/xen/xen/balloon.c		balloon

device	pciback {unit = -1}
attach	pciback at pci
file	arch/xen/xen/pciback.c		pciback

device vcpu
attach vcpu at xendevbus
file	arch/xen/x86/cpu.c		xenpv & vcpu

# Domain-0 operations
defflag	opt_xen.h			DOM0OPS XENPV
file	arch/xen/xen/privcmd.c		dom0ops
file 	arch/xen/x86/xen_shm_machdep.c	dom0ops
file	arch/xen/xen/xenevt.c		xenevt & (dom0ops | xenpvhvm)
file	arch/xen/xen/xennetback_xenbus.c xvif
file	arch/xen/xen/xbdback_xenbus.c xbdback

cvs diff -r1.10 -r1.10.10.1 src/sys/arch/xen/conf/Attic/std.xen (expand / switch to unified diff)

--- src/sys/arch/xen/conf/Attic/std.xen 2019/02/04 18:14:53 1.10
+++ src/sys/arch/xen/conf/Attic/std.xen 2020/04/16 08:46:35 1.10.10.1
@@ -1,20 +1,21 @@ @@ -1,20 +1,21 @@
1# $NetBSD: std.xen,v 1.10 2019/02/04 18:14:53 cherry Exp $ 1# $NetBSD: std.xen,v 1.10.10.1 2020/04/16 08:46:35 bouyer Exp $
2# NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp  2# NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp
3# 3#
4# standard, required NetBSD/i386 'options' 4# standard, required NetBSD/i386 'options'
5 5
6machine xen i386 6machine xen i386 x86
7include "conf/std" # MI standard options 7include "conf/std" # MI standard options
 8include "arch/xen/conf/files.xen.pv"
8 9
9options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface 10options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface
10 11
11options EXEC_AOUT # exec a.out binaries 12options EXEC_AOUT # exec a.out binaries
12options EXEC_ELF32 # exec ELF binaries 13options EXEC_ELF32 # exec ELF binaries
13options EXEC_SCRIPT # exec #! scripts 14options EXEC_SCRIPT # exec #! scripts
14 15
15options CPU_IN_CKSUM 16options CPU_IN_CKSUM
16#options CRYPTO_MD_DES_ENC # machine-dependent code for DES 17#options CRYPTO_MD_DES_ENC # machine-dependent code for DES
17#options CRYPTO_MD_DES_CBC # machine-dependent DES CBC code 18#options CRYPTO_MD_DES_CBC # machine-dependent DES CBC code
18#options CRYPTO_MD_BF_ENC # machine-dependent code for BF_encrypt 19#options CRYPTO_MD_BF_ENC # machine-dependent code for BF_encrypt
19#options CRYPTO_MD_BF_CBC # careful: uses bswapl, requires 486 20#options CRYPTO_MD_BF_CBC # careful: uses bswapl, requires 486
20 21

cvs diff -r1.49.10.1 -r1.49.10.2 src/sys/arch/xen/include/hypervisor.h (expand / switch to unified diff)

--- src/sys/arch/xen/include/hypervisor.h 2020/04/12 17:25:52 1.49.10.1
+++ src/sys/arch/xen/include/hypervisor.h 2020/04/16 08:46:35 1.49.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hypervisor.h,v 1.49.10.1 2020/04/12 17:25:52 bouyer Exp $ */ 1/* $NetBSD: hypervisor.h,v 1.49.10.2 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -48,26 +48,28 @@ @@ -48,26 +48,28 @@
48 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 48 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
49 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 49 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
50 * IN THE SOFTWARE. 50 * IN THE SOFTWARE.
51 */ 51 */
52 52
53 53
54#ifndef _XEN_HYPERVISOR_H_ 54#ifndef _XEN_HYPERVISOR_H_
55#define _XEN_HYPERVISOR_H_ 55#define _XEN_HYPERVISOR_H_
56 56
57#include "opt_xen.h" 57#include "opt_xen.h"
58#include "isa.h" 58#include "isa.h"
59#include "pci.h" 59#include "pci.h"
60 60
 61void xen_mainbus_attach(device_t, device_t, void *);
 62
61struct hypervisor_attach_args { 63struct hypervisor_attach_args {
62 const char *haa_busname; 64 const char *haa_busname;
63}; 65};
64 66
65struct xencons_attach_args { 67struct xencons_attach_args {
66 const char *xa_device; 68 const char *xa_device;
67}; 69};
68 70
69struct xen_npx_attach_args { 71struct xen_npx_attach_args {
70 const char *xa_device; 72 const char *xa_device;
71}; 73};
72 74
73 75
@@ -98,27 +100,27 @@ struct xen_npx_attach_args { @@ -98,27 +100,27 @@ struct xen_npx_attach_args {
98/* Undo namespace damage from xen/include/public/io/ring.h 100/* Undo namespace damage from xen/include/public/io/ring.h
99 * The proper fix is to get upstream to stop assuming that all OSs use 101 * The proper fix is to get upstream to stop assuming that all OSs use
100 * mb(), rmb(), wmb(). 102 * mb(), rmb(), wmb().
101 */ 103 */
102#undef xen_mb 104#undef xen_mb
103#undef xen_rmb 105#undef xen_rmb
104#undef xen_wmb 106#undef xen_wmb
105 107
106#define xen_mb() membar_sync() 108#define xen_mb() membar_sync()
107#define xen_rmb() membar_producer() 109#define xen_rmb() membar_producer()
108#define xen_wmb() membar_consumer() 110#define xen_wmb() membar_consumer()
109#endif /* __XEN_INTERFACE_VERSION */ 111#endif /* __XEN_INTERFACE_VERSION */
110 112
111#include <machine/hypercalls.h> 113#include <machine/xen/hypercalls.h>
112 114
113#undef u8 115#undef u8
114#undef u16 116#undef u16
115#undef u32 117#undef u32
116#undef u64 118#undef u64
117#undef s8 119#undef s8
118#undef s16 120#undef s16
119#undef s32 121#undef s32
120#undef s64 122#undef s64
121 123
122 124
123 125
124/* 126/*

cvs diff -r1.53.6.1 -r1.53.6.2 src/sys/arch/xen/include/intr.h (expand / switch to unified diff)

--- src/sys/arch/xen/include/intr.h 2020/04/12 17:25:52 1.53.6.1
+++ src/sys/arch/xen/include/intr.h 2020/04/16 08:46:35 1.53.6.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intr.h,v 1.53.6.1 2020/04/12 17:25:52 bouyer Exp $ */ 1/* $NetBSD: intr.h,v 1.53.6.2 2020/04/16 08:46:35 bouyer Exp $ */
2/* NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp */ 2/* NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Charles M. Hannum, and by Jason R. Thorpe. 9 * by Charles M. Hannum, and by Jason R. Thorpe.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#ifndef _XEN_INTR_H_ 33#ifndef _XEN_INTR_H_
34#define _XEN_INTR_H_ 34#define _XEN_INTR_H_
35 35
36#include <machine/intrdefs.h> 36#include <xen/intrdefs.h>
37 37
38#ifndef _LOCORE 38#ifndef _LOCORE
39#include <xen/include/public/xen.h> 39#include <xen/include/public/xen.h>
40#include <xen/include/public/event_channel.h> 40#include <xen/include/public/event_channel.h>
41#include <x86/intr.h> 41#include <x86/intr.h>
42#include <xen/xen.h> 42#include <xen/xen.h>
43#include <xen/hypervisor.h> 43#include <xen/hypervisor.h>
44#include <machine/pic.h> 44#include <machine/pic.h>
45#include <sys/evcnt.h> 45#include <sys/evcnt.h>
46 46
47#include "opt_xen.h" 47#include "opt_xen.h"
48 48
49 49

cvs diff -r1.42 -r1.42.6.1 src/sys/arch/xen/include/xenpmap.h (expand / switch to unified diff)

--- src/sys/arch/xen/include/xenpmap.h 2019/10/30 07:40:06 1.42
+++ src/sys/arch/xen/include/xenpmap.h 2020/04/16 08:46:35 1.42.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xenpmap.h,v 1.42 2019/10/30 07:40:06 maxv Exp $ */ 1/* $NetBSD: xenpmap.h,v 1.42.6.1 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/* 3/*
4 * 4 *
5 * Copyright (c) 2004 Christian Limpach. 5 * Copyright (c) 2004 Christian Limpach.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -112,27 +112,26 @@ static __inline void @@ -112,27 +112,26 @@ static __inline void
112xpmap_ptom_unmap(paddr_t ppa) 112xpmap_ptom_unmap(paddr_t ppa)
113{ 113{
114 xpmap_phys_to_machine_mapping[ppa >> PAGE_SHIFT] = INVALID_P2M_ENTRY; 114 xpmap_phys_to_machine_mapping[ppa >> PAGE_SHIFT] = INVALID_P2M_ENTRY;
115} 115}
116 116
117static __inline bool 117static __inline bool
118xpmap_ptom_isvalid(paddr_t ppa) 118xpmap_ptom_isvalid(paddr_t ppa)
119{ 119{
120 return ( 120 return (
121 xpmap_phys_to_machine_mapping[ppa >> PAGE_SHIFT] 121 xpmap_phys_to_machine_mapping[ppa >> PAGE_SHIFT]
122 != INVALID_P2M_ENTRY); 122 != INVALID_P2M_ENTRY);
123} 123}
124 124
125#endif /* XENPV */ 
126 125
127static inline void 126static inline void
128MULTI_update_va_mapping( 127MULTI_update_va_mapping(
129 multicall_entry_t *mcl, vaddr_t va, 128 multicall_entry_t *mcl, vaddr_t va,
130 pt_entry_t new_val, unsigned long flags) 129 pt_entry_t new_val, unsigned long flags)
131{ 130{
132 mcl->op = __HYPERVISOR_update_va_mapping; 131 mcl->op = __HYPERVISOR_update_va_mapping;
133 mcl->args[0] = va; 132 mcl->args[0] = va;
134#if defined(__x86_64__) 133#if defined(__x86_64__)
135 mcl->args[1] = new_val; 134 mcl->args[1] = new_val;
136 mcl->args[2] = flags; 135 mcl->args[2] = flags;
137#else 136#else
138 mcl->args[1] = (new_val & 0xffffffff); 137 mcl->args[1] = (new_val & 0xffffffff);
@@ -160,15 +159,16 @@ MULTI_update_va_mapping_otherdomain( @@ -160,15 +159,16 @@ MULTI_update_va_mapping_otherdomain(
160#endif 159#endif
161} 160}
162#if defined(__x86_64__) 161#if defined(__x86_64__)
163#define MULTI_UVMFLAGS_INDEX 2 162#define MULTI_UVMFLAGS_INDEX 2
164#define MULTI_UVMDOMID_INDEX 3 163#define MULTI_UVMDOMID_INDEX 3
165#else 164#else
166#define MULTI_UVMFLAGS_INDEX 3 165#define MULTI_UVMFLAGS_INDEX 3
167#define MULTI_UVMDOMID_INDEX 4 166#define MULTI_UVMDOMID_INDEX 4
168#endif 167#endif
169 168
170#if defined(__x86_64__) 169#if defined(__x86_64__)
171void xen_set_user_pgd(paddr_t); 170void xen_set_user_pgd(paddr_t);
172#endif 171#endif
 172#endif /* XENPV */
173 173
174#endif /* _XEN_XENPMAP_H_ */ 174#endif /* _XEN_XENPMAP_H_ */

File Deleted: src/sys/arch/xen/include/amd64/Attic/hypercalls.h

File Deleted: src/sys/arch/xen/include/i386/Attic/hypercalls.h

cvs diff -r1.36.8.1 -r1.36.8.2 src/sys/arch/xen/x86/hypervisor_machdep.c (expand / switch to unified diff)

--- src/sys/arch/xen/x86/hypervisor_machdep.c 2020/04/12 17:25:52 1.36.8.1
+++ src/sys/arch/xen/x86/hypervisor_machdep.c 2020/04/16 08:46:35 1.36.8.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hypervisor_machdep.c,v 1.36.8.1 2020/04/12 17:25:52 bouyer Exp $ */ 1/* $NetBSD: hypervisor_machdep.c,v 1.36.8.2 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/* 3/*
4 * 4 *
5 * Copyright (c) 2004 Christian Limpach. 5 * Copyright (c) 2004 Christian Limpach.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -44,38 +44,39 @@ @@ -44,38 +44,39 @@
44 * all copies or substantial portions of the Software. 44 * all copies or substantial portions of the Software.
45 *  45 *
46 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  46 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  47 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  48 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  49 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  50 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
51 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  51 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
52 * DEALINGS IN THE SOFTWARE. 52 * DEALINGS IN THE SOFTWARE.
53 */ 53 */
54 54
55 55
56#include <sys/cdefs.h> 56#include <sys/cdefs.h>
57__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.1 2020/04/12 17:25:52 bouyer Exp $"); 57__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.2 2020/04/16 08:46:35 bouyer Exp $");
58 58
59#include <sys/param.h> 59#include <sys/param.h>
60#include <sys/systm.h> 60#include <sys/systm.h>
61#include <sys/kmem.h> 61#include <sys/kmem.h>
62 62
63#include <uvm/uvm_extern.h> 63#include <uvm/uvm_extern.h>
64 64
65#include <machine/vmparam.h> 65#include <machine/vmparam.h>
66#include <machine/pmap.h> 66#include <machine/pmap.h>
67 67
68#include <xen/xen.h> 68#include <xen/xen.h>
 69#include <xen/intr.h>
69#include <xen/hypervisor.h> 70#include <xen/hypervisor.h>
70#include <xen/evtchn.h> 71#include <xen/evtchn.h>
71#include <xen/xenpmap.h> 72#include <xen/xenpmap.h>
72 73
73#include "opt_xen.h" 74#include "opt_xen.h"
74#include "isa.h" 75#include "isa.h"
75#include "pci.h" 76#include "pci.h"
76 77
77#ifdef XENPV 78#ifdef XENPV
78/* 79/*
79 * arch-dependent p2m frame lists list (L3 and L2) 80 * arch-dependent p2m frame lists list (L3 and L2)
80 * used by Xen for save/restore mappings 81 * used by Xen for save/restore mappings
81 */ 82 */

cvs diff -r1.21.2.4 -r1.21.2.5 src/sys/arch/xen/x86/xen_intr.c (expand / switch to unified diff)

--- src/sys/arch/xen/x86/xen_intr.c 2020/04/14 16:52:35 1.21.2.4
+++ src/sys/arch/xen/x86/xen_intr.c 2020/04/16 08:46:35 1.21.2.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xen_intr.c,v 1.21.2.4 2020/04/14 16:52:35 bouyer Exp $ */ 1/* $NetBSD: xen_intr.c,v 1.21.2.5 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2001 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 Charles M. Hannum, and by Jason R. Thorpe. 8 * by Charles M. Hannum, and by Jason R. Thorpe.
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.
@@ -20,36 +20,37 @@ @@ -20,36 +20,37 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.4 2020/04/14 16:52:35 bouyer Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.5 2020/04/16 08:46:35 bouyer Exp $");
34 34
35#include "opt_multiprocessor.h" 35#include "opt_multiprocessor.h"
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/kmem.h> 39#include <sys/kmem.h>
40#include <sys/cpu.h> 40#include <sys/cpu.h>
41#include <sys/device.h> 41#include <sys/device.h>
42 42
 43#include <xen/intr.h>
43#include <xen/evtchn.h> 44#include <xen/evtchn.h>
44#include <xen/xenfunc.h> 45#include <xen/xenfunc.h>
45 46
46#include <uvm/uvm.h> 47#include <uvm/uvm.h>
47 48
48#include <machine/cpu.h> 49#include <machine/cpu.h>
49#include <machine/intr.h> 50#include <machine/intr.h>
50 51
51#include "acpica.h" 52#include "acpica.h"
52#include "ioapic.h" 53#include "ioapic.h"
53#include "lapic.h" 54#include "lapic.h"
54#include "pci.h" 55#include "pci.h"
55 56
@@ -434,27 +435,27 @@ xintr_string(intr_handle_t ih, char *buf @@ -434,27 +435,27 @@ xintr_string(intr_handle_t ih, char *buf
434 435
435/* 436/*
436 * Create an interrupt id such as "ioapic0 pin 9". This interrupt id is used 437 * Create an interrupt id such as "ioapic0 pin 9". This interrupt id is used
437 * by MI code and intrctl(8). 438 * by MI code and intrctl(8).
438 */ 439 */
439const char * xen_intr_create_intrid(int legacy_irq, struct pic *pic, 440const char * xen_intr_create_intrid(int legacy_irq, struct pic *pic,
440 int pin, char *buf, size_t len); 441 int pin, char *buf, size_t len);
441 442
442const char * 443const char *
443xen_intr_create_intrid(int legacy_irq, struct pic *pic, int pin, char *buf, size_t len) 444xen_intr_create_intrid(int legacy_irq, struct pic *pic, int pin, char *buf, size_t len)
444{ 445{
445 int ih = 0; 446 int ih = 0;
446 447
447#if NPCI > 0 448#if NPCI > 0 && defined(XENPV)
448#if defined(__HAVE_PCI_MSI_MSIX) 449#if defined(__HAVE_PCI_MSI_MSIX)
449 if ((pic->pic_type == PIC_MSI) || (pic->pic_type == PIC_MSIX)) { 450 if ((pic->pic_type == PIC_MSI) || (pic->pic_type == PIC_MSIX)) {
450 uint64_t pih; 451 uint64_t pih;
451 int dev, vec; 452 int dev, vec;
452 453
453 dev = msipic_get_devid(pic); 454 dev = msipic_get_devid(pic);
454 vec = pin; 455 vec = pin;
455 pih = __SHIFTIN((uint64_t)dev, MSI_INT_DEV_MASK) 456 pih = __SHIFTIN((uint64_t)dev, MSI_INT_DEV_MASK)
456 | __SHIFTIN((uint64_t)vec, MSI_INT_VEC_MASK) 457 | __SHIFTIN((uint64_t)vec, MSI_INT_VEC_MASK)
457 | APIC_INT_VIA_MSI; 458 | APIC_INT_VIA_MSI;
458 if (pic->pic_type == PIC_MSI) 459 if (pic->pic_type == PIC_MSI)
459 MSI_INT_MAKE_MSI(pih); 460 MSI_INT_MAKE_MSI(pih);
460 else if (pic->pic_type == PIC_MSIX) 461 else if (pic->pic_type == PIC_MSIX)

cvs diff -r1.35.6.2 -r1.35.6.3 src/sys/arch/xen/x86/xen_ipi.c (expand / switch to unified diff)

--- src/sys/arch/xen/x86/xen_ipi.c 2020/04/12 17:17:38 1.35.6.2
+++ src/sys/arch/xen/x86/xen_ipi.c 2020/04/16 08:46:35 1.35.6.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $ */ 1/* $NetBSD: xen_ipi.c,v 1.35.6.3 2020/04/16 08:46:35 bouyer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc. 4 * Copyright (c) 2011, 2019 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 Cherry G. Mathew <cherry@zyx.in> 8 * by Cherry G. Mathew <cherry@zyx.in>
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.
@@ -23,30 +23,30 @@ @@ -23,30 +23,30 @@
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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#include <sys/cdefs.h> /* RCS ID macro */ 32#include <sys/cdefs.h> /* RCS ID macro */
33 33
34/*  34/*
35 * Based on: x86/ipi.c 35 * Based on: x86/ipi.c
36 * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $"); 36 * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.3 2020/04/16 08:46:35 bouyer Exp $");
37 */ 37 */
38 38
39__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.3 2020/04/16 08:46:35 bouyer Exp $");
40 40
41#include "opt_ddb.h" 41#include "opt_ddb.h"
42 42
43#include <sys/types.h> 43#include <sys/types.h>
44 44
45#include <sys/atomic.h> 45#include <sys/atomic.h>
46#include <sys/cpu.h> 46#include <sys/cpu.h>
47#include <sys/mutex.h> 47#include <sys/mutex.h>
48#include <sys/device.h> 48#include <sys/device.h>
49#include <sys/xcall.h> 49#include <sys/xcall.h>
50#include <sys/ipi.h> 50#include <sys/ipi.h>
51#include <sys/errno.h> 51#include <sys/errno.h>
52#include <sys/systm.h> 52#include <sys/systm.h>
@@ -64,64 +64,66 @@ __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v  @@ -64,64 +64,66 @@ __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v
64#ifdef DDB 64#ifdef DDB
65extern void ddb_ipi(struct trapframe); 65extern void ddb_ipi(struct trapframe);
66static void xen_ipi_ddb(struct cpu_info *, struct intrframe *); 66static void xen_ipi_ddb(struct cpu_info *, struct intrframe *);
67#endif 67#endif
68 68
69static void xen_ipi_halt(struct cpu_info *, struct intrframe *); 69static void xen_ipi_halt(struct cpu_info *, struct intrframe *);
70static void xen_ipi_synch_fpu(struct cpu_info *, struct intrframe *); 70static void xen_ipi_synch_fpu(struct cpu_info *, struct intrframe *);
71static void xen_ipi_xcall(struct cpu_info *, struct intrframe *); 71static void xen_ipi_xcall(struct cpu_info *, struct intrframe *);
72static void xen_ipi_hvcb(struct cpu_info *, struct intrframe *); 72static void xen_ipi_hvcb(struct cpu_info *, struct intrframe *);
73static void xen_ipi_generic(struct cpu_info *, struct intrframe *); 73static void xen_ipi_generic(struct cpu_info *, struct intrframe *);
74static void xen_ipi_ast(struct cpu_info *, struct intrframe *); 74static void xen_ipi_ast(struct cpu_info *, struct intrframe *);
75static void xen_ipi_kpreempt(struct cpu_info *ci, struct intrframe *); 75static void xen_ipi_kpreempt(struct cpu_info *ci, struct intrframe *);
76 76
77static void (*ipifunc[XEN_NIPIS])(struct cpu_info *, struct intrframe *) = 77static void (*xen_ipifunc[XEN_NIPIS])(struct cpu_info *, struct intrframe *) =
78{ /* In order of priority (see: xen/include/intrdefs.h */ 78{ /* In order of priority (see: xen/include/intrdefs.h */
79 xen_ipi_halt, 79 xen_ipi_halt,
80 xen_ipi_synch_fpu, 80 xen_ipi_synch_fpu,
81#ifdef DDB 81#ifdef DDB
82 xen_ipi_ddb, 82 xen_ipi_ddb,
83#else 83#else
84 NULL, 84 NULL,
85#endif 85#endif
86 xen_ipi_xcall, 86 xen_ipi_xcall,
87 xen_ipi_hvcb, 87 xen_ipi_hvcb,
88 xen_ipi_generic, 88 xen_ipi_generic,
89 xen_ipi_ast, 89 xen_ipi_ast,
90 xen_ipi_kpreempt 90 xen_ipi_kpreempt
91}; 91};
92 92
93static int 93static int
94xen_ipi_handler(void *arg) 94xen_ipi_handler(void *arg)
95{ 95{
96 uint32_t pending; 96 uint32_t pending;
97 int bit; 97 int bit;
98 struct cpu_info *ci; 98 struct cpu_info *ci;
99 struct intrframe *regs; 99 struct intrframe *regs;
100 100
101 ci = curcpu(); 101 ci = curcpu();
102 regs = arg; 102 regs = arg;
 103
 104 KASSERT(ci == arg);
103  105
104 pending = atomic_swap_32(&ci->ci_ipis, 0); 106 pending = atomic_swap_32(&ci->ci_ipis, 0);
105 107
106 KDASSERT((pending >> XEN_NIPIS) == 0); 108 KDASSERT((pending >> XEN_NIPIS) == 0);
107 while ((bit = ffs(pending)) != 0) { 109 while ((bit = ffs(pending)) != 0) {
108 bit--; 110 bit--;
109 pending &= ~(1 << bit); 111 pending &= ~(1 << bit);
110 ci->ci_ipi_events[bit].ev_count++; 112 ci->ci_ipi_events[bit].ev_count++;
111 if (ipifunc[bit] != NULL) { 113 if (xen_ipifunc[bit] != NULL) {
112 (*ipifunc[bit])(ci, regs); 114 (*xen_ipifunc[bit])(ci, regs);
113 } else { 115 } else {
114 panic("ipifunc[%d] unsupported!\n", bit); 116 panic("xen_ipifunc[%d] unsupported!\n", bit);
115 /* NOTREACHED */ 117 /* NOTREACHED */
116 } 118 }
117 } 119 }
118 120
119 return 0; 121 return 0;
120} 122}
121 123
122/* Must be called once for every cpu that expects to send/recv ipis */ 124/* Must be called once for every cpu that expects to send/recv ipis */
123void 125void
124xen_ipi_init(void) 126xen_ipi_init(void)
125{ 127{
126 cpuid_t vcpu; 128 cpuid_t vcpu;
127 evtchn_port_t evtchn; 129 evtchn_port_t evtchn;
@@ -286,67 +288,68 @@ xen_ipi_xcall(struct cpu_info *ci, struc @@ -286,67 +288,68 @@ xen_ipi_xcall(struct cpu_info *ci, struc
286 288
287 xc_ipi_handler(); 289 xc_ipi_handler();
288} 290}
289 291
290static void 292static void
291xen_ipi_ast(struct cpu_info *ci, struct intrframe *intrf) 293xen_ipi_ast(struct cpu_info *ci, struct intrframe *intrf)
292{ 294{
293 KASSERT(ci != NULL); 295 KASSERT(ci != NULL);
294 KASSERT(intrf != NULL); 296 KASSERT(intrf != NULL);
295 297
296 aston(ci->ci_onproc); 298 aston(ci->ci_onproc);
297} 299}
298 300
 301static void
 302xen_ipi_generic(struct cpu_info *ci, struct intrframe *intrf)
 303{
 304 KASSERT(ci != NULL);
 305 KASSERT(intrf != NULL);
 306 ipi_cpu_handler();
 307}
 308
 309static void
 310xen_ipi_hvcb(struct cpu_info *ci, struct intrframe *intrf)
 311{
 312 KASSERT(ci != NULL);
 313 KASSERT(intrf != NULL);
 314 KASSERT(ci == curcpu());
 315 KASSERT(!ci->ci_vcpu->evtchn_upcall_mask);
 316
 317 hypervisor_force_callback();
 318}
 319
 320static void
 321xen_ipi_kpreempt(struct cpu_info *ci, struct intrframe * intrf)
 322{
 323 softint_trigger(1 << SIR_PREEMPT);
 324}
 325
 326#ifdef XENPV
299void 327void
300xc_send_ipi(struct cpu_info *ci) 328xc_send_ipi(struct cpu_info *ci)
301{ 329{
302 330
303 KASSERT(kpreempt_disabled()); 331 KASSERT(kpreempt_disabled());
304 KASSERT(curcpu() != ci); 332 KASSERT(curcpu() != ci);
305 if (ci) { 333 if (ci) {
306 if (0 != xen_send_ipi(ci, XEN_IPI_XCALL)) { 334 if (0 != xen_send_ipi(ci, XEN_IPI_XCALL)) {
307 panic("xen_send_ipi(XEN_IPI_XCALL) failed\n"); 335 panic("xen_send_ipi(XEN_IPI_XCALL) failed\n");
308 } 336 }
309 } else { 337 } else {
310 xen_broadcast_ipi(XEN_IPI_XCALL); 338 xen_broadcast_ipi(XEN_IPI_XCALL);
311 } 339 }
312} 340}
313 341
314static void 
315xen_ipi_generic(struct cpu_info *ci, struct intrframe *intrf) 
316{ 
317 KASSERT(ci != NULL); 
318 KASSERT(intrf != NULL); 
319 
320 ipi_cpu_handler(); 
321} 
322 
323void 342void
324cpu_ipi(struct cpu_info *ci) 343cpu_ipi(struct cpu_info *ci)
325{ 344{
326 KASSERT(kpreempt_disabled()); 345 KASSERT(kpreempt_disabled());
327 KASSERT(curcpu() != ci); 346 KASSERT(curcpu() != ci);
328 if (ci) { 347 if (ci) {
329 if (0 != xen_send_ipi(ci, XEN_IPI_GENERIC)) { 348 if (0 != xen_send_ipi(ci, XEN_IPI_GENERIC)) {
330 panic("xen_send_ipi(XEN_IPI_GENERIC) failed\n"); 349 panic("xen_send_ipi(XEN_IPI_GENERIC) failed\n");
331 } 350 }
332 } else { 351 } else {
333 xen_broadcast_ipi(XEN_IPI_GENERIC); 352 xen_broadcast_ipi(XEN_IPI_GENERIC);
334 } 353 }
335} 354}
336 355#endif /* XENPV */
337static void 
338xen_ipi_hvcb(struct cpu_info *ci, struct intrframe *intrf) 
339{ 
340 KASSERT(ci != NULL); 
341 KASSERT(intrf != NULL); 
342 KASSERT(ci == curcpu()); 
343 KASSERT(!ci->ci_vcpu->evtchn_upcall_mask); 
344 
345 hypervisor_force_callback(); 
346} 
347 
348static void 
349xen_ipi_kpreempt(struct cpu_info *ci, struct intrframe * intrf) 
350{ 
351 softint_trigger(1 << SIR_PREEMPT); 
352} 

cvs diff -r1.6 -r1.6.12.1 src/sys/arch/xen/x86/xen_mainbus.c (expand / switch to unified diff)

--- src/sys/arch/xen/x86/xen_mainbus.c 2019/02/14 08:18:26 1.6
+++ src/sys/arch/xen/x86/xen_mainbus.c 2020/04/16 08:46:35 1.6.12.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xen_mainbus.c,v 1.6 2019/02/14 08:18:26 cherry Exp $ */ 1/* $NetBSD: xen_mainbus.c,v 1.6.12.1 2020/04/16 08:46:35 bouyer Exp $ */
2/* NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp */ 2/* NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp */
3/* NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp */ 3/* NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp */
4 4
5/* 5/*
6 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 6 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.6 2019/02/14 08:18:26 cherry Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.6.12.1 2020/04/16 08:46:35 bouyer Exp $");
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/device.h> 40#include <sys/device.h>
41 41
42#include <sys/bus.h> 42#include <sys/bus.h>
43 43
44#include "hypervisor.h" 44#include "hypervisor.h"
45#include "pci.h" 45#include "pci.h"
46 46
47#include "opt_xen.h" 47#include "opt_xen.h"
48#include "opt_mpbios.h" 48#include "opt_mpbios.h"
49#include "opt_pcifixup.h" 49#include "opt_pcifixup.h"
@@ -89,75 +89,60 @@ int mp_isa_bus = -1; /* XXX */ @@ -89,75 +89,60 @@ int mp_isa_bus = -1; /* XXX */
89int mp_eisa_bus = -1; /* XXX */ 89int mp_eisa_bus = -1; /* XXX */
90 90
91#ifdef MPVERBOSE 91#ifdef MPVERBOSE
92int mp_verbose = 1; 92int mp_verbose = 1;
93#else /* MPVERBOSE */ 93#else /* MPVERBOSE */
94int mp_verbose = 0; 94int mp_verbose = 0;
95#endif /* MPVERBOSE */ 95#endif /* MPVERBOSE */
96#endif /* defined(MPBIOS) || NACPICA > 0 */ 96#endif /* defined(MPBIOS) || NACPICA > 0 */
97#endif /* NPCI > 0 */ 97#endif /* NPCI > 0 */
98 98
99extern bool acpi_present; 99extern bool acpi_present;
100extern bool mpacpi_active; 100extern bool mpacpi_active;
101 101
102int xen_mainbus_match(device_t, cfdata_t, void *); 
103void xen_mainbus_attach(device_t, device_t, void *); 102void xen_mainbus_attach(device_t, device_t, void *);
104int xen_mainbus_print(void *, const char *); 103static int xen_mainbus_print(void *, const char *);
105 104
106union xen_mainbus_attach_args { 105union xen_mainbus_attach_args {
107 const char *mba_busname; /* first elem of all */ 106 const char *mba_busname; /* first elem of all */
108 struct cpu_attach_args mba_caa; 107 struct cpu_attach_args mba_caa;
109#if NHYPERVISOR > 0 108#if NHYPERVISOR > 0
110 struct hypervisor_attach_args mba_haa; 109 struct hypervisor_attach_args mba_haa;
111#endif 110#endif
112#if NIPMI > 0 111#if NIPMI > 0
113 struct ipmi_attach_args mba_ipmi; 112 struct ipmi_attach_args mba_ipmi;
114#endif 113#endif
115}; 114};
116 115
117/* 116/*
118 * Probe for the mainbus; always succeeds. 
119 */ 
120int 
121xen_mainbus_match(device_t parent, cfdata_t match, void *aux) 
122{ 
123 
124 return 1; 
125} 
126 
127/* 
128 * Attach the mainbus. 117 * Attach the mainbus.
129 */ 118 */
130void 119void
131xen_mainbus_attach(device_t parent, device_t self, void *aux) 120xen_mainbus_attach(device_t parent, device_t self, void *aux)
132{ 121{
133#if NIPMI > 0 || NHYPERVISOR > 0 
134 union xen_mainbus_attach_args mba; 122 union xen_mainbus_attach_args mba;
135#endif 
136 123
137#if NIPMI > 0 124#if NIPMI > 0 && defined(XENPV)
138 memset(&mba.mba_ipmi, 0, sizeof(mba.mba_ipmi)); 125 memset(&mba.mba_ipmi, 0, sizeof(mba.mba_ipmi));
139 mba.mba_ipmi.iaa_iot = x86_bus_space_io; 126 mba.mba_ipmi.iaa_iot = x86_bus_space_io;
140 mba.mba_ipmi.iaa_memt = x86_bus_space_mem; 127 mba.mba_ipmi.iaa_memt = x86_bus_space_mem;
141 if (ipmi_probe(&mba.mba_ipmi)) 128 if (ipmi_probe(&mba.mba_ipmi))
142 config_found_ia(self, "ipmibus", &mba.mba_ipmi, 0); 129 config_found_ia(self, "ipmibus", &mba.mba_ipmi, 0);
143#endif 130#endif
144 131
145#if NHYPERVISOR > 0 
146 mba.mba_haa.haa_busname = "hypervisor"; 132 mba.mba_haa.haa_busname = "hypervisor";
147 config_found_ia(self, "hypervisorbus", &mba.mba_haa, xen_mainbus_print); 133 config_found_ia(self, "hypervisorbus", &mba.mba_haa, xen_mainbus_print);
148#endif 
149 134
150 /* save/restore for Xen */ 135 /* save/restore for Xen */
151 if (!pmf_device_register(self, NULL, NULL)) 136 if (!pmf_device_register(self, NULL, NULL))
152 aprint_error_dev(self, "couldn't establish power handler\n"); 137 aprint_error_dev(self, "couldn't establish power handler\n");
153} 138}
154 139
155int 140static int
156xen_mainbus_print(void *aux, const char *pnp) 141xen_mainbus_print(void *aux, const char *pnp)
157{ 142{
158 union xen_mainbus_attach_args *mba = aux; 143 union xen_mainbus_attach_args *mba = aux;
159 144
160 if (pnp) 145 if (pnp)
161 aprint_normal("%s at %s", mba->mba_busname, pnp); 146 aprint_normal("%s at %s", mba->mba_busname, pnp);
162 return UNCONF; 147 return UNCONF;
163} 148}

cvs diff -r1.88.2.3 -r1.88.2.4 src/sys/arch/xen/xen/evtchn.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/evtchn.c 2020/04/12 17:25:53 1.88.2.3
+++ src/sys/arch/xen/xen/evtchn.c 2020/04/16 08:46:36 1.88.2.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: evtchn.c,v 1.88.2.3 2020/04/12 17:25:53 bouyer Exp $ */ 1/* $NetBSD: evtchn.c,v 1.88.2.4 2020/04/16 08:46:36 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -44,46 +44,46 @@ @@ -44,46 +44,46 @@
44 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 44 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 46 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
47 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 47 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
52 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 52 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */ 53 */
54 54
55 55
56#include <sys/cdefs.h> 56#include <sys/cdefs.h>
57__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.3 2020/04/12 17:25:53 bouyer Exp $"); 57__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.4 2020/04/16 08:46:36 bouyer Exp $");
58 58
59#include "opt_xen.h" 59#include "opt_xen.h"
60#include "isa.h" 60#include "isa.h"
61#include "pci.h" 61#include "pci.h"
62 62
63#include <sys/param.h> 63#include <sys/param.h>
64#include <sys/cpu.h> 64#include <sys/cpu.h>
65#include <sys/kernel.h> 65#include <sys/kernel.h>
66#include <sys/systm.h> 66#include <sys/systm.h>
67#include <sys/device.h> 67#include <sys/device.h>
68#include <sys/proc.h> 68#include <sys/proc.h>
69#include <sys/kmem.h> 69#include <sys/kmem.h>
70#include <sys/reboot.h> 70#include <sys/reboot.h>
71#include <sys/mutex.h> 71#include <sys/mutex.h>
72#include <sys/interrupt.h> 72#include <sys/interrupt.h>
73 73
74#include <uvm/uvm.h> 74#include <uvm/uvm.h>
75 75
76#include <machine/intrdefs.h> 76#include <xen/intr.h>
77 77
78#include <xen/xen.h> 78#include <xen/xen.h>
79#include <xen/hypervisor.h> 79#include <xen/hypervisor.h>
80#include <xen/evtchn.h> 80#include <xen/evtchn.h>
81#include <xen/xenfunc.h> 81#include <xen/xenfunc.h>
82 82
83/* 83/*
84 * This lock protects updates to the following mapping and reference-count 84 * This lock protects updates to the following mapping and reference-count
85 * arrays. The lock does not need to be acquired to read the mapping tables. 85 * arrays. The lock does not need to be acquired to read the mapping tables.
86 */ 86 */
87static kmutex_t evtchn_lock; 87static kmutex_t evtchn_lock;
88 88
89/* event handlers */ 89/* event handlers */

cvs diff -r1.109 -r1.109.2.1 src/sys/arch/xen/xen/if_xennet_xenbus.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/if_xennet_xenbus.c 2020/04/07 11:47:06 1.109
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c 2020/04/16 08:46:36 1.109.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_xennet_xenbus.c,v 1.109 2020/04/07 11:47:06 jdolecek Exp $ */ 1/* $NetBSD: if_xennet_xenbus.c,v 1.109.2.1 2020/04/16 08:46:36 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -71,27 +71,27 @@ @@ -71,27 +71,27 @@
71 * Purpose is to process the packets received from the outside. RX buffers 71 * Purpose is to process the packets received from the outside. RX buffers
72 * are pre-allocated through xennet_alloc_rx_buffer(), during xennet autoconf 72 * are pre-allocated through xennet_alloc_rx_buffer(), during xennet autoconf
73 * attach. During pre-allocation, frontend pushes requests in the I/O ring, in 73 * attach. During pre-allocation, frontend pushes requests in the I/O ring, in
74 * preparation for incoming packets from backend. 74 * preparation for incoming packets from backend.
75 * When RX packets need to be processed, backend takes the requests previously 75 * When RX packets need to be processed, backend takes the requests previously
76 * offered by frontend and pushes the associated responses inside the I/O ring. 76 * offered by frontend and pushes the associated responses inside the I/O ring.
77 * When done, it notifies frontend through an event notification, which will 77 * When done, it notifies frontend through an event notification, which will
78 * asynchronously call xennet_handler() in frontend. 78 * asynchronously call xennet_handler() in frontend.
79 * xennet_handler() processes the responses, generates the associated mbuf, and 79 * xennet_handler() processes the responses, generates the associated mbuf, and
80 * passes it to the MI layer for further processing. 80 * passes it to the MI layer for further processing.
81 */ 81 */
82 82
83#include <sys/cdefs.h> 83#include <sys/cdefs.h>
84__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.109 2020/04/07 11:47:06 jdolecek Exp $"); 84__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.109.2.1 2020/04/16 08:46:36 bouyer Exp $");
85 85
86#include "opt_xen.h" 86#include "opt_xen.h"
87#include "opt_nfs_boot.h" 87#include "opt_nfs_boot.h"
88 88
89#include <sys/param.h> 89#include <sys/param.h>
90#include <sys/device.h> 90#include <sys/device.h>
91#include <sys/conf.h> 91#include <sys/conf.h>
92#include <sys/kernel.h> 92#include <sys/kernel.h>
93#include <sys/proc.h> 93#include <sys/proc.h>
94#include <sys/systm.h> 94#include <sys/systm.h>
95#include <sys/intr.h> 95#include <sys/intr.h>
96#include <sys/rndsource.h> 96#include <sys/rndsource.h>
97 97
@@ -107,26 +107,27 @@ __KERNEL_RCSID(0, "$NetBSD: if_xennet_xe @@ -107,26 +107,27 @@ __KERNEL_RCSID(0, "$NetBSD: if_xennet_xe
107#include <netinet/in.h> 107#include <netinet/in.h>
108#include <nfs/rpcv2.h> 108#include <nfs/rpcv2.h>
109#include <nfs/nfsproto.h> 109#include <nfs/nfsproto.h>
110#include <nfs/nfs.h> 110#include <nfs/nfs.h>
111#include <nfs/nfsmount.h> 111#include <nfs/nfsmount.h>
112#include <nfs/nfsdiskless.h> 112#include <nfs/nfsdiskless.h>
113#include <xen/if_xennetvar.h> 113#include <xen/if_xennetvar.h>
114#endif /* defined(NFS_BOOT_BOOTSTATIC) */ 114#endif /* defined(NFS_BOOT_BOOTSTATIC) */
115 115
116#include <xen/xennet_checksum.h> 116#include <xen/xennet_checksum.h>
117 117
118#include <uvm/uvm.h> 118#include <uvm/uvm.h>
119 119
 120#include <xen/intr.h>
120#include <xen/hypervisor.h> 121#include <xen/hypervisor.h>
121#include <xen/evtchn.h> 122#include <xen/evtchn.h>
122#include <xen/granttables.h> 123#include <xen/granttables.h>
123#include <xen/include/public/io/netif.h> 124#include <xen/include/public/io/netif.h>
124#include <xen/xenpmap.h> 125#include <xen/xenpmap.h>
125 126
126#include <xen/xenbus.h> 127#include <xen/xenbus.h>
127#include "locators.h" 128#include "locators.h"
128 129
129#undef XENNET_DEBUG_DUMP 130#undef XENNET_DEBUG_DUMP
130#undef XENNET_DEBUG 131#undef XENNET_DEBUG
131 132
132#ifdef XENNET_DEBUG 133#ifdef XENNET_DEBUG

cvs diff -r1.97 -r1.97.2.1 src/sys/arch/xen/xen/xbd_xenbus.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/xbd_xenbus.c 2020/04/07 11:47:06 1.97
+++ src/sys/arch/xen/xen/xbd_xenbus.c 2020/04/16 08:46:36 1.97.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xbd_xenbus.c,v 1.97 2020/04/07 11:47:06 jdolecek Exp $ */ 1/* $NetBSD: xbd_xenbus.c,v 1.97.2.1 2020/04/16 08:46:36 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -40,49 +40,50 @@ @@ -40,49 +40,50 @@
40 * - initiate request: xbdread/write/open/ioctl/.. 40 * - initiate request: xbdread/write/open/ioctl/..
41 * - depending on operation, it is handled directly by disk(9) subsystem or 41 * - depending on operation, it is handled directly by disk(9) subsystem or
42 * goes through physio(9) first. 42 * goes through physio(9) first.
43 * - the request is ultimately processed by xbd_diskstart() that prepares the 43 * - the request is ultimately processed by xbd_diskstart() that prepares the
44 * xbd requests, post them in the ring I/O queue, then signal the backend. 44 * xbd requests, post them in the ring I/O queue, then signal the backend.
45 * 45 *
46 * When a response is available in the queue, the backend signals the frontend 46 * When a response is available in the queue, the backend signals the frontend
47 * via its event channel. This triggers xbd_handler(), which will link back 47 * via its event channel. This triggers xbd_handler(), which will link back
48 * the response to its request through the request ID, and mark the I/O as 48 * the response to its request through the request ID, and mark the I/O as
49 * completed. 49 * completed.
50 */ 50 */
51 51
52#include <sys/cdefs.h> 52#include <sys/cdefs.h>
53__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.97 2020/04/07 11:47:06 jdolecek Exp $"); 53__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.97.2.1 2020/04/16 08:46:36 bouyer Exp $");
54 54
55#include "opt_xen.h" 55#include "opt_xen.h"
56 56
57 57
58#include <sys/param.h> 58#include <sys/param.h>
59#include <sys/buf.h> 59#include <sys/buf.h>
60#include <sys/bufq.h> 60#include <sys/bufq.h>
61#include <sys/device.h> 61#include <sys/device.h>
62#include <sys/disk.h> 62#include <sys/disk.h>
63#include <sys/disklabel.h> 63#include <sys/disklabel.h>
64#include <sys/conf.h> 64#include <sys/conf.h>
65#include <sys/fcntl.h> 65#include <sys/fcntl.h>
66#include <sys/kernel.h> 66#include <sys/kernel.h>
67#include <sys/proc.h> 67#include <sys/proc.h>
68#include <sys/systm.h> 68#include <sys/systm.h>
69#include <sys/stat.h> 69#include <sys/stat.h>
70#include <sys/vnode.h> 70#include <sys/vnode.h>
71 71
72#include <dev/dkvar.h> 72#include <dev/dkvar.h>
73 73
74#include <uvm/uvm.h> 74#include <uvm/uvm.h>
75 75
 76#include <xen/intr.h>
76#include <xen/hypervisor.h> 77#include <xen/hypervisor.h>
77#include <xen/evtchn.h> 78#include <xen/evtchn.h>
78#include <xen/granttables.h> 79#include <xen/granttables.h>
79#include <xen/include/public/io/blkif.h> 80#include <xen/include/public/io/blkif.h>
80#include <xen/include/public/io/protocols.h> 81#include <xen/include/public/io/protocols.h>
81 82
82#include <xen/xenbus.h> 83#include <xen/xenbus.h>
83#include "locators.h" 84#include "locators.h"
84 85
85#undef XBD_DEBUG 86#undef XBD_DEBUG
86#ifdef XBD_DEBUG 87#ifdef XBD_DEBUG
87#define DPRINTF(x) printf x; 88#define DPRINTF(x) printf x;
88#else 89#else

cvs diff -r1.22 -r1.22.10.1 src/sys/arch/xen/xen/xen_machdep.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/xen_machdep.c 2019/03/09 08:42:25 1.22
+++ src/sys/arch/xen/xen/xen_machdep.c 2020/04/16 08:46:36 1.22.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xen_machdep.c,v 1.22 2019/03/09 08:42:25 maxv Exp $ */ 1/* $NetBSD: xen_machdep.c,v 1.22.10.1 2020/04/16 08:46:36 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -43,40 +43,41 @@ @@ -43,40 +43,41 @@
43 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 43 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */ 52 */
53 53
54 54
55#include <sys/cdefs.h> 55#include <sys/cdefs.h>
56__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.22 2019/03/09 08:42:25 maxv Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.22.10.1 2020/04/16 08:46:36 bouyer Exp $");
57 57
58#include "opt_xen.h" 58#include "opt_xen.h"
59 59
60#include <sys/param.h> 60#include <sys/param.h>
61#include <sys/systm.h> 61#include <sys/systm.h>
62#include <sys/boot_flag.h> 62#include <sys/boot_flag.h>
63#include <sys/mount.h> 63#include <sys/mount.h>
64#include <sys/reboot.h> 64#include <sys/reboot.h>
65#include <sys/timetc.h> 65#include <sys/timetc.h>
66#include <sys/sysctl.h> 66#include <sys/sysctl.h>
67#include <sys/pmf.h> 67#include <sys/pmf.h>
68#include <sys/xcall.h> 68#include <sys/xcall.h>
69 69
 70#include <xen/intr.h>
70#include <xen/hypervisor.h> 71#include <xen/hypervisor.h>
71#include <xen/shutdown_xenbus.h> 72#include <xen/shutdown_xenbus.h>
72#include <xen/include/public/version.h> 73#include <xen/include/public/version.h>
73 74
74#define DPRINTK(x) printk x 75#define DPRINTK(x) printk x
75#if 0 76#if 0
76#define DPRINTK(x) 77#define DPRINTK(x)
77#endif 78#endif
78 79
79u_int tsc_get_timecount(struct timecounter *); 80u_int tsc_get_timecount(struct timecounter *);
80 81
81bool xen_suspend_allow; 82bool xen_suspend_allow;
82 83

cvs diff -r1.48 -r1.48.10.1 src/sys/arch/xen/xen/xencons.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/xencons.c 2019/02/02 12:32:55 1.48
+++ src/sys/arch/xen/xen/xencons.c 2020/04/16 08:46:36 1.48.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xencons.c,v 1.48 2019/02/02 12:32:55 cherry Exp $ */ 1/* $NetBSD: xencons.c,v 1.48.10.1 2020/04/16 08:46:36 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -43,40 +43,41 @@ @@ -43,40 +43,41 @@
43 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 43 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */ 52 */
53 53
54 54
55#include <sys/cdefs.h> 55#include <sys/cdefs.h>
56__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.48 2019/02/02 12:32:55 cherry Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.48.10.1 2020/04/16 08:46:36 bouyer Exp $");
57 57
58#include "opt_xen.h" 58#include "opt_xen.h"
59 59
60#include <sys/param.h> 60#include <sys/param.h>
61#include <sys/ioctl.h> 61#include <sys/ioctl.h>
62#include <sys/proc.h> 62#include <sys/proc.h>
63#include <sys/tty.h> 63#include <sys/tty.h>
64#include <sys/systm.h> 64#include <sys/systm.h>
65#include <sys/device.h> 65#include <sys/device.h>
66#include <sys/conf.h> 66#include <sys/conf.h>
67#include <sys/kauth.h> 67#include <sys/kauth.h>
68#include <sys/kernel.h> 68#include <sys/kernel.h>
69 69
 70#include <xen/intr.h>
70#include <xen/xen.h> 71#include <xen/xen.h>
71#include <xen/hypervisor.h> 72#include <xen/hypervisor.h>
72#include <xen/evtchn.h> 73#include <xen/evtchn.h>
73#include <uvm/uvm.h> 74#include <uvm/uvm.h>
74#include <machine/pmap.h> 75#include <machine/pmap.h>
75#include <xen/include/public/io/console.h> 76#include <xen/include/public/io/console.h>
76 77
77#include <dev/cons.h> 78#include <dev/cons.h>
78 79
79#ifdef DDB 80#ifdef DDB
80#include <ddb/db_output.h> /* XXX for db_max_line */ 81#include <ddb/db_output.h> /* XXX for db_max_line */
81#endif 82#endif
82 83

cvs diff -r1.21 -r1.21.10.1 src/sys/arch/xen/xenbus/xenbus_comms.c (expand / switch to unified diff)

--- src/sys/arch/xen/xenbus/xenbus_comms.c 2018/12/24 14:55:42 1.21
+++ src/sys/arch/xen/xenbus/xenbus_comms.c 2020/04/16 08:46:36 1.21.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xenbus_comms.c,v 1.21 2018/12/24 14:55:42 cherry Exp $ */ 1/* $NetBSD: xenbus_comms.c,v 1.21.10.1 2020/04/16 08:46:36 bouyer Exp $ */
2/****************************************************************************** 2/******************************************************************************
3 * xenbus_comms.c 3 * xenbus_comms.c
4 * 4 *
5 * Low level code to talks to Xen Store: ringbuffer and event channel. 5 * Low level code to talks to Xen Store: ringbuffer and event channel.
6 * 6 *
7 * Copyright (C) 2005 Rusty Russell, IBM Corporation 7 * Copyright (C) 2005 Rusty Russell, IBM Corporation
8 *  8 *
9 * This file may be distributed separately from the Linux kernel, or 9 * This file may be distributed separately from the Linux kernel, or
10 * incorporated into other software packages, subject to the following license: 10 * incorporated into other software packages, subject to the following license:
11 *  11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a copy 12 * Permission is hereby granted, free of charge, to any person obtaining a copy
13 * of this source file (the "Software"), to deal in the Software without 13 * of this source file (the "Software"), to deal in the Software without
14 * restriction, including without limitation the rights to use, copy, modify, 14 * restriction, including without limitation the rights to use, copy, modify,
@@ -19,36 +19,37 @@ @@ -19,36 +19,37 @@
19 * The above copyright notice and this permission notice shall be included in 19 * The above copyright notice and this permission notice shall be included in
20 * all copies or substantial portions of the Software. 20 * all copies or substantial portions of the Software.
21 *  21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * IN THE SOFTWARE. 28 * IN THE SOFTWARE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.21 2018/12/24 14:55:42 cherry Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.21.10.1 2020/04/16 08:46:36 bouyer Exp $");
33 33
34#include <sys/types.h> 34#include <sys/types.h>
35#include <sys/null.h>  35#include <sys/null.h>
36#include <sys/errno.h>  36#include <sys/errno.h>
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/proc.h> 38#include <sys/proc.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40 40
41#include <xen/xen.h> /* for xendomain_is_dom0() */ 41#include <xen/xen.h> /* for xendomain_is_dom0() */
 42#include <xen/intr.h> /* for xendomain_is_dom0() */
42#include <xen/hypervisor.h> 43#include <xen/hypervisor.h>
43#include <xen/evtchn.h> 44#include <xen/evtchn.h>
44#include <xen/xenbus.h> 45#include <xen/xenbus.h>
45#include "xenbus_comms.h" 46#include "xenbus_comms.h"
46 47
47#undef XENDEBUG 48#undef XENDEBUG
48#ifdef XENDEBUG 49#ifdef XENDEBUG
49#define XENPRINTF(x) printf x 50#define XENPRINTF(x) printf x
50#else 51#else
51#define XENPRINTF(x) 52#define XENPRINTF(x)
52#endif 53#endif
53 54
54static struct intrhand *ih; 55static struct intrhand *ih;

cvs diff -r1.17 -r1.17.2.1 src/sys/arch/xen/xenbus/xenbus_dev.c (expand / switch to unified diff)

--- src/sys/arch/xen/xenbus/xenbus_dev.c 2020/04/07 16:10:48 1.17
+++ src/sys/arch/xen/xenbus/xenbus_dev.c 2020/04/16 08:46:36 1.17.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xenbus_dev.c,v 1.17 2020/04/07 16:10:48 jdolecek Exp $ */ 1/* $NetBSD: xenbus_dev.c,v 1.17.2.1 2020/04/16 08:46:36 bouyer Exp $ */
2/* 2/*
3 * xenbus_dev.c 3 * xenbus_dev.c
4 *  4 *
5 * Driver giving user-space access to the kernel's xenbus connection 5 * Driver giving user-space access to the kernel's xenbus connection
6 * to xenstore. 6 * to xenstore.
7 *  7 *
8 * Copyright (c) 2005, Christian Limpach 8 * Copyright (c) 2005, Christian Limpach
9 * Copyright (c) 2005, Rusty Russell, IBM Corporation 9 * Copyright (c) 2005, Rusty Russell, IBM Corporation
10 *  10 *
11 * This file may be distributed separately from the Linux kernel, or 11 * This file may be distributed separately from the Linux kernel, or
12 * incorporated into other software packages, subject to the following license: 12 * incorporated into other software packages, subject to the following license:
13 *  13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy 14 * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -21,45 +21,46 @@ @@ -21,45 +21,46 @@
21 * The above copyright notice and this permission notice shall be included in 21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software. 22 * all copies or substantial portions of the Software.
23 *  23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE. 30 * IN THE SOFTWARE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.17 2020/04/07 16:10:48 jdolecek Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.17.2.1 2020/04/16 08:46:36 bouyer Exp $");
35 35
36#include "opt_xen.h" 36#include "opt_xen.h"
37 37
38#include <sys/types.h> 38#include <sys/types.h>
39#include <sys/null.h> 39#include <sys/null.h>
40#include <sys/errno.h> 40#include <sys/errno.h>
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/proc.h> 42#include <sys/proc.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/dirent.h> 44#include <sys/dirent.h>
45#include <sys/stat.h> 45#include <sys/stat.h>
46#include <sys/tree.h>  46#include <sys/tree.h>
47#include <sys/vnode.h> 47#include <sys/vnode.h>
48#include <miscfs/specfs/specdev.h> 48#include <miscfs/specfs/specdev.h>
49#include <miscfs/kernfs/kernfs.h> 49#include <miscfs/kernfs/kernfs.h>
50 50
51#include <xen/kernfs_machdep.h> 51#include <xen/kernfs_machdep.h>
52 52
 53#include <xen/intr.h>
53#include <xen/hypervisor.h> 54#include <xen/hypervisor.h>
54#include <xen/xenbus.h> 55#include <xen/xenbus.h>
55#include "xenbus_comms.h" 56#include "xenbus_comms.h"
56 57
57static int xenbus_dev_read(void *); 58static int xenbus_dev_read(void *);
58static int xenbus_dev_write(void *); 59static int xenbus_dev_write(void *);
59static int xenbus_dev_open(void *); 60static int xenbus_dev_open(void *);
60static int xenbus_dev_close(void *); 61static int xenbus_dev_close(void *);
61static int xsd_port_read(void *); 62static int xsd_port_read(void *);
62 63
63#define DIR_MODE (S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) 64#define DIR_MODE (S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
64#define PRIVCMD_MODE (S_IRUSR | S_IWUSR) 65#define PRIVCMD_MODE (S_IRUSR | S_IWUSR)
65static const struct kernfs_fileop xenbus_fileops[] = { 66static const struct kernfs_fileop xenbus_fileops[] = {