CVS commit: src/doc
Module Name:src Committed By: maxv Date: Mon Jun 18 06:09:56 UTC 2018 Added Files: src/doc: TODO.kaslr Log Message: todo list for kaslr, with the issues I can think of right now To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/doc/TODO.kaslr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/doc/TODO.kaslr diff -u /dev/null src/doc/TODO.kaslr:1.1 --- /dev/null Mon Jun 18 06:09:56 2018 +++ src/doc/TODO.kaslr Mon Jun 18 06:09:56 2018 @@ -0,0 +1,41 @@ +== POINTER LEAKS == + +-- Change the permissions of /dev/ksyms, as discussed in: + http://mail-index.netbsd.org/tech-kern/2018/01/17/msg022960.html + +-- The address of a non-public section is leaked because of Meltdown, + "jmp handler". This can easily be fixed by pushing the handlers into + their own section. + +-- Replace the "%p" fmt by something relative to the kernel section (if + any). Eg, from + printf("%p", &some_global_var); --> "0xe38010f0" + to + printf("%p", &some_global_var); --> ".data.4:0x8010f0" + This eases debugging and also prevents leaks if a driver prints + kernel addresses as debug (I've seen that already). + +-- PPPoE sends a kernel address as host unique. (What is this shit.) + +-- "netstat -nat" leaks kernel addresses. + +-- Investigate some other tools. + +-- Be careful with dmesg. + +== RANDOMIZATION == + +-- Randomize the PTE space. + +-- Randomize the kernel main memory (VM_MIN_KERNEL_ADDRESS). + +-- Randomize the direct map. + +-- Randomize the PCPU area. + +== GENERAL == + +-- Sort the kernel sections by size, from largest to smallest, to save + memory. + +-- Add the "pkboot" command in the EFI bootloader.
CVS commit: src/share/man/man7
Module Name:src Committed By: eadler Date: Mon Jun 18 02:57:51 UTC 2018 Modified Files: src/share/man/man7: sysctl.7 Log Message: sysctl.7: fix speeling mistake To generate a diff of this commit: cvs rdiff -u -r1.127 -r1.128 src/share/man/man7/sysctl.7 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man7/sysctl.7 diff -u src/share/man/man7/sysctl.7:1.127 src/share/man/man7/sysctl.7:1.128 --- src/share/man/man7/sysctl.7:1.127 Sat May 5 21:33:53 2018 +++ src/share/man/man7/sysctl.7 Mon Jun 18 02:57:51 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: sysctl.7,v 1.127 2018/05/05 21:33:53 wiz Exp $ +.\" $NetBSD: sysctl.7,v 1.128 2018/06/18 02:57:51 eadler Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -2058,7 +2058,7 @@ Allow IPsec processing when SPD policies Force IPsec processing even when SPD policies are not present. .El .It Li used -Based on if IPsec is enabled, and SPD rule existance, show if +Based on if IPsec is enabled, and SPD rule existence, show if IPsec is being used. Note that currently once IPsec is being used, it cannot be disabled. .It Li spi_try
CVS commit: src/share/man/man3
Module Name:src Committed By: eadler Date: Mon Jun 18 02:48:56 UTC 2018 Modified Files: src/share/man/man3: queue.3 Log Message: queue.3: deduplicate deduplicate a a word word To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/share/man/man3/queue.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man3/queue.3 diff -u src/share/man/man3/queue.3:1.59 src/share/man/man3/queue.3:1.60 --- src/share/man/man3/queue.3:1.59 Mon Oct 2 05:16:41 2017 +++ src/share/man/man3/queue.3 Mon Jun 18 02:48:56 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: queue.3,v 1.59 2017/10/02 05:16:41 pgoyette Exp $ +.\" $NetBSD: queue.3,v 1.60 2018/06/18 02:48:56 eadler Exp $ .\" .\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -951,7 +951,7 @@ and .Fn TAILQ_FOREACH_REVERSE_SAFE traverse the tail queue referenced by .Fa head -in the forward or reverse direction direction, assigning each element in turn to +in the forward or reverse direction, assigning each element in turn to .Fa var . .Pp The SAFE versions use
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Sun Jun 17 23:37:22 UTC 2018 Modified Files: src/share/mk: bsd.sys.mk Log Message: The compat build plays games with MAKEOBJDIR and unsets MAKEOBJDIRPREFIX. Keep using our standard NETBSDOBJDIR if it was set. To generate a diff of this commit: cvs rdiff -u -r1.281 -r1.282 src/share/mk/bsd.sys.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.sys.mk diff -u src/share/mk/bsd.sys.mk:1.281 src/share/mk/bsd.sys.mk:1.282 --- src/share/mk/bsd.sys.mk:1.281 Wed Jun 13 11:46:26 2018 +++ src/share/mk/bsd.sys.mk Sun Jun 17 19:37:22 2018 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.sys.mk,v 1.281 2018/06/13 15:46:26 christos Exp $ +# $NetBSD: bsd.sys.mk,v 1.282 2018/06/17 23:37:22 christos Exp $ # # Build definitions used for NetBSD source tree builds. @@ -31,6 +31,9 @@ REPROFLAGS+= -fdebug-prefix-map=\$$NETBS REPROFLAGS+= -fdebug-prefix-map=\$$X11SRCDIR=/usr/xsrc .if defined(MAKEOBJDIRPREFIX) NETBSDOBJDIR= ${MAKEOBJDIRPREFIX}${NETBSDSRCDIR} +.endif + +.if defined(NETBSDOBJDIR) .export NETBSDOBJDIR REPROFLAGS+= -fdebug-prefix-map=\$$NETBSDOBJDIR=/usr/obj .endif
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: jmcneill Date: Sun Jun 17 22:42:41 UTC 2018 Modified Files: src/sys/arch/arm/cortex: gtmr.c Log Message: Simplify gtmr_delay and don't mix and match usage of the physical and virtual timers (always use the virtual timer). To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/cortex/gtmr.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/arm/cortex/gtmr.c diff -u src/sys/arch/arm/cortex/gtmr.c:1.29 src/sys/arch/arm/cortex/gtmr.c:1.30 --- src/sys/arch/arm/cortex/gtmr.c:1.29 Sat Jun 9 01:17:35 2018 +++ src/sys/arch/arm/cortex/gtmr.c Sun Jun 17 22:42:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: gtmr.c,v 1.29 2018/06/09 01:17:35 jakllsch Exp $ */ +/* $NetBSD: gtmr.c,v 1.30 2018/06/17 22:42:41 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.29 2018/06/09 01:17:35 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.30 2018/06/17 22:42:41 jmcneill Exp $"); #include #include @@ -89,7 +89,6 @@ reg ## _stable_read(struct gtmr_softc *s stable_read(gtmr_cntv_cval); stable_read(gtmr_cntvct); -stable_read(gtmr_cntpct); static int gtmr_match(device_t, cfdata_t, void *); static void gtmr_attach(device_t, device_t, void *); @@ -177,8 +176,6 @@ gtmr_attach(device_t parent, device_t se device_xname(self), "CNTV_CVAL read retry max"); evcnt_attach_dynamic(>mr_cntvct_read_ev, EVCNT_TYPE_MISC, NULL, device_xname(self), "CNTVCT read retry max"); - evcnt_attach_dynamic(>mr_cntpct_read_ev, EVCNT_TYPE_MISC, NULL, - device_xname(self), "CNTPCT read retry max"); if (mpcaa->mpcaa_irq != -1) { sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK, @@ -256,24 +253,19 @@ gtmr_delay(unsigned int n) KASSERT(freq != 0); const unsigned int incr_per_us = howmany(freq, 100); - unsigned int delta = 0, usecs = 0; + int64_t ticks = (int64_t)n * incr_per_us; arm_isb(); - uint64_t last = gtmr_cntpct_stable_read(sc); + uint64_t last = gtmr_cntvct_stable_read(sc); - while (n > usecs) { + while (ticks > 0) { arm_isb(); - uint64_t curr = gtmr_cntpct_stable_read(sc); - if (curr < last) - delta += curr + (UINT64_MAX - last); + uint64_t curr = gtmr_cntvct_stable_read(sc); + if (curr > last) + ticks -= (curr - last); else - delta += curr - last; - + ticks -= (UINT64_MAX - curr + last); last = curr; - if (delta >= incr_per_us) { - usecs += delta / incr_per_us; - delta %= incr_per_us; - } } } @@ -347,5 +339,5 @@ gtmr_get_timecount(struct timecounter *t { struct gtmr_softc * const sc = tc->tc_priv; arm_isb(); // we want the time NOW, not some instructions later. - return (u_int) gtmr_cntpct_stable_read(sc); + return (u_int) gtmr_cntvct_stable_read(sc); }
CVS commit: src/doc
Module Name:src Committed By: alnsn Date: Sun Jun 17 18:10:18 UTC 2018 Modified Files: src/doc: 3RDPARTY Log Message: Current sljit version is r381. To generate a diff of this commit: cvs rdiff -u -r1.1528 -r1.1529 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1528 src/doc/3RDPARTY:1.1529 --- src/doc/3RDPARTY:1.1528 Thu Jun 7 05:48:29 2018 +++ src/doc/3RDPARTY Sun Jun 17 18:10:18 2018 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1528 2018/06/07 05:48:29 maya Exp $ +# $NetBSD: 3RDPARTY,v 1.1529 2018/06/17 18:10:18 alnsn Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -1557,7 +1557,7 @@ Notes: Package: sljit Version: svn revision 313 -Current Vers: svn revision 350 +Current Vers: svn revision 381 Maintainer: Zoltán Herczeg http://sourceforge.net/projects/sljit/ Home Page: http://sljit.sourceforge.net/
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Sun Jun 17 17:19:06 UTC 2018 Modified Files: src/bin/sh: eval.c Log Message: NFC: correct typo in a comment. To generate a diff of this commit: cvs rdiff -u -r1.153 -r1.154 src/bin/sh/eval.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/eval.c diff -u src/bin/sh/eval.c:1.153 src/bin/sh/eval.c:1.154 --- src/bin/sh/eval.c:1.153 Sun Nov 19 03:23:01 2017 +++ src/bin/sh/eval.c Sun Jun 17 17:19:06 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: eval.c,v 1.153 2017/11/19 03:23:01 kre Exp $ */ +/* $NetBSD: eval.c,v 1.154 2018/06/17 17:19:06 kre Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #else -__RCSID("$NetBSD: eval.c,v 1.153 2017/11/19 03:23:01 kre Exp $"); +__RCSID("$NetBSD: eval.c,v 1.154 2018/06/17 17:19:06 kre Exp $"); #endif #endif /* not lint */ @@ -931,7 +931,7 @@ evalcommand(union node *cmd, int flgs, s cmd_flags |= DO_NOFUNC; argsused = parse_command_args(argc, argv, &use_syspath); if (argsused == 0) { -/* use 'type' builting to display info */ +/* use 'type' builtin to display info */ cmdentry.u.bltin = typecmd; break; }
CVS commit: src/sys/arch/i386/include
Module Name:src Committed By: maxv Date: Sun Jun 17 15:46:39 UTC 2018 Modified Files: src/sys/arch/i386/include: frameasm.h Log Message: i586 and below don't have this 3-byte nop, so use three 1-byte nops, reported by Nathanial Sloss To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/include/frameasm.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/i386/include/frameasm.h diff -u src/sys/arch/i386/include/frameasm.h:1.25 src/sys/arch/i386/include/frameasm.h:1.26 --- src/sys/arch/i386/include/frameasm.h:1.25 Sat Jan 27 18:48:59 2018 +++ src/sys/arch/i386/include/frameasm.h Sun Jun 17 15:46:39 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: frameasm.h,v 1.25 2018/01/27 18:48:59 maxv Exp $ */ +/* $NetBSD: frameasm.h,v 1.26 2018/06/17 15:46:39 maxv Exp $ */ #ifndef _I386_FRAMEASM_H_ #define _I386_FRAMEASM_H_ @@ -42,11 +42,11 @@ #define SMAP_ENABLE \ HOTPATCH(HP_NAME_CLAC, 3) ; \ - .byte 0x0F, 0x1F, 0x00 + .byte 0x90, 0x90, 0x90 #define SMAP_DISABLE \ HOTPATCH(HP_NAME_STAC, 3) ; \ - .byte 0x0F, 0x1F, 0x00 + .byte 0x90, 0x90, 0x90 /* * These are used on interrupt or trap entry or exit.
CVS commit: src/sys/sys
Module Name:src Committed By: thorpej Date: Sun Jun 17 15:06:27 UTC 2018 Modified Files: src/sys/sys: device.h Log Message: Add slightly-more generalized version of the "of_compat_data" structure called "device_compatible_entry". It performs a similar function, but instead of one "compatible" string per entry, it takes an array of "comaptible" strings per entry. Also included are macros for initializing an array of these entries and accessing data embedded in them. To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/sys/device.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/sys/device.h diff -u src/sys/sys/device.h:1.151 src/sys/sys/device.h:1.152 --- src/sys/sys/device.h:1.151 Sun Mar 4 07:13:11 2018 +++ src/sys/sys/device.h Sun Jun 17 15:06:27 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.151 2018/03/04 07:13:11 mlelstv Exp $ */ +/* $NetBSD: device.h,v 1.152 2018/06/17 15:06:27 thorpej Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -123,6 +123,29 @@ typedef struct cfdriver *cfdriver_t; typedef struct cfattach *cfattach_t; #if defined(_KERNEL) || defined(_KMEMUSER) +struct device_compatible_entry { + const char ** dce_compat_strings; + union { + uintptr_t dceu_val; + const void *dceu_ptr; + } dce_un; +}; +#define DEVICE_COMPAT_ENTRY_WITH_DATA(strings, opaque) \ + { .dce_compat_strings = (strings),\ + .dce_un.dceu_val = (uintptr_t)(opaque) } + +#define DEVICE_COMPAT_ENTRY(strings) \ + DEVICE_COMPAT_ENTRY_WITH_DATA(strings, 0) + +#define DEVICE_COMPAT_TERMINATOR \ + { .dce_compat_strings = NULL } + +#define DEVICE_COMPAT_ENTRY_GET_STRINGS(_dce) ((_dce)->dce_compat_strings) +#define DEVICE_COMPAT_ENTRY_GET_NUM(_dce) ((_dce)->dce_un.dceu_val) +#define DEVICE_COMPAT_ENTRY_GET_PTR(_dce) ((_dce)->dce_un.dceu_ptr) +#define DEVICE_COMPAT_ENTRY_IS_TERMINATOR(_dce)\ + (((_dce) == NULL || (_dce)->dce_compat_strings == NULL) ? true : false) + struct device_lock { int dvl_nwait; int dvl_nlock;
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun Jun 17 14:50:54 UTC 2018 Modified Files: src/sys/dev/i2c: max77620.c Log Message: Fix compilation error pointed out by nishimura@. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/max77620.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/i2c/max77620.c diff -u src/sys/dev/i2c/max77620.c:1.3 src/sys/dev/i2c/max77620.c:1.4 --- src/sys/dev/i2c/max77620.c:1.3 Sat Jun 16 21:22:13 2018 +++ src/sys/dev/i2c/max77620.c Sun Jun 17 14:50:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: max77620.c,v 1.3 2018/06/16 21:22:13 thorpej Exp $ */ +/* $NetBSD: max77620.c,v 1.4 2018/06/17 14:50:54 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: max77620.c,v 1.3 2018/06/16 21:22:13 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: max77620.c,v 1.4 2018/06/17 14:50:54 thorpej Exp $"); #include #include @@ -260,7 +260,7 @@ max77620_match(device_t parent, cfdata_t struct i2c_attach_args *ia = aux; int match_result; - if (iic_use_direct_match(ia, match, max77620_compats, match_result)) + if (iic_use_direct_match(ia, match, max77620_compats, &match_result)) return match_result; return 0;
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: jmcneill Date: Sun Jun 17 14:48:15 UTC 2018 Modified Files: src/sys/arch/arm/rockchip: rk_cru_composite.c rk_cru_gate.c Log Message: Make gate enable/disable logic easier to read. NFC. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_cru_composite.c \ src/sys/arch/arm/rockchip/rk_cru_gate.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/arm/rockchip/rk_cru_composite.c diff -u src/sys/arch/arm/rockchip/rk_cru_composite.c:1.1 src/sys/arch/arm/rockchip/rk_cru_composite.c:1.2 --- src/sys/arch/arm/rockchip/rk_cru_composite.c:1.1 Sat Jun 16 00:19:04 2018 +++ src/sys/arch/arm/rockchip/rk_cru_composite.c Sun Jun 17 14:48:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_cru_composite.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $ */ +/* $NetBSD: rk_cru_composite.c,v 1.2 2018/06/17 14:48:15 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_cru_composite.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_cru_composite.c,v 1.2 2018/06/17 14:48:15 jmcneill Exp $"); #include #include @@ -48,7 +48,7 @@ rk_cru_composite_enable(struct rk_cru_so return enable ? 0 : ENXIO; const uint32_t write_mask = composite->gate_mask << 16; - const uint32_t write_val = __SHIFTIN(!enable, composite->gate_mask); + const uint32_t write_val = enable ? 0 : composite->gate_mask; CRU_WRITE(sc, composite->gate_reg, write_mask | write_val); Index: src/sys/arch/arm/rockchip/rk_cru_gate.c diff -u src/sys/arch/arm/rockchip/rk_cru_gate.c:1.1 src/sys/arch/arm/rockchip/rk_cru_gate.c:1.2 --- src/sys/arch/arm/rockchip/rk_cru_gate.c:1.1 Sat Jun 16 00:19:04 2018 +++ src/sys/arch/arm/rockchip/rk_cru_gate.c Sun Jun 17 14:48:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_cru_gate.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $ */ +/* $NetBSD: rk_cru_gate.c,v 1.2 2018/06/17 14:48:15 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_cru_gate.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_cru_gate.c,v 1.2 2018/06/17 14:48:15 jmcneill Exp $"); #include #include @@ -45,7 +45,7 @@ rk_cru_gate_enable(struct rk_cru_softc * KASSERT(clk->type == RK_CRU_GATE); const uint32_t write_mask = gate->mask << 16; - const uint32_t write_val = __SHIFTIN(!enable, gate->mask); + const uint32_t write_val = enable ? 0 : gate->mask; CRU_WRITE(sc, gate->reg, write_mask | write_val);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jmcneill Date: Sun Jun 17 13:12:25 UTC 2018 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: Avoid calling bus_dmamap_sync with len=0 To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.46 src/sys/dev/ic/dwc_gmac.c:1.47 --- src/sys/dev/ic/dwc_gmac.c:1.46 Sat Jun 16 00:15:00 2018 +++ src/sys/dev/ic/dwc_gmac.c Sun Jun 17 13:12:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.46 2018/06/16 00:15:00 jmcneill Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.47 2018/06/17 13:12:25 jmcneill Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.46 2018/06/16 00:15:00 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.47 2018/06/17 13:12:25 jmcneill Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -635,11 +635,13 @@ dwc_gmac_txdesc_sync(struct dwc_gmac_sof TX_DESC_OFFSET(start), TX_DESC_OFFSET(AWGE_TX_RING_COUNT)-TX_DESC_OFFSET(start), ops); - /* sync from start of ring to 'end' */ - bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, - TX_DESC_OFFSET(0), - TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0), - ops); + if (TX_DESC_OFFSET(end) - TX_DESC_OFFSET(0) > 0) { + /* sync from start of ring to 'end' */ + bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map, + TX_DESC_OFFSET(0), + TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0), + ops); + } } static void
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: jmcneill Date: Sun Jun 17 11:52:38 UTC 2018 Modified Files: src/sys/arch/arm/rockchip: rk_cru.c Log Message: Fix soft reset logic To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_cru.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/arm/rockchip/rk_cru.c diff -u src/sys/arch/arm/rockchip/rk_cru.c:1.1 src/sys/arch/arm/rockchip/rk_cru.c:1.2 --- src/sys/arch/arm/rockchip/rk_cru.c:1.1 Sat Jun 16 00:19:04 2018 +++ src/sys/arch/arm/rockchip/rk_cru.c Sun Jun 17 11:52:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_cru.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $ */ +/* $NetBSD: rk_cru.c,v 1.2 2018/06/17 11:52:38 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -30,7 +30,7 @@ #include "opt_fdt_arm.h" #include -__KERNEL_RCSID(0, "$NetBSD: rk_cru.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_cru.c,v 1.2 2018/06/17 11:52:38 jmcneill Exp $"); #include #include @@ -64,10 +64,10 @@ rk_cru_reset_assert(device_t dev, void * { struct rk_cru_softc * const sc = device_private(dev); const uintptr_t reset_id = (uintptr_t)priv; - const bus_size_t reg = CRU_SOFTRST_CON0 + (reset_id / 32) * 4; - const u_int shift = reset_id % 32; + const bus_size_t reg = CRU_SOFTRST_CON0 + (reset_id / 16) * 4; + const u_int shift = reset_id % 16; - CRU_WRITE(sc, reg, (1 << (shift + 16)) | (0 << shift)); + CRU_WRITE(sc, reg, (1 << (shift + 16)) | (1 << shift)); return 0; } @@ -77,10 +77,10 @@ rk_cru_reset_deassert(device_t dev, void { struct rk_cru_softc * const sc = device_private(dev); const uintptr_t reset_id = (uintptr_t)priv; - const bus_size_t reg = CRU_SOFTRST_CON0 + (reset_id / 32) * 4; - const u_int shift = reset_id % 32; + const bus_size_t reg = CRU_SOFTRST_CON0 + (reset_id / 16) * 4; + const u_int shift = reset_id % 16; - CRU_WRITE(sc, reg, (1 << (shift + 16)) | (1 << shift)); + CRU_WRITE(sc, reg, (1 << (shift + 16)) | (0 << shift)); return 0; }
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: maxv Date: Sun Jun 17 07:13:02 UTC 2018 Modified Files: src/sys/arch/x86/x86: identcpu.c Log Message: Enable eager fpu automatically at boot time if the cpu is affected. Intel hasn't published a list of its affected products, but it appears that Xen was given this information since they have a specific detection code. We could just unconditionally enable eager; but on x86_32 eager may have a greater performance cost than lazy, and we don't want to lose performance on unaffected (and ~old) CPUs running NetBSD/i386. So use the same code as Xen: take Family 6, and whitelist certain models. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/arch/x86/x86/identcpu.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/identcpu.c diff -u src/sys/arch/x86/x86/identcpu.c:1.71 src/sys/arch/x86/x86/identcpu.c:1.72 --- src/sys/arch/x86/x86/identcpu.c:1.71 Fri Mar 30 19:51:53 2018 +++ src/sys/arch/x86/x86/identcpu.c Sun Jun 17 07:13:02 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: identcpu.c,v 1.71 2018/03/30 19:51:53 maxv Exp $ */ +/* $NetBSD: identcpu.c,v 1.72 2018/06/17 07:13:02 maxv Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.71 2018/03/30 19:51:53 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.72 2018/06/17 07:13:02 maxv Exp $"); #include "opt_xen.h" @@ -719,11 +719,59 @@ cpu_probe_old_fpu(struct cpu_info *ci) #endif } +#ifndef XEN +static void +cpu_probe_fpu_leak(struct cpu_info *ci) +{ + /* + * INTEL-SA-00145. Affected CPUs are from Family 6. + */ + if (cpu_vendor != CPUVENDOR_INTEL) { + return; + } + if (CPUID_TO_FAMILY(ci->ci_signature) != 6) { + return; + } + + switch (CPUID_TO_MODEL(ci->ci_signature)) { + /* Atom CPUs are not vulnerable. */ + case 0x1c: /* Pineview */ + case 0x26: /* Lincroft */ + case 0x27: /* Penwell */ + case 0x35: /* Cloverview */ + case 0x36: /* Cedarview */ + case 0x37: /* Baytrail / Valleyview (Silvermont) */ + case 0x4d: /* Avaton / Rangely (Silvermont) */ + case 0x4c: /* Cherrytrail / Brasswell */ + case 0x4a: /* Merrifield */ + case 0x5a: /* Moorefield */ + case 0x5c: /* Goldmont */ + case 0x5f: /* Denverton */ + case 0x7a: /* Gemini Lake */ + break; + + /* Knights CPUs are not vulnerable. */ + case 0x57: /* Knights Landing */ + case 0x85: /* Knights Mill */ + break; + + /* The rest is vulnerable. */ + default: + x86_fpu_eager = true; + break; + } +} +#endif + static void cpu_probe_fpu(struct cpu_info *ci) { u_int descs[4]; +#ifndef XEN + cpu_probe_fpu_leak(ci); +#endif + x86_fpu_save = FPU_SAVE_FSAVE; #ifdef i386 /* amd64 always has fxsave, sse and sse2 */