CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 25 15:03:18 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC src/sys/arch/i386/conf [bouyer-xenpvh]: GENERIC Removed Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC_XENHVM XEN3_PVHVM src/sys/arch/i386/conf [bouyer-xenpvh]: GENERIC_XENHVM XEN3PAE_PVHVM Log Message: Merge GENERIC_XENHVM in GENERIC. Remove XEN3_PVHVM/XEN3PAE_PVHVM files which have been obsolete for some time on the branch To generate a diff of this commit: cvs rdiff -u -r1.564.2.1 -r1.564.2.2 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.1.2.5 -r0 src/sys/arch/amd64/conf/GENERIC_XENHVM cvs rdiff -u -r1.3.2.3 -r0 src/sys/arch/amd64/conf/XEN3_PVHVM cvs rdiff -u -r1.1227.2.1 -r1.1227.2.2 src/sys/arch/i386/conf/GENERIC cvs rdiff -u -r1.1.2.2 -r0 src/sys/arch/i386/conf/GENERIC_XENHVM cvs rdiff -u -r1.3.2.3 -r0 src/sys/arch/i386/conf/XEN3PAE_PVHVM Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.564.2.1 src/sys/arch/amd64/conf/GENERIC:1.564.2.2 --- src/sys/arch/amd64/conf/GENERIC:1.564.2.1 Mon Apr 20 11:28:51 2020 +++ src/sys/arch/amd64/conf/GENERIC Sat Apr 25 15:03:17 2020 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.564.2.1 2020/04/20 11:28:51 bouyer Exp $ +# $NetBSD: GENERIC,v 1.564.2.2 2020/04/25 15:03:17 bouyer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.564.2.1 $" +#ident "GENERIC-$Revision: 1.564.2.2 $" maxusers 64 # estimated number of users @@ -89,6 +89,15 @@ hyperv0 at cpu0 # Microsoft Hyper-V powernow0 at cpu0 # AMD PowerNow! and Cool'n'Quiet (non-ACPI) vmt0 at cpu0 # VMware Tools +#Xen PV support for HVM guests +options XENPVHVM +options XEN +hypervisor* at mainbus? # Xen hypervisor +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 + # Alternate buffer queue strategies for better responsiveness under high # disk I/O load. #options BUFQ_READPRIO Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1227.2.1 src/sys/arch/i386/conf/GENERIC:1.1227.2.2 --- src/sys/arch/i386/conf/GENERIC:1.1227.2.1 Mon Apr 20 19:38:11 2020 +++ src/sys/arch/i386/conf/GENERIC Sat Apr 25 15:03:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1227.2.1 2020/04/20 19:38:11 bouyer Exp $ +# $NetBSD: GENERIC,v 1.1227.2.2 2020/04/25 15:03:18 bouyer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1227.2.1 $" +#ident "GENERIC-$Revision: 1.1227.2.2 $" maxusers 64 # estimated number of users @@ -44,6 +44,15 @@ powernow0 at cpu0 # AMD PowerNow! and C viac7temp* at cpu? # VIA C7 temperature sensor vmt0 at cpu0 # VMware Tools +#Xen PV support for HVM guests +options XENPVHVM +options XEN +hypervisor* at mainbus? # Xen hypervisor +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 + options MTRR # memory-type range register syscall support options MULTIBOOT # Multiboot support (see multiboot(8))
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/conf
Module Name:src Committed By: bouyer Date: Sat Apr 25 15:01:41 UTC 2020 Modified Files: src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen Log Message: restore part accidentaly deleted To generate a diff of this commit: cvs rdiff -u -r1.180.2.8 -r1.180.2.9 src/sys/arch/xen/conf/files.xen Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.180.2.8 src/sys/arch/xen/conf/files.xen:1.180.2.9 --- src/sys/arch/xen/conf/files.xen:1.180.2.8 Sat Apr 25 13:16:48 2020 +++ src/sys/arch/xen/conf/files.xen Sat Apr 25 15:01:41 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.180.2.8 2020/04/25 13:16:48 bouyer Exp $ +# $NetBSD: files.xen,v 1.180.2.9 2020/04/25 15:01:41 bouyer Exp $ defflag opt_xen.h XEN XENPVH XENPVHVM PAE @@ -10,3 +10,37 @@ file arch/xen/xen/xengnt.c xen file arch/xen/x86/xen_mainbus.c xen file arch/xen/xen/xen_clock.c xen file arch/xen/x86/xen_bus_dma.c xen + +define hypervisorbus {} +define xendevbus {} + +# Xen hypervisor +device hypervisor { [apid = -1]}: isabus, pcibus, sysmon_power, xendevbus, acpibus +attach hypervisor at hypervisorbus +file arch/xen/xen/hypervisor.c hypervisor needs-flag +file arch/xen/xen/shutdown_xenbus.c hypervisor + +# Xenbus +device xenbus {[id = -1]} +attach xenbus at xendevbus +file arch/xen/xenbus/xenbus_client.c xenbus needs-flag +file arch/xen/xenbus/xenbus_comms.c xenbus needs-flag +file arch/xen/xenbus/xenbus_dev.c xenbus needs-flag +file arch/xen/xenbus/xenbus_probe.c xenbus needs-flag +file arch/xen/xenbus/xenbus_xs.c xenbus needs-flag + +# Xen console support +device xencons: tty +attach xencons at xendevbus +file arch/xen/xen/xencons.c xencons needs-flag + +# Xen Network driver +device xennet: arp, ether, ifnet +attach xennet at xenbus +file arch/xen/xen/if_xennet_xenbus.c xennet needs-flag +file arch/xen/xen/xennet_checksum.c xvif | xennet + +# Xen Block device driver and wd/sd/cd identities +device xbd: disk +attach xbd at xenbus +file arch/xen/xen/xbd_xenbus.c xbd
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 25 15:01:01 UTC 2020 Modified Files: src/sys/arch/amd64/include/xen [bouyer-xenpvh]: hypercalls.h src/sys/arch/i386/include/xen [bouyer-xenpvh]: hypercalls.h Log Message: Include changes in sys/arch/xen/include/ between bouyer-xenpvh-base1 and bouyer-xenpvh-base2. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/amd64/include/xen/hypercalls.h cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/i386/include/xen/hypercalls.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/include/xen/hypercalls.h diff -u src/sys/arch/amd64/include/xen/hypercalls.h:1.1.2.1 src/sys/arch/amd64/include/xen/hypercalls.h:1.1.2.2 --- src/sys/arch/amd64/include/xen/hypercalls.h:1.1.2.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/amd64/include/xen/hypercalls.h Sat Apr 25 15:01:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypercalls.h,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $ */ +/* $NetBSD: hypercalls.h,v 1.1.2.2 2020/04/25 15:01:01 bouyer Exp $ */ /** * hypercall.h * @@ -274,9 +274,9 @@ HYPERVISOR_console_io( } static inline int -HYPERVISOR_physdev_op(void *op) +HYPERVISOR_physdev_op(int cmd, void *op) { - return _hypercall1(int, physdev_op_compat, op); + return _hypercall2(int, physdev_op, cmd, op); } static inline int Index: src/sys/arch/i386/include/xen/hypercalls.h diff -u src/sys/arch/i386/include/xen/hypercalls.h:1.1.2.1 src/sys/arch/i386/include/xen/hypercalls.h:1.1.2.2 --- src/sys/arch/i386/include/xen/hypercalls.h:1.1.2.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/i386/include/xen/hypercalls.h Sat Apr 25 15:01:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypercalls.h,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $ */ +/* $NetBSD: hypercalls.h,v 1.1.2.2 2020/04/25 15:01:01 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -536,13 +536,13 @@ HYPERVISOR_console_io(int cmd, int count } static __inline int -HYPERVISOR_physdev_op(void *physdev_op) +HYPERVISOR_physdev_op(int cmd, void *physdev_op) { int ret; -unsigned long ign1; +unsigned long ign1, ign2; -_hypercall(__HYPERVISOR_physdev_op, _harg("1" (physdev_op)), - _harg("=a" (ret), "=b" (ign1))); +_hypercall(__HYPERVISOR_physdev_op, _harg("1" (cmd), "2" (physdev_op)), + _harg("=a" (ret), "=b" (ign1), "=c" (ign2))); return ret; }
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 25 13:16:48 UTC 2020 Modified Files: src/sys/arch/x86/conf [bouyer-xenpvh]: files.x86 src/sys/arch/x86/x86 [bouyer-xenpvh]: cpu.c i8259.c src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c xen_intr.c xen_ipi.c src/sys/arch/xen/xen [bouyer-xenpvh]: xbdback_xenbus.c Log Message: sync with bouyer-xenpvh-base2 (HEAD) To generate a diff of this commit: cvs rdiff -u -r1.107.10.2 -r1.107.10.3 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r1.181.4.4 -r1.181.4.5 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.23.10.2 -r1.23.10.3 src/sys/arch/x86/x86/i8259.c cvs rdiff -u -r1.180.2.7 -r1.180.2.8 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.36.8.6 -r1.36.8.7 src/sys/arch/xen/x86/hypervisor_machdep.c cvs rdiff -u -r1.21.2.9 -r1.21.2.10 src/sys/arch/xen/x86/xen_intr.c cvs rdiff -u -r1.35.6.6 -r1.35.6.7 src/sys/arch/xen/x86/xen_ipi.c cvs rdiff -u -r1.77.2.3 -r1.77.2.4 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/conf/files.x86 diff -u src/sys/arch/x86/conf/files.x86:1.107.10.2 src/sys/arch/x86/conf/files.x86:1.107.10.3 --- src/sys/arch/x86/conf/files.x86:1.107.10.2 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/x86/conf/files.x86 Sat Apr 25 13:16:48 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.107.10.2 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: files.x86,v 1.107.10.3 2020/04/25 13:16:48 bouyer Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI @@ -59,7 +59,7 @@ device odcm attach odcm at cpufeaturebus file arch/x86/x86/odcm.c odcm -device padlock: opencrypto +device padlock: opencrypto, rijndael attach padlock at cpufeaturebus file arch/x86/x86/via_padlock.c padlock @@ -91,6 +91,7 @@ file arch/x86/x86/efi.c machdep file arch/x86/x86/errata.c machdep file arch/x86/x86/genfb_machdep.c machdep file arch/x86/x86/identcpu.c machdep +file arch/x86/x86/identcpu_subr.c machdep file arch/x86/x86/i8259.c machdep & (!xenpv | dom0ops) file arch/x86/x86/intr.c machdep & !xenpv file arch/x86/x86/x86_softintr.c machdep Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.181.4.4 src/sys/arch/x86/x86/cpu.c:1.181.4.5 --- src/sys/arch/x86/x86/cpu.c:1.181.4.4 Mon Apr 20 11:29:00 2020 +++ src/sys/arch/x86/x86/cpu.c Sat Apr 25 13:16:48 2020 @@ -1,7 +1,7 @@ -/* $NetBSD: cpu.c,v 1.181.4.4 2020/04/20 11:29:00 bouyer Exp $ */ +/* $NetBSD: cpu.c,v 1.181.4.5 2020/04/25 13:16:48 bouyer Exp $ */ /* - * Copyright (c) 2000-2012 NetBSD Foundation, Inc. + * Copyright (c) 2000-2020 NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.181.4.4 2020/04/20 11:29:00 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.181.4.5 2020/04/25 13:16:48 bouyer Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18 #include "lapic.h" #include "ioapic.h" #include "acpica.h" +#include "hpet.h" #include #include @@ -119,6 +120,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18 #endif #include +#include #include #include @@ -202,6 +204,8 @@ static vaddr_t cmos_data_mapping; #endif struct cpu_info *cpu_starting; +int (*cpu_nullop_ptr)(void *) = nullop; + #ifdef MULTIPROCESSOR void cpu_hatch(void *); static void cpu_boot_secondary(struct cpu_info *ci); @@ -433,8 +437,11 @@ cpu_attach(device_t parent, device_t sel * must be done to allow booting other processors. */ if (!again) { - atomic_or_32(&ci->ci_flags, CPUF_PRESENT | CPUF_PRIMARY); + /* Make sure DELAY() (likely i8254_delay()) is initialized. */ + DELAY(1); + /* Basic init. */ + atomic_or_32(&ci->ci_flags, CPUF_PRESENT | CPUF_PRIMARY); cpu_intr_init(ci); cpu_get_tsc_freq(ci); cpu_init(ci); @@ -451,8 +458,6 @@ cpu_attach(device_t parent, device_t sel lapic_calibrate_timer(ci); } #endif - /* Make sure DELAY() is initialized. */ - DELAY(1); kcsan_cpu_init(ci); again = true; } @@ -718,7 +723,6 @@ cpu_init(struct cpu_info *ci) if (ci != &cpu_info_primary) { /* Synchronize TSC */ - wbinvd(); atomic_or_32(&ci->ci_flags, CPUF_RUNNING); tsc_sync_ap(ci); } else { @@ -734,6 +738,14 @@ cpu_boot_secondary_processors(void) kcpuset_t *cpus; u_long i; +#if NHPET > 0 + /* Use HPET delay, and re-calibrate TSC on boot CPU using HPET. */ + if (hpet_delay_p() && x86_delay == i8254_delay) { + delay_func = x86_delay = hpet_delay; + cpu_get_tsc_freq(curcpu()); + } +#endif + /* Now that we know the number of CPUs, patch the text segment. */ x86_patch(false); @@ -842,7 +854,6 @@ cpu_start_secondary
CVS commit: [bouyer-xenpvh] src/sys/rump
Module Name:src Committed By: bouyer Date: Sat Apr 25 11:44:29 UTC 2020 Modified Files: src/sys/rump [bouyer-xenpvh]: listsrcdirs Log Message: Add xen as include dir for x86 To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.49.6.1 src/sys/rump/listsrcdirs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/listsrcdirs diff -u src/sys/rump/listsrcdirs:1.49 src/sys/rump/listsrcdirs:1.49.6.1 --- src/sys/rump/listsrcdirs:1.49 Fri Sep 27 11:57:42 2019 +++ src/sys/rump/listsrcdirs Sat Apr 25 11:44:29 2020 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: listsrcdirs,v 1.49 2019/09/27 11:57:42 bad Exp $ +# $NetBSD: listsrcdirs,v 1.49.6.1 2020/04/25 11:44:29 bouyer Exp $ # # @@ -78,7 +78,7 @@ include_headerlist () fi } -ARCHS="amd64 i386 x86 arm evbarm sparc sparc64 powerpc evbppc mips evbmips aarch64 riscv" +ARCHS="amd64 i386 x86 xen arm evbarm sparc sparc64 powerpc evbppc mips evbmips aarch64 riscv" ARCHS_EXTRA="arm/arm32 Makefile" # files listed in src/tools/Makefile.nbincludes ARCHS_EXTRA="$ARCHS_EXTRA ews4800mips/include/pdinfo.h
CVS commit: [bouyer-xenpvh] src/sys
Module Name:src Committed By: bouyer Date: Sat Apr 25 11:24:08 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64 [bouyer-xenpvh]: netbsd32_machdep.c sig_machdep.c src/sys/arch/aarch64/include [bouyer-xenpvh]: profile.h src/sys/arch/amd64/amd64 [bouyer-xenpvh]: machdep.c netbsd32_machdep.c src/sys/arch/amd64/include [bouyer-xenpvh]: gdt.h pte.h src/sys/arch/arm/arm32 [bouyer-xenpvh]: pmap.c src/sys/arch/arm/include [bouyer-xenpvh]: asm.h src/sys/arch/hp300/hp300 [bouyer-xenpvh]: machdep.c src/sys/arch/hppa/hppa [bouyer-xenpvh]: trap.c src/sys/arch/i386/conf [bouyer-xenpvh]: files.i386 src/sys/arch/i386/i386 [bouyer-xenpvh]: genassym.cf machdep.c src/sys/arch/i386/include [bouyer-xenpvh]: gdt.h kcore.h pte.h src/sys/arch/macppc/conf [bouyer-xenpvh]: GENERIC src/sys/arch/macppc/dev [bouyer-xenpvh]: lmu.c src/sys/arch/macppc/stand [bouyer-xenpvh]: Makefile.inc src/sys/arch/macppc/stand/ofwboot [bouyer-xenpvh]: boot.c net.c src/sys/arch/mips/cavium/dev [bouyer-xenpvh]: if_cnmac.c octeon_gmx.c octeon_gmxvar.h src/sys/arch/sparc/stand/bootxx [bouyer-xenpvh]: Makefile src/sys/arch/sparc/stand/common [bouyer-xenpvh]: net.c src/sys/arch/sparc/stand/ofwboot [bouyer-xenpvh]: net.c src/sys/arch/sun68k/stand/libsa [bouyer-xenpvh]: Makefile.inc src/sys/arch/x86/include [bouyer-xenpvh]: apicvar.h cpu.h pmap.h specialreg.h src/sys/arch/x86/pci [bouyer-xenpvh]: amdsmn.c amdzentemp.c src/sys/arch/x86/x86 [bouyer-xenpvh]: bus_space.c hyperv.c pmap.c procfs_machdep.c svs.c sys_machdep.c tsc.c src/sys/arch/xen/include [bouyer-xenpvh]: hypervisor.h i82093var.h intr.h intrdefs.h xenring.h src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c pintr.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c if_xennet_xenbus.c xbd_xenbus.c src/sys/arch/zaurus/stand [bouyer-xenpvh]: Makefile.inc src/sys/compat/linux/common [bouyer-xenpvh]: linux_exec.c linux_sched.c src/sys/compat/netbsd32 [bouyer-xenpvh]: netbsd32_fs.c netbsd32_syscall.h netbsd32_syscallargs.h netbsd32_syscalls.c netbsd32_syscalls_autoload.c netbsd32_sysent.c netbsd32_systrace_args.c syscalls.master src/sys/conf [bouyer-xenpvh]: files src/sys/crypto/rijndael [bouyer-xenpvh]: files.rijndael src/sys/dev [bouyer-xenpvh]: vnd.c src/sys/dev/ata [bouyer-xenpvh]: ata.c ata_subr.c atavar.h src/sys/dev/hid [bouyer-xenpvh]: hidkbdmap.c src/sys/dev/i2c [bouyer-xenpvh]: files.i2c src/sys/dev/ic [bouyer-xenpvh]: bcmgenetreg.h hpet.c hpetvar.h vga.c vga_raster.c src/sys/dev/isa [bouyer-xenpvh]: pcdisplay.c src/sys/dev/marvell [bouyer-xenpvh]: files.armada src/sys/dev/pci [bouyer-xenpvh]: ichsmb.c if_aq.c if_mcx.c if_msk.c pcidevs pcidevs.h pcidevs_data.h src/sys/external/bsd/drm2/dist/drm/i915 [bouyer-xenpvh]: i915_gem_gtt.c src/sys/fs/adosfs [bouyer-xenpvh]: advnops.c src/sys/fs/cd9660 [bouyer-xenpvh]: cd9660_vnops.c src/sys/fs/efs [bouyer-xenpvh]: efs_vnops.c src/sys/fs/filecorefs [bouyer-xenpvh]: filecore_vnops.c src/sys/fs/hfs [bouyer-xenpvh]: hfs_vnops.c src/sys/fs/msdosfs [bouyer-xenpvh]: msdosfs_denode.c msdosfs_vnops.c src/sys/fs/nilfs [bouyer-xenpvh]: nilfs_vnops.c src/sys/fs/puffs [bouyer-xenpvh]: puffs_vnops.c src/sys/fs/sysvbfs [bouyer-xenpvh]: sysvbfs_vnops.c src/sys/fs/tmpfs [bouyer-xenpvh]: tmpfs_subr.c tmpfs_vnops.c src/sys/fs/udf [bouyer-xenpvh]: udf_allocation.c udf_vnops.c src/sys/fs/v7fs [bouyer-xenpvh]: v7fs_vnops.c src/sys/kern [bouyer-xenpvh]: files.kern init_sysent.c kern_crashme.c kern_exec.c kern_exit.c kern_fork.c kern_lwp.c kern_pmf.c kern_proc.c subr_vmem.c sys_lwp.c syscalls.c syscalls.master syscalls_autoload.c systrace_args.c uipc_mbuf.c uipc_usrreq.c vfs_bio.c vfs_cache.c vfs_cwd.c vfs_getcwd.c vfs_lookup.c vfs_mount.c vfs_subr.c vfs_syscalls.c src/sys/lib/libkern [bouyer-xenpvh]: Makefile.compiler-rt src/sys/miscfs/procfs [bouyer-xenpvh]: procfs_linux.c procfs_vnops.c src/sys/netinet6 [bouyer-xenpvh]: in6_proto.c nd6_nbr.c src/sys/netipsec [bouyer-xenpvh]: files.netipsec src/sys/nfs [bouyer-xenpvh]: nfs_bio.c src/sys/opencrypto [bouyer-xenpvh]: files.opencrypto src/sys/rump/include/rump [bouyer-xenpvh]: rump_syscalls.h src/sys/rump/librump/rumpkern [bouyer-xenpvh]: lwproc.c rump.c rump_syscalls.c src/sys/rump/librump/rumpvfs [bouyer-xenpvh]: rump_vfs.c rumpfs.c src/sys/sys [bouyer-xenpvh]: buf.h cdefs.h filedesc.h lwp.h param.h
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/conf
Module Name:src Committed By: bouyer Date: Sat Apr 25 10:52:26 UTC 2020 Modified Files: src/sys/arch/xen/conf [bouyer-xenpvh]: files.compat files.xen files.xen.pv Log Message: Include again xen/conf/files.compat for PV kernels, and make it build. My build.sh -u used stale opt_*.h files ... To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.32.10.1 src/sys/arch/xen/conf/files.compat cvs rdiff -u -r1.180.2.6 -r1.180.2.7 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/xen/conf/files.xen.pv Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/conf/files.compat diff -u src/sys/arch/xen/conf/files.compat:1.32 src/sys/arch/xen/conf/files.compat:1.32.10.1 --- src/sys/arch/xen/conf/files.compat:1.32 Sun Dec 9 00:45:18 2018 +++ src/sys/arch/xen/conf/files.compat Sat Apr 25 10:52:26 2020 @@ -1,16 +1,10 @@ -# $NetBSD: files.compat,v 1.32 2018/12/09 00:45:18 mrg Exp $ +# $NetBSD: files.compat,v 1.32.10.1 2020/04/25 10:52:26 bouyer Exp $ # NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp # options for MP configuration through the MP spec #defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI #defflag opt_mpacpi.h MPACPI MPACPI_SCANPCI -# MTRR support -defflagMTRR - -defflag opt_xen.h XEN PAE - - # XXX define fake options to make config create the .h files defflag lapic.h XXXLAPIC defflag apm.h XXXAPM Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.180.2.6 src/sys/arch/xen/conf/files.xen:1.180.2.7 --- src/sys/arch/xen/conf/files.xen:1.180.2.6 Mon Apr 20 19:40:24 2020 +++ src/sys/arch/xen/conf/files.xen Sat Apr 25 10:52:26 2020 @@ -1,6 +1,6 @@ -# $NetBSD: files.xen,v 1.180.2.6 2020/04/20 19:40:24 bouyer Exp $ +# $NetBSD: files.xen,v 1.180.2.7 2020/04/25 10:52:26 bouyer Exp $ -defflag opt_xen.h XEN XENPVH XENPVHVM +defflag opt_xen.h XEN XENPVH XENPVHVM PAE file arch/xen/x86/hypervisor_machdep.c xen file arch/xen/x86/xen_intr.c xen Index: src/sys/arch/xen/conf/files.xen.pv diff -u src/sys/arch/xen/conf/files.xen.pv:1.1.2.4 src/sys/arch/xen/conf/files.xen.pv:1.1.2.5 --- src/sys/arch/xen/conf/files.xen.pv:1.1.2.4 Mon Apr 20 19:40:24 2020 +++ src/sys/arch/xen/conf/files.xen.pv Sat Apr 25 10:52:26 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen.pv,v 1.1.2.4 2020/04/20 19:40:24 bouyer Exp $ +# $NetBSD: files.xen.pv,v 1.1.2.5 2020/04/25 10:52:26 bouyer Exp $ file arch/xen/x86/autoconf.c xenpv file arch/xen/x86/x86_xpmap.c xenpv @@ -11,6 +11,8 @@ file arch/xen/x86/pintr.c machdep & dom file arch/xen/x86/xen_ipi.c multiprocessor & xenpv +include "arch/xen/conf/files.compat" + # # System bus types #
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/include
Module Name:src Committed By: bouyer Date: Sat Apr 25 10:51:25 UTC 2020 Modified Files: src/sys/arch/xen/include [bouyer-xenpvh]: Makefile Log Message: Also install xen/intrdefs.h To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.108.1 src/sys/arch/xen/include/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/include/Makefile diff -u src/sys/arch/xen/include/Makefile:1.3 src/sys/arch/xen/include/Makefile:1.3.108.1 --- src/sys/arch/xen/include/Makefile:1.3 Sun Feb 17 16:23:12 2008 +++ src/sys/arch/xen/include/Makefile Sat Apr 25 10:51:25 2020 @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.3 2008/02/17 16:23:12 bouyer Exp $ +# $NetBSD: Makefile,v 1.3.108.1 2020/04/25 10:51:25 bouyer Exp $ INCSDIR= /usr/include/xen -INCS= xenio.h xenio3.h +INCS= intrdefs.h xenio.h xenio3.h .include
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Wed Apr 22 20:49:08 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c Log Message: Don't try to attach vcpu on !XENPV remove debug printf and other misc cosmetic changes To generate a diff of this commit: cvs rdiff -u -r1.73.2.8 -r1.73.2.9 src/sys/arch/xen/xen/hypervisor.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/hypervisor.c diff -u src/sys/arch/xen/xen/hypervisor.c:1.73.2.8 src/sys/arch/xen/xen/hypervisor.c:1.73.2.9 --- src/sys/arch/xen/xen/hypervisor.c:1.73.2.8 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/xen/hypervisor.c Wed Apr 22 20:49:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.73.2.8 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: hypervisor.c,v 1.73.2.9 2020/04/22 20:49:08 bouyer Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.8 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.9 2020/04/22 20:49:08 bouyer Exp $"); #include #include @@ -399,8 +399,6 @@ xen_hvm_init_cpu(struct cpu_info *ci) vm_guest = VM_GUEST_XENHVM; return 0; } - printf("cpu %s ci_acpiid %d vcpuid %d domid %d\n", - device_xname(ci->ci_dev), ci->ci_acpiid, descs[1], descs[2]); ci->ci_vcpuid = descs[1]; ci->ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[ci->ci_vcpuid]; @@ -434,9 +432,9 @@ xen_hvm_init_cpu(struct cpu_info *ci) * From FreeBSD: * Trick toolstack to think we are enlightened */ + xen_hvm_param.value = 1; aprint_verbose_dev(ci->ci_dev, "using event upcall vector: %d\n", xen_hvm_vec ); - xen_hvm_param.value = 1; } } @@ -476,14 +474,14 @@ hypervisor_match(device_t parent, cfdata return 1; } -#ifdef MULTIPROCESSOR +#if defined(MULTIPROCESSOR) && defined(XENPV) static int hypervisor_vcpu_print(void *aux, const char *parent) { /* Unconfigured cpus are ignored quietly. */ return (QUIET); } -#endif /* MULTIPROCESSOR */ +#endif /* MULTIPROCESSOR && XENPV */ /* * Attach the hypervisor. @@ -591,6 +589,7 @@ hypervisor_attach(device_t parent, devic xengnt_init(); events_init(); +#ifdef XENPV memset(&hac, 0, sizeof(hac)); hac.hac_vcaa.vcaa_name = "vcpu"; hac.hac_vcaa.vcaa_caa.cpu_number = 0; @@ -622,6 +621,7 @@ hypervisor_attach(device_t parent, devic } #endif /* MULTIPROCESSOR */ +#endif /* XENPV */ #if NXENBUS > 0 extern struct x86_bus_dma_tag xenbus_bus_dma_tag;
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/conf
Module Name:src Committed By: bouyer Date: Wed Apr 22 16:51:56 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: XEN3_DOMU Log Message: Remove HZ=20, it was to testing only. To generate a diff of this commit: cvs rdiff -u -r1.90.6.3 -r1.90.6.4 src/sys/arch/amd64/conf/XEN3_DOMU Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/XEN3_DOMU diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.90.6.3 src/sys/arch/amd64/conf/XEN3_DOMU:1.90.6.4 --- src/sys/arch/amd64/conf/XEN3_DOMU:1.90.6.3 Mon Apr 20 11:28:51 2020 +++ src/sys/arch/amd64/conf/XEN3_DOMU Wed Apr 22 16:51:56 2020 @@ -1,19 +1,17 @@ -# $NetBSD: XEN3_DOMU,v 1.90.6.3 2020/04/20 11:28:51 bouyer Exp $ +# $NetBSD: XEN3_DOMU,v 1.90.6.4 2020/04/22 16:51:56 bouyer Exp $ include "arch/amd64/conf/std.xen" options XENPV # PV domU support options MULTIPROCESSOR -options HZ=20 - options INCLUDE_CONFIG_FILE # embed config file in kernel binary #options UVMHIST #options UVMHIST_PRINT #options SYSCALL_DEBUG -#ident "XEN3_DOMU-$Revision: 1.90.6.3 $" +#ident "XEN3_DOMU-$Revision: 1.90.6.4 $" maxusers 32 # estimated number of users
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Tue Apr 21 16:57:40 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xengnt.c Log Message: It is possible to use grant_v2 with HVM guest; but the status table has to be mapped using XENMEM_add_to_physmap. To generate a diff of this commit: cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/arch/xen/xen/xengnt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xengnt.c diff -u src/sys/arch/xen/xen/xengnt.c:1.29.2.2 src/sys/arch/xen/xen/xengnt.c:1.29.2.3 --- src/sys/arch/xen/xen/xengnt.c:1.29.2.2 Mon Apr 20 19:42:10 2020 +++ src/sys/arch/xen/xen/xengnt.c Tue Apr 21 16:57:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xengnt.c,v 1.29.2.2 2020/04/20 19:42:10 bouyer Exp $ */ +/* $NetBSD: xengnt.c,v 1.29.2.3 2020/04/21 16:57:40 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.29.2.2 2020/04/20 19:42:10 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.29.2.3 2020/04/21 16:57:40 bouyer Exp $"); #include #include @@ -44,16 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 #include "opt_xen.h" -/* - * grant table v2 is not supported for HVM guests on 4.11 at last. - * see xen/arch/x86/hvm/hypercall.c in Xen sources (missing - * GNTTABOP_get_status_frames) - */ - -#ifdef XENPV -#define USE_GRANT_V2 -#endif - /* #define XENDEBUG */ #ifdef XENDEBUG #define DPRINTF(x) printf x @@ -77,7 +67,6 @@ int last_gnt_entry; #define XENGNT_NO_ENTRY 0x /* VM address of the grant table */ -#ifdef USE_GRANT_V2 #define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) #define NR_GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) @@ -86,10 +75,6 @@ grant_entry_v2_t *grant_table; int gnt_status_frames; grant_status_t *grant_status; -#else /* USE_GRANT_V2 */ -#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v1_t)) -grant_entry_v1_t *grant_table; -#endif /* USE_GRANT_V2 */ kmutex_t grant_lock; static grant_ref_t xengnt_get_entry(void); @@ -118,13 +103,11 @@ xengnt_init(void) gnt_nr_grant_frames = gnt_max_grant_frames; -#ifdef USE_GRANT_V2 struct gnttab_set_version gntversion; gntversion.version = 2; rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gntversion, 1); if (rc < 0 || gntversion.version != 2) panic("GNTTABOP_set_version 2 failed %d", rc); -#endif /* USE_GRANT_V2 */ nr_grant_entries = gnt_max_grant_frames * NR_GRANT_ENTRIES_PER_PAGE; @@ -139,14 +122,12 @@ xengnt_init(void) for (i = 0; i <= nr_grant_entries; i++) gnt_entries[i] = XENGNT_NO_ENTRY; -#ifdef USE_GRANT_V2 gnt_status_frames = round_page(nr_grant_entries * sizeof(grant_status_t)) / PAGE_SIZE; grant_status = (void *)uvm_km_alloc(kernel_map, gnt_status_frames * PAGE_SIZE, 0, UVM_KMF_VAONLY); if (grant_status == NULL) panic("xengnt_init() status no VM space"); -#endif /* USE_GRANT_V2 */ mutex_init(&grant_lock, MUTEX_DEFAULT, IPL_VM); @@ -194,10 +175,8 @@ xengnt_suspend(void) { /* Remove virtual => machine mapping for grant table */ pmap_kremove((vaddr_t)grant_table, gnt_nr_grant_frames * PAGE_SIZE); -#ifdef USE_GRANT_V2 /* Remove virtual => machine mapping for status table */ pmap_kremove((vaddr_t)grant_status, gnt_status_frames * PAGE_SIZE); -#endif pmap_update(pmap_kernel()); mutex_exit(&grant_lock); @@ -210,12 +189,8 @@ xengnt_suspend(void) { static int xengnt_map_status(void) { -#ifdef USE_GRANT_V2 - gnttab_get_status_frames_t getstatus; uint64_t *pages; size_t sz; - int err; - KASSERT(mutex_owned(&grant_lock)); sz = gnt_status_frames * sizeof(*pages); @@ -223,6 +198,10 @@ xengnt_map_status(void) if (pages == NULL) return ENOMEM; +#ifdef XENPV + gnttab_get_status_frames_t getstatus; + int err; + getstatus.dom = DOMID_SELF; getstatus.nr_frames = gnt_status_frames; set_xen_guest_handle(getstatus.frame_list, pages); @@ -240,7 +219,23 @@ xengnt_map_status(void) kmem_free(pages, sz); return ENOMEM; } +#else /* XENPV */ + for (int i = 0; i < gnt_status_frames; i++) { + struct vm_page *pg; + struct xen_add_to_physmap xmap; + + pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE|UVM_PGA_ZERO); + pages[i] = atop(uvm_vm_page_to_phys(pg)); + + xmap.domid = DOMID_SELF; + xmap.space = XENMAPSPACE_grant_table; + xmap.idx = i | XENMAPIDX_grant_table_status; + xmap.gpfn = pages[i]; + if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xmap) < 0) + panic("%s: Unable to add grant tables\n", __func__); + } +#endif /* XENPV */ /* * map between status_table addresses and the machine addresses of * the status table frames @@ -253,8 +248,6 @@ xengnt_map_status(void) pmap_update(pmap_kernel()); kmem_free(pages, sz); - -#endif /* USE_GRANT_V2 */ return 0; } @@ -298,7 +291,7 @@ xengnt_mo
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Mon Apr 20 20:19:07 UTC 2020 Modified Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: intr.c src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c Log Message: channel %d -> chan %d, for the benefit of 'systat vm' To generate a diff of this commit: cvs rdiff -u -r1.150.6.5 -r1.150.6.6 src/sys/arch/x86/x86/intr.c cvs rdiff -u -r1.21.2.8 -r1.21.2.9 src/sys/arch/xen/x86/xen_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.150.6.5 src/sys/arch/x86/x86/intr.c:1.150.6.6 --- src/sys/arch/x86/x86/intr.c:1.150.6.5 Sun Apr 19 19:39:10 2020 +++ src/sys/arch/x86/x86/intr.c Mon Apr 20 20:19:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.150.6.5 2020/04/19 19:39:10 bouyer Exp $ */ +/* $NetBSD: intr.c,v 1.150.6.6 2020/04/20 20:19:07 bouyer Exp $ */ /* * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.5 2020/04/19 19:39:10 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.6 2020/04/20 20:19:07 bouyer Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -1189,7 +1189,7 @@ xen_intr_string(int port, char *buf, siz KASSERT(port >= 0); - snprintf(buf, len, "%s channel %d", pic->pic_name, port); + snprintf(buf, len, "%s chan %d", pic->pic_name, port); return buf; } Index: src/sys/arch/xen/x86/xen_intr.c diff -u src/sys/arch/xen/x86/xen_intr.c:1.21.2.8 src/sys/arch/xen/x86/xen_intr.c:1.21.2.9 --- src/sys/arch/xen/x86/xen_intr.c:1.21.2.8 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/x86/xen_intr.c Mon Apr 20 20:19:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_intr.c,v 1.21.2.8 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xen_intr.c,v 1.21.2.9 2020/04/20 20:19:07 bouyer Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.8 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.9 2020/04/20 20:19:07 bouyer Exp $"); #include "opt_multiprocessor.h" @@ -357,7 +357,7 @@ xen_intr_string(int port, char *buf, siz KASSERT(port >= 0); KASSERT(port < NR_EVENT_CHANNELS); - snprintf(buf, len, "%s channel %d", pic->pic_name, port); + snprintf(buf, len, "%s chan %d", pic->pic_name, port); return buf; }
CVS commit: [bouyer-xenpvh] src/sys/arch/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:46:44 UTC 2020 Modified Files: src/sys/arch/xen/include [bouyer-xenpvh]: evtchn.h src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_ipi.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c Log Message: Misc fixes after merge To generate a diff of this commit: cvs rdiff -u -r1.28.2.2 -r1.28.2.3 src/sys/arch/xen/include/evtchn.h cvs rdiff -u -r1.35.6.5 -r1.35.6.6 src/sys/arch/xen/x86/xen_ipi.c cvs rdiff -u -r1.88.2.10 -r1.88.2.11 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/include/evtchn.h diff -u src/sys/arch/xen/include/evtchn.h:1.28.2.2 src/sys/arch/xen/include/evtchn.h:1.28.2.3 --- src/sys/arch/xen/include/evtchn.h:1.28.2.2 Mon Apr 20 11:29:00 2020 +++ src/sys/arch/xen/include/evtchn.h Mon Apr 20 19:46:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.h,v 1.28.2.2 2020/04/20 11:29:00 bouyer Exp $ */ +/* $NetBSD: evtchn.h,v 1.28.2.3 2020/04/20 19:46:44 bouyer Exp $ */ /* * @@ -41,8 +41,8 @@ bool events_resume(void); unsigned int evtchn_do_event(int, struct intrframe *); void call_evtchn_do_event(int, struct intrframe *); void call_xenevt_event(int); -int event_set_handler(int, int (*func)(void *), void *, int, const char *, -const char *, bool, bool); +struct intrhand *event_set_handler(int, int (*func)(void *), void *, +int, const char *, const char *, bool, bool); int event_remove_handler(int, int (*func)(void *), void *); struct cpu_info; Index: src/sys/arch/xen/x86/xen_ipi.c diff -u src/sys/arch/xen/x86/xen_ipi.c:1.35.6.5 src/sys/arch/xen/x86/xen_ipi.c:1.35.6.6 --- src/sys/arch/xen/x86/xen_ipi.c:1.35.6.5 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/x86/xen_ipi.c Mon Apr 20 19:46:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_ipi.c,v 1.35.6.5 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xen_ipi.c,v 1.35.6.6 2020/04/20 19:46:44 bouyer Exp $ */ /*- * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ * Based on: x86/ipi.c */ -__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.5 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.6 2020/04/20 19:46:44 bouyer Exp $"); #include "opt_ddb.h" @@ -143,7 +143,7 @@ xen_ipi_init(void) device_xname(ci->ci_dev)); if (event_set_handler(evtchn, xen_ipi_handler, ci, IPL_HIGH, NULL, - intr_xname, true, false) != 0) { + intr_xname, true, false) == NULL) { panic("%s: unable to register ipi handler\n", __func__); /* NOTREACHED */ } Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.88.2.10 src/sys/arch/xen/xen/evtchn.c:1.88.2.11 --- src/sys/arch/xen/xen/evtchn.c:1.88.2.10 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/xen/evtchn.c Mon Apr 20 19:46:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.88.2.10 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: evtchn.c,v 1.88.2.11 2020/04/20 19:46:44 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.10 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.11 2020/04/20 19:46:44 bouyer Exp $"); #include "opt_xen.h" #include "isa.h" @@ -885,10 +885,11 @@ event_set_handler(int evtch, int (*func) if (bind) { op.cmd = EVTCHNOP_bind_vcpu; op.u.bind_vcpu.port = evtch; - op.u.bind_vcpu.vcpu = ci->ci_cpuid; + op.u.bind_vcpu.vcpu = ci->ci_vcpuid; if (HYPERVISOR_event_channel_op(&op) != 0) { -panic("Failed to bind event %d to " -"VCPU %"PRIuCPUID, evtch, ci->ci_cpuid); +panic("Failed to bind event %d to VCPU %s %d", +evtch, device_xname(ci->ci_dev), +ci->ci_vcpuid); } } } else { @@ -955,15 +956,14 @@ event_set_iplhandler(struct cpu_info *ci ipls->is_recurse = xenev_stubs[level - IPL_VM].ist_recurse; ipls->is_resume = xenev_stubs[level - IPL_VM].ist_resume; ipls->is_handlers = ih; - ipls->is_maxlevel = level; ipls->is_pic = &xen_pic; ci->ci_isources[sir] = ipls; - x86_intr_calculatemasks(ci); } else { ipls = ci->ci_isources[sir]; ih->ih_next = ipls->is_handlers; ipls->is_handlers = ih; } + x86_intr_calculatemasks(ci); } int
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:46:04 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC_XENHVM src/sys/arch/i386/conf [bouyer-xenpvh]: GENERIC_XENHVM Log Message: Thanks do jdolecek@, MAXPHYS is not restricted to 32k now. Nothing prevents merging GENERIC_XENHVM in GENERIC now To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/amd64/conf/GENERIC_XENHVM cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/i386/conf/GENERIC_XENHVM Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/GENERIC_XENHVM diff -u src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.4 src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.5 --- src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.4 Thu Apr 16 17:50:51 2020 +++ src/sys/arch/amd64/conf/GENERIC_XENHVM Mon Apr 20 19:46:03 2020 @@ -1,10 +1,9 @@ -# $NetBSD: GENERIC_XENHVM,v 1.1.2.4 2020/04/16 17:50:51 bouyer Exp $ +# $NetBSD: GENERIC_XENHVM,v 1.1.2.5 2020/04/20 19:46:03 bouyer Exp $ include "arch/amd64/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 Index: src/sys/arch/i386/conf/GENERIC_XENHVM diff -u src/sys/arch/i386/conf/GENERIC_XENHVM:1.1.2.1 src/sys/arch/i386/conf/GENERIC_XENHVM:1.1.2.2 --- src/sys/arch/i386/conf/GENERIC_XENHVM:1.1.2.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/i386/conf/GENERIC_XENHVM Mon Apr 20 19:46:04 2020 @@ -1,11 +1,10 @@ -# $NetBSD: GENERIC_XENHVM,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: GENERIC_XENHVM,v 1.1.2.2 2020/04/20 19:46:04 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
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/conf
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:43:33 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: std.amd64 Log Message: Use std.xenversion To generate a diff of this commit: cvs rdiff -u -r1.11.26.1 -r1.11.26.2 src/sys/arch/amd64/conf/std.amd64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/std.amd64 diff -u src/sys/arch/amd64/conf/std.amd64:1.11.26.1 src/sys/arch/amd64/conf/std.amd64:1.11.26.2 --- src/sys/arch/amd64/conf/std.amd64:1.11.26.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/amd64/conf/std.amd64 Mon Apr 20 19:43:32 2020 @@ -1,9 +1,10 @@ -# $NetBSD: std.amd64,v 1.11.26.1 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: std.amd64,v 1.11.26.2 2020/04/20 19:43:32 bouyer Exp $ # # standard, required NetBSD/amd64 'options' machine amd64 x86 xen include "conf/std" # MI standard options +include "arch/xen/conf/std.xenversion" options CPU_IN_CKSUM options EXEC_ELF64 # exec ELF binaries @@ -14,8 +15,6 @@ options MULTIPROCESSOR options CHILD_MAX=1024 # 160 is too few options OPEN_MAX=1024 # 128 is too few -options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface - mainbus0 at root cpu* at mainbus? ioapic* at mainbus? apid ?
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:42:10 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xengnt.c Log Message: Bad news: * grant table v2 is not supported for HVM guests on 4.11 at last. * see xen/arch/x86/hvm/hypercall.c in Xen sources (missing * GNTTABOP_get_status_frames) So restore grant table v1 for !XENPV To generate a diff of this commit: cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/arch/xen/xen/xengnt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xengnt.c diff -u src/sys/arch/xen/xen/xengnt.c:1.29.2.1 src/sys/arch/xen/xen/xengnt.c:1.29.2.2 --- src/sys/arch/xen/xen/xengnt.c:1.29.2.1 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/xen/xengnt.c Mon Apr 20 19:42:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xengnt.c,v 1.29.2.1 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xengnt.c,v 1.29.2.2 2020/04/20 19:42:10 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.29.2.1 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.29.2.2 2020/04/20 19:42:10 bouyer Exp $"); #include #include @@ -42,6 +42,18 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 #include #include +#include "opt_xen.h" + +/* + * grant table v2 is not supported for HVM guests on 4.11 at last. + * see xen/arch/x86/hvm/hypercall.c in Xen sources (missing + * GNTTABOP_get_status_frames) + */ + +#ifdef XENPV +#define USE_GRANT_V2 +#endif + /* #define XENDEBUG */ #ifdef XENDEBUG #define DPRINTF(x) printf x @@ -49,9 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 #define DPRINTF(x) #endif -#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) -#define NR_GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) - /* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8 @@ -59,8 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 int gnt_nr_grant_frames; /* Maximum number of frames that can make up the grant table */ int gnt_max_grant_frames; -/* Number of grant status frames */ -int gnt_status_frames; /* table of free grant entries */ grant_ref_t *gnt_entries; @@ -70,8 +77,19 @@ int last_gnt_entry; #define XENGNT_NO_ENTRY 0x /* VM address of the grant table */ +#ifdef USE_GRANT_V2 +#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) +#define NR_GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) + grant_entry_v2_t *grant_table; +/* Number of grant status frames */ +int gnt_status_frames; + grant_status_t *grant_status; +#else /* USE_GRANT_V2 */ +#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v1_t)) +grant_entry_v1_t *grant_table; +#endif /* USE_GRANT_V2 */ kmutex_t grant_lock; static grant_ref_t xengnt_get_entry(void); @@ -83,7 +101,6 @@ void xengnt_init(void) { struct gnttab_query_size query; - struct gnttab_set_version gntversion; int rc; int nr_grant_entries; int i; @@ -100,10 +117,14 @@ xengnt_init(void) */ gnt_nr_grant_frames = gnt_max_grant_frames; + +#ifdef USE_GRANT_V2 + struct gnttab_set_version gntversion; gntversion.version = 2; rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gntversion, 1); if (rc < 0 || gntversion.version != 2) panic("GNTTABOP_set_version 2 failed %d", rc); +#endif /* USE_GRANT_V2 */ nr_grant_entries = gnt_max_grant_frames * NR_GRANT_ENTRIES_PER_PAGE; @@ -118,12 +139,14 @@ xengnt_init(void) for (i = 0; i <= nr_grant_entries; i++) gnt_entries[i] = XENGNT_NO_ENTRY; +#ifdef USE_GRANT_V2 gnt_status_frames = round_page(nr_grant_entries * sizeof(grant_status_t)) / PAGE_SIZE; grant_status = (void *)uvm_km_alloc(kernel_map, gnt_status_frames * PAGE_SIZE, 0, UVM_KMF_VAONLY); if (grant_status == NULL) panic("xengnt_init() status no VM space"); +#endif /* USE_GRANT_V2 */ mutex_init(&grant_lock, MUTEX_DEFAULT, IPL_VM); @@ -171,8 +194,10 @@ xengnt_suspend(void) { /* Remove virtual => machine mapping for grant table */ pmap_kremove((vaddr_t)grant_table, gnt_nr_grant_frames * PAGE_SIZE); +#ifdef USE_GRANT_V2 /* Remove virtual => machine mapping for status table */ pmap_kremove((vaddr_t)grant_status, gnt_status_frames * PAGE_SIZE); +#endif pmap_update(pmap_kernel()); mutex_exit(&grant_lock); @@ -185,9 +210,11 @@ xengnt_suspend(void) { static int xengnt_map_status(void) { +#ifdef USE_GRANT_V2 gnttab_get_status_frames_t getstatus; uint64_t *pages; size_t sz; + int err; KASSERT(mutex_owned(&grant_lock)); @@ -204,9 +231,9 @@ xengnt_map_status(void) * get the status frames, and return the list of their virtual * addresses in 'pages' */ - if (HYPERVISOR_grant_table_op(GNTTABOP_get_status_frames, - &getstatus, 1) != 0) - panic("%s: get_status_frames failed", __func__); + if ((err
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:40:51 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xbdback_xenbus.c Log Message: Fix build with DIAGNOSTIC To generate a diff of this commit: cvs rdiff -u -r1.77.2.2 -r1.77.2.3 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.2 src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.3 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.2 Mon Apr 20 18:50:46 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 19:40:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.77.2.3 2020/04/20 19:40:51 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.3 2020/04/20 19:40:51 bouyer Exp $"); #include #include @@ -1049,7 +1049,6 @@ xbdback_co_main_done2(struct xbdback_ins { int work_to_do; - KASSERT(xbdi->xbdio_io == NULL); RING_FINAL_CHECK_FOR_REQUESTS(&xbdi->xbdi_ring.ring_n, work_to_do); if (work_to_do) xbdi->xbdi_cont = xbdback_co_main; @@ -1233,7 +1232,6 @@ static void * xbdback_co_do_io(struct xbdback_instance *xbdi, void *obj) { struct xbdback_io *xbd_io = xbdi->xbdi_io; - int nsegs __diagused; switch (xbd_io->xio_operation) { case BLKIF_OP_FLUSH_DISKCACHE:
CVS commit: [bouyer-xenpvh] src/sys/arch/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:40:24 UTC 2020 Modified Files: src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen files.xen.pv src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_bus_dma.c Log Message: We need xenbus_bus_dma_tag for PVHVM too, but without phys->machine translation To generate a diff of this commit: cvs rdiff -u -r1.180.2.5 -r1.180.2.6 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/xen/conf/files.xen.pv cvs rdiff -u -r1.28.10.1 -r1.28.10.2 src/sys/arch/xen/x86/xen_bus_dma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.180.2.5 src/sys/arch/xen/conf/files.xen:1.180.2.6 --- src/sys/arch/xen/conf/files.xen:1.180.2.5 Sun Apr 19 20:29:30 2020 +++ src/sys/arch/xen/conf/files.xen Mon Apr 20 19:40:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.180.2.5 2020/04/19 20:29:30 bouyer Exp $ +# $NetBSD: files.xen,v 1.180.2.6 2020/04/20 19:40:24 bouyer Exp $ defflag opt_xen.h XEN XENPVH XENPVHVM @@ -9,6 +9,7 @@ file arch/xen/xen/evtchn.c xen file arch/xen/xen/xengnt.c xen file arch/xen/x86/xen_mainbus.c xen file arch/xen/xen/xen_clock.c xen +file arch/xen/x86/xen_bus_dma.c xen define hypervisorbus {} define xendevbus {} Index: src/sys/arch/xen/conf/files.xen.pv diff -u src/sys/arch/xen/conf/files.xen.pv:1.1.2.3 src/sys/arch/xen/conf/files.xen.pv:1.1.2.4 --- src/sys/arch/xen/conf/files.xen.pv:1.1.2.3 Sun Apr 19 20:29:30 2020 +++ src/sys/arch/xen/conf/files.xen.pv Mon Apr 20 19:40:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen.pv,v 1.1.2.3 2020/04/19 20:29:30 bouyer Exp $ +# $NetBSD: files.xen.pv,v 1.1.2.4 2020/04/20 19:40:24 bouyer Exp $ file arch/xen/x86/autoconf.c xenpv file arch/xen/x86/x86_xpmap.c xenpv @@ -6,7 +6,6 @@ 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/x86/xen_bus_dma.c machdep & xenpv file arch/xen/x86/consinit.c machdep & xenpv file arch/xen/x86/pintr.c machdep & dom0ops & xenpv Index: src/sys/arch/xen/x86/xen_bus_dma.c diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.28.10.1 src/sys/arch/xen/x86/xen_bus_dma.c:1.28.10.2 --- src/sys/arch/xen/x86/xen_bus_dma.c:1.28.10.1 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/x86/xen_bus_dma.c Mon Apr 20 19:40:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_bus_dma.c,v 1.28.10.1 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xen_bus_dma.c,v 1.28.10.2 2020/04/20 19:40:23 bouyer Exp $ */ /* NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */ /*- @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.28.10.1 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.28.10.2 2020/04/20 19:40:23 bouyer Exp $"); #include #include @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: xen_bus_dma. #include -extern paddr_t avail_end; +#include "opt_xen.h" /* No special needs */ struct x86_bus_dma_tag xenbus_bus_dma_tag = { @@ -56,6 +56,10 @@ struct x86_bus_dma_tag xenbus_bus_dma_ta ._may_bounce = NULL, }; +#ifdef XENPV + +extern paddr_t avail_end; + /* Pure 2^n version of get_order */ static inline int get_order(unsigned long size) { @@ -318,3 +322,4 @@ dorealloc: return error; goto again; } +#endif /* XENPV */
CVS commit: [bouyer-xenpvh] src/sys/arch/i386/conf
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:38:54 UTC 2020 Modified Files: src/sys/arch/i386/conf [bouyer-xenpvh]: std.i386 std.xen Log Message: Fix build after merge To generate a diff of this commit: cvs rdiff -u -r1.35.26.1 -r1.35.26.2 src/sys/arch/i386/conf/std.i386 cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/arch/i386/conf/std.xen Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/std.i386 diff -u src/sys/arch/i386/conf/std.i386:1.35.26.1 src/sys/arch/i386/conf/std.i386:1.35.26.2 --- src/sys/arch/i386/conf/std.i386:1.35.26.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/i386/conf/std.i386 Mon Apr 20 19:38:54 2020 @@ -1,9 +1,10 @@ -# $NetBSD: std.i386,v 1.35.26.1 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: std.i386,v 1.35.26.2 2020/04/20 19:38:54 bouyer Exp $ # # standard, required NetBSD/i386 'options' machine i386 x86 xen include "conf/std" # MI standard options +include "arch/xen/conf/std.xenversion" options CPU_IN_CKSUM options EXEC_AOUT # exec a.out binaries @@ -18,7 +19,6 @@ options MPBIOS # configure CPUs and A options CHILD_MAX=1024 # 160 is too few options OPEN_MAX=1024 # 128 is too few -options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface mainbus0 at root cpu* at mainbus? Index: src/sys/arch/i386/conf/std.xen diff -u src/sys/arch/i386/conf/std.xen:1.1.4.2 src/sys/arch/i386/conf/std.xen:1.1.4.3 --- src/sys/arch/i386/conf/std.xen:1.1.4.2 Mon Apr 20 11:28:57 2020 +++ src/sys/arch/i386/conf/std.xen Mon Apr 20 19:38:54 2020 @@ -1,10 +1,13 @@ -# $NetBSD: std.xen,v 1.1.4.2 2020/04/20 11:28:57 bouyer Exp $ +# $NetBSD: std.xen,v 1.1.4.3 2020/04/20 19:38:54 bouyer Exp $ # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp # # standard, required NetBSD/i386 'options' -machine xen i386 +machine xen i386 x86 include "conf/std" # MI standard options +include "arch/xen/conf/files.xen.pv" + +options XEN #Xen support include "arch/xen/conf/std.xenversion"
CVS commit: [bouyer-xenpvh] src/sys/arch/i386/conf
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:38:11 UTC 2020 Modified Files: src/sys/arch/i386/conf [bouyer-xenpvh]: GENERIC Log Message: build with -g on the branch To generate a diff of this commit: cvs rdiff -u -r1.1227 -r1.1227.2.1 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1227 src/sys/arch/i386/conf/GENERIC:1.1227.2.1 --- src/sys/arch/i386/conf/GENERIC:1.1227 Sat Mar 28 08:35:36 2020 +++ src/sys/arch/i386/conf/GENERIC Mon Apr 20 19:38:11 2020 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1227 2020/03/28 08:35:36 isaki Exp $ +# $NetBSD: GENERIC,v 1.1227.2.1 2020/04/20 19:38:11 bouyer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1227 $" +#ident "GENERIC-$Revision: 1.1227.2.1 $" maxusers 64 # estimated number of users @@ -119,7 +119,7 @@ options DDB_HISTORY_SIZE=512 # enable h #options DDB_VERBOSE_HELP #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table #options KUBSAN # Kernel Undefined Behavior Sanitizer (kUBSan) #options UBSAN_ALWAYS_FATAL # (optional) Panic on all kUBSan reports #options SYSCALL_STATS # per syscall counts
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 18:50:46 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xbdback_xenbus.c Log Message: Bring in 1.82 and 1.83 from HEAD To generate a diff of this commit: cvs rdiff -u -r1.77.2.1 -r1.77.2.2 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.1 src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.2 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.1 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 18:50:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.77.2.1 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.1 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $"); #include #include @@ -74,9 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenb /* Need to alloc one extra page to account for possible mapping offset */ #define VBD_VA_SIZE (MAXPHYS + PAGE_SIZE) -struct xbdback_request; struct xbdback_io; -struct xbdback_fragment; struct xbdback_instance; /* @@ -98,8 +96,8 @@ typedef enum {WAITING, RUN, DISCONNECTIN * callback), the return value of a continuation can be set to NULL. In that * case, the thread will go back to sleeping and wait for the proper * condition before it starts processing requests again from where it left. - * Continuation state is "stored" in the xbdback instance (xbdi_cont and - * xbdi_cont_aux), and should only be manipulated by the instance thread. + * Continuation state is "stored" in the xbdback instance (xbdi_cont), + * and should only be manipulated by the instance thread. * * As xbdback(4) has to handle different sort of asynchronous events (Xen * event channels, biointr() soft interrupts, xenbus commands), the xbdi_lock @@ -109,36 +107,23 @@ typedef enum {WAITING, RUN, DISCONNECTIN * Here's how the call graph is supposed to be for a single I/O: * * xbdback_co_main() - *| - *| --> xbdback_co_cache_doflush() or NULL - *| | - *| - xbdback_co_cache_flush2() <- xbdback_co_do_io() <- - *|| | - *| |-> xbdback_co_cache_flush() -> xbdback_co_map_io()- + *| --> xbdback_co_cache_flush() + *| || + *| |-> xbdback_co_cache_doflush() or NULL + *| || + *| |-> xbdback_co_do_io() * xbdback_co_main_loop()-| - *| |-> xbdback_co_main_done() ---> xbdback_co_map_io()- - *| | | - *| -- xbdback_co_main_done2() <-- xbdback_co_do_io() <- + *| |-> xbdback_co_main_done2() or NULL *| | - *| --> xbdback_co_main() or NULL + *| --> xbdback_co_main_incr() -> xbdback_co_main_loop() *| * xbdback_co_io() -> xbdback_co_main_incr() -> xbdback_co_main_loop() *| - * xbdback_co_io_gotreq()--+--> xbdback_co_map_io() --- - *|| | - * -> xbdback_co_io_loop()| <- xbdback_co_do_io() <-- - * | | | | - * | | | |--> xbdback_co_io_gotio() - * | | | | - * | | xbdback_co_main_incr() | - * | | | | - * | | xbdback_co_main_loop() | - * | | | - * | xbdback_co_io_gotio2() <---| - * | | | - * | | |--> xbdback_co_io_gotfrag() - * | | | - * -- xbdback_co_io_gotfrag2() <-| + * xbdback_co_io_gotio() -> xbdback_map_shm() + *| | + *| xbdback_co_main_incr() -> xbdback_co_main_loop() + *| + * xbdback_co_do_io() *| * xbdback_co_main_incr() -> xbdback_co_main_loop() */ @@ -192,17 +177,12 @@ struct xbdback_instance { * continuation-ness (see above). */ RING_IDX xbdi_req_prod; /* limit on request indices */ - xbdback_cont_t xbdi_cont, xbdi_cont_aux; + xbdback_cont_t xbdi_cont; /* _request state: track requests fetched from ring */ struct xbdback_request *xbdi_req; /* if NULL, ignore following */ blkif_request_t xbdi_xen_req; - int xbdi_segno; /* _io state: I/O ass
CVS commit: [bouyer-xenpvh] src/sys
Module Name:src Committed By: bouyer Date: Mon Apr 20 11:29:15 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64 [bouyer-xenpvh]: aarch64_machdep.c cpufunc.c cpuswitch.S db_machdep.c db_trace.c genassym.cf locore.S pmap.c pmapboot.c trap.c vectors.S vm_machdep.c src/sys/arch/aarch64/conf [bouyer-xenpvh]: Makefile.aarch64 files.aarch64 src/sys/arch/aarch64/include [bouyer-xenpvh]: armreg.h asm.h cpufunc.h proc.h src/sys/arch/acorn32/acorn32 [bouyer-xenpvh]: rpc_machdep.c src/sys/arch/acorn32/conf [bouyer-xenpvh]: EB7500ATX GENERIC INSTALL LOWMEM_WSCONS NC src/sys/arch/acorn32/eb7500atx [bouyer-xenpvh]: eb7500atx_machdep.c src/sys/arch/alpha/include [bouyer-xenpvh]: asm.h src/sys/arch/amd64/conf [bouyer-xenpvh]: ALL GENERIC Makefile.amd64 XEN3_DOMU XEN3_PVHVM std.xen src/sys/arch/amd64/include [bouyer-xenpvh]: asan.h asm.h msan.h types.h src/sys/arch/arm/arm32 [bouyer-xenpvh]: arm32_machdep.c db_machdep.c pmap.c vm_machdep.c src/sys/arch/arm/at91 [bouyer-xenpvh]: at91bus.c src/sys/arch/arm/conf [bouyer-xenpvh]: files.arm src/sys/arch/arm/cortex [bouyer-xenpvh]: gic.c gicv3.c src/sys/arch/arm/imx [bouyer-xenpvh]: imx23_digfilt.c src/sys/arch/arm/include [bouyer-xenpvh]: asm.h bus_defs.h bus_funcs.h src/sys/arch/arm/include/arm32 [bouyer-xenpvh]: pmap.h src/sys/arch/arm/omap [bouyer-xenpvh]: omap3_sdmareg.h omap3_sdmavar.h omapfbreg.h src/sys/arch/arm/ti [bouyer-xenpvh]: omap3_dssreg.h src/sys/arch/arm/xscale [bouyer-xenpvh]: pxa2x0_ac97.c src/sys/arch/cats/cats [bouyer-xenpvh]: cats_machdep.c src/sys/arch/cats/conf [bouyer-xenpvh]: GENERIC INSTALL src/sys/arch/evbarm/adi_brh [bouyer-xenpvh]: brh_machdep.c src/sys/arch/evbarm/armadillo [bouyer-xenpvh]: armadillo9_machdep.c src/sys/arch/evbarm/conf [bouyer-xenpvh]: ADI_BRH ARMADAXP ARMADILLO-IOT-G3 ARMADILLO210 ARMADILLO9 BCM5301X BCM56340 CP3100 CUBOX CUBOX-I DNS323 DUOVERO GEMINI GEMINI_MASTER GEMINI_SLAVE GENERIC GENERIC.common GENERIC64 GUMSTIX HDL_G HPT5325 HUMMINGBOARD IMX IMX31LITE IMX6UL-STARTER INTEGRATOR INTEGRATOR_CP IQ31244 IQ80310 IQ80321 IXDP425 IXM1200 IYONIX KOBO KUROBOX_PRO KURONAS_X4 LUBBOCK MARVELL_NAS MINI2440 N900 NAPPI NETWALKER NSLU2 OMAP5EVM OPENBLOCKS_A6 OPENBLOCKS_AX3 OSK5912 PANDABOARD PARALLELLA PEPPER RPI SHEEVAPLUG SMDK2410 SMDK2800 TEAMASA_NPWR TEAMASA_NPWR_FC TISDP2420 TISDP2430 TS7200 TWINTAIL VIPER VIRT VTC100 ZAO425 ZEDBOARD src/sys/arch/evbarm/g42xxeb [bouyer-xenpvh]: g42xxeb_machdep.c src/sys/arch/evbarm/gumstix [bouyer-xenpvh]: gumstix_machdep.c src/sys/arch/evbarm/hdl_g [bouyer-xenpvh]: hdlg_machdep.c src/sys/arch/evbarm/imx31 [bouyer-xenpvh]: imx31lk_machdep.c src/sys/arch/evbarm/integrator [bouyer-xenpvh]: integrator_machdep.c src/sys/arch/evbarm/iq80310 [bouyer-xenpvh]: iq80310_machdep.c src/sys/arch/evbarm/iq80321 [bouyer-xenpvh]: iq80321_machdep.c src/sys/arch/evbarm/ixdp425 [bouyer-xenpvh]: ixdp425_machdep.c src/sys/arch/evbarm/ixm1200 [bouyer-xenpvh]: ixm1200_machdep.c src/sys/arch/evbarm/iyonix [bouyer-xenpvh]: iyonix_machdep.c src/sys/arch/evbarm/lubbock [bouyer-xenpvh]: lubbock_machdep.c src/sys/arch/evbarm/mini2440 [bouyer-xenpvh]: mini2440_machdep.c src/sys/arch/evbarm/mmnet [bouyer-xenpvh]: mmnet_machdep.c src/sys/arch/evbarm/mpcsa [bouyer-xenpvh]: mpcsa_machdep.c src/sys/arch/evbarm/npwr_fc [bouyer-xenpvh]: npwr_fc_machdep.c src/sys/arch/evbarm/nslu2 [bouyer-xenpvh]: nslu2_machdep.c src/sys/arch/evbarm/smdk2xx0 [bouyer-xenpvh]: smdk2410_machdep.c smdk2800_machdep.c src/sys/arch/evbarm/tsarm [bouyer-xenpvh]: tsarm_machdep.c src/sys/arch/evbarm/viper [bouyer-xenpvh]: viper_machdep.c src/sys/arch/hpcarm/conf [bouyer-xenpvh]: IPAQ JORNADA720 JORNADA820 NETBOOKPRO WZERO3 src/sys/arch/hpcarm/hpcarm [bouyer-xenpvh]: pxa2x0_hpc_machdep.c sa11x0_hpc_machdep.c src/sys/arch/hppa/dev [bouyer-xenpvh]: cpu.c src/sys/arch/hppa/gsc [bouyer-xenpvh]: if_ie_gsc.c src/sys/arch/hppa/hppa [bouyer-xenpvh]: fpu.c hppa_machdep.c machdep.c pmap.c src/sys/arch/hppa/include [bouyer-xenpvh]: asm.h cpu.h types.h src/sys/arch/i386/conf [bouyer-xenpvh]: XEN3PAE_DOM0 XEN3PAE_DOMU XEN3PAE_PVHVM src/sys/arch/i386/include [bouyer-xenpvh]: asm.h src/sys/arch/ia64/include [bouyer-xenpvh]: asm.h src/sys/arch/iyonix/conf [bouyer-xenpvh]: GENERIC src/sys/arch/iyonix/iyonix [bouyer-xenpvh]: iyonix_machdep.c src/sys/arch/m68k/in
CVS commit: [bouyer-xenpvh] src/sys/arch/xen
Module Name:src Committed By: bouyer Date: Sun Apr 19 20:29:30 UTC 2020 Modified Files: src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen files.xen.pv src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c Log Message: Move xen_ipi.c to XENPV only. Make sure we don't need to send events to remote CPUs (outside of IPIs) To generate a diff of this commit: cvs rdiff -u -r1.180.2.4 -r1.180.2.5 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/xen/conf/files.xen.pv cvs rdiff -u -r1.36.8.4 -r1.36.8.5 src/sys/arch/xen/x86/hypervisor_machdep.c cvs rdiff -u -r1.88.2.8 -r1.88.2.9 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.180.2.4 src/sys/arch/xen/conf/files.xen:1.180.2.5 --- src/sys/arch/xen/conf/files.xen:1.180.2.4 Thu Apr 16 19:23:50 2020 +++ src/sys/arch/xen/conf/files.xen Sun Apr 19 20:29:30 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.180.2.4 2020/04/16 19:23:50 bouyer Exp $ +# $NetBSD: files.xen,v 1.180.2.5 2020/04/19 20:29:30 bouyer Exp $ defflag opt_xen.h XEN XENPVH XENPVHVM @@ -7,7 +7,6 @@ file arch/xen/x86/xen_intr.c xen file arch/xen/xen/xen_machdep.c xen file arch/xen/xen/evtchn.c xen file arch/xen/xen/xengnt.c xen -file arch/xen/x86/xen_ipi.c multiprocessor & xen file arch/xen/x86/xen_mainbus.c xen file arch/xen/xen/xen_clock.c xen Index: src/sys/arch/xen/conf/files.xen.pv diff -u src/sys/arch/xen/conf/files.xen.pv:1.1.2.2 src/sys/arch/xen/conf/files.xen.pv:1.1.2.3 --- src/sys/arch/xen/conf/files.xen.pv:1.1.2.2 Thu Apr 16 19:23:50 2020 +++ src/sys/arch/xen/conf/files.xen.pv Sun Apr 19 20:29:30 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen.pv,v 1.1.2.2 2020/04/16 19:23:50 bouyer Exp $ +# $NetBSD: files.xen.pv,v 1.1.2.3 2020/04/19 20:29:30 bouyer Exp $ file arch/xen/x86/autoconf.c xenpv file arch/xen/x86/x86_xpmap.c xenpv @@ -10,6 +10,8 @@ file arch/xen/x86/xen_bus_dma.c machdep file arch/xen/x86/consinit.c machdep & xenpv file arch/xen/x86/pintr.c machdep & dom0ops & xenpv +file arch/xen/x86/xen_ipi.c multiprocessor & xenpv + # # System bus types # Index: src/sys/arch/xen/x86/hypervisor_machdep.c diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.4 src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.5 --- src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.4 Sat Apr 18 15:06:18 2020 +++ src/sys/arch/xen/x86/hypervisor_machdep.c Sun Apr 19 20:29:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor_machdep.c,v 1.36.8.4 2020/04/18 15:06:18 bouyer Exp $ */ +/* $NetBSD: hypervisor_machdep.c,v 1.36.8.5 2020/04/19 20:29:30 bouyer Exp $ */ /* * @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.4 2020/04/18 15:06:18 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.5 2020/04/19 20:29:30 bouyer Exp $"); #include #include @@ -291,6 +291,7 @@ do_hypervisor_callback(struct intrframe #endif } +#if 0 void hypervisor_send_event(struct cpu_info *ci, unsigned int ev) { @@ -323,6 +324,7 @@ hypervisor_send_event(struct cpu_info *c } } } +#endif void hypervisor_unmask_event(unsigned int ev) @@ -422,6 +424,8 @@ hypervisor_set_ipending(uint32_t imask, KASSERT(ci->ci_isources[sir] != NULL); ci->ci_isources[sir]->ipl_evt_mask1 |= 1UL << l1; ci->ci_isources[sir]->ipl_evt_mask2[l1] |= 1UL << l2; + KASSERT(ci == curcpu()); +#if 0 if (__predict_false(ci != curcpu())) { if (xen_send_ipi(ci, XEN_IPI_HVCB)) { panic("hypervisor_set_ipending: " @@ -429,6 +433,7 @@ hypervisor_set_ipending(uint32_t imask, (int) ci->ci_cpuid, ci->ci_vcpuid); } } +#endif } void Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.88.2.8 src/sys/arch/xen/xen/evtchn.c:1.88.2.9 --- src/sys/arch/xen/xen/evtchn.c:1.88.2.8 Sun Apr 19 19:39:11 2020 +++ src/sys/arch/xen/xen/evtchn.c Sun Apr 19 20:29:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.88.2.8 2020/04/19 19:39:11 bouyer Exp $ */ +/* $NetBSD: evtchn.c,v 1.88.2.9 2020/04/19 20:29:30 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.8 2020/04/19 19:39:11 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.9 2020/04/19 20:29:30 bouyer Exp $"); #include "opt_xen.h" #include "isa.h" @@ -376,12 +376,15 @@ evtchn_do_event(int evtch, struct intrfr mutex_spin_enter(&evtlock[evtch]); ih = evtsource[evtch]->ev_handlers; while (ih != NULL) { + KASSERT(ih->ih_cpu == ci); +#if 0 if (ih->ih_cpu != ci) { hypervisor_send_event(ih->ih_cpu, evtch); iplmask &= ~(1 << XEN_IPL2SIR(ih->ih_level)); ih = ih->ih_evt_next; continue; } +#endif if (ih->ih_level <= ilevel) { #ifdef IRQ_DEBUG i
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sun Apr 19 19:39:11 UTC 2020 Modified Files: src/sys/arch/x86/include [bouyer-xenpvh]: intr.h pic.h src/sys/arch/x86/pci [bouyer-xenpvh]: msipic.c src/sys/arch/x86/x86 [bouyer-xenpvh]: i8259.c intr.c ioapic.c lapic.c src/sys/arch/xen/include [bouyer-xenpvh]: intr.h src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c xen_clock.c Log Message: Add per-PIC callbacks for interrupt_get_devname(), interrupt_get_assigned() and interrupt_get_count(). Implement Xen-specific callbacks for PIC_XEN and use the x86 one for others. In event_set_handler(), call intr_allocate_io_intrsource() so that events appears in interrupt list (intrctl list). To generate a diff of this commit: cvs rdiff -u -r1.61.6.4 -r1.61.6.5 src/sys/arch/x86/include/intr.h cvs rdiff -u -r1.9 -r1.9.14.1 src/sys/arch/x86/include/pic.h cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/arch/x86/pci/msipic.c cvs rdiff -u -r1.23.10.1 -r1.23.10.2 src/sys/arch/x86/x86/i8259.c cvs rdiff -u -r1.150.6.4 -r1.150.6.5 src/sys/arch/x86/x86/intr.c cvs rdiff -u -r1.63 -r1.63.8.1 src/sys/arch/x86/x86/ioapic.c cvs rdiff -u -r1.76.6.3 -r1.76.6.4 src/sys/arch/x86/x86/lapic.c cvs rdiff -u -r1.53.6.2 -r1.53.6.3 src/sys/arch/xen/include/intr.h cvs rdiff -u -r1.21.2.6 -r1.21.2.7 src/sys/arch/xen/x86/xen_intr.c cvs rdiff -u -r1.88.2.7 -r1.88.2.8 src/sys/arch/xen/xen/evtchn.c cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/xen/xen/xen_clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/intr.h diff -u src/sys/arch/x86/include/intr.h:1.61.6.4 src/sys/arch/x86/include/intr.h:1.61.6.5 --- src/sys/arch/x86/include/intr.h:1.61.6.4 Sun Apr 19 11:40:30 2020 +++ src/sys/arch/x86/include/intr.h Sun Apr 19 19:39:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.61.6.4 2020/04/19 11:40:30 bouyer Exp $ */ +/* $NetBSD: intr.h,v 1.61.6.5 2020/04/19 19:39:10 bouyer Exp $ */ /*- * Copyright (c) 1998, 2001, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc. @@ -39,6 +39,7 @@ #ifdef _KERNEL #include +#include #else #include #endif @@ -237,6 +238,10 @@ int x86_send_ipi(struct cpu_info *, int) void x86_broadcast_ipi(int); void x86_ipi_handler(void); +void x86_intr_get_devname(const char *, char *, size_t); +void x86_intr_get_assigned(const char *, kcpuset_t *); +uint64_t x86_intr_get_count(const char *, u_int); + #ifndef XENPV extern void (* const ipifunc[X86_NIPI])(struct cpu_info *); #endif Index: src/sys/arch/x86/include/pic.h diff -u src/sys/arch/x86/include/pic.h:1.9 src/sys/arch/x86/include/pic.h:1.9.14.1 --- src/sys/arch/x86/include/pic.h:1.9 Sat Nov 4 10:26:14 2017 +++ src/sys/arch/x86/include/pic.h Sun Apr 19 19:39:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pic.h,v 1.9 2017/11/04 10:26:14 cherry Exp $ */ +/* $NetBSD: pic.h,v 1.9.14.1 2020/04/19 19:39:10 bouyer Exp $ */ #ifndef _X86_PIC_H #define _X86_PIC_H @@ -23,6 +23,10 @@ struct pic { struct intrstub *pic_edge_stubs; struct ioapic_softc *pic_ioapic; /* if pic_type == PIC_IOAPIC */ struct msipic *pic_msipic; /* if (pic_type == PIC_MSI) || (pic_type == PIC_MSIX) */ + /* interface for subr_interrupt.c */ + void (*pic_intr_get_devname)(const char *, char *, size_t); + void (*pic_intr_get_assigned)(const char *, kcpuset_t *); + uint64_t (*pic_intr_get_count)(const char *, u_int); }; /* Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.20 src/sys/arch/x86/pci/msipic.c:1.20.6.1 --- src/sys/arch/x86/pci/msipic.c:1.20 Mon Dec 2 03:06:51 2019 +++ src/sys/arch/x86/pci/msipic.c Sun Apr 19 19:39:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.20 2019/12/02 03:06:51 msaitoh Exp $ */ +/* $NetBSD: msipic.c,v 1.20.6.1 2020/04/19 19:39:10 bouyer Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.20 2019/12/02 03:06:51 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.20.6.1 2020/04/19 19:39:10 bouyer Exp $"); #include "opt_intrdebug.h" @@ -436,6 +436,9 @@ static struct pic msi_pic_tmpl = { .pic_hwunmask = msi_hwunmask, .pic_addroute = msi_addroute, .pic_delroute = msi_delroute, + .pic_intr_get_devname = x86_intr_get_devname, + .pic_intr_get_assigned = x86_intr_get_assigned, + .pic_intr_get_count = x86_intr_get_count, }; /* @@ -611,6 +614,9 @@ static struct pic msix_pic_tmpl = { .pic_hwunmask = msix_hwunmask, .pic_addroute = msix_addroute, .pic_delroute = msix_delroute, + .pic_intr_get_devname = x86_intr_get_devname, + .pic_intr_get_assigned = x86_intr_get_assigned, + .pic_intr_get_count = x86_intr_get_count, }; struct pic * Index: src/sys/arch/x86/x86/i8259.c diff -u src/sys/arch/x86/x86/i8259.c:1.23.10.1 src/sys/arch/x86/x86/i8259.c:1.23.10.2 --- src/sys/arch/x86/x86/i8259.c:1.23.10.1 Sun Apr 12 17:25:52 20
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sun Apr 19 11:40:31 UTC 2020 Modified Files: src/sys/arch/x86/include [bouyer-xenpvh]: intr.h src/sys/arch/x86/x86 [bouyer-xenpvh]: intr.c x86_softintr.c src/sys/arch/xen/include [bouyer-xenpvh]: evtchn.h src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c Log Message: Add a struct pic * member to struct intrhand. This will be used for interrupt_get_count() For Xen remplace pic_type with a pointer to the pic, and add a pointer to intrhand, in struct pintrhand Make event_set_handler return the pointer to struct intrhand. Don't allocate a fake intrhand in xen_intr_establish_xname(), use the one returned by event_set_handler(). To generate a diff of this commit: cvs rdiff -u -r1.61.6.3 -r1.61.6.4 src/sys/arch/x86/include/intr.h cvs rdiff -u -r1.150.6.3 -r1.150.6.4 src/sys/arch/x86/x86/intr.c cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/x86/x86/x86_softintr.c cvs rdiff -u -r1.28 -r1.28.2.1 src/sys/arch/xen/include/evtchn.h cvs rdiff -u -r1.21.2.5 -r1.21.2.6 src/sys/arch/xen/x86/xen_intr.c cvs rdiff -u -r1.88.2.6 -r1.88.2.7 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/intr.h diff -u src/sys/arch/x86/include/intr.h:1.61.6.3 src/sys/arch/x86/include/intr.h:1.61.6.4 --- src/sys/arch/x86/include/intr.h:1.61.6.3 Thu Apr 16 08:46:35 2020 +++ src/sys/arch/x86/include/intr.h Sun Apr 19 11:40:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.61.6.3 2020/04/16 08:46:35 bouyer Exp $ */ +/* $NetBSD: intr.h,v 1.61.6.4 2020/04/19 11:40:30 bouyer Exp $ */ /*- * Copyright (c) 1998, 2001, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc. @@ -130,19 +130,7 @@ struct intrsource { */ struct intrhand { -#if defined(XEN) - /* - * Note: This is transitional and will go away. - * The only current consumer is xen_intr_disestablish() - * - * We ought to use a union here, but too much effort. - * We use this field to tear down the cookie handed to us - * via x86/intr.c:intr_disestablish(); - * Interestingly, the intr_establish_xname() function returns - * a "void *" - so we abuse this for now. - */ - int pic_type; /* Overloading wrt struct pintrhand */ -#endif + struct pic *ih_pic; int (*ih_fun)(void *); void *ih_arg; int ih_level; Index: src/sys/arch/x86/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.150.6.3 src/sys/arch/x86/x86/intr.c:1.150.6.4 --- src/sys/arch/x86/x86/intr.c:1.150.6.3 Thu Apr 16 09:45:57 2020 +++ src/sys/arch/x86/x86/intr.c Sun Apr 19 11:40:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.150.6.3 2020/04/16 09:45:57 bouyer Exp $ */ +/* $NetBSD: intr.c,v 1.150.6.4 2020/04/19 11:40:30 bouyer Exp $ */ /* * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.3 2020/04/16 09:45:57 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.4 2020/04/19 11:40:30 bouyer Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -880,6 +880,7 @@ intr_establish_xname(int legacy_irq, str /* nothing */; } + ih->ih_pic = pic; ih->ih_fun = ih->ih_realfun = handler; ih->ih_arg = ih->ih_realarg = arg; ih->ih_prevp = p; @@ -1302,6 +1303,7 @@ cpu_intr_init(struct cpu_info *ci) isp = kmem_zalloc(sizeof(*isp), KM_SLEEP); isp->is_recurse = Xrecurse_lapic_ltimer; isp->is_resume = Xresume_lapic_ltimer; + fake_timer_intrhand.ih_pic = &local_pic; fake_timer_intrhand.ih_level = IPL_CLOCK; isp->is_handlers = &fake_timer_intrhand; isp->is_pic = &local_pic; @@ -1315,6 +1317,7 @@ cpu_intr_init(struct cpu_info *ci) isp = kmem_zalloc(sizeof(*isp), KM_SLEEP); isp->is_recurse = Xrecurse_lapic_ipi; isp->is_resume = Xresume_lapic_ipi; + fake_ipi_intrhand.ih_pic = &local_pic; fake_ipi_intrhand.ih_level = IPL_HIGH; isp->is_handlers = &fake_ipi_intrhand; isp->is_pic = &local_pic; Index: src/sys/arch/x86/x86/x86_softintr.c diff -u src/sys/arch/x86/x86/x86_softintr.c:1.1.2.1 src/sys/arch/x86/x86/x86_softintr.c:1.1.2.2 --- src/sys/arch/x86/x86/x86_softintr.c:1.1.2.1 Sat Apr 11 18:26:07 2020 +++ src/sys/arch/x86/x86/x86_softintr.c Sun Apr 19 11:40:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_softintr.c,v 1.1.2.1 2020/04/11 18:26:07 bouyer Exp $ */ +/* $NetBSD: x86_softintr.c,v 1.1.2.2 2020/04/19 11:40:30 bouyer Exp $ */ /* * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: x86_softintr.c,v 1.1.2.1 2020/04/11 18:26:07 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_softintr.c,v 1.1.2.2 2020/04/19 11:40:30 bouyer Exp $"); #include #include @@ -226,6 +226,7 @@ x86_init_preempt(struct cpu_info *ci) isp = kmem_zalloc(sizeof(*isp), KM_SLEEP); isp->is_recurse = Xrecurse_preempt; isp->is_resume = Xresu
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Sat Apr 18 20:36:31 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c Log Message: If we get an event for another CPU just ignore it. The hypervisor will callback on the other CPU anyway. To generate a diff of this commit: cvs rdiff -u -r1.88.2.5 -r1.88.2.6 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.88.2.5 src/sys/arch/xen/xen/evtchn.c:1.88.2.6 --- src/sys/arch/xen/xen/evtchn.c:1.88.2.5 Sat Apr 18 15:06:18 2020 +++ src/sys/arch/xen/xen/evtchn.c Sat Apr 18 20:36:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.88.2.5 2020/04/18 15:06:18 bouyer Exp $ */ +/* $NetBSD: evtchn.c,v 1.88.2.6 2020/04/18 20:36:31 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.5 2020/04/18 15:06:18 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.6 2020/04/18 20:36:31 bouyer Exp $"); #include "opt_xen.h" #include "isa.h" @@ -341,15 +341,14 @@ evtchn_do_event(int evtch, struct intrfr } KASSERTMSG(evtsource[evtch] != NULL, "unknown event %d", evtch); + + if (evtsource[evtch]->ev_cpu != ci) + return 0; + ci->ci_data.cpu_nintr++; evtsource[evtch]->ev_evcnt.ev_count++; ilevel = ci->ci_ilevel; - if (evtsource[evtch]->ev_cpu != ci /* XXX: get stats */) { - hypervisor_send_event(evtsource[evtch]->ev_cpu, evtch); - return 0; - } - if (evtsource[evtch]->ev_maxlevel <= ilevel) { #ifdef IRQ_DEBUG if (evtch == IRQ_DEBUG)
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 18 20:03:02 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: vector.S src/sys/arch/i386/i386 [bouyer-xenpvh]: vector.S src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c Log Message: If possible, register a per-cpu callback via HVMOP_set_evtchn_upcall_vector. >From FreeBSD. This requires acking the interrupt in hypervisor_pvhvm_callback. Don't try to use x86_cpu_idle_xen() for PVHVM, it cause the domU to hang. FreeBSD doesn't seem to use it either. To generate a diff of this commit: cvs rdiff -u -r1.73.6.5 -r1.73.6.6 src/sys/arch/amd64/amd64/vector.S cvs rdiff -u -r1.85.6.6 -r1.85.6.7 src/sys/arch/i386/i386/vector.S cvs rdiff -u -r1.73.2.6 -r1.73.2.7 src/sys/arch/xen/xen/hypervisor.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/vector.S diff -u src/sys/arch/amd64/amd64/vector.S:1.73.6.5 src/sys/arch/amd64/amd64/vector.S:1.73.6.6 --- src/sys/arch/amd64/amd64/vector.S:1.73.6.5 Thu Apr 16 17:50:51 2020 +++ src/sys/arch/amd64/amd64/vector.S Sat Apr 18 20:03:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.73.6.5 2020/04/16 17:50:51 bouyer Exp $ */ +/* $NetBSD: vector.S,v 1.73.6.6 2020/04/18 20:03:02 bouyer Exp $ */ /* * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. @@ -772,6 +772,14 @@ IDTVEC(hypervisor_pvhvm_callback) incl CPUVAR(IDEPTH) movq %rsp,%rdi call do_hypervisor_callback +#ifndef XENPV + movzbl _C_LABEL(xenhvm_use_percpu_callback),%edi + testl %edi, %edi + jz 1f + movq _C_LABEL(local_apic_va),%rdi + movl $0,LAPIC_EOI(%rdi) +1: +#endif jmp _C_LABEL(Xdoreti) IDTVEC_END(hypervisor_pvhvm_callback) TEXT_USER_END Index: src/sys/arch/i386/i386/vector.S diff -u src/sys/arch/i386/i386/vector.S:1.85.6.6 src/sys/arch/i386/i386/vector.S:1.85.6.7 --- src/sys/arch/i386/i386/vector.S:1.85.6.6 Thu Apr 16 17:50:52 2020 +++ src/sys/arch/i386/i386/vector.S Sat Apr 18 20:03:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.85.6.6 2020/04/16 17:50:52 bouyer Exp $ */ +/* $NetBSD: vector.S,v 1.85.6.7 2020/04/18 20:03:02 bouyer Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.6 2020/04/16 17:50:52 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.7 2020/04/18 20:03:02 bouyer Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -1019,6 +1019,14 @@ IDTVEC(hypervisor_pvhvm_callback) * Xdoreti needs it too. */ call do_hypervisor_callback +#ifndef XENPV + movzbl _C_LABEL(xenhvm_use_percpu_callback),%eax + testl %eax, %eax + jz 1f + movl _C_LABEL(local_apic_va),%eax + movl $0, LAPIC_EOI(%eax) +1: +#endif jmp _C_LABEL(Xdoreti) IDTVEC_END(hypervisor_pvhvm_callback) END(hypervisor_callback) Index: src/sys/arch/xen/xen/hypervisor.c diff -u src/sys/arch/xen/xen/hypervisor.c:1.73.2.6 src/sys/arch/xen/xen/hypervisor.c:1.73.2.7 --- src/sys/arch/xen/xen/hypervisor.c:1.73.2.6 Sat Apr 18 15:06:18 2020 +++ src/sys/arch/xen/xen/hypervisor.c Sat Apr 18 20:03:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.73.2.6 2020/04/18 15:06:18 bouyer Exp $ */ +/* $NetBSD: hypervisor.c,v 1.73.2.7 2020/04/18 20:03:02 bouyer Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.6 2020/04/18 15:06:18 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.7 2020/04/18 20:03:02 bouyer Exp $"); #include #include @@ -207,6 +207,8 @@ enum { #ifdef XENPVHVM +bool xenhvm_use_percpu_callback = 0; + static bool xen_check_hypervisordev(void) { @@ -373,7 +375,6 @@ xen_hvm_init(void) delay_func = xen_delay; x86_initclock_func = xen_initclocks; x86_cpu_initclock_func = xen_cpu_initclocks; - x86_cpu_idle_set(x86_cpu_idle_xen, "xen", true); vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */ return 1; } @@ -383,6 +384,8 @@ xen_hvm_init_cpu(struct cpu_info *ci) { u_int32_t descs[4]; struct xen_hvm_param xen_hvm_param; + int error; + static bool again = 0; if (vm_guest != VM_GUEST_XENPVHVM) return 0; @@ -410,13 +413,43 @@ xen_hvm_init_cpu(struct cpu_info *ci) /* val[63:56] = 2, val[7:0] = vec */ xen_hvm_param.value = ((int64_t)0x2 << 56) | xen_hvm_vec; + /* First try to set up a per-cpu vector. */ + if (!again || xenhvm_use_percpu_callback) { + struct xen_hvm_evtchn_upcall_vector xen_hvm_uvec; + xen_hvm_uvec.vcpu = ci->ci_vcpuid; + xen_hvm_uvec.vector = xen_hvm_vec; + + xenhvm_use_percpu_callback = 1; + error = HYPERVISOR_hvm_op( + HVMOP_set_evtchn_upcall_vector, &xen_hvm_uvec); + if (error < 0) { + aprint_error_dev(ci->ci_dev, + "failed to set event upcall vector: %d\n", error); + if (again) +panic("event upcall vector"); + aprint_error_dev(ci->ci_dev, + "falling back to global vector\n"); + } else { + /*
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 18 15:06:18 UTC 2020 Modified Files: src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h cpuvar.h src/sys/arch/x86/x86 [bouyer-xenpvh]: cpu.c mainbus.c src/sys/arch/xen/include [bouyer-xenpvh]: hypervisor.h xen.h src/sys/arch/xen/x86 [bouyer-xenpvh]: cpu.c hypervisor_machdep.c xen_ipi.c xen_mainbus.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c hypervisor.c xen_clock.c Log Message: Add PVHVM multiprocessor support: We need the hypervisor to be set up before cpus attaches. Move hypervisor setup to a new function xen_hvm_init(), called at the beggining of mainbus_attach(). This function searches the cfdata[] array to see if the hypervisor device is enabled (so you can disable PV support with disable hypervisor from userconf). For HVM, ci_cpuid doens't match the virtual CPU index needed by Xen. Introduce ci_vcpuid to cpu_info. Introduce xen_hvm_init_cpu(), to be called for each CPU in in its context, which initialize ci_vcpuid and ci_vcpu, and setup the event callback. Change Xen code to use ci_vcpuid. Do not call lapic_calibrate_timer() for VM_GUEST_XENPVHVM, we will use Xen timers. Don't call lapic_initclocks() from cpu_hatch(); instead set x86_cpu_initclock_func to lapic_initclocks() in lapic_calibrate_timer(), and call *(x86_cpu_initclock_func)() from cpu_hatch(). Also call x86_cpu_initclock_func from cpu_attach() for the boot CPU. As x86_cpu_initclock_func is called for all CPUs, x86_initclock_func can be a NOP for lapic timer. Reorganize Xen code for x86_initclock_func/x86_cpu_initclock_func. Move x86_cpu_idle_xen() to hypervisor_machdep.c To generate a diff of this commit: cvs rdiff -u -r1.117.4.5 -r1.117.4.6 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.51 -r1.51.10.1 src/sys/arch/x86/include/cpuvar.h cvs rdiff -u -r1.181.4.2 -r1.181.4.3 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.3.12.2 -r1.3.12.3 src/sys/arch/x86/x86/mainbus.c cvs rdiff -u -r1.49.10.2 -r1.49.10.3 src/sys/arch/xen/include/hypervisor.h cvs rdiff -u -r1.44 -r1.44.8.1 src/sys/arch/xen/include/xen.h cvs rdiff -u -r1.133 -r1.133.4.1 src/sys/arch/xen/x86/cpu.c cvs rdiff -u -r1.36.8.3 -r1.36.8.4 src/sys/arch/xen/x86/hypervisor_machdep.c cvs rdiff -u -r1.35.6.3 -r1.35.6.4 src/sys/arch/xen/x86/xen_ipi.c cvs rdiff -u -r1.6.12.2 -r1.6.12.3 src/sys/arch/xen/x86/xen_mainbus.c cvs rdiff -u -r1.88.2.4 -r1.88.2.5 src/sys/arch/xen/xen/evtchn.c cvs rdiff -u -r1.73.2.5 -r1.73.2.6 src/sys/arch/xen/xen/hypervisor.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/xen/xen/xen_clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.117.4.5 src/sys/arch/x86/include/cpu.h:1.117.4.6 --- src/sys/arch/x86/include/cpu.h:1.117.4.5 Thu Apr 16 17:44:54 2020 +++ src/sys/arch/x86/include/cpu.h Sat Apr 18 15:06:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.117.4.5 2020/04/16 17:44:54 bouyer Exp $ */ +/* $NetBSD: cpu.h,v 1.117.4.6 2020/04/18 15:06:18 bouyer Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -223,6 +223,7 @@ struct cpu_info { uint32_t ci_flags __aligned(64);/* general flags */ uint32_t ci_acpiid; /* our ACPI/MADT ID */ uint32_t ci_initapicid; /* our initial APIC ID */ + uint32_t ci_vcpuid; /* our CPU id for hypervisor */ cpuid_t ci_cpuid; /* our CPU ID */ struct cpu_info *ci_next; /* next cpu */ @@ -530,6 +531,7 @@ void lwp_trampoline(void); void xen_startrtclock(void); void xen_delay(unsigned int); void xen_initclocks(void); +void xen_cpu_initclocks(void); void xen_suspendclocks(struct cpu_info *); void xen_resumeclocks(struct cpu_info *); #endif /* XEN */ Index: src/sys/arch/x86/include/cpuvar.h diff -u src/sys/arch/x86/include/cpuvar.h:1.51 src/sys/arch/x86/include/cpuvar.h:1.51.10.1 --- src/sys/arch/x86/include/cpuvar.h:1.51 Mon Feb 11 14:59:32 2019 +++ src/sys/arch/x86/include/cpuvar.h Sat Apr 18 15:06:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.51 2019/02/11 14:59:32 cherry Exp $ */ +/* $NetBSD: cpuvar.h,v 1.51.10.1 2020/04/18 15:06:18 bouyer Exp $ */ /*- * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. @@ -99,6 +99,7 @@ struct cpufeature_attach_args { #include #if defined(_KERNEL_OPT) #include "opt_multiprocessor.h" +#include "opt_xen.h" #endif /* defined(_KERNEL_OPT) */ extern int (*x86_ipi)(int, int, int); @@ -115,7 +116,7 @@ void cpu_init_first(void); void x86_cpu_idle_init(void); void x86_cpu_idle_halt(void); void x86_cpu_idle_mwait(void); -#ifdef XENPV +#ifdef XEN void x86_cpu_idle_xen(void); #endif Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.181.4.2 src/sys/arch/x86/x86/cpu.c:1.181.4.3 --- src/sys/arch/x86/x86/cpu.c:1.181.4.2 Thu Apr 16 09:45:56 2020 +++ src/sys/arch/x86/x86/cpu.c Sat Apr 18 15:06:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v
CVS commit: [bouyer-xenpvh] src/sys/arch/i386/i386
Module Name:src Committed By: bouyer Date: Sat Apr 18 14:49:57 UTC 2020 Modified Files: src/sys/arch/i386/i386 [bouyer-xenpvh]: i386_trap.S locore.S Log Message: Call stipending() only on XenPV. Fix spurious fpudna from kernel mode To generate a diff of this commit: cvs rdiff -u -r1.20.6.1 -r1.20.6.2 src/sys/arch/i386/i386/i386_trap.S cvs rdiff -u -r1.179.2.2 -r1.179.2.3 src/sys/arch/i386/i386/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/i386_trap.S diff -u src/sys/arch/i386/i386/i386_trap.S:1.20.6.1 src/sys/arch/i386/i386/i386_trap.S:1.20.6.2 --- src/sys/arch/i386/i386/i386_trap.S:1.20.6.1 Sun Apr 12 17:25:52 2020 +++ src/sys/arch/i386/i386/i386_trap.S Sat Apr 18 14:49:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: i386_trap.S,v 1.20.6.1 2020/04/12 17:25:52 bouyer Exp $ */ +/* $NetBSD: i386_trap.S,v 1.20.6.2 2020/04/18 14:49:57 bouyer Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -66,7 +66,7 @@ #if 0 #include -__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.20.6.1 2020/04/12 17:25:52 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.20.6.2 2020/04/18 14:49:57 bouyer Exp $"); #endif /* @@ -434,7 +434,7 @@ calltrap: 3: CHECK_DEFERRED_SWITCH jnz 9f -#ifdef XEN +#ifdef XENPV STIC(%eax) jz 22f call _C_LABEL(stipending) @@ -456,7 +456,7 @@ calltrap: 11: movl %ebx,CPUVAR(ILEVEL) /* restore cpl */ jmp .Lalltraps_checkusr 22: -#endif +#endif /* XEN */ HANDLE_DEFERRED_FPU Index: src/sys/arch/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.179.2.2 src/sys/arch/i386/i386/locore.S:1.179.2.3 --- src/sys/arch/i386/i386/locore.S:1.179.2.2 Sun Apr 12 17:25:52 2020 +++ src/sys/arch/i386/i386/locore.S Sat Apr 18 14:49:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.179.2.2 2020/04/12 17:25:52 bouyer Exp $ */ +/* $NetBSD: locore.S,v 1.179.2.3 2020/04/18 14:49:57 bouyer Exp $ */ /* * Copyright-o-rama! @@ -128,7 +128,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.179.2.2 2020/04/12 17:25:52 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.179.2.3 2020/04/18 14:49:57 bouyer Exp $"); #include "opt_copy_symtab.h" #include "opt_ddb.h" @@ -1478,7 +1478,7 @@ IDTVEC(syscall) orl CPUVAR(WANT_PMAPLOAD), %eax jnz 9f -#ifdef XEN +#ifdef XENPV STIC(%eax) jz 14f call _C_LABEL(stipending) @@ -1500,7 +1500,7 @@ IDTVEC(syscall) 17: movl %ebx, CPUVAR(ILEVEL) /* restore cpl */ jmp .Lsyscall_checkast 14: -#endif /* XEN */ +#endif /* XENPV */ #ifdef DIAGNOSTIC cmpl $IPL_NONE,CPUVAR(ILEVEL)
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 18 14:47:56 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: machdep.c src/sys/arch/i386/i386 [bouyer-xenpvh]: machdep.c src/sys/arch/x86/include [bouyer-xenpvh]: machdep.h src/sys/arch/x86/isa [bouyer-xenpvh]: clock.c src/sys/arch/x86/x86 [bouyer-xenpvh]: lapic.c x86_machdep.c Log Message: Centralize initialisations of delay_func and initclock_func in x86_machdep.c and export from Introduce a x86_dummy_initclock() and a x86_cpu_initclock_func pointer, to be used later for Xen HVM native clock support. rename rtclock_tval to x86_rtclock_tval and export from , for the benefit of lapic.c To generate a diff of this commit: cvs rdiff -u -r1.346.4.2 -r1.346.4.3 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.825.4.2 -r1.825.4.3 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.9 -r1.9.26.1 src/sys/arch/x86/include/machdep.h cvs rdiff -u -r1.36 -r1.36.6.1 src/sys/arch/x86/isa/clock.c cvs rdiff -u -r1.76.6.2 -r1.76.6.3 src/sys/arch/x86/x86/lapic.c cvs rdiff -u -r1.137.2.4 -r1.137.2.5 src/sys/arch/x86/x86/x86_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.346.4.2 src/sys/arch/amd64/amd64/machdep.c:1.346.4.3 --- src/sys/arch/amd64/amd64/machdep.c:1.346.4.2 Thu Apr 16 09:45:56 2020 +++ src/sys/arch/amd64/amd64/machdep.c Sat Apr 18 14:47:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.346.4.2 2020/04/16 09:45:56 bouyer Exp $ */ +/* $NetBSD: machdep.c,v 1.346.4.3 2020/04/18 14:47:55 bouyer Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -110,7 +110,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346.4.2 2020/04/16 09:45:56 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346.4.3 2020/04/18 14:47:55 bouyer Exp $"); #include "opt_modular.h" #include "opt_user_ldt.h" @@ -280,14 +280,6 @@ extern paddr_t avail_start, avail_end; extern paddr_t pmap_pa_start, pmap_pa_end; #endif -#ifndef XENPV -void (*delay_func)(unsigned int) = i8254_delay; -void (*initclock_func)(void) = i8254_initclocks; -#else /* XENPV */ -void (*delay_func)(unsigned int) = xen_delay; -void (*initclock_func)(void) = xen_initclocks; -#endif - struct nmistore { uint64_t cr3; uint64_t scratch; @@ -2129,12 +2121,6 @@ cpu_mcontext_validate(struct lwp *l, con return 0; } -void -cpu_initclocks(void) -{ - (*initclock_func)(); -} - int mm_md_kernacc(void *ptr, vm_prot_t prot, bool *handled) { Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.825.4.2 src/sys/arch/i386/i386/machdep.c:1.825.4.3 --- src/sys/arch/i386/i386/machdep.c:1.825.4.2 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/i386/i386/machdep.c Sat Apr 18 14:47:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.825.4.2 2020/04/16 08:46:34 bouyer Exp $ */ +/* $NetBSD: machdep.c,v 1.825.4.3 2020/04/18 14:47:55 bouyer Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017 @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825.4.2 2020/04/16 08:46:34 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825.4.3 2020/04/18 14:47:55 bouyer Exp $"); #include "opt_beep.h" #include "opt_compat_freebsd.h" @@ -235,14 +235,6 @@ void hypervisor_callback(void); void failsafe_callback(void); #endif -#ifdef XENPV -void (*delay_func)(unsigned int) = xen_delay; -void (*initclock_func)(void) = xen_initclocks; -#else -void (*delay_func)(unsigned int) = i8254_delay; -void (*initclock_func)(void) = i8254_initclocks; -#endif - /* * Size of memory segments, before any memory is stolen. */ @@ -1624,13 +1616,6 @@ cpu_setmcontext(struct lwp *l, const mco return (0); } -void -cpu_initclocks(void) -{ - - (*initclock_func)(); -} - #define DEV_IO 14 /* iopl for compat_10 */ int Index: src/sys/arch/x86/include/machdep.h diff -u src/sys/arch/x86/include/machdep.h:1.9 src/sys/arch/x86/include/machdep.h:1.9.26.1 --- src/sys/arch/x86/include/machdep.h:1.9 Mon Dec 26 17:54:07 2016 +++ src/sys/arch/x86/include/machdep.h Sat Apr 18 14:47:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.h,v 1.9 2016/12/26 17:54:07 cherry Exp $ */ +/* $NetBSD: machdep.h,v 1.9.26.1 2020/04/18 14:47:55 bouyer Exp $ */ /* * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -51,6 +51,12 @@ void x86_cpu_idle_init(void); void x86_cpu_idle_get(void (**)(void), char *, size_t); void x86_cpu_idle_set(void (*)(void), const char *, bool); +extern u_long x86_rtclock_tval; +extern void (*x86_initclock_func)(void); +extern void (*x86_cpu_initclock_func)(void); + +void x86_dummy_initclock(void); + int x86_select_freelist(uint64_t); void init_x86_clusters(void); Index: src/sys/arch/x86/isa/clock.c diff -u src/sys/arch/x86/isa/cloc
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Thu Apr 16 20:21:45 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xen_clock.c Log Message: MOve the #ifdef XENPV block to the end, so that XEN3_DOM0 builds again. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/xen/xen/xen_clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xen_clock.c diff -u src/sys/arch/xen/xen/xen_clock.c:1.1.2.1 src/sys/arch/xen/xen/xen_clock.c:1.1.2.2 --- src/sys/arch/xen/xen/xen_clock.c:1.1.2.1 Thu Apr 16 19:23:50 2020 +++ src/sys/arch/xen/xen/xen_clock.c Thu Apr 16 20:21:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_clock.c,v 1.1.2.1 2020/04/16 19:23:50 bouyer Exp $ */ +/* $NetBSD: xen_clock.c,v 1.1.2.2 2020/04/16 20:21:44 bouyer Exp $ */ /*- * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.1.2.1 2020/04/16 19:23:50 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.1.2.2 2020/04/16 20:21:44 bouyer Exp $"); #include #include @@ -114,128 +114,6 @@ static void xen_timepush_intr(void *); static int sysctl_xen_timepush(SYSCTLFN_ARGS); #endif -#ifdef XENPV -static int xen_rtc_get(struct todr_chip_handle *, struct timeval *); -static int xen_rtc_set(struct todr_chip_handle *, struct timeval *); -static void xen_wallclock_time(struct timespec *); -/* - * xen time of day register: - * - * Xen wall clock time, plus a Xen vCPU system time adjustment. - */ -static struct todr_chip_handle xen_todr_chip = { - .todr_gettime = xen_rtc_get, - .todr_settime = xen_rtc_set, -}; - -/* - * startrtclock() - * - * Initialize the real-time clock from x86 machdep autoconf. - */ -void -startrtclock(void) -{ - - todr_attach(&xen_todr_chip); -} - -/* - * setstatclockrate(rate) - * - * Set the statclock to run at rate, in units of ticks per second. - * - * Currently Xen does not have a separate statclock, so this is a - * noop; instad the statclock runs in hardclock. - */ -void -setstatclockrate(int rate) -{ -} - -/* - * xen_rtc_get(todr, tv) - * - * Get the current real-time clock from the Xen wall clock time - * and vCPU system time adjustment. - */ -static int -xen_rtc_get(struct todr_chip_handle *todr, struct timeval *tvp) -{ - struct timespec ts; - - xen_wallclock_time(&ts); - TIMESPEC_TO_TIMEVAL(tvp, &ts); - - return 0; -} - -/* - * xen_rtc_set(todr, tv) - * - * Set the Xen wall clock time, if we can. - */ -static int -xen_rtc_set(struct todr_chip_handle *todr, struct timeval *tvp) -{ -#ifdef DOM0OPS - struct clock_ymdhms dt; - xen_platform_op_t op; - uint64_t systime_ns; - - if (xendomain_is_privileged()) { - /* Convert to ymdhms and set the x86 ISA RTC. */ - clock_secs_to_ymdhms(tvp->tv_sec, &dt); - rtc_set_ymdhms(NULL, &dt); - - /* Get the global system time so we can preserve it. */ - systime_ns = xen_global_systime_ns(); - - /* Set the hypervisor wall clock time. */ - op.cmd = XENPF_settime; - op.u.settime.secs = tvp->tv_sec; - op.u.settime.nsecs = tvp->tv_usec * 1000; - op.u.settime.system_time = systime_ns; - return HYPERVISOR_platform_op(&op); - } -#endif - - /* XXX Should this fail if not on privileged dom0? */ - return 0; -} - -/* - * xen_wallclock_time(tsp) - * - * Return a snapshot of the current low-resolution wall clock - * time, as reported by the hypervisor, in tsp. - */ -static void -xen_wallclock_time(struct timespec *tsp) -{ - struct xen_wallclock_ticket ticket; - uint64_t systime_ns; - - int s = splsched(); /* make sure we won't be interrupted */ - /* Read the last wall clock sample from the hypervisor. */ - do { - xen_wallclock_enter(&ticket); - tsp->tv_sec = HYPERVISOR_shared_info->wc_sec; - tsp->tv_nsec = HYPERVISOR_shared_info->wc_nsec; - } while (!xen_wallclock_exit(&ticket)); - - /* Get the global system time. */ - systime_ns = xen_global_systime_ns(); - splx(s); - - /* Add the system time to the wall clock time. */ - systime_ns += tsp->tv_nsec; - tsp->tv_sec += systime_ns / 10ull; - tsp->tv_nsec = systime_ns % 10ull; -} - -#endif /* XENPV */ - /* * idle_block() * @@ -1011,3 +889,125 @@ sysctl_xen_timepush(SYSCTLFN_ARGS) } #endif /* DOM0OPS */ + +#ifdef XENPV +static int xen_rtc_get(struct todr_chip_handle *, struct timeval *); +static int xen_rtc_set(struct todr_chip_handle *, struct timeval *); +static void xen_wallclock_time(struct timespec *); +/* + * xen time of day register: + * + * Xen wall clock time, plus a Xen vCPU system time adjustment. + */ +static struct todr_chip_handle xen_todr_chip = { + .todr_gettime = xen_rtc_get, + .todr_settime = xen_rtc_set, +}; + +/* + * startrtclock() + * + * Initialize the real-time clock from x86 machdep autoconf. + */ +void +startrtclock(void) +{ + + todr_attach(&xen_todr_chip); +} + +/* + * setstatclockrate(rate) + * + * Set the statclock to run at rat
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Thu Apr 16 20:21:04 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c Log Message: switch vm_guest to VM_GUEST_XENPVHVM only after all tests succeeded. To generate a diff of this commit: cvs rdiff -u -r1.73.2.4 -r1.73.2.5 src/sys/arch/xen/xen/hypervisor.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/hypervisor.c diff -u src/sys/arch/xen/xen/hypervisor.c:1.73.2.4 src/sys/arch/xen/xen/hypervisor.c:1.73.2.5 --- src/sys/arch/xen/xen/hypervisor.c:1.73.2.4 Thu Apr 16 19:23:50 2020 +++ src/sys/arch/xen/xen/hypervisor.c Thu Apr 16 20:21:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.73.2.4 2020/04/16 19:23:50 bouyer Exp $ */ +/* $NetBSD: hypervisor.c,v 1.73.2.5 2020/04/16 20:21:04 bouyer Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.4 2020/04/16 19:23:50 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.5 2020/04/16 20:21:04 bouyer Exp $"); #include #include @@ -251,8 +251,6 @@ hypervisor_match(device_t parent, cfdata /* XXX: vtophys(&hypercall_page) */ wrmsr(descs[1], (uintptr_t)&hypercall_page - KERNBASE); - vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */ - } else { return 0; } @@ -427,7 +425,7 @@ hypervisor_match(device_t parent, cfdata bi.common.len = sizeof(struct btinfo_rootdevice); /* From i386/multiboot.c */ - /* $NetBSD: hypervisor.c,v 1.73.2.4 2020/04/16 19:23:50 bouyer Exp $ */ + /* $NetBSD: hypervisor.c,v 1.73.2.5 2020/04/16 20:21:04 bouyer Exp $ */ int i, len; vaddr_t data; extern struct bootinfo bootinfo; @@ -456,6 +454,8 @@ hypervisor_match(device_t parent, cfdata events_default_setup(); delay_func = xen_delay; initclock_func = xen_initclocks; + vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */ + #endif /* XENPVHVM */ /* If we got here, it must mean we matched */
CVS commit: [bouyer-xenpvh] src/sys/arch/xen
Module Name:src Committed By: bouyer Date: Thu Apr 16 19:23:51 UTC 2020 Modified Files: src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen files.xen.pv src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c Added Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xen_clock.c Removed Files: src/sys/arch/xen/xen [bouyer-xenpvh]: clock.c Log Message: Rename xen/xen/clock.c to xen_clock.c, so that it can be compiled with x86/isa/clock.c call events_default_setup() from hypervisor_match to that event arrays are properly initialised. Use xen_delay() and xen's timecounter for PVHVM. To generate a diff of this commit: cvs rdiff -u -r1.180.2.3 -r1.180.2.4 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/xen/conf/files.xen.pv cvs rdiff -u -r1.80.6.2 -r0 src/sys/arch/xen/xen/clock.c cvs rdiff -u -r1.73.2.3 -r1.73.2.4 src/sys/arch/xen/xen/hypervisor.c cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/xen/xen/xen_clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.180.2.3 src/sys/arch/xen/conf/files.xen:1.180.2.4 --- src/sys/arch/xen/conf/files.xen:1.180.2.3 Thu Apr 16 08:46:35 2020 +++ src/sys/arch/xen/conf/files.xen Thu Apr 16 19:23:50 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.180.2.3 2020/04/16 08:46:35 bouyer Exp $ +# $NetBSD: files.xen,v 1.180.2.4 2020/04/16 19:23:50 bouyer Exp $ defflag opt_xen.h XEN XENPVH XENPVHVM @@ -9,7 +9,7 @@ file arch/xen/xen/evtchn.c xen file arch/xen/xen/xengnt.c xen file arch/xen/x86/xen_ipi.c multiprocessor & xen file arch/xen/x86/xen_mainbus.c xen - +file arch/xen/xen/xen_clock.c xen define hypervisorbus {} define xendevbus {} Index: src/sys/arch/xen/conf/files.xen.pv diff -u src/sys/arch/xen/conf/files.xen.pv:1.1.2.1 src/sys/arch/xen/conf/files.xen.pv:1.1.2.2 --- src/sys/arch/xen/conf/files.xen.pv:1.1.2.1 Thu Apr 16 08:46:35 2020 +++ src/sys/arch/xen/conf/files.xen.pv Thu Apr 16 19:23:50 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen.pv,v 1.1.2.1 2020/04/16 08:46:35 bouyer Exp $ +# $NetBSD: files.xen.pv,v 1.1.2.2 2020/04/16 19:23:50 bouyer Exp $ file arch/xen/x86/autoconf.c xenpv file arch/xen/x86/x86_xpmap.c xenpv @@ -6,7 +6,6 @@ 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 Index: src/sys/arch/xen/xen/hypervisor.c diff -u src/sys/arch/xen/xen/hypervisor.c:1.73.2.3 src/sys/arch/xen/xen/hypervisor.c:1.73.2.4 --- src/sys/arch/xen/xen/hypervisor.c:1.73.2.3 Thu Apr 16 17:47:37 2020 +++ src/sys/arch/xen/xen/hypervisor.c Thu Apr 16 19:23:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $ */ +/* $NetBSD: hypervisor.c,v 1.73.2.4 2020/04/16 19:23:50 bouyer Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.4 2020/04/16 19:23:50 bouyer Exp $"); #include #include @@ -186,6 +186,10 @@ paddr_t HYPERVISOR_shared_info_pa; union start_info_union start_info_union __aligned(PAGE_SIZE); #endif +extern void (*delay_func)(unsigned int); +extern void (*initclock_func)(void); + + int xen_version; /* power management, for save/restore */ @@ -423,7 +427,7 @@ hypervisor_match(device_t parent, cfdata bi.common.len = sizeof(struct btinfo_rootdevice); /* From i386/multiboot.c */ - /* $NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $ */ + /* $NetBSD: hypervisor.c,v 1.73.2.4 2020/04/16 19:23:50 bouyer Exp $ */ int i, len; vaddr_t data; extern struct bootinfo bootinfo; @@ -449,6 +453,9 @@ hypervisor_match(device_t parent, cfdata aprint_error("%s: Unable to disable emulated devices\n", haa->haa_busname); } + events_default_setup(); + delay_func = xen_delay; + initclock_func = xen_initclocks; #endif /* XENPVHVM */ /* If we got here, it must mean we matched */ Added files: Index: src/sys/arch/xen/xen/xen_clock.c diff -u /dev/null src/sys/arch/xen/xen/xen_clock.c:1.1.2.1 --- /dev/null Thu Apr 16 19:23:51 2020 +++ src/sys/arch/xen/xen/xen_clock.c Thu Apr 16 19:23:50 2020 @@ -0,0 +1,1013 @@ +/* $NetBSD: xen_clock.c,v 1.1.2.1 2020/04/16 19:23:50 bouyer Exp $ */ + +/*- + * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Taylor R. Campbell. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of sou
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Thu Apr 16 17:50:52 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: vector.S src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC_XENHVM src/sys/arch/i386/i386 [bouyer-xenpvh]: vector.S src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c Log Message: amd64: Xhypervisor_pvhvm_callback has to be in text.user for SVS. Thanks to maxv@ for helping me with this. Enable SVS again. While there, increase ci_idepth before calling do_hypervisor_callback, and don't touch ci_idepth while looping over pending events. To generate a diff of this commit: cvs rdiff -u -r1.73.6.4 -r1.73.6.5 src/sys/arch/amd64/amd64/vector.S cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/amd64/conf/GENERIC_XENHVM cvs rdiff -u -r1.85.6.5 -r1.85.6.6 src/sys/arch/i386/i386/vector.S cvs rdiff -u -r1.36.8.2 -r1.36.8.3 src/sys/arch/xen/x86/hypervisor_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/vector.S diff -u src/sys/arch/amd64/amd64/vector.S:1.73.6.4 src/sys/arch/amd64/amd64/vector.S:1.73.6.5 --- src/sys/arch/amd64/amd64/vector.S:1.73.6.4 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/amd64/amd64/vector.S Thu Apr 16 17:50:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.73.6.4 2020/04/16 08:46:34 bouyer Exp $ */ +/* $NetBSD: vector.S,v 1.73.6.5 2020/04/16 17:50:51 bouyer Exp $ */ /* * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. @@ -761,17 +761,20 @@ ENTRY(hypervisor_callback) movq (%rsp),%rcx movq 8(%rsp),%r11 addq $16,%rsp + jmp _C_LABEL(Xhypervisor_pvhvm_callback) + TEXT_USER_BEGIN IDTVEC(hypervisor_pvhvm_callback) pushq $0 /* Dummy error code */ pushq $T_ASTFLT INTRENTRY movlCPUVAR(ILEVEL),%edi pushq %rdi /* for Xdoreti */ + incl CPUVAR(IDEPTH) movq %rsp,%rdi call do_hypervisor_callback - incl CPUVAR(IDEPTH) jmp _C_LABEL(Xdoreti) IDTVEC_END(hypervisor_pvhvm_callback) + TEXT_USER_END END(hypervisor_callback) #endif /* XEN */ Index: src/sys/arch/amd64/conf/GENERIC_XENHVM diff -u src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.3 src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.4 --- src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.3 Thu Apr 16 10:42:26 2020 +++ src/sys/arch/amd64/conf/GENERIC_XENHVM Thu Apr 16 17:50:51 2020 @@ -1,14 +1,13 @@ -# $NetBSD: GENERIC_XENHVM,v 1.1.2.3 2020/04/16 10:42:26 bouyer Exp $ +# $NetBSD: GENERIC_XENHVM,v 1.1.2.4 2020/04/16 17:50:51 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 +xennet* at xenbus? # Xen virtual network interface xbd* at xenbus? # Xen virtual block device Index: src/sys/arch/i386/i386/vector.S diff -u src/sys/arch/i386/i386/vector.S:1.85.6.5 src/sys/arch/i386/i386/vector.S:1.85.6.6 --- src/sys/arch/i386/i386/vector.S:1.85.6.5 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/i386/i386/vector.S Thu Apr 16 17:50:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.85.6.5 2020/04/16 08:46:34 bouyer Exp $ */ +/* $NetBSD: vector.S,v 1.85.6.6 2020/04/16 17:50:52 bouyer Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.5 2020/04/16 08:46:34 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.6 2020/04/16 17:50:52 bouyer Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -1013,11 +1013,12 @@ IDTVEC(hypervisor_pvhvm_callback) pushl $T_ASTFLT INTRENTRY pushl CPUVAR(ILEVEL) - push %esp - call do_hypervisor_callback - add $4,%esp IDEPTH_INCR - CLI(%eax) + /* IDEPTH_INCR puts %esp on stack; we use it as argument to + * do_hypervisor_callback. But don't restore the stack after, + * Xdoreti needs it too. + */ + call do_hypervisor_callback jmp _C_LABEL(Xdoreti) IDTVEC_END(hypervisor_pvhvm_callback) END(hypervisor_callback) Index: src/sys/arch/xen/x86/hypervisor_machdep.c diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.2 src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.3 --- src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.2 Thu Apr 16 08:46:35 2020 +++ src/sys/arch/xen/x86/hypervisor_machdep.c Thu Apr 16 17:50:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor_machdep.c,v 1.36.8.2 2020/04/16 08:46:35 bouyer Exp $ */ +/* $NetBSD: hypervisor_machdep.c,v 1.36.8.3 2020/04/16 17:50:52 bouyer Exp $ */ /* * @@ -54,11 +54,12 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.2 2020/04/16 08:46:35 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.3 2020/04/16 17:50:52 bouyer Exp $"
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Thu Apr 16 17:47:37 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c Log Message: fail silently if hypervisor is not found. To generate a diff of this commit: cvs rdiff -u -r1.73.2.2 -r1.73.2.3 src/sys/arch/xen/xen/hypervisor.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/hypervisor.c diff -u src/sys/arch/xen/xen/hypervisor.c:1.73.2.2 src/sys/arch/xen/xen/hypervisor.c:1.73.2.3 --- src/sys/arch/xen/xen/hypervisor.c:1.73.2.2 Sat Apr 11 21:21:16 2020 +++ src/sys/arch/xen/xen/hypervisor.c Thu Apr 16 17:47:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $ */ +/* $NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $"); #include #include @@ -250,8 +250,6 @@ hypervisor_match(device_t parent, cfdata vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */ } else { - aprint_normal("%s: Xen HVM mode not identified. Exiting.\n", - haa->haa_busname); return 0; } @@ -425,7 +423,7 @@ hypervisor_match(device_t parent, cfdata bi.common.len = sizeof(struct btinfo_rootdevice); /* From i386/multiboot.c */ - /* $NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $ */ + /* $NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $ */ int i, len; vaddr_t data; extern struct bootinfo bootinfo;
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Thu Apr 16 17:46:44 UTC 2020 Modified Files: src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_mainbus.c Log Message: Don't try to attach hypervisor on non Xen; no more error messages about hypervisor when booting on bare metal. To generate a diff of this commit: cvs rdiff -u -r1.6.12.1 -r1.6.12.2 src/sys/arch/xen/x86/xen_mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/xen_mainbus.c diff -u src/sys/arch/xen/x86/xen_mainbus.c:1.6.12.1 src/sys/arch/xen/x86/xen_mainbus.c:1.6.12.2 --- src/sys/arch/xen/x86/xen_mainbus.c:1.6.12.1 Thu Apr 16 08:46:35 2020 +++ src/sys/arch/xen/x86/xen_mainbus.c Thu Apr 16 17:46:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_mainbus.c,v 1.6.12.1 2020/04/16 08:46:35 bouyer Exp $ */ +/* $NetBSD: xen_mainbus.c,v 1.6.12.2 2020/04/16 17:46:44 bouyer Exp $ */ /* NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp */ /* NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp */ @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.6.12.1 2020/04/16 08:46:35 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.6.12.2 2020/04/16 17:46:44 bouyer Exp $"); #include #include @@ -121,20 +121,31 @@ xen_mainbus_attach(device_t parent, devi { union xen_mainbus_attach_args mba; + switch(vm_guest) { + case VM_GUEST_XENPV: #if NIPMI > 0 && defined(XENPV) - memset(&mba.mba_ipmi, 0, sizeof(mba.mba_ipmi)); - mba.mba_ipmi.iaa_iot = x86_bus_space_io; - mba.mba_ipmi.iaa_memt = x86_bus_space_mem; - if (ipmi_probe(&mba.mba_ipmi)) - config_found_ia(self, "ipmibus", &mba.mba_ipmi, 0); -#endif - - mba.mba_haa.haa_busname = "hypervisor"; - config_found_ia(self, "hypervisorbus", &mba.mba_haa, xen_mainbus_print); - - /* save/restore for Xen */ - if (!pmf_device_register(self, NULL, NULL)) - aprint_error_dev(self, "couldn't establish power handler\n"); + memset(&mba.mba_ipmi, 0, sizeof(mba.mba_ipmi)); + mba.mba_ipmi.iaa_iot = x86_bus_space_io; + mba.mba_ipmi.iaa_memt = x86_bus_space_mem; + if (ipmi_probe(&mba.mba_ipmi)) + config_found_ia(self, "ipmibus", &mba.mba_ipmi, 0); +#endif + /* FALLTHROUGH */ + case VM_GUEST_XENHVM: + mba.mba_haa.haa_busname = "hypervisor"; + config_found_ia(self, "hypervisorbus", + &mba.mba_haa, xen_mainbus_print); + break; + default: + return; + } + + if (vm_guest == VM_GUEST_XENPV) { + /* save/restore for Xen */ + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, + "couldn't establish power handler\n"); + } } static int
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Thu Apr 16 17:44:54 UTC 2020 Modified Files: src/sys/arch/amd64/include [bouyer-xenpvh]: intrdefs.h src/sys/arch/i386/include [bouyer-xenpvh]: intrdefs.h src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h Log Message: Avoid overflow of ci_ipi_events[] in the PVHVM case (it's size is XEN_NIPIS but we use x86 IPIs): size XEN_NIPIS only for PV, and CTASSERT that XEN_NIPIS <= X86_NIPI if we ever use Xen IPIs for PVHVM. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.64.1 src/sys/arch/amd64/include/intrdefs.h cvs rdiff -u -r1.4 -r1.4.64.1 src/sys/arch/i386/include/intrdefs.h cvs rdiff -u -r1.117.4.4 -r1.117.4.5 src/sys/arch/x86/include/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/include/intrdefs.h diff -u src/sys/arch/amd64/include/intrdefs.h:1.2 src/sys/arch/amd64/include/intrdefs.h:1.2.64.1 --- src/sys/arch/amd64/include/intrdefs.h:1.2 Wed Aug 10 06:30:59 2011 +++ src/sys/arch/amd64/include/intrdefs.h Thu Apr 16 17:44:54 2020 @@ -1,6 +1,4 @@ -/* $NetBSD: intrdefs.h,v 1.2 2011/08/10 06:30:59 cherry Exp $ */ +/* $NetBSD: intrdefs.h,v 1.2.64.1 2020/04/16 17:44:54 bouyer Exp $ */ #include -#ifdef XEN #include -#endif /* XEN */ Index: src/sys/arch/i386/include/intrdefs.h diff -u src/sys/arch/i386/include/intrdefs.h:1.4 src/sys/arch/i386/include/intrdefs.h:1.4.64.1 --- src/sys/arch/i386/include/intrdefs.h:1.4 Wed Aug 10 06:30:59 2011 +++ src/sys/arch/i386/include/intrdefs.h Thu Apr 16 17:44:54 2020 @@ -1,6 +1,4 @@ -/* $NetBSD: intrdefs.h,v 1.4 2011/08/10 06:30:59 cherry Exp $ */ +/* $NetBSD: intrdefs.h,v 1.4.64.1 2020/04/16 17:44:54 bouyer Exp $ */ #include -#ifdef XEN #include -#endif /* XEN */ Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.117.4.4 src/sys/arch/x86/include/cpu.h:1.117.4.5 --- src/sys/arch/x86/include/cpu.h:1.117.4.4 Sun Apr 12 17:25:52 2020 +++ src/sys/arch/x86/include/cpu.h Thu Apr 16 17:44:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.117.4.4 2020/04/12 17:25:52 bouyer Exp $ */ +/* $NetBSD: cpu.h,v 1.117.4.5 2020/04/16 17:44:54 bouyer Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -262,9 +262,13 @@ struct cpu_info { vaddr_t ci_svs_utls; #endif +#ifndef XENPV + struct evcnt ci_ipi_events[X86_NIPI]; +#else + struct evcnt ci_ipi_events[XEN_NIPIS]; +#endif #ifdef XEN u_long ci_evtmask[NR_EVENT_CHANNELS]; /* events allowed on this CPU */ - struct evcnt ci_ipi_events[XEN_NIPIS]; evtchn_port_t ci_ipi_evtchn; #if defined(XENPV) #if defined(PAE) || defined(__x86_64__) @@ -299,9 +303,6 @@ struct cpu_info { */ uint64_t ci_xen_systime_ns_skew; - /* Xen periodic timer interrupt handle. */ - struct intrhand *ci_xen_timer_intrhand; - /* * Clockframe for timer interrupt handler. * Saved at entry via event callback. @@ -316,11 +317,11 @@ struct cpu_info { struct evcnt ci_xen_raw_systime_backwards_evcnt; struct evcnt ci_xen_systime_backwards_hardclock_evcnt; struct evcnt ci_xen_missed_hardclock_evcnt; -#else /* XEN */ - struct evcnt ci_ipi_events[X86_NIPI]; #endif /* XEN */ - }; +#ifndef XENPV + __CTASSERT(XEN_NIPIS <= X86_NIPI); +#endif /* * Macros to handle (some) trapframe registers for common x86 code.
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/conf
Module Name:src Committed By: bouyer Date: Thu Apr 16 10:42:26 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC_XENHVM Log Message: Well, no, SVS does't quite work yet. To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/amd64/conf/GENERIC_XENHVM Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/GENERIC_XENHVM diff -u src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.2 src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.3 --- src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.2 Thu Apr 16 10:07:23 2020 +++ src/sys/arch/amd64/conf/GENERIC_XENHVM Thu Apr 16 10:42:26 2020 @@ -1,9 +1,10 @@ -# $NetBSD: GENERIC_XENHVM,v 1.1.2.2 2020/04/16 10:07:23 bouyer Exp $ +# $NetBSD: GENERIC_XENHVM,v 1.1.2.3 2020/04/16 10:42:26 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
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/conf
Module Name:src Committed By: bouyer Date: Thu Apr 16 10:07:23 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC_XENHVM Log Message: SVS is working with PVHVM now To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/amd64/conf/GENERIC_XENHVM Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/GENERIC_XENHVM diff -u src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.1 src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.2 --- src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/amd64/conf/GENERIC_XENHVM Thu Apr 16 10:07:23 2020 @@ -1,10 +1,9 @@ -# $NetBSD: GENERIC_XENHVM,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: GENERIC_XENHVM,v 1.1.2.2 2020/04/16 10:07:23 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
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Thu Apr 16 09:45:57 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: locore.S machdep.c src/sys/arch/x86/include [bouyer-xenpvh]: pci_machdep_common.h src/sys/arch/x86/x86 [bouyer-xenpvh]: consinit.c cpu.c cpu_ucode_amd.c identcpu.c intr.c pmap.c x86_autoconf.c x86_machdep.c Log Message: More #ifndef XEN -> #ifndef XENPV To generate a diff of this commit: cvs rdiff -u -r1.200.4.1 -r1.200.4.2 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.346.4.1 -r1.346.4.2 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.23 -r1.23.28.1 src/sys/arch/x86/include/pci_machdep_common.h cvs rdiff -u -r1.31 -r1.31.8.1 src/sys/arch/x86/x86/consinit.c cvs rdiff -u -r1.181.4.1 -r1.181.4.2 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.10.6.1 -r1.10.6.2 src/sys/arch/x86/x86/cpu_ucode_amd.c cvs rdiff -u -r1.102.2.1 -r1.102.2.2 src/sys/arch/x86/x86/identcpu.c cvs rdiff -u -r1.150.6.2 -r1.150.6.3 src/sys/arch/x86/x86/intr.c cvs rdiff -u -r1.381 -r1.381.2.1 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.79 -r1.79.6.1 src/sys/arch/x86/x86/x86_autoconf.c cvs rdiff -u -r1.137.2.3 -r1.137.2.4 src/sys/arch/x86/x86/x86_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.200.4.1 src/sys/arch/amd64/amd64/locore.S:1.200.4.2 --- src/sys/arch/amd64/amd64/locore.S:1.200.4.1 Wed Apr 8 17:59:16 2020 +++ src/sys/arch/amd64/amd64/locore.S Thu Apr 16 09:45:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.200.4.1 2020/04/08 17:59:16 bouyer Exp $ */ +/* $NetBSD: locore.S,v 1.200.4.2 2020/04/16 09:45:56 bouyer Exp $ */ /* * Copyright-o-rama! @@ -1110,7 +1110,7 @@ ENTRY(cpu_switchto) .Lskip_svs: #endif -#ifndef XEN +#ifndef XENPV movq %r13,%rdi movq %r12,%rsi callq _C_LABEL(speculation_barrier) Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.346.4.1 src/sys/arch/amd64/amd64/machdep.c:1.346.4.2 --- src/sys/arch/amd64/amd64/machdep.c:1.346.4.1 Thu Apr 9 16:12:50 2020 +++ src/sys/arch/amd64/amd64/machdep.c Thu Apr 16 09:45:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.346.4.1 2020/04/09 16:12:50 bouyer Exp $ */ +/* $NetBSD: machdep.c,v 1.346.4.2 2020/04/16 09:45:56 bouyer Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -110,7 +110,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346.4.1 2020/04/09 16:12:50 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346.4.2 2020/04/16 09:45:56 bouyer Exp $"); #include "opt_modular.h" #include "opt_user_ldt.h" @@ -1696,7 +1696,7 @@ init_x86_64(paddr_t first_avail) svs_init(); #endif cpu_init_msrs(&cpu_info_primary, true); -#ifndef XEN +#ifndef XENPV cpu_speculation_init(&cpu_info_primary); #endif Index: src/sys/arch/x86/include/pci_machdep_common.h diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.23 src/sys/arch/x86/include/pci_machdep_common.h:1.23.28.1 --- src/sys/arch/x86/include/pci_machdep_common.h:1.23 Mon Jul 11 06:14:51 2016 +++ src/sys/arch/x86/include/pci_machdep_common.h Thu Apr 16 09:45:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_common.h,v 1.23 2016/07/11 06:14:51 knakahara Exp $ */ +/* $NetBSD: pci_machdep_common.h,v 1.23.28.1 2020/04/16 09:45:56 bouyer Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -37,7 +37,7 @@ * Machine-specific definitions for PCI autoconfiguration. */ #define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH -#ifndef XEN +#ifndef XENPV #define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_DISESTABLISH #endif Index: src/sys/arch/x86/x86/consinit.c diff -u src/sys/arch/x86/x86/consinit.c:1.31 src/sys/arch/x86/x86/consinit.c:1.31.8.1 --- src/sys/arch/x86/x86/consinit.c:1.31 Fri May 31 03:10:31 2019 +++ src/sys/arch/x86/x86/consinit.c Thu Apr 16 09:45:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: consinit.c,v 1.31 2019/05/31 03:10:31 nonaka Exp $ */ +/* $NetBSD: consinit.c,v 1.31.8.1 2020/04/16 09:45:56 bouyer Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.31 2019/05/31 03:10:31 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.31.8.1 2020/04/16 09:45:56 bouyer Exp $"); #include "opt_kgdb.h" #include "opt_puc.h" @@ -91,7 +91,7 @@ __KERNEL_RCSID(0, "$NetBSD: consinit.c,v #include #endif -#ifndef XEN +#ifndef XENPV #include "hvkbd.h" #if NHVKBD > 0 #include Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.181.4.1 src/sys/arch/x86/x86/cpu.c:1.181.4.2 --- src/sys/arch/x86/x86/cpu.c:1.181.4.1 Fri Apr 10 14:37:54 2020 +++ src/sys/arch/x86/x86/cpu.c Thu Apr 16 09:45:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.181.4.1 2020/04/10 14:37:54 bouyer Exp $ */ +/* $NetBSD: cpu.c,v 1.181.4.2 2020/04/16 09:45:56 bouyer Exp $ */
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Thu Apr 16 08:46:36 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: vector.S src/sys/arch/amd64/conf [bouyer-xenpvh]: Makefile.amd64 XEN3_DOM0 files.amd64 std.amd64 std.xen src/sys/arch/i386/conf [bouyer-xenpvh]: Makefile.i386 XEN3PAE_DOM0 files.i386 std.i386 src/sys/arch/i386/i386 [bouyer-xenpvh]: machdep.c vector.S src/sys/arch/x86/conf [bouyer-xenpvh]: files.x86 src/sys/arch/x86/include [bouyer-xenpvh]: intr.h src/sys/arch/x86/x86 [bouyer-xenpvh]: cpu_ucode.c cpu_ucode_amd.c cpu_ucode_intel.c lapic.c mainbus.c src/sys/arch/xen/conf [bouyer-xenpvh]: Makefile.xen files.xen std.xen src/sys/arch/xen/include [bouyer-xenpvh]: hypervisor.h intr.h xenpmap.h src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c xen_intr.c xen_ipi.c xen_mainbus.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c if_xennet_xenbus.c xbd_xenbus.c xen_machdep.c xencons.c src/sys/arch/xen/xenbus [bouyer-xenpvh]: xenbus_comms.c xenbus_dev.c Added Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC_XENHVM src/sys/arch/amd64/include/xen [bouyer-xenpvh]: hypercalls.h src/sys/arch/i386/conf [bouyer-xenpvh]: GENERIC_XENHVM src/sys/arch/i386/include/xen [bouyer-xenpvh]: hypercalls.h src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen.pv Removed Files: src/sys/arch/xen/include/amd64 [bouyer-xenpvh]: hypercalls.h src/sys/arch/xen/include/i386 [bouyer-xenpvh]: hypercalls.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.73.6.3 -r1.73.6.4 src/sys/arch/amd64/amd64/vector.S cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/amd64/conf/GENERIC_XENHVM cvs rdiff -u -r1.82 -r1.82.2.1 src/sys/arch/amd64/conf/Makefile.amd64 cvs rdiff -u -r1.175.4.1 -r1.175.4.2 src/sys/arch/amd64/conf/XEN3_DOM0 cvs rdiff -u -r1.115 -r1.115.4.1 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.11 -r1.11.26.1 src/sys/arch/amd64/conf/std.amd64 cvs rdiff -u -r1.11 -r1.11.10.1 src/sys/arch/amd64/conf/std.xen cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/amd64/include/xen/hypercalls.h cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/i386/conf/GENERIC_XENHVM cvs rdiff -u -r1.194 -r1.194.10.1 src/sys/arch/i386/conf/Makefile.i386 cvs rdiff -u -r1.21.2.1 -r1.21.2.2 src/sys/arch/i386/conf/XEN3PAE_DOM0 cvs rdiff -u -r1.401 -r1.401.6.1 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.35 -r1.35.26.1 src/sys/arch/i386/conf/std.i386 cvs rdiff -u -r1.825.4.1 -r1.825.4.2 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.85.6.4 -r1.85.6.5 src/sys/arch/i386/i386/vector.S cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/i386/include/xen/hypercalls.h cvs rdiff -u -r1.107.10.1 -r1.107.10.2 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r1.61.6.2 -r1.61.6.3 src/sys/arch/x86/include/intr.h cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/arch/x86/x86/cpu_ucode.c cvs rdiff -u -r1.10 -r1.10.6.1 src/sys/arch/x86/x86/cpu_ucode_amd.c cvs rdiff -u -r1.17 -r1.17.8.1 src/sys/arch/x86/x86/cpu_ucode_intel.c cvs rdiff -u -r1.76.6.1 -r1.76.6.2 src/sys/arch/x86/x86/lapic.c cvs rdiff -u -r1.3.12.1 -r1.3.12.2 src/sys/arch/x86/x86/mainbus.c cvs rdiff -u -r1.48 -r1.48.10.1 src/sys/arch/xen/conf/Makefile.xen cvs rdiff -u -r1.180.2.2 -r1.180.2.3 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/xen/conf/files.xen.pv cvs rdiff -u -r1.10 -r1.10.10.1 src/sys/arch/xen/conf/std.xen cvs rdiff -u -r1.49.10.1 -r1.49.10.2 src/sys/arch/xen/include/hypervisor.h cvs rdiff -u -r1.53.6.1 -r1.53.6.2 src/sys/arch/xen/include/intr.h cvs rdiff -u -r1.42 -r1.42.6.1 src/sys/arch/xen/include/xenpmap.h cvs rdiff -u -r1.12 -r0 src/sys/arch/xen/include/amd64/hypercalls.h cvs rdiff -u -r1.19 -r0 src/sys/arch/xen/include/i386/hypercalls.h cvs rdiff -u -r1.36.8.1 -r1.36.8.2 src/sys/arch/xen/x86/hypervisor_machdep.c cvs rdiff -u -r1.21.2.4 -r1.21.2.5 src/sys/arch/xen/x86/xen_intr.c cvs rdiff -u -r1.35.6.2 -r1.35.6.3 src/sys/arch/xen/x86/xen_ipi.c cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/arch/xen/x86/xen_mainbus.c cvs rdiff -u -r1.88.2.3 -r1.88.2.4 src/sys/arch/xen/xen/evtchn.c cvs rdiff -u -r1.109 -r1.109.2.1 src/sys/arch/xen/xen/if_xennet_xenbus.c cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/xen/xen/xbd_xenbus.c cvs rdiff -u -r1.22 -r1.22.10.1 src/sys/arch/xen/xen/xen_machdep.c cvs rdiff -u -r1.48 -r1.48.10.1 src/sys/arch/x
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Wed Apr 15 16:04:07 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: spl.S src/sys/arch/amd64/conf [bouyer-xenpvh]: XEN3_DOMU src/sys/arch/i386/i386 [bouyer-xenpvh]: lock_stubs.S spl.S src/sys/arch/x86/include [bouyer-xenpvh]: cpufunc.h src/sys/arch/x86/x86 [bouyer-xenpvh]: patch.c Log Message: On amd64, always use the cmpxchg8b version of spllower. All x86_64 host should have it and we already rely on it in lock stubs. On i386, always use i686_mutex_spin_exit and cx8_spllower for Xen; Xen doesn't run on CPUs on CPUs lacking the required instructions anyway. Skip x86_patch only for XENPV, and adjust for changes in assembly functions. Tested on Xen PV and PVHVM, and on bare metal core i5. To generate a diff of this commit: cvs rdiff -u -r1.43.4.6 -r1.43.4.7 src/sys/arch/amd64/amd64/spl.S cvs rdiff -u -r1.90.6.1 -r1.90.6.2 src/sys/arch/amd64/conf/XEN3_DOMU cvs rdiff -u -r1.32 -r1.32.6.1 src/sys/arch/i386/i386/lock_stubs.S cvs rdiff -u -r1.50.4.5 -r1.50.4.6 src/sys/arch/i386/i386/spl.S cvs rdiff -u -r1.37 -r1.37.6.1 src/sys/arch/x86/include/cpufunc.h cvs rdiff -u -r1.37.6.2 -r1.37.6.3 src/sys/arch/x86/x86/patch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/spl.S diff -u src/sys/arch/amd64/amd64/spl.S:1.43.4.6 src/sys/arch/amd64/amd64/spl.S:1.43.4.7 --- src/sys/arch/amd64/amd64/spl.S:1.43.4.6 Sun Apr 12 17:25:52 2020 +++ src/sys/arch/amd64/amd64/spl.S Wed Apr 15 16:04:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.43.4.6 2020/04/12 17:25:52 bouyer Exp $ */ +/* $NetBSD: spl.S,v 1.43.4.7 2020/04/15 16:04:06 bouyer Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -227,50 +227,12 @@ IDTVEC_END(resume_preempt) /* * void spllower(int s); * - * Must be the same size as cx8_spllower(). This must use - * pushf/cli/popf as it is used early in boot where interrupts - * are disabled via eflags/IE. - */ -ENTRY(spllower) - cmpl CPUVAR(ILEVEL),%edi - jae 1f - movl CPUVAR(IUNMASK)(,%rdi,4),%edx - PUSHF(ax) - CLI(ax) - testl CPUVAR(IPENDING),%edx - jnz 2f - movl %edi,CPUVAR(ILEVEL) - POPF /* clobbers %rdi */ -1: - ret - ret -2: -#ifdef XENPV - /* - * no need to call stipending, we're going to CLI again - * just drop the saved value on stack - */ - addq $8,%rsp -#else - popf -#endif - jmp _C_LABEL(Xspllower) -3: - .space 16 - .align 16 -END(spllower) -LABEL(spllower_end) - -#ifndef XENPV -/* - * void cx8_spllower(int s); - * * For cmpxchg8b, edx/ecx are the high words and eax/ebx the low. * * edx : eax = old level / old ipending * ecx : ebx = new level / old ipending */ -ENTRY(cx8_spllower) +ENTRY(spllower) movl CPUVAR(ILEVEL),%edx movq %rbx,%r8 cmpl %edx,%edi /* new level is lower? */ @@ -292,15 +254,11 @@ ENTRY(cx8_spllower) ret 2: movq %r8,%rbx - .type _C_LABEL(cx8_spllower_patch), @function -LABEL(cx8_spllower_patch) jmp _C_LABEL(Xspllower) .align 16 -END(cx8_spllower_patch) -END(cx8_spllower) -LABEL(cx8_spllower_end) -#endif /* !XENPV */ +END(spllower) +LABEL(spllower_end) /* * void Xspllower(int s); Index: src/sys/arch/amd64/conf/XEN3_DOMU diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.90.6.1 src/sys/arch/amd64/conf/XEN3_DOMU:1.90.6.2 --- src/sys/arch/amd64/conf/XEN3_DOMU:1.90.6.1 Wed Apr 8 17:56:08 2020 +++ src/sys/arch/amd64/conf/XEN3_DOMU Wed Apr 15 16:04:06 2020 @@ -1,17 +1,19 @@ -# $NetBSD: XEN3_DOMU,v 1.90.6.1 2020/04/08 17:56:08 bouyer Exp $ +# $NetBSD: XEN3_DOMU,v 1.90.6.2 2020/04/15 16:04:06 bouyer Exp $ include "arch/amd64/conf/std.xen" options XENPV # PV domU support options MULTIPROCESSOR +options HZ=20 + options INCLUDE_CONFIG_FILE # embed config file in kernel binary #options UVMHIST #options UVMHIST_PRINT #options SYSCALL_DEBUG -#ident "XEN3_DOMU-$Revision: 1.90.6.1 $" +#ident "XEN3_DOMU-$Revision: 1.90.6.2 $" maxusers 32 # estimated number of users Index: src/sys/arch/i386/i386/lock_stubs.S diff -u src/sys/arch/i386/i386/lock_stubs.S:1.32 src/sys/arch/i386/i386/lock_stubs.S:1.32.6.1 --- src/sys/arch/i386/i386/lock_stubs.S:1.32 Sun Dec 8 20:00:56 2019 +++ src/sys/arch/i386/i386/lock_stubs.S Wed Apr 15 16:04:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.S,v 1.32 2019/12/08 20:00:56 ad Exp $ */ +/* $NetBSD: lock_stubs.S,v 1.32.6.1 2020/04/15 16:04:06 bouyer Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.32 2019/12/08 20:00:56 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.32.6.1 2020/04/15 16:04:06 bouyer Exp $"); #include "opt_lockdebug.h" @@ -223,7 +223,6 @@ ENTRY(rw_tryenter) jmp 3b END(rw_tryenter) -#ifndef XENPV /* * void mutex_spin_enter(kmutex_t *mtx); @@ -254,6 +253,7 @@ ENTRY(mutex_spin_enter) LABEL(mutex_spin_enter_end) END(mute
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Tue Apr 14 16:53:57 UTC 2020 Modified Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: patch.c src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen Log Message: Always patch spllower with cx8_spllower; it works fine for Xen now Include x86/x86/patch.c is !xenpv While there, defopt XENPV To generate a diff of this commit: cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/arch/x86/x86/patch.c cvs rdiff -u -r1.180.2.1 -r1.180.2.2 src/sys/arch/xen/conf/files.xen Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/patch.c diff -u src/sys/arch/x86/x86/patch.c:1.37.6.1 src/sys/arch/x86/x86/patch.c:1.37.6.2 --- src/sys/arch/x86/x86/patch.c:1.37.6.1 Fri Apr 10 14:37:54 2020 +++ src/sys/arch/x86/x86/patch.c Tue Apr 14 16:53:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $ */ +/* $NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $"); #include "opt_lockdebug.h" #ifdef i386 @@ -250,8 +250,7 @@ x86_patch(bool early) #endif /* i386 */ #if !defined(SPLDEBUG) - if (!early && (cpu_feature[0] & CPUID_CX8) != 0 && - !vm_guest_is_xenpv()) { + if (!early && (cpu_feature[0] & CPUID_CX8) != 0) { /* Faster splx(), mutex_spin_exit(). */ patchfunc( cx8_spllower, cx8_spllower_end, Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.180.2.1 src/sys/arch/xen/conf/files.xen:1.180.2.2 --- src/sys/arch/xen/conf/files.xen:1.180.2.1 Sat Apr 11 18:26:07 2020 +++ src/sys/arch/xen/conf/files.xen Tue Apr 14 16:53:57 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.180.2.1 2020/04/11 18:26:07 bouyer Exp $ +# $NetBSD: files.xen,v 1.180.2.2 2020/04/14 16:53:57 bouyer Exp $ # NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp # NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp @@ -150,6 +150,7 @@ file arch/x86/x86/idt.c machdep file arch/x86/x86/intr.c machdep & xenpvhvm file arch/x86/x86/x86_softintr.c machdep file arch/x86/x86/ipi.c xenpvhvm +file arch/x86/x86/patch.c machdep & ! xenpv file arch/x86/x86/pmap.c machdep file arch/x86/x86/x86_tlb.c machdep file arch/x86/x86/procfs_machdep.c procfs @@ -390,7 +391,7 @@ endif include "dev/pcmcia/files.pcmcia" # Domain-0 operations -defflag opt_xen.h DOM0OPS +defflag opt_xen.h DOM0OPS XENPV file arch/xen/xen/privcmd.c dom0ops file arch/xen/x86/xen_shm_machdep.c dom0ops file arch/x86/pci/pci_machdep.c (xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm )
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Tue Apr 14 16:52:36 UTC 2020 Modified Files: src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c Log Message: Remove spllower alias, xen_spllower is gone To generate a diff of this commit: cvs rdiff -u -r1.21.2.3 -r1.21.2.4 src/sys/arch/xen/x86/xen_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/xen_intr.c diff -u src/sys/arch/xen/x86/xen_intr.c:1.21.2.3 src/sys/arch/xen/x86/xen_intr.c:1.21.2.4 --- src/sys/arch/xen/x86/xen_intr.c:1.21.2.3 Sun Apr 12 19:53:37 2020 +++ src/sys/arch/xen/x86/xen_intr.c Tue Apr 14 16:52:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $ */ +/* $NetBSD: xen_intr.c,v 1.21.2.4 2020/04/14 16:52:35 bouyer Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.4 2020/04/14 16:52:35 bouyer Exp $"); #include "opt_multiprocessor.h" @@ -495,7 +495,6 @@ xen_intr_create_intrid(int legacy_irq, s } #if !defined(XENPVHVM) -__strong_alias(spllower, xen_spllower); __strong_alias(x86_read_psl, xen_read_psl); __strong_alias(x86_write_psl, xen_write_psl);
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/conf
Module Name:src Committed By: bouyer Date: Sun Apr 12 21:20:16 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: XEN3_DOM0 Log Message: no MULTIPROCESSOR so NO_PREEMTION To generate a diff of this commit: cvs rdiff -u -r1.175 -r1.175.4.1 src/sys/arch/amd64/conf/XEN3_DOM0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/XEN3_DOM0 diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.175 src/sys/arch/amd64/conf/XEN3_DOM0:1.175.4.1 --- src/sys/arch/amd64/conf/XEN3_DOM0:1.175 Sun Feb 9 16:06:18 2020 +++ src/sys/arch/amd64/conf/XEN3_DOM0 Sun Apr 12 21:20:16 2020 @@ -1,9 +1,10 @@ -# $NetBSD: XEN3_DOM0,v 1.175 2020/02/09 16:06:18 jmcneill Exp $ +# $NetBSD: XEN3_DOM0,v 1.175.4.1 2020/04/12 21:20:16 bouyer Exp $ include "arch/amd64/conf/std.xen" options XENPV # PV dom0 support #options MULTIPROCESSOR # (not yet - dom0 stuff is not MP-safe) +options NO_PREEMPTION options INCLUDE_CONFIG_FILE # embed config file in kernel binary @@ -11,7 +12,7 @@ options INCLUDE_CONFIG_FILE # embed con #options UVMHIST_PRINT #options SYSCALL_DEBUG -#ident "XEN3_DOM0-$Revision: 1.175 $" +#ident "XEN3_DOM0-$Revision: 1.175.4.1 $" maxusers 32 # estimated number of users @@ -60,7 +61,7 @@ options DDB_ONPANIC=1 # see also sysctl options DDB_HISTORY_SIZE=512 # enable history editing in DDB #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table makeoptions COPTS="-O2 -fno-omit-frame-pointer" options DDB_COMMANDONENTER="show registers"
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Sun Apr 12 21:19:49 UTC 2020 Modified Files: src/sys/arch/xen/x86 [bouyer-xenpvh]: autoconf.c Log Message: remove stray 'else' To generate a diff of this commit: cvs rdiff -u -r1.23.8.1 -r1.23.8.2 src/sys/arch/xen/x86/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/autoconf.c diff -u src/sys/arch/xen/x86/autoconf.c:1.23.8.1 src/sys/arch/xen/x86/autoconf.c:1.23.8.2 --- src/sys/arch/xen/x86/autoconf.c:1.23.8.1 Wed Apr 8 17:59:16 2020 +++ src/sys/arch/xen/x86/autoconf.c Sun Apr 12 21:19:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.23.8.1 2020/04/08 17:59:16 bouyer Exp $ */ +/* $NetBSD: autoconf.c,v 1.23.8.2 2020/04/12 21:19:49 bouyer Exp $ */ /* NetBSD: autoconf.c,v 1.75 2003/12/30 12:33:22 pk Exp */ /*- @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23.8.1 2020/04/08 17:59:16 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23.8.2 2020/04/12 21:19:49 bouyer Exp $"); #include "opt_xen.h" #include "opt_multiprocessor.h" @@ -126,7 +126,7 @@ cpu_configure(void) /* identify hypervisor type from SMBIOS */ identify_hypervisor(); #endif /* NBIOS32 > 0 */ - } else + } #endif /* DOM0OPS */ #ifdef PCIBIOS pcibios_init();
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Sun Apr 12 19:53:37 UTC 2020 Modified Files: src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c Log Message: We need to call x86_init_preempt() for all CPUs now. To generate a diff of this commit: cvs rdiff -u -r1.21.2.2 -r1.21.2.3 src/sys/arch/xen/x86/xen_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/xen_intr.c diff -u src/sys/arch/xen/x86/xen_intr.c:1.21.2.2 src/sys/arch/xen/x86/xen_intr.c:1.21.2.3 --- src/sys/arch/xen/x86/xen_intr.c:1.21.2.2 Sun Apr 12 17:25:52 2020 +++ src/sys/arch/xen/x86/xen_intr.c Sun Apr 12 19:53:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_intr.c,v 1.21.2.2 2020/04/12 17:25:52 bouyer Exp $ */ +/* $NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.2 2020/04/12 17:25:52 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $"); #include "opt_multiprocessor.h" @@ -306,6 +306,11 @@ void xen_cpu_intr_init(struct cpu_info * void xen_cpu_intr_init(struct cpu_info *ci) { +#if defined(__HAVE_PREEMPTION) + x86_init_preempt(ci); +#endif + x86_intr_calculatemasks(ci); + #if defined(INTRSTACKSIZE) vaddr_t istack;
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sun Apr 12 17:25:53 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: genassym.cf lock_stubs.S spl.S vector.S src/sys/arch/i386/i386 [bouyer-xenpvh]: genassym.cf i386_trap.S locore.S spl.S vector.S src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h intrdefs.h src/sys/arch/x86/isa [bouyer-xenpvh]: isa_machdep.c src/sys/arch/x86/x86 [bouyer-xenpvh]: i8259.c intr.c src/sys/arch/xen/include [bouyer-xenpvh]: hypervisor.h intr.h src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c xen_intr.c src/sys/arch/xen/xen [bouyer-xenpvh]: clock.c evtchn.c xenevt.c Log Message: Get rid of xen-specific ci_x* interrupt handling: - use the general SIR mechanism, reserving 3 more slots for IPL_VM, IPL_SCHED and IPL_HIGH - remove specific handling from C sources, or change to ipending - convert IPL number to SIR number in various places - Remove XUNMASK/XPENDING in assembly or change to IUNMASK/IPENDING - remove Xen-specific ci_xsources, ci_xmask, ci_xunmask, ci_xpending from struct cpu_info - for now remove a KASSERT that there are no pending interrupts in idle_block(). We can get there with some software interrupts pending in autoconf XXX needs to be looked at. To generate a diff of this commit: cvs rdiff -u -r1.82.4.2 -r1.82.4.3 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.35.6.1 -r1.35.6.2 src/sys/arch/amd64/amd64/lock_stubs.S cvs rdiff -u -r1.43.4.5 -r1.43.4.6 src/sys/arch/amd64/amd64/spl.S cvs rdiff -u -r1.73.6.2 -r1.73.6.3 src/sys/arch/amd64/amd64/vector.S cvs rdiff -u -r1.119.4.2 -r1.119.4.3 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/arch/i386/i386/i386_trap.S cvs rdiff -u -r1.179.2.1 -r1.179.2.2 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.50.4.4 -r1.50.4.5 src/sys/arch/i386/i386/spl.S cvs rdiff -u -r1.85.6.3 -r1.85.6.4 src/sys/arch/i386/i386/vector.S cvs rdiff -u -r1.117.4.3 -r1.117.4.4 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/arch/x86/include/intrdefs.h cvs rdiff -u -r1.44 -r1.44.10.1 src/sys/arch/x86/isa/isa_machdep.c cvs rdiff -u -r1.23 -r1.23.10.1 src/sys/arch/x86/x86/i8259.c cvs rdiff -u -r1.150.6.1 -r1.150.6.2 src/sys/arch/x86/x86/intr.c cvs rdiff -u -r1.49 -r1.49.10.1 src/sys/arch/xen/include/hypervisor.h cvs rdiff -u -r1.53 -r1.53.6.1 src/sys/arch/xen/include/intr.h cvs rdiff -u -r1.36 -r1.36.8.1 src/sys/arch/xen/x86/hypervisor_machdep.c cvs rdiff -u -r1.21.2.1 -r1.21.2.2 src/sys/arch/xen/x86/xen_intr.c cvs rdiff -u -r1.80.6.1 -r1.80.6.2 src/sys/arch/xen/xen/clock.c cvs rdiff -u -r1.88.2.2 -r1.88.2.3 src/sys/arch/xen/xen/evtchn.c cvs rdiff -u -r1.56 -r1.56.2.1 src/sys/arch/xen/xen/xenevt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/genassym.cf diff -u src/sys/arch/amd64/amd64/genassym.cf:1.82.4.2 src/sys/arch/amd64/amd64/genassym.cf:1.82.4.3 --- src/sys/arch/amd64/amd64/genassym.cf:1.82.4.2 Sat Apr 11 10:11:30 2020 +++ src/sys/arch/amd64/amd64/genassym.cf Sun Apr 12 17:25:52 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.82.4.2 2020/04/11 10:11:30 bouyer Exp $ +# $NetBSD: genassym.cf,v 1.82.4.3 2020/04/12 17:25:52 bouyer Exp $ # # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -323,6 +323,8 @@ define IPL_NONE IPL_NONE define IPL_PREEMPT IPL_PREEMPT define IPL_NET IPL_NET define IPL_CLOCK IPL_CLOCK +define IPL_VM IPL_VM +define IPL_SCHED IPL_SCHED define IPL_HIGH IPL_HIGH define LIR_IPI LIR_IPI @@ -362,10 +364,9 @@ define VM_GUEST_XENPV VM_GUEST_XENPV ifdef XEN define CPU_INFO_VCPU offsetof(struct cpu_info, ci_vcpu) -define CPU_INFO_XPENDING offsetof(struct cpu_info, ci_xpending) -define CPU_INFO_XMASK offsetof(struct cpu_info, ci_xmask) -define CPU_INFO_XUNMASK offsetof(struct cpu_info, ci_xunmask) -define CPU_INFO_XSOURCES offsetof(struct cpu_info, ci_xsources) +define SIR_XENIPL_VM SIR_XENIPL_VM +define SIR_XENIPL_SCHED SIR_XENIPL_SCHED +define SIR_XENIPL_HIGH SIR_XENIPL_HIGH define EVTCHN_UPCALL_MASK offsetof(struct vcpu_info, evtchn_upcall_mask) ifdef XENPV define XEN_PT_BASE offsetof(struct start_info, pt_base) Index: src/sys/arch/amd64/amd64/lock_stubs.S diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.1 src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.2 --- src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.1 Sat Apr 11 18:26:06 2020 +++ src/sys/arch/amd64/amd64/lock_stubs.S Sun Apr 12 17:25:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.S,v 1.35.6.1 2020/04/11 18:26:06 bouyer Exp $ */ +/* $NetBSD: lock_stubs.S,v 1.35.6.2 2020/04/12 17:25:52 bouyer Exp $ */ /* * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -130,11 +130,6 @@ ENTRY(mutex_spin_exit) CLI(ax) testl CPU_INFO_IPENDING(%r8), %esi jnz _C_LABEL(Xspllower) -#if defined(XEN) - movl CPU_INFO_X
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Sun Apr 12 17:17:38 UTC 2020 Modified Files: src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_ipi.c Log Message: Add XEN_IPI_KPREEMPT to list of valid IPIs To generate a diff of this commit: cvs rdiff -u -r1.35.6.1 -r1.35.6.2 src/sys/arch/xen/x86/xen_ipi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/xen_ipi.c diff -u src/sys/arch/xen/x86/xen_ipi.c:1.35.6.1 src/sys/arch/xen/x86/xen_ipi.c:1.35.6.2 --- src/sys/arch/xen/x86/xen_ipi.c:1.35.6.1 Sat Apr 11 18:26:07 2020 +++ src/sys/arch/xen/x86/xen_ipi.c Sun Apr 12 17:17:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_ipi.c,v 1.35.6.1 2020/04/11 18:26:07 bouyer Exp $ */ +/* $NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $ */ /*- * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc. @@ -33,10 +33,10 @@ /* * Based on: x86/ipi.c - * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.1 2020/04/11 18:26:07 bouyer Exp $"); + * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $"); */ -__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.1 2020/04/11 18:26:07 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $"); #include "opt_ddb.h" @@ -156,7 +156,7 @@ valid_ipimask(uint32_t ipimask) { uint32_t masks = XEN_IPI_GENERIC | XEN_IPI_HVCB | XEN_IPI_XCALL | XEN_IPI_DDB | XEN_IPI_SYNCH_FPU | - XEN_IPI_HALT | XEN_IPI_KICK | XEN_IPI_AST; + XEN_IPI_HALT | XEN_IPI_KICK | XEN_IPI_AST | XEN_IPI_KPREEMPT; if (ipimask & ~masks) { return false;
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Sun Apr 12 17:16:58 UTC 2020 Modified Files: src/sys/arch/xen/x86 [bouyer-xenpvh]: xenfunc.c Log Message: kpreempt_disable() only for x86_64 (which calls pmap_changeprot_local)). On i386 curcpu() is not valid yet and we don't need preemption disabled. To generate a diff of this commit: cvs rdiff -u -r1.26.8.1 -r1.26.8.2 src/sys/arch/xen/x86/xenfunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/xenfunc.c diff -u src/sys/arch/xen/x86/xenfunc.c:1.26.8.1 src/sys/arch/xen/x86/xenfunc.c:1.26.8.2 --- src/sys/arch/xen/x86/xenfunc.c:1.26.8.1 Sat Apr 11 18:26:07 2020 +++ src/sys/arch/xen/x86/xenfunc.c Sun Apr 12 17:16:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xenfunc.c,v 1.26.8.1 2020/04/11 18:26:07 bouyer Exp $ */ +/* $NetBSD: xenfunc.c,v 1.26.8.2 2020/04/12 17:16:58 bouyer Exp $ */ /* * Copyright (c) 2004 Christian Limpach. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.26.8.1 2020/04/11 18:26:07 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.26.8.2 2020/04/12 17:16:58 bouyer Exp $"); #include @@ -61,7 +61,9 @@ lidt(struct region_descriptor *rd) * will be available at the boot stage when this is called. */ static char xen_idt_page[PAGE_SIZE] __attribute__((__aligned__ (PAGE_SIZE))); +#if defined(__x86_64__) kpreempt_disable(); +#endif memset(xen_idt_page, 0, PAGE_SIZE); struct trap_info *xen_idt = (void * )xen_idt_page; @@ -96,8 +98,8 @@ lidt(struct region_descriptor *rd) #if defined(__x86_64__) /* reset */ pmap_changeprot_local((vaddr_t) xen_idt, VM_PROT_READ|VM_PROT_WRITE); -#endif /* __x86_64 */ kpreempt_enable(); +#endif /* __x86_64 */ } void
CVS commit: [bouyer-xenpvh] src/sys/arch/i386/i386
Module Name:src Committed By: bouyer Date: Sun Apr 12 16:35:49 UTC 2020 Modified Files: src/sys/arch/i386/i386 [bouyer-xenpvh]: vector.S Log Message: The critical section handling is gone, remove comment about it To generate a diff of this commit: cvs rdiff -u -r1.85.6.2 -r1.85.6.3 src/sys/arch/i386/i386/vector.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/vector.S diff -u src/sys/arch/i386/i386/vector.S:1.85.6.2 src/sys/arch/i386/i386/vector.S:1.85.6.3 --- src/sys/arch/i386/i386/vector.S:1.85.6.2 Sat Apr 11 12:01:42 2020 +++ src/sys/arch/i386/i386/vector.S Sun Apr 12 16:35:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $ */ +/* $NetBSD: vector.S,v 1.85.6.3 2020/04/12 16:35:49 bouyer Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.3 2020/04/12 16:35:49 bouyer Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -1062,19 +1062,6 @@ END(xenev_stubs) #ifdef XEN -/* - * A note on the "critical region" in our callback handler. - * We want to avoid stacking callback handlers due to events occurring - * during handling of the last event. To do this, we keep events disabled - * until weve done all processing. HOWEVER, we must enable events before - * popping the stack frame (cant be done atomically) and so it would still - * be possible to get enough handler activations to overflow the stack. - * Although unlikely, bugs of that kind are hard to track down, so wed - * like to avoid the possibility. - * So, on entry to the handler we detect whether we interrupted an - * existing activation in its critical region -- if so, we pop the current - * activation and restart the handler using the previous one. - */ ENTRY(hypervisor_callback) IDTVEC(hypervisor_pvhvm_callback) pushl $0 /* dummy error code */
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Sun Apr 12 11:16:59 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c Log Message: Now that we return from hypervisor_callback via Xdoreti, no need to emulate it in evtchn_do_event() any more. To generate a diff of this commit: cvs rdiff -u -r1.88.2.1 -r1.88.2.2 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.88.2.1 src/sys/arch/xen/xen/evtchn.c:1.88.2.2 --- src/sys/arch/xen/xen/evtchn.c:1.88.2.1 Fri Apr 10 14:38:19 2020 +++ src/sys/arch/xen/xen/evtchn.c Sun Apr 12 11:16:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.88.2.1 2020/04/10 14:38:19 bouyer Exp $ */ +/* $NetBSD: evtchn.c,v 1.88.2.2 2020/04/12 11:16:58 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.1 2020/04/10 14:38:19 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.2 2020/04/12 11:16:58 bouyer Exp $"); #include "opt_xen.h" #include "isa.h" @@ -316,8 +316,6 @@ evtchn_do_event(int evtch, struct intrfr struct intrhand *ih; int (*ih_fun)(void *, void *); uint32_t iplmask; - int i; - uint32_t iplbit; KASSERTMSG(evtch >= 0, "negative evtch: %d", evtch); KASSERTMSG(evtch < NR_EVENT_CHANNELS, @@ -404,35 +402,6 @@ evtchn_do_event(int evtch, struct intrfr #endif /* NPCI > 0 || NISA > 0 */ splx: - /* - * C version of spllower(). ASTs will be checked when - * hypevisor_callback() exits, so no need to check here. - */ - iplmask = (XUNMASK(ci, ilevel) & ci->ci_xpending); - while (iplmask != 0) { - iplbit = 1 << (NIPL - 1); - i = (NIPL - 1); - while (iplmask != 0 && i > ilevel) { - while (iplmask & iplbit) { -ci->ci_xpending &= ~iplbit; -ci->ci_ilevel = i; -for (ih = ci->ci_xsources[i]->is_handlers; -ih != NULL; ih = ih->ih_next) { - KASSERT(ih->ih_cpu == ci); - x86_enable_intr(); - ih_fun = (void *)ih->ih_fun; - ih_fun(ih->ih_arg, regs); - x86_disable_intr(); -} -hypervisor_enable_ipl(i); -/* more pending IPLs may have been registered */ -iplmask = -(XUNMASK(ci, ilevel) & ci->ci_xpending); - } - i--; - iplbit >>= 1; - } - } ci->ci_ilevel = ilevel; return 0; }
CVS commit: [bouyer-xenpvh] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sat Apr 11 21:21:49 UTC 2020 Modified Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: mainbus.c Log Message: Attach hypervisor earlier, so that ISA/PCI emulated device are disabled before we probe them. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.12.1 src/sys/arch/x86/x86/mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/mainbus.c diff -u src/sys/arch/x86/x86/mainbus.c:1.3 src/sys/arch/x86/x86/mainbus.c:1.3.12.1 --- src/sys/arch/x86/x86/mainbus.c:1.3 Thu Feb 14 08:18:25 2019 +++ src/sys/arch/x86/x86/mainbus.c Sat Apr 11 21:21:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $ */ +/* $NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $"); #include #include @@ -225,17 +225,17 @@ mainbus_attach(device_t parent, device_t #endif /* XENPV */ x86_cpubus_attach(self); -#if defined(__i386__) && !defined(XENPV) - i386_mainbus_attach(parent, self, aux); -#elif defined(__x86_64__) && !defined(XENPV) - amd64_mainbus_attach(parent, self, aux); -#endif #if defined(XENPV) } #endif /* XENPV */ #if defined(XEN) xen_mainbus_attach(parent, self, aux); #endif +#if defined(__i386__) && !defined(XENPV) + i386_mainbus_attach(parent, self, aux); +#elif defined(__x86_64__) && !defined(XENPV) + amd64_mainbus_attach(parent, self, aux); +#endif } int
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Sat Apr 11 21:21:16 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c Log Message: Use some PIO magic to disable qemu emulated disks and network device when PVHVM is configured. From FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/arch/xen/xen/hypervisor.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/hypervisor.c diff -u src/sys/arch/xen/xen/hypervisor.c:1.73.2.1 src/sys/arch/xen/xen/hypervisor.c:1.73.2.2 --- src/sys/arch/xen/xen/hypervisor.c:1.73.2.1 Wed Apr 8 17:59:17 2020 +++ src/sys/arch/xen/xen/hypervisor.c Sat Apr 11 21:21:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.73.2.1 2020/04/08 17:59:17 bouyer Exp $ */ +/* $NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.1 2020/04/08 17:59:17 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $"); #include #include @@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c #include #include #include +#include #include #include @@ -191,6 +192,15 @@ int xen_version; static bool hypervisor_suspend(device_t, const pmf_qual_t *); static bool hypervisor_resume(device_t, const pmf_qual_t *); +/* from FreeBSD */ +#define XEN_MAGIC_IOPORT 0x10 +enum { + XMI_MAGIC= 0x49d2, + XMI_UNPLUG_IDE_DISKS = 0x01, + XMI_UNPLUG_NICS = 0x02, + XMI_UNPLUG_IDE_EXCEPT_PRI_MASTER = 0x04 +}; + /* * Probe for the hypervisor; always succeeds. */ @@ -415,7 +425,7 @@ hypervisor_match(device_t parent, cfdata bi.common.len = sizeof(struct btinfo_rootdevice); /* From i386/multiboot.c */ - /* $NetBSD: hypervisor.c,v 1.73.2.1 2020/04/08 17:59:17 bouyer Exp $ */ + /* $NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $ */ int i, len; vaddr_t data; extern struct bootinfo bootinfo; @@ -434,6 +444,13 @@ hypervisor_match(device_t parent, cfdata bip->bi_nentries++; } + /* disable emulated devices */ + if (inw(XEN_MAGIC_IOPORT) == XMI_MAGIC) { + outw(XEN_MAGIC_IOPORT, XMI_UNPLUG_IDE_DISKS | XMI_UNPLUG_NICS); + } else { + aprint_error("%s: Unable to disable emulated devices\n", + haa->haa_busname); + } #endif /* XENPVHVM */ /* If we got here, it must mean we matched */
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 11 18:26:08 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: lock_stubs.S spl.S src/sys/arch/i386/i386 [bouyer-xenpvh]: spl.S src/sys/arch/x86/conf [bouyer-xenpvh]: files.x86 src/sys/arch/x86/include [bouyer-xenpvh]: intr.h src/sys/arch/x86/x86 [bouyer-xenpvh]: intr.c x86_machdep.c src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen src/sys/arch/xen/include [bouyer-xenpvh]: intrdefs.h src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_ipi.c xenfunc.c src/sys/arch/xen/xen [bouyer-xenpvh]: clock.c Added Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: x86_softintr.c Log Message: Move softint and preemtion-related functions out of x86/x86/intr.c to its own file, x86/x86/x86_softintr.c Add x86/x86/x86_softintr.c for native and XenPV Make sure XenPV also check ci_ioending, which is used for softints. Switch XenPV to fast softints and allow kernel preemption. kpreempt_disable() before calling pmap_changeprot_local() run xen_wallclock_time() and xen_global_systime_ns() at splshed() to avoid being interrupted. XXX amd64 lock stubs are racy for XPENDING To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/arch/amd64/amd64/lock_stubs.S cvs rdiff -u -r1.43.4.4 -r1.43.4.5 src/sys/arch/amd64/amd64/spl.S cvs rdiff -u -r1.50.4.3 -r1.50.4.4 src/sys/arch/i386/i386/spl.S cvs rdiff -u -r1.107 -r1.107.10.1 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r1.61.6.1 -r1.61.6.2 src/sys/arch/x86/include/intr.h cvs rdiff -u -r1.150 -r1.150.6.1 src/sys/arch/x86/x86/intr.c cvs rdiff -u -r1.137.2.2 -r1.137.2.3 src/sys/arch/x86/x86/x86_machdep.c cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/x86/x86/x86_softintr.c cvs rdiff -u -r1.180 -r1.180.2.1 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.15 -r1.15.2.1 src/sys/arch/xen/include/intrdefs.h cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/arch/xen/x86/xen_ipi.c cvs rdiff -u -r1.26 -r1.26.8.1 src/sys/arch/xen/x86/xenfunc.c cvs rdiff -u -r1.80 -r1.80.6.1 src/sys/arch/xen/xen/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/lock_stubs.S diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.35 src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.1 --- src/sys/arch/amd64/amd64/lock_stubs.S:1.35 Sun Dec 8 20:00:56 2019 +++ src/sys/arch/amd64/amd64/lock_stubs.S Sat Apr 11 18:26:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.S,v 1.35 2019/12/08 20:00:56 ad Exp $ */ +/* $NetBSD: lock_stubs.S,v 1.35.6.1 2020/04/11 18:26:06 bouyer Exp $ */ /* * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -126,15 +126,12 @@ ENTRY(mutex_spin_exit) jnz 1f cmpl CPU_INFO_ILEVEL(%r8), %edi jae 1f -#if !defined(XENPV) movl CPU_INFO_IUNMASK(%r8,%rdi,4), %esi CLI(ax) testl CPU_INFO_IPENDING(%r8), %esi jnz _C_LABEL(Xspllower) -#endif #if defined(XEN) movl CPU_INFO_XUNMASK(%r8,%rdi,4), %esi - CLI(ax) testl CPU_INFO_XPENDING(%r8), %esi jnz _C_LABEL(Xspllower) #endif @@ -155,14 +152,12 @@ ENTRY(mutex_spin_exit) cmpl %edx,%ecx /* new level is lower? */ jae 2f 1: -#if !defined(XENPV) movl CPU_INFO_IPENDING(%rsi),%eax testl %eax,CPU_INFO_IUNMASK(%rsi,%rcx,4)/* deferred interrupts? */ jnz 3f movl %eax,%ebx cmpxchg8b CPU_INFO_ISTATE(%rsi) /* swap in new ilevel */ jnz 4f -#endif #if defined(XEN) movl CPU_INFO_XPENDING(%rsi),%eax testl %eax,CPU_INFO_XUNMASK(%rsi,%rcx,4)/* deferred interrupts? */ Index: src/sys/arch/amd64/amd64/spl.S diff -u src/sys/arch/amd64/amd64/spl.S:1.43.4.4 src/sys/arch/amd64/amd64/spl.S:1.43.4.5 --- src/sys/arch/amd64/amd64/spl.S:1.43.4.4 Sat Apr 11 10:11:30 2020 +++ src/sys/arch/amd64/amd64/spl.S Sat Apr 11 18:26:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.43.4.4 2020/04/11 10:11:30 bouyer Exp $ */ +/* $NetBSD: spl.S,v 1.43.4.5 2020/04/11 18:26:06 bouyer Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -91,7 +91,6 @@ ENTRY(splraise) ret END(splraise) -#ifndef XENPV /* * Xsoftintr() * @@ -148,11 +147,11 @@ IDTVEC(softintr) movq PCB_RSP0(%rdx),%rsp /* dispatch */ - sti + STI(di) movq %r15,%rdi /* interrupted LWP */ movl IS_MAXLEVEL(%rax),%esi /* ipl to run at */ call _C_LABEL(softint_dispatch)/* run handlers */ - cli + CLI(di) /* restore old context */ movq L_PCB(%r15),%rcx @@ -174,7 +173,7 @@ IDTVEC_END(softintr) */ ENTRY(softintr_ret) incl CPUVAR(MTX_COUNT) /* re-adjust after mi_switch */ - cli + CLI(ax) /* %rax not used by Xspllower/Xdoreti */ jmp *%r13 /* back to Xspllower/Xdoreti */ END(softintr_ret) @@ -196,11 +195,11 @@ END(softint_trigger) */ IDTVEC(recurse_preempt) movl $IPL_PREEMPT,CPUVAR(ILEVEL) - sti + STI(di) xorq %rdi,%rdi KMSAN_INIT_ARG(8) call _C_LABEL(kpreempt) - cli + CLI(di) jmp *%r13 /* back to Xspllower */ IDTVEC_END(recurse_preempt) @@ -211,20 +210,19 @@ IDTVEC_END(recur
CVS commit: [bouyer-xenpvh] src/sys/arch/i386/i386
Module Name:src Committed By: bouyer Date: Sat Apr 11 12:01:42 UTC 2020 Modified Files: src/sys/arch/i386/i386 [bouyer-xenpvh]: spl.S vector.S Log Message: calling stipending() is only needed in the PV case; in PVHVM hypervisor_callback() will be called again as soon as we enable interrupts. Use the PVHVM XENINTRSTUB for PV too; asjust Xdoreti as needed. merge hypervisor_callback with hypervisor_pvhvm_callback. The reetrancy should not be an issue, as we're already re-enabling events in do_hupervisor_callback (that it, outside of the critical section). We now can call Xdoreti in both cases. To generate a diff of this commit: cvs rdiff -u -r1.50.4.2 -r1.50.4.3 src/sys/arch/i386/i386/spl.S cvs rdiff -u -r1.85.6.1 -r1.85.6.2 src/sys/arch/i386/i386/vector.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/spl.S diff -u src/sys/arch/i386/i386/spl.S:1.50.4.2 src/sys/arch/i386/i386/spl.S:1.50.4.3 --- src/sys/arch/i386/i386/spl.S:1.50.4.2 Sat Apr 11 10:11:31 2020 +++ src/sys/arch/i386/i386/spl.S Sat Apr 11 12:01:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.50.4.2 2020/04/11 10:11:31 bouyer Exp $ */ +/* $NetBSD: spl.S,v 1.50.4.3 2020/04/11 12:01:42 bouyer Exp $ */ /* * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50.4.2 2020/04/11 10:11:31 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50.4.3 2020/04/11 12:01:42 bouyer Exp $"); #include "opt_ddb.h" #include "opt_spldebug.h" @@ -236,7 +236,7 @@ IDTVEC(spllower) #endif 3: movl %ebx,CPUVAR(ILEVEL) -#ifdef XEN +#ifdef XENPV STIC(%eax) jz 4f call _C_LABEL(stipending) @@ -260,7 +260,7 @@ IDTVEC(spllower) IDTVEC_END(spllower) /* - * Handle return from interrupt after device handler finishes. + * Xdoreti: Handle return from interrupt after device handler finishes. * * Important registers: * ebx - cpl to restore @@ -270,10 +270,8 @@ IDTVEC_END(spllower) * called with interrupt disabled. */ IDTVEC(doreti) -#ifndef XENPV IDEPTH_DECR popl %ebx /* get previous priority */ -#endif .Ldoreti_resume_stic: movl $.Ldoreti_resume,%esi /* address to resume loop at */ .Ldoreti_resume: @@ -292,7 +290,6 @@ IDTVEC(doreti) #endif /* XENPV */ #endif /* defined(DEBUG) */ -#if !defined(XENPV) movl %ebx,%eax movl CPUVAR(IUNMASK)(,%eax,4),%eax andl CPUVAR(IPENDING),%eax @@ -301,7 +298,6 @@ IDTVEC(doreti) btrl %eax,CPUVAR(IPENDING) movl CPUVAR(ISOURCES)(,%eax, 4),%eax jmp *IS_RESUME(%eax) -#endif 2: #if defined(XEN) movl %ebx,%eax @@ -340,7 +336,7 @@ END(doreti_checkast) jnz 9f HANDLE_DEFERRED_FPU 6: -#ifdef XEN +#ifdef XENPV STIC(%eax) jz 4f call _C_LABEL(stipending) Index: src/sys/arch/i386/i386/vector.S diff -u src/sys/arch/i386/i386/vector.S:1.85.6.1 src/sys/arch/i386/i386/vector.S:1.85.6.2 --- src/sys/arch/i386/i386/vector.S:1.85.6.1 Fri Apr 10 14:42:00 2020 +++ src/sys/arch/i386/i386/vector.S Sat Apr 11 12:01:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.85.6.1 2020/04/10 14:42:00 bouyer Exp $ */ +/* $NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.1 2020/04/10 14:42:00 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -940,38 +940,6 @@ END(x2apic_level_stubs) #if defined(XEN) #define voidop(num) -#ifdef XENPV -#define XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \ -IDTVEC(recurse_ ## name ## num) ;\ - INTR_RECURSE_HWFRAME ;\ - subl $4,%esp ;\ - pushl $T_ASTFLT /* trap # for doing ASTs */ ;\ - INTRENTRY ;\ - movl $_C_LABEL(Xdoreti), %esi; /* we now have a trap frame, so loop using doreti instead */ ;\ -IDTVEC(resume_ ## name ## num) \ - movl $IREENT_MAGIC,TF_ERR(%esp);\ - pushl %ebx ;\ - movl CPUVAR(XSOURCES) + (num) * 4,%ebp ;\ - movl $num,CPUVAR(ILEVEL) ;\ - IDEPTH_INCR /* leaves old %esp on stack */ ;\ - STI(%eax) ;\ - movl IS_HANDLERS(%ebp),%ebx ;\ -6: \ - pushl IH_ARG(%ebx) ;\ - call *IH_FUN(%ebx) /* call it */ ;\ - addl $4,%esp /* toss the arg */ ;\ - movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\ - testl %ebx,%ebx ;\ - jnz 6b ;\ - \ - CLI(%eax) ;\ - unmask(num) /* unmask it in hardware */ ;\ - late_ack(num) ;\ - IDEPTH_DECR ;\ - popl %ebx ;\ - jmp *%esi /* lower spl and do ASTs */ ;\ - -#else /* XENPV */ #define XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \ IDTVEC(recurse_ ## name ## num) ;\ INTR_RECURSE_HWFRAME ;\ @@ -999,8 +967,6 @@ IDTVEC(resume_ ## name ## num) \ late_ack(num) ;\ jmp _C_LABEL(Xdoreti
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/amd64
Module Name:src Committed By: bouyer Date: Sat Apr 11 11:56:51 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: vector.S Log Message: Merge back hypervisor_callback and hypervisor_pvhvm_callback, there's no issues calling Xdoreti in the PV case. To generate a diff of this commit: cvs rdiff -u -r1.73.6.1 -r1.73.6.2 src/sys/arch/amd64/amd64/vector.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/vector.S diff -u src/sys/arch/amd64/amd64/vector.S:1.73.6.1 src/sys/arch/amd64/amd64/vector.S:1.73.6.2 --- src/sys/arch/amd64/amd64/vector.S:1.73.6.1 Fri Apr 10 14:41:59 2020 +++ src/sys/arch/amd64/amd64/vector.S Sat Apr 11 11:56:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.73.6.1 2020/04/10 14:41:59 bouyer Exp $ */ +/* $NetBSD: vector.S,v 1.73.6.2 2020/04/11 11:56:51 bouyer Exp $ */ /* * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. @@ -811,36 +811,23 @@ END(xenev_stubs) */ /* Hypervisor callback */ + ENTRY(hypervisor_callback) movq (%rsp),%rcx movq 8(%rsp),%r11 addq $16,%rsp - pushq $0 /* Dummy error code */ - pushq $T_ASTFLT - INTRENTRY - /* sti?? */ - movq %rsp,%rdi - subq $8,%rdi; /* don't forget if_ppl */ - call do_hypervisor_callback - testb $SEL_RPL,TF_CS(%rsp) - jnz doreti_checkast -1: - INTRFASTEXIT -END(hypervisor_callback) - IDTVEC(hypervisor_pvhvm_callback) pushq $0 /* Dummy error code */ pushq $T_ASTFLT INTRENTRY movlCPUVAR(ILEVEL),%edi pushq %rdi /* for Xdoreti */ - /* sti?? */ movq %rsp,%rdi - subq $8,%rdi; /* don't forget if_ppl */ call do_hypervisor_callback incl CPUVAR(IDEPTH) jmp _C_LABEL(Xdoreti) IDTVEC_END(hypervisor_pvhvm_callback) +END(hypervisor_callback) #endif /* XEN */ #ifdef XENPV
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Sat Apr 11 10:11:31 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: genassym.cf spl.S src/sys/arch/amd64/include [bouyer-xenpvh]: frameasm.h src/sys/arch/i386/i386 [bouyer-xenpvh]: genassym.cf spl.S src/sys/arch/i386/include [bouyer-xenpvh]: frameasm.h src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c Log Message: Include ci_isources[] for XenPV too. Adjust spllower() to XenPV needs, and switch XenPV to the native spllower(). Remove xen_spllower(). To generate a diff of this commit: cvs rdiff -u -r1.82.4.1 -r1.82.4.2 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.43.4.3 -r1.43.4.4 src/sys/arch/amd64/amd64/spl.S cvs rdiff -u -r1.47 -r1.47.6.1 src/sys/arch/amd64/include/frameasm.h cvs rdiff -u -r1.119.4.1 -r1.119.4.2 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.50.4.1 -r1.50.4.2 src/sys/arch/i386/i386/spl.S cvs rdiff -u -r1.29 -r1.29.6.1 src/sys/arch/i386/include/frameasm.h cvs rdiff -u -r1.117.4.2 -r1.117.4.3 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.21 -r1.21.2.1 src/sys/arch/xen/x86/xen_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/genassym.cf diff -u src/sys/arch/amd64/amd64/genassym.cf:1.82.4.1 src/sys/arch/amd64/amd64/genassym.cf:1.82.4.2 --- src/sys/arch/amd64/amd64/genassym.cf:1.82.4.1 Wed Apr 8 17:59:16 2020 +++ src/sys/arch/amd64/amd64/genassym.cf Sat Apr 11 10:11:30 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.82.4.1 2020/04/08 17:59:16 bouyer Exp $ +# $NetBSD: genassym.cf,v 1.82.4.2 2020/04/11 10:11:30 bouyer Exp $ # # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -246,13 +246,11 @@ define CPU_INFO_CURPRIORITY offsetof(str define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt) define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel) define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth) -if !defined(XENPV) define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending) define CPU_INFO_IMASKED offsetof(struct cpu_info, ci_imasked) define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask) define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask) define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources) -endif define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) define CPU_INFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl) define CPU_INFO_CPUID offsetof(struct cpu_info, ci_cpuid) Index: src/sys/arch/amd64/amd64/spl.S diff -u src/sys/arch/amd64/amd64/spl.S:1.43.4.3 src/sys/arch/amd64/amd64/spl.S:1.43.4.4 --- src/sys/arch/amd64/amd64/spl.S:1.43.4.3 Fri Apr 10 14:41:59 2020 +++ src/sys/arch/amd64/amd64/spl.S Sat Apr 11 10:11:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.43.4.3 2020/04/10 14:41:59 bouyer Exp $ */ +/* $NetBSD: spl.S,v 1.43.4.4 2020/04/11 10:11:30 bouyer Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -226,7 +226,6 @@ IDTVEC(resume_preempt) IDTVEC_END(resume_preempt) #endif /* XEN */ -#ifndef XENPV /* * void spllower(int s); * @@ -238,8 +237,8 @@ ENTRY(spllower) cmpl CPUVAR(ILEVEL),%edi jae 1f movl CPUVAR(IUNMASK)(,%rdi,4),%edx - pushf - cli + PUSHF(ax) + CLI(ax) testl CPUVAR(IPENDING),%edx jnz 2f #if defined(XEN) @@ -248,12 +247,20 @@ ENTRY(spllower) jnz 2f #endif movl %edi,CPUVAR(ILEVEL) - popf + POPF /* clobbers %rdi */ 1: ret ret 2: +#ifdef XENPV + /* + * no need to call stipending, we're going to CLI again + * just drop the saved value on stack + */ + addq $8,%rsp +#else popf +#endif jmp _C_LABEL(Xspllower) 3: .space 16 @@ -261,6 +268,7 @@ ENTRY(spllower) END(spllower) LABEL(spllower_end) +#ifndef XENPV /* * void cx8_spllower(int s); * Index: src/sys/arch/amd64/include/frameasm.h diff -u src/sys/arch/amd64/include/frameasm.h:1.47 src/sys/arch/amd64/include/frameasm.h:1.47.6.1 --- src/sys/arch/amd64/include/frameasm.h:1.47 Sun Nov 17 14:07:00 2019 +++ src/sys/arch/amd64/include/frameasm.h Sat Apr 11 10:11:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: frameasm.h,v 1.47 2019/11/17 14:07:00 maxv Exp $ */ +/* $NetBSD: frameasm.h,v 1.47.6.1 2020/04/11 10:11:30 bouyer Exp $ */ #ifndef _AMD64_MACHINE_FRAMEASM_H #define _AMD64_MACHINE_FRAMEASM_H @@ -31,11 +31,23 @@ movq CPUVAR(VCPU),%r ## temp_reg ; \ movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg); +#define PUSHF(temp_reg) \ + movq CPUVAR(VCPU),%r ## temp_reg ; \ + movzbl EVTCHN_UPCALL_MASK(%r ## temp_reg), %e ## temp_reg; \ + pushq %r ## temp_reg + +#define POPF \ + popq %rdi; \ + call _C_LABEL(xen_write_psl) + + #else /* XENPV */ #define XEN_ONLY2(x,y) #define NOT_XEN(x) x #define CLI(temp_reg) cli #define STI(temp_reg) sti +#define PUSHF(temp_reg) pushf +#define POPL popl #endif /* XEN */ #define HP_NAME_CLAC 1 Index: src/sys/arch/i386/i386/genassym.cf diff -u sr
CVS commit: [bouyer-xenpvh] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sat Apr 11 08:06:16 UTC 2020 Modified Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: x86_machdep.c Log Message: Remove spaces in machdep.hypervisor, suggested by mlelstv@ To generate a diff of this commit: cvs rdiff -u -r1.137.2.1 -r1.137.2.2 src/sys/arch/x86/x86/x86_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/x86_machdep.c diff -u src/sys/arch/x86/x86/x86_machdep.c:1.137.2.1 src/sys/arch/x86/x86/x86_machdep.c:1.137.2.2 --- src/sys/arch/x86/x86/x86_machdep.c:1.137.2.1 Wed Apr 8 17:59:16 2020 +++ src/sys/arch/x86/x86/x86_machdep.c Sat Apr 11 08:06:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_machdep.c,v 1.137.2.1 2020/04/08 17:59:16 bouyer Exp $ */ +/* $NetBSD: x86_machdep.c,v 1.137.2.2 2020/04/11 08:06:16 bouyer Exp $ */ /*- * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.137.2.1 2020/04/08 17:59:16 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.137.2.2 2020/04/11 08:06:16 bouyer Exp $"); #include "opt_modular.h" #include "opt_physmem.h" @@ -1255,10 +1255,10 @@ sysctl_machdep_tsc_enable(SYSCTLFN_ARGS) static const char * const vm_guest_name[VM_LAST] = { [VM_GUEST_NO] = "none", [VM_GUEST_VM] = "generic", - [VM_GUEST_XENPV] = "Xen PV", - [VM_GUEST_XENPVH] = "Xen PVH", - [VM_GUEST_XENHVM] = "Xen HVM", - [VM_GUEST_XENPVHVM] = "Xen PVHVM", + [VM_GUEST_XENPV] = "XenPV", + [VM_GUEST_XENPVH] = "XenPVH", + [VM_GUEST_XENHVM] = "XenHVM", + [VM_GUEST_XENPVHVM] = "XenPVHVM", [VM_GUEST_HV] = "Hyper-V", [VM_GUEST_VMWARE] = "VMware", [VM_GUEST_KVM] = "KVM",
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Fri Apr 10 14:42:00 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: spl.S vector.S src/sys/arch/amd64/conf [bouyer-xenpvh]: XEN3_PVHVM src/sys/arch/i386/conf [bouyer-xenpvh]: XEN3PAE_PVHVM src/sys/arch/i386/i386 [bouyer-xenpvh]: spl.S vector.S src/sys/arch/x86/include [bouyer-xenpvh]: intr.h Log Message: spllower(): Also check Xen pending events hypervisor_pvhvm_callback(): exit via Xdoreti, so that pending interrupts are checked. disable __HAVE_FAST_SOFTINTS only for XENPV, it now works for PVHVM. We still have to disable PREEMPTION, until we support MULTIPROCESSOR To generate a diff of this commit: cvs rdiff -u -r1.43.4.2 -r1.43.4.3 src/sys/arch/amd64/amd64/spl.S cvs rdiff -u -r1.73 -r1.73.6.1 src/sys/arch/amd64/amd64/vector.S cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/sys/arch/amd64/conf/XEN3_PVHVM cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/sys/arch/i386/conf/XEN3PAE_PVHVM cvs rdiff -u -r1.50 -r1.50.4.1 src/sys/arch/i386/i386/spl.S cvs rdiff -u -r1.85 -r1.85.6.1 src/sys/arch/i386/i386/vector.S cvs rdiff -u -r1.61 -r1.61.6.1 src/sys/arch/x86/include/intr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/spl.S diff -u src/sys/arch/amd64/amd64/spl.S:1.43.4.2 src/sys/arch/amd64/amd64/spl.S:1.43.4.3 --- src/sys/arch/amd64/amd64/spl.S:1.43.4.2 Thu Apr 9 21:01:33 2020 +++ src/sys/arch/amd64/amd64/spl.S Fri Apr 10 14:41:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.43.4.2 2020/04/09 21:01:33 bouyer Exp $ */ +/* $NetBSD: spl.S,v 1.43.4.3 2020/04/10 14:41:59 bouyer Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -91,7 +91,7 @@ ENTRY(splraise) ret END(splraise) -#ifndef XEN +#ifndef XENPV /* * Xsoftintr() * @@ -242,6 +242,11 @@ ENTRY(spllower) cli testl CPUVAR(IPENDING),%edx jnz 2f +#if defined(XEN) + movl CPUVAR(XUNMASK)(,%rdi,4),%edx + testl CPUVAR(XPENDING),%edx + jnz 2f +#endif movl %edi,CPUVAR(ILEVEL) popf 1: Index: src/sys/arch/amd64/amd64/vector.S diff -u src/sys/arch/amd64/amd64/vector.S:1.73 src/sys/arch/amd64/amd64/vector.S:1.73.6.1 --- src/sys/arch/amd64/amd64/vector.S:1.73 Mon Dec 30 23:32:29 2019 +++ src/sys/arch/amd64/amd64/vector.S Fri Apr 10 14:41:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.73 2019/12/30 23:32:29 thorpej Exp $ */ +/* $NetBSD: vector.S,v 1.73.6.1 2020/04/10 14:41:59 bouyer Exp $ */ /* * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. @@ -815,7 +815,6 @@ ENTRY(hypervisor_callback) movq (%rsp),%rcx movq 8(%rsp),%r11 addq $16,%rsp -IDTVEC(hypervisor_pvhvm_callback) pushq $0 /* Dummy error code */ pushq $T_ASTFLT INTRENTRY @@ -827,8 +826,21 @@ IDTVEC(hypervisor_pvhvm_callback) jnz doreti_checkast 1: INTRFASTEXIT -IDTVEC_END(hypervisor_pvhvm_callback) END(hypervisor_callback) + +IDTVEC(hypervisor_pvhvm_callback) + pushq $0 /* Dummy error code */ + pushq $T_ASTFLT + INTRENTRY + movlCPUVAR(ILEVEL),%edi + pushq %rdi /* for Xdoreti */ + /* sti?? */ + movq %rsp,%rdi + subq $8,%rdi; /* don't forget if_ppl */ + call do_hypervisor_callback + incl CPUVAR(IDEPTH) + jmp _C_LABEL(Xdoreti) +IDTVEC_END(hypervisor_pvhvm_callback) #endif /* XEN */ #ifdef XENPV Index: src/sys/arch/amd64/conf/XEN3_PVHVM diff -u src/sys/arch/amd64/conf/XEN3_PVHVM:1.3.2.1 src/sys/arch/amd64/conf/XEN3_PVHVM:1.3.2.2 --- src/sys/arch/amd64/conf/XEN3_PVHVM:1.3.2.1 Wed Apr 8 17:56:08 2020 +++ src/sys/arch/amd64/conf/XEN3_PVHVM Fri Apr 10 14:42:00 2020 @@ -1,10 +1,11 @@ -# $NetBSD: XEN3_PVHVM,v 1.3.2.1 2020/04/08 17:56:08 bouyer Exp $ +# $NetBSD: XEN3_PVHVM,v 1.3.2.2 2020/04/10 14:42:00 bouyer Exp $ include "arch/amd64/conf/std.xen" options XENPVHVM #options MULTIPROCESSOR # Not yet. +options NO_PREEMPTION options INCLUDE_CONFIG_FILE # embed config file in kernel binary @@ -12,7 +13,7 @@ options INCLUDE_CONFIG_FILE # embed con #options UVMHIST_PRINT #options SYSCALL_DEBUG -#ident "XEN3_PVHVM-$Revision: 1.3.2.1 $" +#ident "XEN3_PVHVM-$Revision: 1.3.2.2 $" maxusers 32 # estimated number of users options MAXPHYS=32768 #xbd doesn't handle 64k transfers Index: src/sys/arch/i386/conf/XEN3PAE_PVHVM diff -u src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.3.2.1 src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.3.2.2 --- src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.3.2.1 Wed Apr 8 17:56:08 2020 +++ src/sys/arch/i386/conf/XEN3PAE_PVHVM Fri Apr 10 14:42:00 2020 @@ -1,10 +1,11 @@ -# $NetBSD: XEN3PAE_PVHVM,v 1.3.2.1 2020/04/08 17:56:08 bouyer Exp $ +# $NetBSD: XEN3PAE_PVHVM,v 1.3.2.2 2020/04/10 14:42:00 bouyer Exp $ include "arch/xen/conf/std.xen" options XENPVHVM # PVHVM domU support #options MULTIPROCESSOR # Not yet. +options NO_PREEMPTION options INCLUDE_CONFIG_FILE # embed config file in kernel binary @@ -115,7 +116,7 @@ hypervisor* at mainbus? # Xen hyperviso #vcpu* at hypervisor? # Xen virtual
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Fri Apr 10 14:38:19 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c Log Message: Remove extra assignement To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.88.2.1 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.88 src/sys/arch/xen/xen/evtchn.c:1.88.2.1 --- src/sys/arch/xen/xen/evtchn.c:1.88 Mon Apr 6 19:26:00 2020 +++ src/sys/arch/xen/xen/evtchn.c Fri Apr 10 14:38:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.88 2020/04/06 19:26:00 jdolecek Exp $ */ +/* $NetBSD: evtchn.c,v 1.88.2.1 2020/04/10 14:38:19 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88 2020/04/06 19:26:00 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.1 2020/04/10 14:38:19 bouyer Exp $"); #include "opt_xen.h" #include "isa.h" @@ -942,7 +942,6 @@ event_set_iplhandler(struct cpu_info *ci KM_NOSLEEP); if (ipls == NULL) panic("can't allocate fixed interrupt source"); - ipls->is_recurse = xenev_stubs[level].ist_entry; ipls->is_recurse = xenev_stubs[level].ist_recurse; ipls->is_resume = xenev_stubs[level].ist_resume; ipls->is_handlers = ih;
CVS commit: [bouyer-xenpvh] src/sys/arch/x86
Module Name:src Committed By: bouyer Date: Fri Apr 10 14:37:54 UTC 2020 Modified Files: src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h src/sys/arch/x86/x86 [bouyer-xenpvh]: cpu.c patch.c Log Message: Skip cx8_spllower patch if we're running on any form of Xen PV, we can't handle PV interrupts with a single atomic op here. Enable x86_patch() for Xen too. To generate a diff of this commit: cvs rdiff -u -r1.117.4.1 -r1.117.4.2 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.181 -r1.181.4.1 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.37 -r1.37.6.1 src/sys/arch/x86/x86/patch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.117.4.1 src/sys/arch/x86/include/cpu.h:1.117.4.2 --- src/sys/arch/x86/include/cpu.h:1.117.4.1 Wed Apr 8 17:59:16 2020 +++ src/sys/arch/x86/include/cpu.h Fri Apr 10 14:37:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.117.4.1 2020/04/08 17:59:16 bouyer Exp $ */ +/* $NetBSD: cpu.h,v 1.117.4.2 2020/04/10 14:37:54 bouyer Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -507,6 +507,19 @@ typedef enum vm_guest { } vm_guest_t; extern vm_guest_t vm_guest; +static __inline bool __unused +vm_guest_is_xenpv(void) +{ + switch(vm_guest) { + case VM_GUEST_XENPV: + case VM_GUEST_XENPVH: + case VM_GUEST_XENPVHVM: + return true; + default: + return false; + } +} + /* cpu_topology.c */ void x86_cpu_topology(struct cpu_info *); Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.181 src/sys/arch/x86/x86/cpu.c:1.181.4.1 --- src/sys/arch/x86/x86/cpu.c:1.181 Tue Jan 14 01:41:37 2020 +++ src/sys/arch/x86/x86/cpu.c Fri Apr 10 14:37:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.181 2020/01/14 01:41:37 pgoyette Exp $ */ +/* $NetBSD: cpu.c,v 1.181.4.1 2020/04/10 14:37:54 bouyer Exp $ */ /* * Copyright (c) 2000-2012 NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.181 2020/01/14 01:41:37 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.181.4.1 2020/04/10 14:37:54 bouyer Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -720,10 +720,8 @@ cpu_boot_secondary_processors(void) kcpuset_t *cpus; u_long i; -#ifndef XEN /* Now that we know the number of CPUs, patch the text segment. */ x86_patch(false); -#endif #if NACPICA > 0 /* Finished with NUMA info for now. */ Index: src/sys/arch/x86/x86/patch.c diff -u src/sys/arch/x86/x86/patch.c:1.37 src/sys/arch/x86/x86/patch.c:1.37.6.1 --- src/sys/arch/x86/x86/patch.c:1.37 Wed Sep 18 15:07:08 2019 +++ src/sys/arch/x86/x86/patch.c Fri Apr 10 14:37:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: patch.c,v 1.37 2019/09/18 15:07:08 kamil Exp $ */ +/* $NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37 2019/09/18 15:07:08 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $"); #include "opt_lockdebug.h" #ifdef i386 @@ -250,7 +250,8 @@ x86_patch(bool early) #endif /* i386 */ #if !defined(SPLDEBUG) - if (!early && (cpu_feature[0] & CPUID_CX8) != 0) { + if (!early && (cpu_feature[0] & CPUID_CX8) != 0 && + !vm_guest_is_xenpv()) { /* Faster splx(), mutex_spin_exit(). */ patchfunc( cx8_spllower, cx8_spllower_end,
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/amd64
Module Name:src Committed By: bouyer Date: Thu Apr 9 21:01:33 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: spl.S Log Message: Fix a second place where %eax is used with the wrong value. To generate a diff of this commit: cvs rdiff -u -r1.43.4.1 -r1.43.4.2 src/sys/arch/amd64/amd64/spl.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/spl.S diff -u src/sys/arch/amd64/amd64/spl.S:1.43.4.1 src/sys/arch/amd64/amd64/spl.S:1.43.4.2 --- src/sys/arch/amd64/amd64/spl.S:1.43.4.1 Thu Apr 9 16:51:00 2020 +++ src/sys/arch/amd64/amd64/spl.S Thu Apr 9 21:01:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.43.4.1 2020/04/09 16:51:00 bouyer Exp $ */ +/* $NetBSD: spl.S,v 1.43.4.2 2020/04/09 21:01:33 bouyer Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -322,8 +322,9 @@ IDTVEC(spllower) pushq %r12 movl %edi,%ebx leaq 1f(%rip),%r13 /* address to resume loop at */ -1: movl %ebx,%eax /* get cpl */ +1: #if !defined(XENPV) + movl %ebx,%eax /* get cpl */ movl CPUVAR(IUNMASK)(,%rax,4),%eax CLI(si) andl CPUVAR(IPENDING),%eax /* any non-masked bits left? */ @@ -335,6 +336,7 @@ IDTVEC(spllower) #endif 2: #if defined(XEN) + movl %ebx,%eax /* get cpl */ movl CPUVAR(XUNMASK)(,%rax,4),%eax CLI(si) andl CPUVAR(XPENDING),%eax /* any non-masked bits left? */
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/amd64
Module Name:src Committed By: bouyer Date: Thu Apr 9 16:51:00 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: spl.S Log Message: restore %eax before using it. This bug caused event handlers to be called spuriously at high spl or in a reentrant manner. Now a amd64 PVHVM domU can checkout pkgsrc and build packages without panic. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.43.4.1 src/sys/arch/amd64/amd64/spl.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/spl.S diff -u src/sys/arch/amd64/amd64/spl.S:1.43 src/sys/arch/amd64/amd64/spl.S:1.43.4.1 --- src/sys/arch/amd64/amd64/spl.S:1.43 Wed Jan 8 17:38:41 2020 +++ src/sys/arch/amd64/amd64/spl.S Thu Apr 9 16:51:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.43 2020/01/08 17:38:41 ad Exp $ */ +/* $NetBSD: spl.S,v 1.43.4.1 2020/04/09 16:51:00 bouyer Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -366,8 +366,9 @@ IDTVEC(doreti) popq %rbx /* get previous priority */ decl CPUVAR(IDEPTH) leaq 1f(%rip),%r13 -1: movl %ebx,%eax +1: #if !defined(XENPV) + movl%ebx,%eax movl CPUVAR(IUNMASK)(,%rax,4),%eax CLI(si) andl CPUVAR(IPENDING),%eax @@ -379,6 +380,7 @@ IDTVEC(doreti) #endif 2: #if defined(XEN) + movl%ebx,%eax movl CPUVAR(XUNMASK)(,%rax,4),%eax CLI(si) andl CPUVAR(XPENDING),%eax
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Thu Apr 9 16:12:50 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: machdep.c src/sys/arch/i386/i386 [bouyer-xenpvh]: machdep.c Log Message: For RB_POWERDONW, call HYPERVISOR_shutdown() in all cases where the hypercall page is available. A PVHHVM domU now properly exits on halt -p To generate a diff of this commit: cvs rdiff -u -r1.346 -r1.346.4.1 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.825 -r1.825.4.1 src/sys/arch/i386/i386/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.346 src/sys/arch/amd64/amd64/machdep.c:1.346.4.1 --- src/sys/arch/amd64/amd64/machdep.c:1.346 Fri Jan 31 08:21:11 2020 +++ src/sys/arch/amd64/amd64/machdep.c Thu Apr 9 16:12:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.346 2020/01/31 08:21:11 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.346.4.1 2020/04/09 16:12:50 bouyer Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -110,7 +110,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346 2020/01/31 08:21:11 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346.4.1 2020/04/09 16:12:50 bouyer Exp $"); #include "opt_modular.h" #include "opt_user_ldt.h" @@ -729,9 +729,12 @@ haltsys: acpi_enter_sleep_state(ACPI_STATE_S5); #endif -#ifdef XENPV - HYPERVISOR_shutdown(); -#endif /* XENPV */ +#ifdef XEN + if (vm_guest == VM_GUEST_XENPV || + vm_guest == VM_GUEST_XENPVH || + vm_guest == VM_GUEST_XENPVHVM) + HYPERVISOR_shutdown(); +#endif /* XEN */ } cpu_broadcast_halt(); Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.825 src/sys/arch/i386/i386/machdep.c:1.825.4.1 --- src/sys/arch/i386/i386/machdep.c:1.825 Fri Jan 31 08:21:11 2020 +++ src/sys/arch/i386/i386/machdep.c Thu Apr 9 16:12:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.825 2020/01/31 08:21:11 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.825.4.1 2020/04/09 16:12:50 bouyer Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017 @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825 2020/01/31 08:21:11 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825.4.1 2020/04/09 16:12:50 bouyer Exp $"); #include "opt_beep.h" #include "opt_compat_freebsd.h" @@ -793,10 +793,12 @@ haltsys: #else __USE(s); #endif -#ifdef XENPV - HYPERVISOR_shutdown(); - for (;;); -#endif +#ifdef XEN + if (vm_guest == VM_GUEST_XENPV || + vm_guest == VM_GUEST_XENPVH || + vm_guest == VM_GUEST_XENPVHVM) + HYPERVISOR_shutdown(); +#endif /* XEN */ } #ifdef MULTIPROCESSOR
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Wed Apr 8 17:59:17 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [bouyer-xenpvh]: genassym.cf locore.S src/sys/arch/i386/i386 [bouyer-xenpvh]: genassym.cf locore.S src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h src/sys/arch/x86/x86 [bouyer-xenpvh]: identcpu.c lapic.c x86_machdep.c src/sys/arch/xen/x86 [bouyer-xenpvh]: autoconf.c src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c Log Message: Remove VM_GUEST_XEN and define only Xen subtypes: VM_GUEST_XENPV VM_GUEST_XENPVH VM_GUEST_XENHVM VM_GUEST_XENPVHVM Set vm_guest in the start routine, if it is hypervisor-specific (e.g Xen PV). If vm_guest was not set early and we detect Xen in identify_hypervisor(), assume it is VM_GUEST_XENHVM. Refine to VM_GUEST_PVXENHVM in hypervisor_match(). To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.82.4.1 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.200 -r1.200.4.1 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.119 -r1.119.4.1 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.179 -r1.179.2.1 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.117 -r1.117.4.1 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.102 -r1.102.2.1 src/sys/arch/x86/x86/identcpu.c cvs rdiff -u -r1.76 -r1.76.6.1 src/sys/arch/x86/x86/lapic.c cvs rdiff -u -r1.137 -r1.137.2.1 src/sys/arch/x86/x86/x86_machdep.c cvs rdiff -u -r1.23 -r1.23.8.1 src/sys/arch/xen/x86/autoconf.c cvs rdiff -u -r1.73 -r1.73.2.1 src/sys/arch/xen/xen/hypervisor.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/genassym.cf diff -u src/sys/arch/amd64/amd64/genassym.cf:1.82 src/sys/arch/amd64/amd64/genassym.cf:1.82.4.1 --- src/sys/arch/amd64/amd64/genassym.cf:1.82 Mon Feb 17 09:09:48 2020 +++ src/sys/arch/amd64/amd64/genassym.cf Wed Apr 8 17:59:16 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.82 2020/02/17 09:09:48 skrll Exp $ +# $NetBSD: genassym.cf,v 1.82.4.1 2020/04/08 17:59:16 bouyer Exp $ # # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -360,6 +360,8 @@ define X86_BUS_SPACE_IO X86_BUS_SPACE_IO define BST_TYPE offsetof(struct bus_space_tag, bst_type) +define VM_GUEST_XENPV VM_GUEST_XENPV + ifdef XEN define CPU_INFO_VCPU offsetof(struct cpu_info, ci_vcpu) define CPU_INFO_XPENDING offsetof(struct cpu_info, ci_xpending) Index: src/sys/arch/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.200 src/sys/arch/amd64/amd64/locore.S:1.200.4.1 --- src/sys/arch/amd64/amd64/locore.S:1.200 Wed Jan 15 18:47:23 2020 +++ src/sys/arch/amd64/amd64/locore.S Wed Apr 8 17:59:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.200 2020/01/15 18:47:23 ad Exp $ */ +/* $NetBSD: locore.S,v 1.200.4.1 2020/04/08 17:59:16 bouyer Exp $ */ /* * Copyright-o-rama! @@ -942,6 +942,8 @@ longmode_hi: cpuid movl %eax,_C_LABEL(cpuid_level) + movl $VM_GUEST_XENPV, _C_LABEL(vm_guest) + movq $cpu_info_primary,%rdi movq %rdi,CPU_INFO_SELF(%rdi) /* ci->ci_self = ci */ movq $1,%rsi Index: src/sys/arch/i386/i386/genassym.cf diff -u src/sys/arch/i386/i386/genassym.cf:1.119 src/sys/arch/i386/i386/genassym.cf:1.119.4.1 --- src/sys/arch/i386/i386/genassym.cf:1.119 Mon Feb 17 09:09:48 2020 +++ src/sys/arch/i386/i386/genassym.cf Wed Apr 8 17:59:16 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.119 2020/02/17 09:09:48 skrll Exp $ +# $NetBSD: genassym.cf,v 1.119.4.1 2020/04/08 17:59:16 bouyer Exp $ # # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -374,6 +374,8 @@ define L2_FRAME L2_FRAME define PGOFSET PGOFSET define PGSHIFT PGSHIFT +define VM_GUEST_XENPV VM_GUEST_XENPV + ifdef XEN define CPU_INFO_VCPU offsetof(struct cpu_info, ci_vcpu) define CPU_INFO_XPENDING offsetof(struct cpu_info, ci_xpending) Index: src/sys/arch/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.179 src/sys/arch/i386/i386/locore.S:1.179.2.1 --- src/sys/arch/i386/i386/locore.S:1.179 Fri Mar 27 21:05:03 2020 +++ src/sys/arch/i386/i386/locore.S Wed Apr 8 17:59:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.179 2020/03/27 21:05:03 ad Exp $ */ +/* $NetBSD: locore.S,v 1.179.2.1 2020/04/08 17:59:16 bouyer Exp $ */ /* * Copyright-o-rama! @@ -128,7 +128,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.179 2020/03/27 21:05:03 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.179.2.1 2020/04/08 17:59:16 bouyer Exp $"); #include "opt_copy_symtab.h" #include "opt_ddb.h" @@ -1115,6 +1115,8 @@ begin: cpuid movl %eax,RELOC(cpuid_level) + movl$VM_GUEST_XENPV, RELOC(vm_guest) + /* * Use a temporary GDT page. We'll re-add it to uvm(9) once we're done * using it. Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.117 src/sys/arch/x86/include/cpu.h:1.117.4.1 --- src/sys/arch/x86/include/cpu.h:1.117 Wed Jan 15 13:22:03 2020 +++ s
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Wed Apr 8 17:56:08 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: XEN3_DOMU XEN3_PVHVM src/sys/arch/i386/conf [bouyer-xenpvh]: XEN3PAE_DOM0 XEN3PAE_DOMU XEN3PAE_PVHVM Log Message: Turn on -g by default on the branch To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.90.6.1 src/sys/arch/amd64/conf/XEN3_DOMU cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/arch/amd64/conf/XEN3_PVHVM cvs rdiff -u -r1.21 -r1.21.2.1 src/sys/arch/i386/conf/XEN3PAE_DOM0 cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/arch/i386/conf/XEN3PAE_DOMU cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/arch/i386/conf/XEN3PAE_PVHVM Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/XEN3_DOMU diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.90 src/sys/arch/amd64/conf/XEN3_DOMU:1.90.6.1 --- src/sys/arch/amd64/conf/XEN3_DOMU:1.90 Wed Aug 21 12:16:07 2019 +++ src/sys/arch/amd64/conf/XEN3_DOMU Wed Apr 8 17:56:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOMU,v 1.90 2019/08/21 12:16:07 maxv Exp $ +# $NetBSD: XEN3_DOMU,v 1.90.6.1 2020/04/08 17:56:08 bouyer Exp $ include "arch/amd64/conf/std.xen" @@ -11,7 +11,7 @@ options INCLUDE_CONFIG_FILE # embed con #options UVMHIST_PRINT #options SYSCALL_DEBUG -#ident "XEN3_DOMU-$Revision: 1.90 $" +#ident "XEN3_DOMU-$Revision: 1.90.6.1 $" maxusers 32 # estimated number of users @@ -52,7 +52,7 @@ options DDB_ONPANIC=1 # see also sysctl options DDB_HISTORY_SIZE=512 # enable history editing in DDB #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table makeoptions COPTS="-O2 -fno-omit-frame-pointer" options DDB_COMMANDONENTER="trace;show registers" Index: src/sys/arch/amd64/conf/XEN3_PVHVM diff -u src/sys/arch/amd64/conf/XEN3_PVHVM:1.3 src/sys/arch/amd64/conf/XEN3_PVHVM:1.3.2.1 --- src/sys/arch/amd64/conf/XEN3_PVHVM:1.3 Mon Apr 6 19:28:21 2020 +++ src/sys/arch/amd64/conf/XEN3_PVHVM Wed Apr 8 17:56:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_PVHVM,v 1.3 2020/04/06 19:28:21 bouyer Exp $ +# $NetBSD: XEN3_PVHVM,v 1.3.2.1 2020/04/08 17:56:08 bouyer Exp $ include "arch/amd64/conf/std.xen" @@ -12,7 +12,7 @@ options INCLUDE_CONFIG_FILE # embed con #options UVMHIST_PRINT #options SYSCALL_DEBUG -#ident "XEN3_PVHVM-$Revision: 1.3 $" +#ident "XEN3_PVHVM-$Revision: 1.3.2.1 $" maxusers 32 # estimated number of users options MAXPHYS=32768 #xbd doesn't handle 64k transfers @@ -52,7 +52,7 @@ options DDB_ONPANIC=1 # see also sysctl options DDB_HISTORY_SIZE=512 # enable history editing in DDB #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table makeoptions COPTS="-O2 -fno-omit-frame-pointer" options DDB_COMMANDONENTER="show registers" Index: src/sys/arch/i386/conf/XEN3PAE_DOM0 diff -u src/sys/arch/i386/conf/XEN3PAE_DOM0:1.21 src/sys/arch/i386/conf/XEN3PAE_DOM0:1.21.2.1 --- src/sys/arch/i386/conf/XEN3PAE_DOM0:1.21 Wed Mar 25 17:06:19 2020 +++ src/sys/arch/i386/conf/XEN3PAE_DOM0 Wed Apr 8 17:56:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3PAE_DOM0,v 1.21 2020/03/25 17:06:19 jdolecek Exp $ +# $NetBSD: XEN3PAE_DOM0,v 1.21.2.1 2020/04/08 17:56:08 bouyer Exp $ # # XEN3_0: Xen 3.0 domain0 kernel @@ -74,7 +74,7 @@ options DDB_ONPANIC=1 # see also sysctl options DDB_HISTORY_SIZE=512 # enable history editing in DDB #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table options DDB_COMMANDONENTER="show registers" # Compatibility options Index: src/sys/arch/i386/conf/XEN3PAE_DOMU diff -u src/sys/arch/i386/conf/XEN3PAE_DOMU:1.8 src/sys/arch/i386/conf/XEN3PAE_DOMU:1.8.2.1 --- src/sys/arch/i386/conf/XEN3PAE_DOMU:1.8 Wed Mar 25 17:06:19 2020 +++ src/sys/arch/i386/conf/XEN3PAE_DOMU Wed Apr 8 17:56:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3PAE_DOMU,v 1.8 2020/03/25 17:06:19 jdolecek Exp $ +# $NetBSD: XEN3PAE_DOMU,v 1.8.2.1 2020/04/08 17:56:08 bouyer Exp $ include "arch/xen/conf/std.xen" @@ -58,7 +58,7 @@ options DDB_ONPANIC=1 # see also sysctl options DDB_HISTORY_SIZE=512 # enable history editing in DDB #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table options DDB_COMMANDONENTER="trace;show registers" # Compatibility options Index: src/sys/arch/i386/conf/XEN3PAE_PVHVM diff -u src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.3 src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.3.2.1 --- src/