CVS commit: src/sys/dev/pci
Module Name:src Committed By: macallan Date: Wed May 20 08:15:26 UTC 2020 Modified Files: src/sys/dev/pci: files.pci Log Message: radeonfb doesn't attach an iic*, so pull in iic, not i2cbus To generate a diff of this commit: cvs rdiff -u -r1.426 -r1.427 src/sys/dev/pci/files.pci Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/files.pci diff -u src/sys/dev/pci/files.pci:1.426 src/sys/dev/pci/files.pci:1.427 --- src/sys/dev/pci/files.pci:1.426 Sun Feb 9 16:06:18 2020 +++ src/sys/dev/pci/files.pci Wed May 20 08:15:26 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.pci,v 1.426 2020/02/09 16:06:18 jmcneill Exp $ +# $NetBSD: files.pci,v 1.427 2020/05/20 08:15:26 macallan Exp $ # # Config file and device description for machine-independent PCI code. # Included by ports that need it. Requires that the SCSI files be @@ -829,7 +829,7 @@ file dev/pci/unichromefb.c unichromefb # ATI Radeon framebuffer console driver # (Note: to enable the BIOS parser, add options RADEON_BIOS_INIT to the config) -device radeonfb: wsemuldisplaydev, videomode, rasops8, rasops32, vcons, splash, i2cbus, i2c_bitbang, ddc_read_edid, edid, drm, glyphcache +device radeonfb: wsemuldisplaydev, videomode, rasops8, rasops32, vcons, splash, iic, i2c_bitbang, ddc_read_edid, edid, drm, glyphcache attach radeonfb at pci file dev/pci/radeonfb.c radeonfb file dev/pci/radeonfb_i2c.c radeonfb
CVS commit: src/sys
Module Name:src Committed By: hkenken Date: Wed May 20 09:18:25 UTC 2020 Modified Files: src/sys/arch/arm/imx: imxuart.c src/sys/arch/arm/imx/fdt: files.imx6 imx6_spi.c src/sys/arch/evbarm/conf: GENERIC files.generic src/sys/conf: files Added Files: src/sys/arch/arm/imx/fdt: imx6_dwhdmi.c imx6_pwm.c Removed Files: src/sys/arch/evbarm/conf: IMX files.imx mk.imx std.imx Log Message: i.MX support merged into GENERIC kernel. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/imx/imxuart.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/fdt/files.imx6 cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/fdt/imx6_dwhdmi.c \ src/sys/arch/arm/imx/fdt/imx6_pwm.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/fdt/imx6_spi.c cvs rdiff -u -r1.77 -r1.78 src/sys/arch/evbarm/conf/GENERIC cvs rdiff -u -r1.6 -r0 src/sys/arch/evbarm/conf/IMX cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/files.generic cvs rdiff -u -r1.2 -r0 src/sys/arch/evbarm/conf/files.imx cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/conf/mk.imx \ src/sys/arch/evbarm/conf/std.imx cvs rdiff -u -r1.1266 -r1.1267 src/sys/conf/files 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/arm/imx/imxuart.c diff -u src/sys/arch/arm/imx/imxuart.c:1.24 src/sys/arch/arm/imx/imxuart.c:1.25 --- src/sys/arch/arm/imx/imxuart.c:1.24 Wed Jan 15 01:09:56 2020 +++ src/sys/arch/arm/imx/imxuart.c Wed May 20 09:18:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: imxuart.c,v 1.24 2020/01/15 01:09:56 jmcneill Exp $ */ +/* $NetBSD: imxuart.c,v 1.25 2020/05/20 09:18:25 hkenken Exp $ */ /* * Copyright (c) 2009, 2010 Genetec Corporation. All rights reserved. @@ -96,7 +96,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.24 2020/01/15 01:09:56 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.25 2020/05/20 09:18:25 hkenken Exp $"); #include "opt_imxuart.h" #include "opt_ddb.h" @@ -2083,8 +2083,6 @@ imxuart_load_pendings(struct imxuart_sof sc->sc_pending = 0; } -#if defined(IMXUARTCONSOLE) || defined(KGDB) - /* * The following functions are polled getc and putc routines, shared * by the console and kgdb glue. @@ -2171,7 +2169,6 @@ imxuart_common_putc(dev_t dev, struct im splx(s); } -#endif /* defined(IMXUARTCONSOLE) || defined(KGDB) */ /* * Initialize UART @@ -2236,7 +2233,6 @@ imxuart_init(struct imxuart_regs *regsp, } -#ifdef IMXUARTCONSOLE /* * Following are all routines needed for UART to act as console */ @@ -2295,8 +2291,6 @@ imxucnpollc(dev_t dev, int on) imxuart_readahead_out = 0; } -#endif /* IMXUARTCONSOLE */ - #ifdef KGDB int imxuart_kgdb_attach(bus_space_tag_t iot, paddr_t iobase, u_int rate, Index: src/sys/arch/arm/imx/fdt/files.imx6 diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.8 src/sys/arch/arm/imx/fdt/files.imx6:1.9 --- src/sys/arch/arm/imx/fdt/files.imx6:1.8 Wed Jan 15 01:09:56 2020 +++ src/sys/arch/arm/imx/fdt/files.imx6 Wed May 20 09:18:25 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.imx6,v 1.8 2020/01/15 01:09:56 jmcneill Exp $ +# $NetBSD: files.imx6,v 1.9 2020/05/20 09:18:25 hkenken Exp $ # # Configuration info for the Freescale i.MX6 # @@ -10,12 +10,11 @@ defflag opt_soc.h SOC_IMX defflag opt_soc.h SOC_IMX6QDL: SOC_IMX # Clock -device imxccm : clk +device imxccm: clk attach imxccm at fdt file arch/arm/imx/imx6_ccm.c imxccm file arch/arm/imx/fdt/imx6_clk.c imxccm - # Common FDT clock framework define imx_ccm file arch/arm/imx/fdt/imx_ccm.c imx_ccm @@ -51,7 +50,7 @@ file arch/arm/imx/imxgpio.c imxgpio ne file arch/arm/imx/fdt/imx6_gpio.c imxgpio # UART -device imxuart { } : bus_space_generic +device imxuart: tty attach imxuart at fdt with imx6_com file arch/arm/imx/imxuart.c imxuart needs-flag file arch/arm/imx/fdt/imx6_com.c imx6_com needs-flag @@ -84,7 +83,6 @@ device imx8mqusbphy attach imx8mqusbphy at fdt file arch/arm/imx/fdt/imx8mq_usbphy.c imx8mqusbphy - # SDMMC attach sdhc at fdt with imx6_sdhc file arch/arm/imx/fdt/imx6_sdhc.c imx6_sdhc @@ -102,9 +100,18 @@ file arch/arm/imx/imxi2c.c imxi2c file arch/arm/imx/fdt/imx6_i2c.c imxi2c # SPI bus controller -device imxspi : spibus +device imxspi: spibus attach imxspi at fdt with imxspi_fdt -filearch/arm/imx/imxspi.c imxspi +file arch/arm/imx/imxspi.c imxspi file arch/arm/imx/fdt/imx6_spi.c imxspi_fdt defparam opt_imxspi.h IMXSPINSLAVES +# PWM +device imxpwm: pwm +attach imxpwm at fdt with imxpwm_fdt +file arch/arm/imx/imxpwm.c imxpwm +file arch/arm/imx/fdt/imx6_pwm.c imxpwm_fdt + +# HDMI TX (Designware based) +attach dwhdmi at fdt with imx6_dwhdmi +file arch/arm/imx/fdt/imx6_dwhdmi.c imx6_dwhdmi Index: src/sys/arch/arm/imx/fdt/imx6_spi.c diff -u src/sys/arch/arm/imx/fdt/imx6_spi.c:1.3 src/sys/arch/arm/imx/fdt/imx6_spi.c:1.4 --- src/sys/arch/arm/imx/fdt/imx6_spi.c:1.3 Tue Dec 3 10:32:
CVS commit: src/sys/uvm
Module Name:src Committed By: hannken Date: Wed May 20 12:47:36 UTC 2020 Modified Files: src/sys/uvm: uvm_aobj.c Log Message: Suppress GCC warnings and fix a UVMHIST_LOG() statement. Kernels ALL/amd64 and ALL/i386 and port sparc64 build again. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/uvm/uvm_aobj.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/uvm/uvm_aobj.c diff -u src/sys/uvm/uvm_aobj.c:1.142 src/sys/uvm/uvm_aobj.c:1.143 --- src/sys/uvm/uvm_aobj.c:1.142 Tue May 19 22:22:15 2020 +++ src/sys/uvm/uvm_aobj.c Wed May 20 12:47:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_aobj.c,v 1.142 2020/05/19 22:22:15 ad Exp $ */ +/* $NetBSD: uvm_aobj.c,v 1.143 2020/05/20 12:47:36 hannken Exp $ */ /* * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.142 2020/05/19 22:22:15 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.143 2020/05/20 12:47:36 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_uvmhist.h" @@ -802,7 +802,7 @@ uao_get(struct uvm_object *uobj, voff_t { voff_t current_offset; struct vm_page *ptmp = NULL; /* Quell compiler warning */ - int lcv, gotpages, maxpages, swslot, pageidx; + int lcv, gotpages, maxpages, swslot = -1, pageidx = -1; /* XXX: gcc */ UVMHIST_FUNC("uao_get"); UVMHIST_CALLED(pdhist); UVMHIST_LOG(pdhist, "aobj=%#jx offset=%jd, flags=%jd", @@ -876,7 +876,8 @@ uao_get(struct uvm_object *uobj, voff_t * to unlock and do some waiting or I/O. */ - UVMHIST_LOG(pdhist, "<- done (done=%jd)", done, 0,0,0); + UVMHIST_LOG(pdhist, "<- done (done=%jd)", + (pps[centeridx] != NULL), 0,0,0); *npagesp = gotpages; return pps[centeridx] != NULL ? 0 : EBUSY; }
CVS commit: src/sys/ufs/ffs
Module Name:src Committed By: christos Date: Wed May 20 13:16:30 UTC 2020 Modified Files: src/sys/ufs/ffs: ffs_extattr.c Log Message: remove accmode_t typedef (not needed, breaks llvm) from maxv@ To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/ffs/ffs_extattr.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/ufs/ffs/ffs_extattr.c diff -u src/sys/ufs/ffs/ffs_extattr.c:1.5 src/sys/ufs/ffs/ffs_extattr.c:1.6 --- src/sys/ufs/ffs/ffs_extattr.c:1.5 Sat May 16 14:31:53 2020 +++ src/sys/ufs/ffs/ffs_extattr.c Wed May 20 09:16:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_extattr.c,v 1.5 2020/05/16 18:31:53 christos Exp $ */ +/* $NetBSD: ffs_extattr.c,v 1.6 2020/05/20 13:16:30 christos Exp $ */ /*- * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-3-Clause) @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.5 2020/05/16 18:31:53 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.6 2020/05/20 13:16:30 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -121,7 +121,6 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_extattr. #define lblkno(fs, o) ffs_lblkno(fs, o) #define blkoff(fs, o) ffs_blkoff(fs, o) #define sblksize(fs, o, lbn) ffs_sblksize(fs, o, lbn) -typedef mode_t accmode_t; /* so that it breaks soon */ typedef daddr_t ufs_lbn_t; #define msleep(chan, mtx, pri, wmesg, timeo) \ mtsleep((chan), (pri), (wmesg), (timeo), *(mtx))
CVS commit: src/share/mk
Module Name:src Committed By: martin Date: Wed May 20 15:43:29 UTC 2020 Modified Files: src/share/mk: bsd.own.mk Log Message: Switch sparc64 to binutils 2.34 To generate a diff of this commit: cvs rdiff -u -r1.1190 -r1.1191 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1190 src/share/mk/bsd.own.mk:1.1191 --- src/share/mk/bsd.own.mk:1.1190 Tue May 19 08:07:44 2020 +++ src/share/mk/bsd.own.mk Wed May 20 15:43:29 2020 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1190 2020/05/19 08:07:44 rin Exp $ +# $NetBSD: bsd.own.mk,v 1.1191 2020/05/20 15:43:29 martin Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -165,7 +165,7 @@ EXTERNAL_GDB_SUBDIR= /does/not/exist .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" || \ ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc" || \ ${MACHINE_CPU} == "aarch64" || ${MACHINE_CPU} == "arm" || \ -${MACHINE_ARCH} == "hppa" +${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "sparc64" HAVE_BINUTILS?= 234 .else HAVE_BINUTILS?= 231
CVS commit: src/sys/ufs/chfs
Module Name:src Committed By: christos Date: Wed May 20 17:04:58 UTC 2020 Modified Files: src/sys/ufs/chfs: chfs_vnops.c Log Message: fix accessx confusion (thanks hannken@) To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/ufs/chfs/chfs_vnops.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/ufs/chfs/chfs_vnops.c diff -u src/sys/ufs/chfs/chfs_vnops.c:1.39 src/sys/ufs/chfs/chfs_vnops.c:1.40 --- src/sys/ufs/chfs/chfs_vnops.c:1.39 Sat May 16 14:31:53 2020 +++ src/sys/ufs/chfs/chfs_vnops.c Wed May 20 13:04:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: chfs_vnops.c,v 1.39 2020/05/16 18:31:53 christos Exp $ */ +/* $NetBSD: chfs_vnops.c,v 1.40 2020/05/20 17:04:58 christos Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -1663,7 +1663,7 @@ const struct vnodeopv_entry_desc chfs_sp { &vop_open_desc, spec_open }, { &vop_close_desc, ufsspec_close }, { &vop_access_desc, chfs_access }, - { &vop_accessx_desc, genfs_access }, + { &vop_accessx_desc, genfs_accessx }, { &vop_getattr_desc, chfs_getattr }, { &vop_setattr_desc, chfs_setattr }, { &vop_read_desc, chfs_read }, @@ -1720,7 +1720,7 @@ const struct vnodeopv_entry_desc chfs_fi { &vop_open_desc, vn_fifo_bypass }, { &vop_close_desc, ufsfifo_close }, { &vop_access_desc, chfs_access }, - { &vop_accessx_desc, genfs_access }, + { &vop_accessx_desc, genfs_accessx }, { &vop_getattr_desc, chfs_getattr }, { &vop_setattr_desc, chfs_setattr }, { &vop_read_desc, ufsfifo_read },
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: christos Date: Wed May 20 17:06:15 UTC 2020 Modified Files: src/sys/miscfs/genfs: genfs_vnops.c Log Message: Fix EPERM vs EACCES on chtimes (thanks @hannken) To generate a diff of this commit: cvs rdiff -u -r1.206 -r1.207 src/sys/miscfs/genfs/genfs_vnops.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/miscfs/genfs/genfs_vnops.c diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.206 src/sys/miscfs/genfs/genfs_vnops.c:1.207 --- src/sys/miscfs/genfs/genfs_vnops.c:1.206 Mon May 18 15:55:42 2020 +++ src/sys/miscfs/genfs/genfs_vnops.c Wed May 20 13:06:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_vnops.c,v 1.206 2020/05/18 19:55:42 christos Exp $ */ +/* $NetBSD: genfs_vnops.c,v 1.207 2020/05/20 17:06:15 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.206 2020/05/18 19:55:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.207 2020/05/20 17:06:15 christos Exp $"); #include #include @@ -1320,7 +1320,7 @@ genfs_can_chtimes(vnode_t *vp, kauth_cre * server time. */ if ((error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred)) != 0) - return (error); + return (vaflags & VA_UTIMES_NULL) == 0 ? EPERM : EACCES; /* Must be owner, or... */ if (kauth_cred_geteuid(cred) == owner_uid)
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jakllsch Date: Wed May 20 17:32:28 UTC 2020 Modified Files: src/sys/dev/usb: xhci.c Log Message: Use more-semantically-correct types in xhci allocx/freex functions. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/sys/dev/usb/xhci.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/dev/usb/xhci.c diff -u src/sys/dev/usb/xhci.c:1.124 src/sys/dev/usb/xhci.c:1.125 --- src/sys/dev/usb/xhci.c:1.124 Sun Apr 5 20:59:38 2020 +++ src/sys/dev/usb/xhci.c Wed May 20 17:32:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.124 2020/04/05 20:59:38 skrll Exp $ */ +/* $NetBSD: xhci.c,v 1.125 2020/05/20 17:32:27 jakllsch Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.124 2020/04/05 20:59:38 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.125 2020/05/20 17:32:27 jakllsch Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2239,25 +2239,26 @@ static struct usbd_xfer * xhci_allocx(struct usbd_bus *bus, unsigned int nframes) { struct xhci_softc * const sc = XHCI_BUS2SC(bus); - struct usbd_xfer *xfer; + struct xhci_xfer *xx; XHCIHIST_FUNC(); XHCIHIST_CALLED(); - xfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK); - if (xfer != NULL) { - memset(xfer, 0, sizeof(struct xhci_xfer)); + xx = pool_cache_get(sc->sc_xferpool, PR_WAITOK); + if (xx != NULL) { + memset(xx, 0, sizeof(*xx)); #ifdef DIAGNOSTIC - xfer->ux_state = XFER_BUSY; + xx->xx_xfer.ux_state = XFER_BUSY; #endif } - return xfer; + return &xx->xx_xfer; } static void xhci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) { struct xhci_softc * const sc = XHCI_BUS2SC(bus); + struct xhci_xfer * const xx = XHCI_XFER2XXFER(xfer); XHCIHIST_FUNC(); XHCIHIST_CALLED(); @@ -2269,7 +2270,7 @@ xhci_freex(struct usbd_bus *bus, struct } xfer->ux_state = XFER_FREE; #endif - pool_cache_put(sc->sc_xferpool, xfer); + pool_cache_put(sc->sc_xferpool, xx); } static bool
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Wed May 20 17:48:34 UTC 2020 Modified Files: src/sys/uvm: uvm_swap.c Log Message: Make swap encryption MP-safe. Not entirely sure the rest of the swap system is MP-safe, but let's not make it worse! XXX Why is swap_syscall_lock an rwlock? We don't seem to take the reader lock ever. To generate a diff of this commit: cvs rdiff -u -r1.189 -r1.190 src/sys/uvm/uvm_swap.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/uvm/uvm_swap.c diff -u src/sys/uvm/uvm_swap.c:1.189 src/sys/uvm/uvm_swap.c:1.190 --- src/sys/uvm/uvm_swap.c:1.189 Sun May 10 02:38:10 2020 +++ src/sys/uvm/uvm_swap.c Wed May 20 17:48:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swap.c,v 1.189 2020/05/10 02:38:10 riastradh Exp $ */ +/* $NetBSD: uvm_swap.c,v 1.190 2020/05/20 17:48:34 riastradh Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.189 2020/05/10 02:38:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.190 2020/05/20 17:48:34 riastradh Exp $"); #include "opt_uvmhist.h" #include "opt_compat_netbsd.h" @@ -147,7 +147,7 @@ struct swapdev { struct bufq_state *swd_tab; /* buffer list */ int swd_active; /* number of active buffers */ - uint8_t *swd_encmap; /* bitmap of encrypted slots */ + volatile uint32_t *swd_encmap; /* bitmap of encrypted slots */ keyInstance swd_enckey; /* AES key expanded for enc */ keyInstance swd_deckey; /* AES key expanded for dec */ bool swd_encinit; /* true if keys initialized */ @@ -234,6 +234,19 @@ static void uvm_swap_genkey(struct swapd static void uvm_swap_encryptpage(struct swapdev *, void *, int); static void uvm_swap_decryptpage(struct swapdev *, void *, int); +static size_t +encmap_size(size_t npages) +{ + struct swapdev *sdp; + const size_t bytesperword = sizeof(sdp->swd_encmap[0]); + const size_t bitsperword = NBBY * bytesperword; + const size_t nbits = npages; /* one bit for each page */ + const size_t nwords = howmany(nbits, bitsperword); + const size_t nbytes = nwords * bytesperword; + + return nbytes; +} + /* * uvm_swap_init: init the swap system data structures and locks * @@ -304,6 +317,9 @@ swaplist_insert(struct swapdev *sdp, str struct swappri *spp, *pspp; UVMHIST_FUNC("swaplist_insert"); UVMHIST_CALLED(pdhist); + KASSERT(rw_write_held(&swap_syscall_lock)); + KASSERT(mutex_owned(&uvm_swap_data_lock)); + /* * find entry at or after which to insert the new device. */ @@ -356,6 +372,10 @@ swaplist_find(struct vnode *vp, bool rem struct swapdev *sdp; struct swappri *spp; + KASSERT(rw_lock_held(&swap_syscall_lock)); + KASSERT(remove ? rw_write_held(&swap_syscall_lock) : 1); + KASSERT(mutex_owned(&uvm_swap_data_lock)); + /* * search the lists for the requested vp */ @@ -386,6 +406,9 @@ swaplist_trim(void) { struct swappri *spp, *nextspp; + KASSERT(rw_write_held(&swap_syscall_lock)); + KASSERT(mutex_owned(&uvm_swap_data_lock)); + LIST_FOREACH_SAFE(spp, &swap_priority, spi_swappri, nextspp) { if (!TAILQ_EMPTY(&spp->spi_swapdev)) continue; @@ -407,6 +430,8 @@ swapdrum_getsdp(int pgno) struct swapdev *sdp; struct swappri *spp; + KASSERT(mutex_owned(&uvm_swap_data_lock)); + LIST_FOREACH(spp, &swap_priority, spi_swappri) { TAILQ_FOREACH(sdp, &spp->spi_swapdev, swd_next) { if (sdp->swd_flags & SWF_FAKE) @@ -420,6 +445,23 @@ swapdrum_getsdp(int pgno) return NULL; } +/* + * swapdrum_sdp_is: true iff the swap device for pgno is sdp + * + * => for use in positive assertions only; result is not stable + */ +static bool __debugused +swapdrum_sdp_is(int pgno, struct swapdev *sdp) +{ + bool result; + + mutex_enter(&uvm_swap_data_lock); + result = swapdrum_getsdp(pgno) == sdp; + mutex_exit(&uvm_swap_data_lock); + + return result; +} + void swapsys_lock(krw_t op) { rw_enter(&swap_syscall_lock, op); @@ -904,7 +946,7 @@ swap_on(struct lwp *l, struct swapdev *s * allocate space to for swap encryption state and mark the * keys uninitialized so we generate them lazily */ - sdp->swd_encmap = kmem_zalloc(howmany(npages, NBBY), KM_SLEEP); + sdp->swd_encmap = kmem_zalloc(encmap_size(npages), KM_SLEEP); sdp->swd_encinit = false; /* @@ -1011,6 +1053,9 @@ swap_off(struct lwp *l, struct swapdev * UVMHIST_FUNC("swap_off"); UVMHIST_CALLED(pdhist); UVMHIST_LOG(pdhist, " dev=%jx, npages=%jd", sdp->swd_dev,npages, 0, 0); + KASSERT(rw_write_held(&swap_syscall_lock)); + KASSERT(mutex_owned(&uvm_swap_data_lock)); + /* disable the swap area being removed */ sdp->swd_flags &= ~SWF_ENABLE; uvmexp.swpgavail -= npages; @@ -1079,7 +1124,8 @@ swap_off(struct lwp *l, struct swapdev * vmem_free(swapmap, sdp->swd_drumoffset, sdp->swd_drumsize); blist_destroy(sdp->swd_blist); bufq_free(sdp->swd_tab); - kmem_free(sdp->swd_encmap, howmany(s
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Wed May 20 18:37:50 UTC 2020 Modified Files: src/sys/uvm: uvm_loan.c Log Message: uvm_loanuobjpages(): - there are no pages to unbusy in the error case - always clear the caller's page array To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/uvm/uvm_loan.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/uvm/uvm_loan.c diff -u src/sys/uvm/uvm_loan.c:1.102 src/sys/uvm/uvm_loan.c:1.103 --- src/sys/uvm/uvm_loan.c:1.102 Tue May 19 21:52:04 2020 +++ src/sys/uvm/uvm_loan.c Wed May 20 18:37:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_loan.c,v 1.102 2020/05/19 21:52:04 ad Exp $ */ +/* $NetBSD: uvm_loan.c,v 1.103 2020/05/20 18:37:50 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.102 2020/05/19 21:52:04 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.103 2020/05/20 18:37:50 ad Exp $"); #include #include @@ -538,6 +538,9 @@ uvm_loanuobjchunk(struct uvm_object *uob /* loan out pages. they will be unbusied whatever happens. */ error = uvm_loanpage(pgpp, npages, true); rw_exit(uobj->vmobjlock); + if (error != 0) { + memset(pgpp, 0, sizeof(pgpp[0]) * npages); + } return error; case EAGAIN: @@ -546,11 +549,6 @@ uvm_loanuobjchunk(struct uvm_object *uob goto reget; default: - if (npages > 0) { - rw_enter(uobj->vmobjlock, RW_WRITER); - uvm_page_unbusy(pgpp, npages); - rw_exit(uobj->vmobjlock); - } return error; } } @@ -569,6 +567,7 @@ uvm_loanuobjpages(struct uvm_object *uob KASSERT(npages > 0); + memset(pgpp, 0, sizeof(pgpp[0]) * npages); for (ndone = 0; ndone < npages; ndone += chunk) { chunk = MIN(UVM_LOAN_GET_CHUNK, npages - ndone); error = uvm_loanuobjchunk(uobj, pgoff + (ndone << PAGE_SHIFT),
CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: ad Date: Wed May 20 18:39:25 UTC 2020 Modified Files: src/sys/arch/amd64/amd64: cpufunc.S Log Message: Deal with KMSAN fussiness. Pointed out by msaitoh@. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amd64/amd64/cpufunc.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/cpufunc.S diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.54 src/sys/arch/amd64/amd64/cpufunc.S:1.55 --- src/sys/arch/amd64/amd64/cpufunc.S:1.54 Tue May 19 21:54:10 2020 +++ src/sys/arch/amd64/amd64/cpufunc.S Wed May 20 18:39:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.S,v 1.54 2020/05/19 21:54:10 ad Exp $ */ +/* $NetBSD: cpufunc.S,v 1.55 2020/05/20 18:39:25 ad Exp $ */ /* * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc. @@ -206,7 +206,23 @@ ENTRY(x86_hotpatch) END(x86_hotpatch) #endif /* !XENPV */ -ENTRY(tsc_get_timecount) +/* Could be exact same as cpu_counter but for KASAN fussiness. */ +ENTRY(cpu_counter32) + movq CPUVAR(CURLWP), %rcx +1: + movq L_NCSW(%rcx), %rdi + rdtsc + addl CPUVAR(CC_SKEW), %eax + cmpq %rdi, L_NCSW(%rcx) + jne 2f + KMSAN_INIT_RET(4) + ret +2: + jmp 1b +END(cpu_counter32) +STRONG_ALIAS(tsc_get_timecount, cpu_counter32) + +ENTRY(cpu_counter) movq CPUVAR(CURLWP), %rcx 1: movq L_NCSW(%rcx), %rdi @@ -216,14 +232,11 @@ ENTRY(tsc_get_timecount) addq CPUVAR(CC_SKEW), %rax cmpq %rdi, L_NCSW(%rcx) jne 2f - KMSAN_INIT_RET(4) + KMSAN_INIT_RET(8) ret 2: jmp 1b -END(tsc_get_timecount) - -STRONG_ALIAS(cpu_counter, tsc_get_timecount) -STRONG_ALIAS(cpu_counter32, tsc_get_timecount) +END(cpu_counter) ENTRY(rdmsr_safe) movq CPUVAR(CURLWP), %r8
CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: maxv Date: Wed May 20 18:52:48 UTC 2020 Modified Files: src/sys/arch/amd64/amd64: cpufunc.S Log Message: this is kmsan To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/amd64/amd64/cpufunc.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/cpufunc.S diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.55 src/sys/arch/amd64/amd64/cpufunc.S:1.56 --- src/sys/arch/amd64/amd64/cpufunc.S:1.55 Wed May 20 18:39:25 2020 +++ src/sys/arch/amd64/amd64/cpufunc.S Wed May 20 18:52:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.S,v 1.55 2020/05/20 18:39:25 ad Exp $ */ +/* $NetBSD: cpufunc.S,v 1.56 2020/05/20 18:52:48 maxv Exp $ */ /* * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc. @@ -206,7 +206,8 @@ ENTRY(x86_hotpatch) END(x86_hotpatch) #endif /* !XENPV */ -/* Could be exact same as cpu_counter but for KASAN fussiness. */ +/* Could be exact same as cpu_counter, but KMSAN needs to have the correct + * size of the return value. */ ENTRY(cpu_counter32) movq CPUVAR(CURLWP), %rcx 1:
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: ad Date: Wed May 20 20:19:02 UTC 2020 Modified Files: src/sys/arch/x86/x86: tsc.c Log Message: The boot CPU suffers a cache miss during TSC sync, before RDTSC. Make the secondary CPU take a miss as well to try and delay it an equal amount. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/x86/tsc.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/tsc.c diff -u src/sys/arch/x86/x86/tsc.c:1.46 src/sys/arch/x86/x86/tsc.c:1.47 --- src/sys/arch/x86/x86/tsc.c:1.46 Tue May 19 21:56:51 2020 +++ src/sys/arch/x86/x86/tsc.c Wed May 20 20:19:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tsc.c,v 1.46 2020/05/19 21:56:51 ad Exp $ */ +/* $NetBSD: tsc.c,v 1.47 2020/05/20 20:19:02 ad Exp $ */ /*- * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.46 2020/05/19 21:56:51 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.47 2020/05/20 20:19:02 ad Exp $"); #include #include @@ -54,6 +54,7 @@ u_int tsc_get_timecount(struct timecount static void tsc_delay(unsigned int); +static uint64_t tsc_dummy_cacheline __cacheline_aligned; uint64_t tsc_freq; /* exported for sysctl */ static int64_t tsc_drift_max = 1000; /* max cycles */ static int64_t tsc_drift_observed; @@ -200,7 +201,7 @@ tsc_sync_drift(int64_t drift) * Called during startup of APs, by the boot processor. Interrupts * are disabled on entry. */ -static void +static void __noinline tsc_read_bp(struct cpu_info *ci, uint64_t *bptscp, uint64_t *aptscp) { uint64_t bptsc; @@ -209,10 +210,13 @@ tsc_read_bp(struct cpu_info *ci, uint64_ panic("tsc_sync_bp: 1"); } - /* Flag it and read our TSC. */ + /* Prepare a cache miss for the other side. */ + (void)atomic_swap_uint((void *)&tsc_dummy_cacheline, 0); + + /* Flag our readiness. */ atomic_or_uint(&ci->ci_flags, CPUF_SYNCTSC); - /* Wait for remote to complete, and read ours again. */ + /* Wait for other side then read our TSC. */ while ((ci->ci_flags & CPUF_SYNCTSC) != 0) { __insn_barrier(); } @@ -254,7 +258,7 @@ tsc_sync_bp(struct cpu_info *ci) * Called during startup of AP, by the AP itself. Interrupts are * disabled on entry. */ -static void +static void __noinline tsc_post_ap(struct cpu_info *ci) { uint64_t tsc; @@ -266,7 +270,12 @@ tsc_post_ap(struct cpu_info *ci) /* Instruct primary to read its counter. */ atomic_and_uint(&ci->ci_flags, ~CPUF_SYNCTSC); - tsc = rdtsc(); + + /* Suffer a cache miss, then read TSC. */ + __insn_barrier(); + tsc = tsc_dummy_cacheline; + __insn_barrier(); + tsc += rdtsc(); /* Post result. Ensure the whole value goes out atomically. */ (void)atomic_swap_64(&tsc_sync_val, tsc);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: sevan Date: Wed May 20 20:18:38 UTC 2020 Modified Files: src/sys/dev/pci: if_rge.c Log Message: use device_private() instead of casting self as it doesn't work here. Bump rcs tag which was missed in r1.9 To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/if_rge.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/dev/pci/if_rge.c diff -u src/sys/dev/pci/if_rge.c:1.10 src/sys/dev/pci/if_rge.c:1.11 --- src/sys/dev/pci/if_rge.c:1.10 Thu Apr 30 00:32:16 2020 +++ src/sys/dev/pci/if_rge.c Wed May 20 20:18:37 2020 @@ -1,5 +1,5 @@ -/* $NetBSD: if_rge.c,v 1.10 2020/04/30 00:32:16 sevan Exp $ */ -/* $OpenBSD: if_rge.c,v 1.2 2020/01/02 09:00:45 kevlo Exp $ */ +/* $NetBSD: if_rge.c,v 1.11 2020/05/20 20:18:37 sevan Exp $ */ +/* $OpenBSD: if_rge.c,v 1.3 2020/03/27 15:15:24 krw Exp $ */ /* * Copyright (c) 2019 Kevin Lo @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.10 2020/04/30 00:32:16 sevan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.11 2020/05/20 20:18:37 sevan Exp $"); /* #include "vlan.h" Sevan */ @@ -189,7 +189,7 @@ rge_match(device_t parent, cfdata_t matc void rge_attach(device_t parent, device_t self, void *aux) { - struct rge_softc *sc = (struct rge_softc *)self; + struct rge_softc *sc = device_private(self); struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; pci_intr_handle_t ih;
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: ad Date: Wed May 20 20:47:18 UTC 2020 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c Log Message: zfs_netbsd_getpages: - implement the PGO_LOCKED case - handle npages > 1 for PGO_SYNCIO To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.67 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.68 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.67 Sat May 16 18:31:46 2020 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Wed May 20 20:47:18 2020 @@ -755,15 +755,14 @@ mappedread(vnode_t *vp, int nbytes, uio_ va = zfs_map_page(pp, S_READ); error = uiomove(va + off, bytes, UIO_READ, uio); zfs_unmap_page(pp, va); + rw_enter(rw, RW_WRITER); + uvm_page_unbusy(&pp, 1); + rw_exit(rw); } else { error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl), uio, bytes); } - rw_enter(rw, RW_WRITER); - uvm_page_unbusy(&pp, 1); - rw_exit(rw); - len -= bytes; off = 0; if (error) @@ -5987,9 +5986,24 @@ zfs_netbsd_getpages(void *v) int npages, found, err = 0; if (flags & PGO_LOCKED) { - *ap->a_count = 0; - ap->a_m[ap->a_centeridx] = NULL; - return EBUSY; + uvn_findpages(uobj, ap->a_offset, ap->a_count, ap->a_m, NULL, + UFP_NOWAIT | UFP_NOALLOC | UFP_NOBUSY | + (memwrite ? UFP_NORDONLY : 0)); + if (memwrite) { + KASSERT(rw_write_held(uobj->vmobjlock)); + for (int i = 0; i < npages; i++) { +pg = ap->a_m[i]; +if (pg == NULL || pg == PGO_DONTCARE) { + continue; +} +if (uvm_pagegetdirty(pg) == +UVM_PAGE_STATUS_CLEAN) { + uvm_pagemarkdirty(pg, + UVM_PAGE_STATUS_UNKNOWN); +} + } + } + return ap->a_m[ap->a_centeridx] == NULL ? EBUSY : 0; } rw_exit(rw); @@ -6016,28 +6030,42 @@ zfs_netbsd_getpages(void *v) fstrans_done(mp); return EINVAL; } - npages = 1; - pg = NULL; - uvn_findpages(uobj, offset, &npages, &pg, NULL, UFP_ALL); + npages = *ap->a_count; + uvn_findpages(uobj, offset, &npages, ap->a_m, NULL, UFP_ALL); - if (pg->flags & PG_FAKE) { - rw_exit(rw); + for (int i = 0; i < npages; i++) { + pg = ap->a_m[i]; + if (pg->flags & PG_FAKE) { + rw_exit(rw); - va = zfs_map_page(pg, S_WRITE); - err = dmu_read(zfsvfs->z_os, zp->z_id, offset, PAGE_SIZE, - va, DMU_READ_PREFETCH); - zfs_unmap_page(pg, va); + va = zfs_map_page(pg, S_WRITE); + err = dmu_read(zfsvfs->z_os, zp->z_id, offset, + PAGE_SIZE, va, DMU_READ_PREFETCH); + zfs_unmap_page(pg, va); - rw_enter(rw, RW_WRITER); - pg->flags &= ~(PG_FAKE); - } + rw_enter(rw, RW_WRITER); + if (err != 0) { +for (i = 0; i < npages; i++) { + pg = ap->a_m[i]; + if ((pg->flags & PG_FAKE) != 0) { + uvm_pagefree(pg); + } else { + uvm_page_unbusy(&pg, 1); + } +} +memset(ap->a_m, 0, sizeof(ap->a_m[0]) * +npages); +break; + } + pg->flags &= ~(PG_FAKE); + } - if (memwrite && uvm_pagegetdirty(pg) == UVM_PAGE_STATUS_CLEAN) { - /* For write faults, start dirtiness tracking. */ - uvm_pagemarkdirty(pg, UVM_PAGE_STATUS_UNKNOWN); + if (memwrite && uvm_pagegetdirty(pg) == UVM_PAGE_STATUS_CLEAN) { + /* For write faults, start dirtiness tracking. */ + uvm_pagemarkdirty(pg, UVM_PAGE_STATUS_UNKNOWN); + } } rw_exit(rw); - ap->a_m[ap->a_centeridx] = pg; ZFS_EXIT(zfsvfs); fstrans_done(mp);
CVS commit: src/sys/kern
Module Name:src Committed By: maxv Date: Wed May 20 20:59:31 UTC 2020 Modified Files: src/sys/kern: kern_synch.c Log Message: future-proof-ness To generate a diff of this commit: cvs rdiff -u -r1.347 -r1.348 src/sys/kern/kern_synch.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/kern/kern_synch.c diff -u src/sys/kern/kern_synch.c:1.347 src/sys/kern/kern_synch.c:1.348 --- src/sys/kern/kern_synch.c:1.347 Sun Apr 19 20:35:29 2020 +++ src/sys/kern/kern_synch.c Wed May 20 20:59:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_synch.c,v 1.347 2020/04/19 20:35:29 ad Exp $ */ +/* $NetBSD: kern_synch.c,v 1.348 2020/05/20 20:59:31 maxv Exp $ */ /*- * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019, 2020 @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.347 2020/04/19 20:35:29 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.348 2020/05/20 20:59:31 maxv Exp $"); #include "opt_kstack.h" #include "opt_dtrace.h" @@ -334,7 +334,7 @@ preempt_needed(void) needed = l->l_cpu->ci_want_resched; KPREEMPT_ENABLE(l); - return (bool)needed; + return (needed != 0); } /*
CVS commit: src/doc
Module Name:src Committed By: maxv Date: Wed May 20 21:05:21 UTC 2020 Modified Files: src/doc: TODO.nvmm Log Message: sync with reality To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/doc/TODO.nvmm Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/TODO.nvmm diff -u src/doc/TODO.nvmm:1.3 src/doc/TODO.nvmm:1.4 --- src/doc/TODO.nvmm:1.3 Mon Apr 29 18:54:25 2019 +++ src/doc/TODO.nvmm Wed May 20 21:05:21 2020 @@ -6,14 +6,12 @@ Known issues in NVMM, low priority in mo install the PDPTEs, and currently we don't do it. In practice they don't misbehave because the emulator never has to interfere with CR3. - * Maybe we will want a way to return to userland when the guest TPR changes. - On Intel that's not complicated, but on old AMD CPUs, we need to disassemble - the instruction, and I don't like that. + * AMD: we don't support VCPU_CONF_TPR, would be nice to. - * We need a cleaner way to handle CPUID exits. It is not complicated to solve, - but I'm still not sure which design is the cleanest. + * AMD: need to do comprehensive CPUID filtering. - * Same for the MSRs. + * Intel: we have comprehensive CPUID filtering, but should we limit the highest + leaf? == LIBNVMM == @@ -22,3 +20,5 @@ Known issues in NVMM, low priority in mo must base the GVA on %SS and not %DS. This is tiring, and in practice, no guest is dumb enough to perform such accesses. + * Maybe the __areas should have a rwlock? I don't think Qemu unmaps memory + while VCPUs are running, but still.
CVS commit: src/sys/kern
Module Name:src Committed By: thorpej Date: Thu May 21 00:39:04 UTC 2020 Modified Files: src/sys/kern: kern_sleepq.c Log Message: In sleepq_insert(), in the SOBJ_SLEEPQ_SORTED case, if there are existing waiters of lower priority, then the new LWP will be inserted in FIFO order with respect to other LWPs of the same priority. However, if all other LWPs are of equal priority to the LWP being inserted, the new LWP would be inserted in LIFO order. Fix this to always insert in FIFO order with respect to equal priority LWPs. OK ad@. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/kern/kern_sleepq.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/kern/kern_sleepq.c diff -u src/sys/kern/kern_sleepq.c:1.67 src/sys/kern/kern_sleepq.c:1.68 --- src/sys/kern/kern_sleepq.c:1.67 Fri May 8 03:26:51 2020 +++ src/sys/kern/kern_sleepq.c Thu May 21 00:39:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sleepq.c,v 1.67 2020/05/08 03:26:51 thorpej Exp $ */ +/* $NetBSD: kern_sleepq.c,v 1.68 2020/05/21 00:39:04 thorpej Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.67 2020/05/08 03:26:51 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.68 2020/05/21 00:39:04 thorpej Exp $"); #include #include @@ -188,15 +188,23 @@ sleepq_insert(sleepq_t *sq, lwp_t *l, sy KASSERT(sq != NULL); if ((sobj->sobj_flag & SOBJ_SLEEPQ_SORTED) != 0) { - lwp_t *l2; + lwp_t *l2, *l_last = NULL; const pri_t pri = lwp_eprio(l); LIST_FOREACH(l2, sq, l_sleepchain) { + l_last = l2; if (lwp_eprio(l2) < pri) { LIST_INSERT_BEFORE(l2, l, l_sleepchain); return; } } + /* + * Ensure FIFO ordering if no waiters are of lower priority. + */ + if (l_last != NULL) { + LIST_INSERT_AFTER(l_last, l, l_sleepchain); + return; + } } LIST_INSERT_HEAD(sq, l, l_sleepchain);
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Thu May 21 05:04:13 UTC 2020 Modified Files: src/sys/arch/aarch64/include: armreg.h Log Message: fix typo To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/arch/aarch64/include/armreg.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/aarch64/include/armreg.h diff -u src/sys/arch/aarch64/include/armreg.h:1.43 src/sys/arch/aarch64/include/armreg.h:1.44 --- src/sys/arch/aarch64/include/armreg.h:1.43 Wed May 13 06:08:51 2020 +++ src/sys/arch/aarch64/include/armreg.h Thu May 21 05:04:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: armreg.h,v 1.43 2020/05/13 06:08:51 ryo Exp $ */ +/* $NetBSD: armreg.h,v 1.44 2020/05/21 05:04:13 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -845,7 +845,7 @@ AARCH64REG_WRITE_INLINE(spsr_el1) #define SPSR_IT4 __BIT(12) // A32: IT[4] #define SPSR_IT3 __BIT(11) // A32: IT[3] #define SPSR_IT2 __BIT(10) // A32: IT[2] -#define SPSR_A64_BTYPE __BIT(11,10) // A64: BTYPE +#define SPSR_A64_BTYPE __BITS(11,10) // A64: BTYPE #define SPSR_A64_D __BIT(9) // A64: Debug Exception Mask #define SPSR_A32_E __BIT(9) // A32: BE Endian Mode #define SPSR_A __BIT(8) // Async abort (SError) Mask
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu May 21 05:41:40 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: cpu_machdep.c Log Message: Fix a problem that setcontext(2) sometimes fail on ARMv8.5-BTI cpu. fixed to always get 0 for SPSR.BTYPE with getcontext(2). a non-zero SPSR.BTYPE cannot be set with setcontext(2). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/cpu_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/aarch64/aarch64/cpu_machdep.c diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.9 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.10 --- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.9 Fri May 1 17:58:48 2020 +++ src/sys/arch/aarch64/aarch64/cpu_machdep.c Thu May 21 05:41:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $ */ +/* $NetBSD: cpu_machdep.c,v 1.10 2020/05/21 05:41:40 ryo Exp $ */ /*- * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $"); +__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.10 2020/05/21 05:41:40 ryo Exp $"); #include "opt_multiprocessor.h" @@ -185,6 +185,7 @@ cpu_getmcontext(struct lwp *l, mcontext_ memcpy(mcp->__gregs, &tf->tf_regs, sizeof(mcp->__gregs)); mcp->__gregs[_REG_TPIDR] = (uintptr_t)l->l_private; + mcp->__gregs[_REG_SPSR] &= ~SPSR_A64_BTYPE; if (fpu_used_p(l)) { const struct pcb * const pcb = lwp_getpcb(l);
CVS commit: src/lib/libc/compat/gen
Module Name:src Committed By: riastradh Date: Thu May 21 05:56:31 UTC 2020 Modified Files: src/lib/libc/compat/gen: compat_ldexp_ieee754.c Log Message: Teach libc's compat ldexp stub to raise fp exceptions. This ldexp stub will shadow the ldexp weak alias for scalbn in libm, which is unfortunate but hard to fix properly without chasing the mythical libc bump beast. With the change here, we should raise all the same exceptions that libm's scalbn does -- overflow, underflow, inexact-result, and (for signalling NaN only) invalid-operation. This in turn should correct the missing overflow/underflow exceptions of our portable C fma, and perhaps other routines. XXX pullup To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/compat/gen/compat_ldexp_ieee754.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/compat/gen/compat_ldexp_ieee754.c diff -u src/lib/libc/compat/gen/compat_ldexp_ieee754.c:1.7 src/lib/libc/compat/gen/compat_ldexp_ieee754.c:1.8 --- src/lib/libc/compat/gen/compat_ldexp_ieee754.c:1.7 Sat Aug 27 09:35:13 2016 +++ src/lib/libc/compat/gen/compat_ldexp_ieee754.c Thu May 21 05:56:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_ldexp_ieee754.c,v 1.7 2016/08/27 09:35:13 christos Exp $ */ +/* $NetBSD: compat_ldexp_ieee754.c,v 1.8 2020/05/21 05:56:31 riastradh Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,14 +31,34 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: compat_ldexp_ieee754.c,v 1.7 2016/08/27 09:35:13 christos Exp $"); +__RCSID("$NetBSD: compat_ldexp_ieee754.c,v 1.8 2020/05/21 05:56:31 riastradh Exp $"); #endif /* LIBC_SCCS and not lint */ #include + #include + #include +#include +#include + +static volatile const double tiny = DBL_MIN, huge = DBL_MAX; + +static double +underflow(double val) +{ + + errno = ERANGE; + return (val < 0 ? -tiny*tiny : tiny*tiny); +} + +static double +overflow(double val) +{ -double ldexp(double, int); + errno = ERANGE; + return (val < 0 ? -huge*huge : huge*huge); +} /* * Multiply the given value by 2^expon. @@ -53,10 +73,13 @@ ldexp(double val, int expon) oldexp = u.dblu_dbl.dbl_exp; /* - * If input is zero, Inf or NaN, just return it. + * If input is zero, Inf or NaN, just return it, but raise + * invalid exception if it is a signalling NaN: adding any of + * these inputs to itself gives itself as output; arithmetic on + * a signalling NaN additionally raises invalid-operation. */ if (u.dblu_d == 0.0 || oldexp == DBL_EXP_INFNAN) - return (val); + return (val + val); if (oldexp == 0) { /* @@ -68,17 +91,13 @@ ldexp(double val, int expon) * Optimization: if the scaling can be done in a single * multiply, or underflows, just do it now. */ - if (expon <= -DBL_FRACBITS) { -errno = ERANGE; -return (val < 0.0 ? -0.0 : 0.0); - } + if (expon <= -DBL_FRACBITS) +return underflow(val); mul.dblu_d = 0.0; mul.dblu_dbl.dbl_exp = expon + DBL_EXP_BIAS; u.dblu_d *= mul.dblu_d; - if (u.dblu_d == 0.0) { -errno = ERANGE; -return (val < 0.0 ? -0.0 : 0.0); - } + if (u.dblu_d == 0.0) +return underflow(val); return (u.dblu_d); } else { /* @@ -105,20 +124,14 @@ ldexp(double val, int expon) /* * The result overflowed; return +/-Inf. */ - u.dblu_dbl.dbl_exp = DBL_EXP_INFNAN; - u.dblu_dbl.dbl_frach = 0; - u.dblu_dbl.dbl_fracl = 0; - errno = ERANGE; - return (u.dblu_d); + return overflow(val); } else if (newexp <= 0) { /* * The output number is either denormal or underflows (see * comments in machine/ieee.h). */ - if (newexp <= -DBL_FRACBITS) { - errno = ERANGE; - return (val < 0.0 ? -0.0 : 0.0); - } + if (newexp <= -DBL_FRACBITS) + return underflow(val); /* * Denormalize the result. We do this with a multiply. If * expon is very large, it won't fit in a double, so we have
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maxv Date: Thu May 21 05:58:00 UTC 2020 Modified Files: src/sys/dev/usb: vhci.c Log Message: Increase the number of ports to 8. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/vhci.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/dev/usb/vhci.c diff -u src/sys/dev/usb/vhci.c:1.17 src/sys/dev/usb/vhci.c:1.18 --- src/sys/dev/usb/vhci.c:1.17 Fri May 15 12:34:52 2020 +++ src/sys/dev/usb/vhci.c Thu May 21 05:58:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vhci.c,v 1.17 2020/05/15 12:34:52 maxv Exp $ */ +/* $NetBSD: vhci.c,v 1.18 2020/05/21 05:58:00 maxv Exp $ */ /* * Copyright (c) 2019-2020 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.17 2020/05/15 12:34:52 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.18 2020/05/21 05:58:00 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -238,7 +238,7 @@ typedef struct vhci_xfer { typedef TAILQ_HEAD(, vhci_xfer) vhci_xfer_list_t; #define VHCI_INDEX2PORT(idx) (idx) -#define VHCI_NPORTS 4 +#define VHCI_NPORTS 8 /* above 8, update TODO-bitmap */ typedef struct { device_t sc_dev; @@ -834,7 +834,7 @@ vhci_usb_attach(vhci_fd_t *vfd) p = xfer->ux_buf; memset(p, 0, xfer->ux_length); - p[0] = __BIT(vfd->port); + p[0] = __BIT(vfd->port); /* TODO-bitmap */ xfer->ux_actlen = xfer->ux_length; xfer->ux_status = USBD_NORMAL_COMPLETION;