CVS commit: src/sys/arch

2019-12-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec  9 04:51:04 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/sunxi: sun8i_crypto.c sun8i_crypto.h

Log Message:
Draft driver for Allwinner Crypto Engine.

Found on, e.g., the Pinebook.

Only used for TRNG at the moment, but hooking it up to opencrypto(9)
shouldn't be too hard if anyone still cares about that these days.

The distribution of the alleged TRNG is very nonuniform distributed
seems to alternate between toward runs with exceptionally high
fractions of 0 bits and runs with exceptionally high fractions of 1
bits -- initially all my samples were mostly 0's, and then all my
samples were mostly 1's, and now I'm seeing more oscillation between
these runs.

So I've wired it up as RND_TYPE_UNKNOWN, not RND_TYPE_RNG (it will
immediately flunk our rngtest and be disabled), and I estimated it to
provide at most one bit of entropy per byte of data -- which may
still be optimistic.  I also added a sysctl node hw.sun8icryptoN.rng
to read out 1024-byte samples for analysis, and I left the driver
commented out in GENERIC64 for now.

(If anyone has contacts at Allwinner who can tell us about how the
alleged TRNG is supposed to work, please let me know!)


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sun8i_crypto.c \
src/sys/arch/arm/sunxi/sun8i_crypto.h
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/evbarm/conf/GENERIC64

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/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.66 src/sys/arch/arm/sunxi/files.sunxi:1.67
--- src/sys/arch/arm/sunxi/files.sunxi:1.66	Sat Aug  3 13:28:42 2019
+++ src/sys/arch/arm/sunxi/files.sunxi	Mon Dec  9 04:51:03 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.66 2019/08/03 13:28:42 tnn Exp $
+#	$NetBSD: files.sunxi,v 1.67 2019/12/09 04:51:03 riastradh Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -364,6 +364,11 @@ device	sunxihdmiphy: drmkms
 attach	sunxihdmiphy at fdt with sunxi_hdmiphy
 file	arch/arm/sunxi/sunxi_hdmiphy.c		sunxi_hdmiphy | sunxi_dwhdmi
 
+# Allwinner Crypto Engine
+device	sun8icrypto
+attach	sun8icrypto at fdt with sun8i_crypto
+file	arch/arm/sunxi/sun8i_crypto.c		sun8i_crypto
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUNXI_MC

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.115 src/sys/arch/evbarm/conf/GENERIC64:1.116
--- src/sys/arch/evbarm/conf/GENERIC64:1.115	Sun Nov 17 19:51:35 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Mon Dec  9 04:51:04 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.115 2019/11/17 19:51:35 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.116 2019/12/09 04:51:04 riastradh Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -370,6 +370,7 @@ amdccp*		at fdt?			# AMD Cryptograhic Co
 amdccp*		at acpi?
 bcmrng*		at fdt?			# Broadcom BCM283x RNG
 mesonrng*	at fdt?			# Amlogic Meson RNG
+#sun8icrypto* 	at fdt?			# Allwinner Crypto Engine
 
 # RTC
 plrtc*		at fdt?			# ARM PrimeCell RTC

Added files:

Index: src/sys/arch/arm/sunxi/sun8i_crypto.c
diff -u /dev/null src/sys/arch/arm/sunxi/sun8i_crypto.c:1.1
--- /dev/null	Mon Dec  9 04:51:04 2019
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c	Mon Dec  9 04:51:03 2019
@@ -0,0 +1,1349 @@
+/*	$NetBSD: sun8i_crypto.c,v 1.1 2019/12/09 04:51:03 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2019 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 source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, 

CVS commit: src/sys/arch/arm/dts

2019-12-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec  9 04:40:50 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun50i-a64.dtsi

Log Message:
Add crypto engine block.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/dts/sun50i-a64.dtsi

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/dts/sun50i-a64.dtsi
diff -u src/sys/arch/arm/dts/sun50i-a64.dtsi:1.13 src/sys/arch/arm/dts/sun50i-a64.dtsi:1.14
--- src/sys/arch/arm/dts/sun50i-a64.dtsi:1.13	Sun Nov 17 17:35:10 2019
+++ src/sys/arch/arm/dts/sun50i-a64.dtsi	Mon Dec  9 04:40:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64.dtsi,v 1.13 2019/11/17 17:35:10 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64.dtsi,v 1.14 2019/12/09 04:40:50 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -50,6 +50,15 @@
 			resets = < RST_BUS_THS>;
 			#thermal-sensor-cells = <0>;
 		};
+
+		crypto: crypto@1c15000 {
+			compatible = "allwinner,sun50i-a64-crypto";
+			reg = <0x01c15000 0x1000>;
+			interrupts = ;
+			clocks = < CLK_BUS_CE>, < CLK_CE>;
+			clock-names = "bus", "mod";
+			resets = < RST_BUS_CE>;
+		};
 	};
 
 	/* PMU interrupt numbers are wrong in mainline dts */



CVS commit: src/sys/uvm/pmap

2019-12-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec  9 04:39:58 UTC 2019

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Convert pmap_pvt to atomic_load/store.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/uvm/pmap/pmap_pvt.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/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.4 src/sys/uvm/pmap/pmap_pvt.c:1.5
--- src/sys/uvm/pmap/pmap_pvt.c:1.4	Sat Dec  7 17:56:08 2019
+++ src/sys/uvm/pmap/pmap_pvt.c	Mon Dec  9 04:39:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.4 2019/12/07 17:56:08 jmcneill Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.5 2019/12/09 04:39:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.4 2019/12/07 17:56:08 jmcneill Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.5 2019/12/09 04:39:58 riastradh Exp $");
 
 #include 
 #include 
@@ -92,8 +92,7 @@ pmap_pv_track(paddr_t start, psize_t siz
 
 	mutex_enter(_unmanaged.lock);
 	pvt->pvt_next = pv_unmanaged.list;
-	membar_producer();
-	pv_unmanaged.list = pvt;
+	atomic_store_release(_unmanaged.list, pvt);
 	mutex_exit(_unmanaged.lock);
 }
 
@@ -119,9 +118,21 @@ pmap_pv_untrack(paddr_t start, psize_t s
 			panic("pmap_pv_untrack: pv-tracking at 0x%"PRIxPADDR
 			": 0x%"PRIxPSIZE" bytes, not 0x%"PRIxPSIZE" bytes",
 			pvt->pvt_start, pvt->pvt_size, size);
-		*pvtp = pvt->pvt_next;
+
+		/*
+		 * Remove from list.  Readers can safely see the old
+		 * and new states of the list.
+		 */
+		atomic_store_relaxed(pvtp, pvt->pvt_next);
+
+		/* Wait for readers who can see the old state to finish.  */
 		pserialize_perform(pv_unmanaged.psz);
-		pvt->pvt_next = NULL;
+
+		/*
+		 * We now have exclusive access to pvt and can destroy
+		 * it.  Poison it to catch bugs.
+		 */
+		explicit_memset(>pvt_next, 0x1a, sizeof pvt->pvt_next);
 		goto out;
 	}
 	panic("pmap_pv_untrack: pages not pv-tracked at 0x%"PRIxPADDR
@@ -143,8 +154,9 @@ pmap_pv_tracked(paddr_t pa)
 	KASSERT(pa == trunc_page(pa));
 
 	s = pserialize_read_enter();
-	for (pvt = pv_unmanaged.list; pvt != NULL; pvt = pvt->pvt_next) {
-		membar_datadep_consumer();
+	for (pvt = atomic_load_consume(_unmanaged.list);
+	 pvt != NULL;
+	 pvt = pvt->pvt_next) {
 		if ((pvt->pvt_start <= pa) &&
 		((pa - pvt->pvt_start) < pvt->pvt_size))
 			break;



CVS commit: src/sys/dev/pci

2019-12-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Dec  9 02:30:30 UTC 2019

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
 Fix a bug that wm_sgmii_readreg_locked() may return error even if error isn't
occured.


To generate a diff of this commit:
cvs rdiff -u -r1.650 -r1.651 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.650 src/sys/dev/pci/if_wm.c:1.651
--- src/sys/dev/pci/if_wm.c:1.650	Wed Dec  4 09:03:45 2019
+++ src/sys/dev/pci/if_wm.c	Mon Dec  9 02:30:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.650 2019/12/04 09:03:45 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.651 2019/12/09 02:30:30 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.650 2019/12/04 09:03:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.651 2019/12/09 02:30:30 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -11626,7 +11626,7 @@ wm_sgmii_readreg_locked(device_t dev, in
 {
 	struct wm_softc *sc = device_private(dev);
 	uint32_t i2ccmd;
-	int i, rv;
+	int i, rv = 0;
 
 	i2ccmd = (reg << I2CCMD_REG_ADDR_SHIFT)
 	| (phy << I2CCMD_PHY_ADDR_SHIFT) | I2CCMD_OPCODE_READ;



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2019-12-08 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Dec  9 00:15:11 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c

Log Message:
We currently lack a tunable to control ZFS prefetch, so skip the warning and
FreeBSD specific instructions on settings.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.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/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.15 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.16
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.15	Sun Dec  1 20:26:05 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Mon Dec  9 00:15:11 2019
@@ -6218,6 +6218,7 @@ arc_init(void)
 	}
 
 #ifdef _KERNEL
+#ifdef __FreeBSD__
 	if (TUNABLE_INT_FETCH("vfs.zfs.prefetch_disable", _prefetch_disable))
 		prefetch_tunable_set = 1;
 
@@ -6239,6 +6240,7 @@ arc_init(void)
 		zfs_prefetch_disable = 1;
 	}
 #endif
+#endif
 	/* Warn about ZFS memory and address space requirements. */
 	if (((uint64_t)physmem * PAGESIZE) < (256 + 128 + 64) * (1 << 20)) {
 		printf("ZFS WARNING: Recommended minimum RAM size is 512MB; "
@@ -6247,9 +6249,11 @@ arc_init(void)
 	if (kmem_size() < 512 * (1 << 20)) {
 		printf("ZFS WARNING: Recommended minimum kmem_size is 512MB; "
 		"expect unstable behavior.\n");
+#ifdef __FreeBSD__
 		printf(" Consider tuning vm.kmem_size and "
 		"vm.kmem_size_max\n");
 		printf(" in /boot/loader.conf.\n");
+#endif
 	}
 #endif
 }



CVS commit: src/bin/sh

2019-12-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec  9 00:14:30 UTC 2019

Modified Files:
src/bin/sh: trap.c

Log Message:
PR bin/54743

If a builtin command or function is the final command intended to be
executed, and is interrupted by a caught signal, the trap handler for
that signal was not executed - the shell simply exited (an exit trap
handler would still have been run - if there was one the handler
for the signal may have been invoked during the execution of the
exit trap handler, which, if it happened, is incorrect sequencing).

Now, if we're exiting, and there are pending signals, run their handlers
just before running the EXIT trap handler, if any.

There are almost certainly plenty more issues with traps that need
solving.   Later,

XXX pullup -9

(-8 is too different in this area, and this problem suitably obscure,
that we won't bother) (the -7 sh is simply obsolete).


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/sh/trap.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/trap.c
diff -u src/bin/sh/trap.c:1.52 src/bin/sh/trap.c:1.53
--- src/bin/sh/trap.c:1.52	Thu Apr 25 03:54:10 2019
+++ src/bin/sh/trap.c	Mon Dec  9 00:14:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.52 2019/04/25 03:54:10 kre Exp $	*/
+/*	$NetBSD: trap.c,v 1.53 2019/12/09 00:14:30 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)trap.c	8.5 (Berkeley) 6/5/95";
 #else
-__RCSID("$NetBSD: trap.c,v 1.52 2019/04/25 03:54:10 kre Exp $");
+__RCSID("$NetBSD: trap.c,v 1.53 2019/12/09 00:14:30 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -854,6 +854,12 @@ exitshell_savedstatus(void)
 	}
 	exitstatus = exiting_status;
 
+	if (pendingsigs && !setjmp(loc.loc)) {
+		handler = 
+
+		dotrap();
+	}
+
 	if (!setjmp(loc.loc)) {
 		handler = 
 



CVS commit: src/bin/sh

2019-12-08 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Dec  9 00:14:24 UTC 2019

Modified Files:
src/bin/sh: eval.c

Log Message:
PR bin/54743

Having traps set should not enforce a fork for the next command,
whatever that command happens to be, only for commands which would
normally fork if they weren't the last command expected to be
executed (ie: builtins and functions shouldn't be exexuted in a
sub-shell merely because a trap is set).

As it was (for example)
trap 'whatever' SIGANY; wait $anypid
was guaranteed to fail the wait, as the subshell it was executed
in could not have any children.

XXX pullup -9


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 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.175 src/bin/sh/eval.c:1.176
--- src/bin/sh/eval.c:1.175	Sat May  4 02:52:55 2019
+++ src/bin/sh/eval.c	Mon Dec  9 00:14:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.175 2019/05/04 02:52:55 kre Exp $	*/
+/*	$NetBSD: eval.c,v 1.176 2019/12/09 00:14:24 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.175 2019/05/04 02:52:55 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.176 2019/12/09 00:14:24 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -1061,13 +1061,18 @@ evalcommand(union node *cmd, int flgs, s
 		free_traps();
 
 	/* Fork off a child process if necessary. */
-	if (cmd->ncmd.backgnd || (have_traps() && (flags & EV_EXIT) != 0)
-	 || ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN)
-	 && (flags & EV_EXIT) == 0)
-	 || ((flags & EV_BACKCMD) != 0 &&
-	((cmdentry.cmdtype != CMDBUILTIN && cmdentry.cmdtype != CMDSPLBLTIN)
-		 || cmdentry.u.bltin == dotcmd
-		 || cmdentry.u.bltin == evalcmd))) {
+	if (cmd->ncmd.backgnd
+	  || ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN)
+	 && (have_traps() || (flags & EV_EXIT) == 0))
+#ifdef notyet			/* EV_BACKCMD is never set currently */
+			/* this will need more work if/when it gets used */
+	  || ((flags & EV_BACKCMD) != 0
+	 && (cmdentry.cmdtype != CMDBUILTIN
+	 && cmdentry.cmdtype != CMDSPLBLTIN)
+	   || cmdentry.u.bltin == dotcmd
+	   || cmdentry.u.bltin == evalcmd)
+#endif
+	 ) {
 		INTOFF;
 		jp = makejob(cmd, 1);
 		mode = cmd->ncmd.backgnd;



CVS commit: src/etc/rc.d

2019-12-08 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Dec  9 00:11:32 UTC 2019

Modified Files:
src/etc/rc.d: zfs

Log Message:
This script just makes sure that the ZFS module loads and unloads, mountall
script takes care of mounting filesystems.
Don't try to unmount all file systems before unloading the ZFS module, leave
that to the operator in preperation or the mountall script to take care
of. Module will of course fail to unload then if file systems are still
mounted.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/zfs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/zfs
diff -u src/etc/rc.d/zfs:1.4 src/etc/rc.d/zfs:1.5
--- src/etc/rc.d/zfs:1.4	Sun Dec  8 00:58:16 2019
+++ src/etc/rc.d/zfs	Mon Dec  9 00:11:32 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: zfs,v 1.4 2019/12/08 00:58:16 sevan Exp $
+# $NetBSD: zfs,v 1.5 2019/12/09 00:11:32 sevan Exp $
 #
 
 # PROVIDE: zfs
@@ -29,7 +29,6 @@ zfs_start()
 zfs_stop()
 {
 	if [ -x /sbin/zfs ]; then
-		zfs unmount -a
 		modunload zfs
 	fi
 	return 0;



CVS commit: src/libexec/ld.elf_so/arch/powerpc

2019-12-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec  8 23:49:16 UTC 2019

Modified Files:
src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c

Log Message:
Use existing lo() and hi() macros.  Same object code is generated.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
diff -u src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.59 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.60
--- src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.59	Sun Dec  8 22:57:51 2019
+++ src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c	Sun Dec  8 23:49:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppc_reloc.c,v 1.59 2019/12/08 22:57:51 uwe Exp $	*/
+/*	$NetBSD: ppc_reloc.c,v 1.60 2019/12/08 23:49:16 uwe Exp $	*/
 
 /*-
  * Copyright (C) 1998	Tsubai Masanari
@@ -30,7 +30,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ppc_reloc.c,v 1.59 2019/12/08 22:57:51 uwe Exp $");
+__RCSID("$NetBSD: ppc_reloc.c,v 1.60 2019/12/08 23:49:16 uwe Exp $");
 #endif /* not lint */
 
 #include 
@@ -246,7 +246,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			tmp = (Elf_Addr)(defobj->relocbase + def->st_value +
 			rela->r_addend);
 
-			uint16_t tmp16 = (uint16_t)(tmp & 0x);
+			uint16_t tmp16 = lo(tmp);
 
 			uint16_t *where16 = (uint16_t *)where;
 			if (*where16 != tmp16)
@@ -262,10 +262,10 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			tmp = (Elf_Addr)(defobj->relocbase + def->st_value +
 			rela->r_addend);
 
-			uint16_t tmp16 = (uint16_t)((tmp >> 16) & 0x);
+			uint16_t tmp16 = hi(tmp);
 			if (ELF_R_TYPE(rela->r_info) == R_TYPE(ADDR16_HA)
-			&& (tmp & 0x8000))
-++tmp16;
+			&& (tmp & __ha16))
+++tmp16; /* adjust to ha(tmp) */
 
 			uint16_t *where16 = (uint16_t *)where;
 			if (*where16 != tmp16)



CVS commit: src/libexec/ld.elf_so/arch/powerpc

2019-12-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec  8 22:57:51 UTC 2019

Modified Files:
src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c

Log Message:
Resolve ADDR16_LO, ADDR16_HI, and ADDR16_HA relocs.

Recent GNU ld does not resolve them statically if the reloc is in a
writable section and the symbol is not already referenced from text.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
diff -u src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.58 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.59
--- src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.58	Sun Dec 30 03:23:46 2018
+++ src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c	Sun Dec  8 22:57:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppc_reloc.c,v 1.58 2018/12/30 03:23:46 christos Exp $	*/
+/*	$NetBSD: ppc_reloc.c,v 1.59 2019/12/08 22:57:51 uwe Exp $	*/
 
 /*-
  * Copyright (C) 1998	Tsubai Masanari
@@ -30,7 +30,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ppc_reloc.c,v 1.58 2018/12/30 03:23:46 christos Exp $");
+__RCSID("$NetBSD: ppc_reloc.c,v 1.59 2019/12/08 22:57:51 uwe Exp $");
 #endif /* not lint */
 
 #include 
@@ -197,6 +197,9 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 		case R_TYPE(ADDR32):	/*  S + A */
 #endif
 		case R_TYPE(GLOB_DAT):	/*  S + A */
+		case R_TYPE(ADDR16_LO):
+		case R_TYPE(ADDR16_HI):
+		case R_TYPE(ADDR16_HA):
 		case R_TYPE(DTPMOD):
 		case R_TYPE(DTPREL):
 		case R_TYPE(TPREL):
@@ -234,6 +237,50 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			obj->path, (void *)*where, defobj->path));
 			break;
 
+		/*
+		 * Recent GNU ld does not resolve ADDR16_{LO,HI,HA} if
+		 * the reloc is in a writable section and the symbol
+		 * is not already referenced from text.
+		 */
+		case R_TYPE(ADDR16_LO): {
+			tmp = (Elf_Addr)(defobj->relocbase + def->st_value +
+			rela->r_addend);
+
+			uint16_t tmp16 = (uint16_t)(tmp & 0x);
+
+			uint16_t *where16 = (uint16_t *)where;
+			if (*where16 != tmp16)
+*where16 = tmp16;
+			rdbg(("ADDR16_LO %s in %s --> #lo(%p) = 0x%x in %s",
+			obj->strtab + obj->symtab[symnum].st_name,
+			  obj->path, (void *)tmp, tmp16, defobj->path));
+			break;
+		}
+
+		case R_TYPE(ADDR16_HI):
+		case R_TYPE(ADDR16_HA): {
+			tmp = (Elf_Addr)(defobj->relocbase + def->st_value +
+			rela->r_addend);
+
+			uint16_t tmp16 = (uint16_t)((tmp >> 16) & 0x);
+			if (ELF_R_TYPE(rela->r_info) == R_TYPE(ADDR16_HA)
+			&& (tmp & 0x8000))
+++tmp16;
+
+			uint16_t *where16 = (uint16_t *)where;
+			if (*where16 != tmp16)
+*where16 = tmp16;
+			rdbg(("ADDR16_H%c %s in %s --> #h%c(%p) = 0x%x in %s",
+			  (ELF_R_TYPE(rela->r_info) == R_TYPE(ADDR16_HI)
+			   ? 'I' : 'A'),
+			  obj->strtab + obj->symtab[symnum].st_name,
+			  obj->path,
+			  (ELF_R_TYPE(rela->r_info) == R_TYPE(ADDR16_HI)
+			   ? 'i' : 'a'),
+			  (void *)tmp, tmp16, defobj->path));
+			break;
+		}
+
 		case R_TYPE(RELATIVE):	/*  B + A */
 			*where = (Elf_Addr)(obj->relocbase + rela->r_addend);
 			rdbg(("RELATIVE in %s --> %p", obj->path,



CVS commit: src/libexec/ld.elf_so

2019-12-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec  8 22:41:42 UTC 2019

Modified Files:
src/libexec/ld.elf_so: xprintf.c

Log Message:
Fix typo in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/libexec/ld.elf_so/xprintf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/xprintf.c
diff -u src/libexec/ld.elf_so/xprintf.c:1.21 src/libexec/ld.elf_so/xprintf.c:1.22
--- src/libexec/ld.elf_so/xprintf.c:1.21	Thu Dec 16 22:52:32 2010
+++ src/libexec/ld.elf_so/xprintf.c	Sun Dec  8 22:41:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xprintf.c,v 1.21 2010/12/16 22:52:32 joerg Exp $	 */
+/*	$NetBSD: xprintf.c,v 1.22 2019/12/08 22:41:42 uwe Exp $	 */
 
 /*
  * Copyright 1996 Matt Thomas 
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: xprintf.c,v 1.21 2010/12/16 22:52:32 joerg Exp $");
+__RCSID("$NetBSD: xprintf.c,v 1.22 2019/12/08 22:41:42 uwe Exp $");
 #endif /* not lint */
 
 #include 
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: xprintf.c,v 1.21 2010/
  * Non-mallocing printf, for use by malloc and rtld itself.
  * This avoids putting in most of stdio.
  *
- * deals withs formats %x, %p, %s, and %d.
+ * deals with formats %x, %p, %s, and %d.
  */
 size_t
 xvsnprintf(char *buf, size_t buflen, const char *fmt, va_list ap)



CVS commit: src/libexec/ld.elf_so

2019-12-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec  8 22:35:27 UTC 2019

Modified Files:
src/libexec/ld.elf_so: rtld.c

Log Message:
_rtld_relro - fix debug printf format for a size_t argument


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/libexec/ld.elf_so/rtld.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.200 src/libexec/ld.elf_so/rtld.c:1.201
--- src/libexec/ld.elf_so/rtld.c:1.200	Fri Oct  4 01:57:53 2019
+++ src/libexec/ld.elf_so/rtld.c	Sun Dec  8 22:35:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.200 2019/10/04 01:57:53 christos Exp $	 */
+/*	$NetBSD: rtld.c,v 1.201 2019/12/08 22:35:27 uwe Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.200 2019/10/04 01:57:53 christos Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.201 2019/12/08 22:35:27 uwe Exp $");
 #endif /* not lint */
 
 #include 
@@ -1776,7 +1776,7 @@ _rtld_relro(const Obj_Entry *obj, bool w
 	if (wantmain != (obj ==_rtld_objmain))
 		return 0;
 
-	dbg(("RELRO %s %p %lx\n", obj->path, obj->relro_page, obj->relro_size));
+	dbg(("RELRO %s %p %zx\n", obj->path, obj->relro_page, obj->relro_size));
 	if (mprotect(obj->relro_page, obj->relro_size, PROT_READ) == -1) {
 		_rtld_error("%s: Cannot enforce relro " "protection: %s",
 		obj->path, xstrerror(errno));



CVS commit: src/sys/arch/powerpc/include

2019-12-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec  8 21:46:03 UTC 2019

Modified Files:
src/sys/arch/powerpc/include: elf_machdep.h

Log Message:
Fix typo in the definition of #ha() in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/include/elf_machdep.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/powerpc/include/elf_machdep.h
diff -u src/sys/arch/powerpc/include/elf_machdep.h:1.15 src/sys/arch/powerpc/include/elf_machdep.h:1.16
--- src/sys/arch/powerpc/include/elf_machdep.h:1.15	Mon Nov  6 19:20:54 2017
+++ src/sys/arch/powerpc/include/elf_machdep.h	Sun Dec  8 21:46:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_machdep.h,v 1.15 2017/11/06 19:20:54 christos Exp $	*/
+/*	$NetBSD: elf_machdep.h,v 1.16 2019/12/08 21:46:03 uwe Exp $	*/
 
 #ifndef _POWERPC_ELF_MACHDEP_H_
 #define _POWERPC_ELF_MACHDEP_H_
@@ -71,7 +71,7 @@
 // 
 // #lo(x) = (x & 0x)
 // #hi(x) = ((x >> 16) & 0x)
-// #ha(x) = (((x >> 16) + ((x & 0x8) == 0x8000)) & 0x)
+// #ha(x) = (((x >> 16) + ((x & 0x8000) == 0x8000)) & 0x)
 // #higher(x) = ((x >> 32) & 0x)
 // #highera(x) =
 //(((x >> 32) + ((x & 0x8000) == 0x8000)) & 0x)



CVS commit: src/sys/arch/macppc/conf

2019-12-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sun Dec  8 21:30:00 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: INSTALL_601

Log Message:
add platinumfb


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/conf/INSTALL_601

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/macppc/conf/INSTALL_601
diff -u src/sys/arch/macppc/conf/INSTALL_601:1.2 src/sys/arch/macppc/conf/INSTALL_601:1.3
--- src/sys/arch/macppc/conf/INSTALL_601:1.2	Mon Jan  7 01:44:59 2019
+++ src/sys/arch/macppc/conf/INSTALL_601	Sun Dec  8 21:30:00 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_601,v 1.2 2019/01/07 01:44:59 scole Exp $
+#	$NetBSD: INSTALL_601,v 1.3 2019/12/08 21:30:00 scole Exp $
 #
 # config file for INSTALL
 #
@@ -84,7 +84,7 @@ ahc*	at pci? dev ? function ?	# Adaptec 
 # untested with OF 1.0.5
 # this will take over the console if output-device is set to 'screen' or
 # 'platinum'. It will provide a NetBSD console, but still won't work with OF
-#platinumfb0 	at mainbus?
+platinumfb0 	at mainbus?
 
 #gffb*		at pci?	function ?	# NVIDIA GeForce2 MX
 #machfb*		at pci? function ?	# ATI Mach 64, Rage, Rage Pro



CVS commit: src/sys/arch

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 20:42:49 UTC 2019

Modified Files:
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c svs.c
src/sys/arch/xen/x86: xen_pmap.c

Log Message:
Merge x86 pmap changes from yamt-pagecache:

- Deal better with the multi-level pmap object locking kludge.
- Handle uvm_pagealloc() being able to block.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.342 -r1.343 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/x86/svs.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/xen/x86/xen_pmap.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/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.105 src/sys/arch/x86/include/pmap.h:1.106
--- src/sys/arch/x86/include/pmap.h:1.105	Thu Nov 14 16:23:52 2019
+++ src/sys/arch/x86/include/pmap.h	Sun Dec  8 20:42:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.105 2019/11/14 16:23:52 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.106 2019/12/08 20:42:48 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -249,8 +249,7 @@ extern struct pool_cache pmap_pdp_cache;
 
 struct pmap {
 	struct uvm_object pm_obj[PTP_LEVELS-1]; /* objects for lvl >= 1) */
-#define	pm_lock	pm_obj[0].vmobjlock
-	kmutex_t pm_obj_lock[PTP_LEVELS-1];	/* locks for pm_objs */
+	kmutex_t pm_lock;		/* locks for pm_objs */
 	LIST_ENTRY(pmap) pm_list;	/* list (lck by pm_list lock) */
 	pd_entry_t *pm_pdir;		/* VA of PD (lck by object lock) */
 	paddr_t pm_pdirpa[PDP_SIZE];	/* PA of PDs (read-only after create) */

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.342 src/sys/arch/x86/x86/pmap.c:1.343
--- src/sys/arch/x86/x86/pmap.c:1.342	Tue Dec  3 15:20:59 2019
+++ src/sys/arch/x86/x86/pmap.c	Sun Dec  8 20:42:48 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: pmap.c,v 1.342 2019/12/03 15:20:59 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.343 2019/12/08 20:42:48 ad Exp $	*/
 
 /*
- * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2010, 2016, 2017, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.342 2019/12/03 15:20:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.343 2019/12/08 20:42:48 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -261,24 +261,6 @@ struct pcpu_area *pcpuarea __read_mostly
 static vaddr_t pmap_maxkvaddr;
 
 /*
- * XXX kludge: dummy locking to make KASSERTs in uvm_page.c comfortable.
- * actual locking is done by pm_lock.
- */
-#if defined(DIAGNOSTIC)
-#define	PMAP_SUBOBJ_LOCK(pm, idx) \
-	KASSERT(mutex_owned((pm)->pm_lock)); \
-	if ((idx) != 0) \
-		mutex_enter((pm)->pm_obj[(idx)].vmobjlock)
-#define	PMAP_SUBOBJ_UNLOCK(pm, idx) \
-	KASSERT(mutex_owned((pm)->pm_lock)); \
-	if ((idx) != 0) \
-		mutex_exit((pm)->pm_obj[(idx)].vmobjlock)
-#else /* defined(DIAGNOSTIC) */
-#define	PMAP_SUBOBJ_LOCK(pm, idx)	/* nothing */
-#define	PMAP_SUBOBJ_UNLOCK(pm, idx)	/* nothing */
-#endif /* defined(DIAGNOSTIC) */
-
-/*
  * Misc. event counters.
  */
 struct evcnt pmap_iobmp_evcnt;
@@ -475,8 +457,8 @@ static void pmap_init_lapic(void);
 static void pmap_remap_largepages(void);
 #endif
 
-static struct vm_page *pmap_get_ptp(struct pmap *, vaddr_t,
-pd_entry_t * const *, int);
+static int pmap_get_ptp(struct pmap *, vaddr_t,
+pd_entry_t * const *, int, struct vm_page **);
 static struct vm_page *pmap_find_ptp(struct pmap *, vaddr_t, paddr_t, int);
 static void pmap_freepage(struct pmap *, struct vm_page *, int);
 static void pmap_free_ptp(struct pmap *, struct vm_page *, vaddr_t,
@@ -502,7 +484,7 @@ pmap_stats_update(struct pmap *pmap, int
 		atomic_add_long(>pm_stats.resident_count, resid_diff);
 		atomic_add_long(>pm_stats.wired_count, wired_diff);
 	} else {
-		KASSERT(mutex_owned(pmap->pm_lock));
+		KASSERT(mutex_owned(>pm_lock));
 		pmap->pm_stats.resident_count += resid_diff;
 		pmap->pm_stats.wired_count += wired_diff;
 	}
@@ -640,13 +622,13 @@ pmap_map_ptes(struct pmap *pmap, struct 
 
 	l = curlwp;
  retry:
-	mutex_enter(pmap->pm_lock);
+	mutex_enter(>pm_lock);
 	ci = curcpu();
 	curpmap = ci->ci_pmap;
 	if (vm_map_pmap(>l_proc->p_vmspace->vm_map) == pmap) {
 		/* Our own pmap so just load it: easy. */
 		if (__predict_false(ci->ci_want_pmapload)) {
-			mutex_exit(pmap->pm_lock);
+			mutex_exit(>pm_lock);
 			pmap_load();
 			goto retry;
 		}
@@ -670,6 +652,7 @@ pmap_map_ptes(struct pmap *pmap, struct 
 		kcpuset_atomic_clear(curpmap->pm_kernel_cpus, cid);
 		ci->ci_pmap = pmap;
 		ci->ci_tlbstate = TLBSTATE_VALID;
+		ci->ci_want_pmapload = 0;
 		kcpuset_atomic_set(pmap->pm_cpus, cid);
 		kcpuset_atomic_set(pmap->pm_kernel_cpus, cid);
 		

CVS commit: src/sys/kern

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 20:35:23 UTC 2019

Modified Files:
src/sys/kern: vfs_bio.c

Log Message:
For safety, cv_broadcast(>b_busy) in more places where the buffer is
changing identity or moving from one vnode list to another.


To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 src/sys/kern/vfs_bio.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/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.281 src/sys/kern/vfs_bio.c:1.282
--- src/sys/kern/vfs_bio.c:1.281	Sun Dec  8 19:49:25 2019
+++ src/sys/kern/vfs_bio.c	Sun Dec  8 20:35:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.281 2019/12/08 19:49:25 ad Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.282 2019/12/08 20:35:23 ad Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.281 2019/12/08 19:49:25 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.282 2019/12/08 20:35:23 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -896,6 +896,8 @@ bwrite(buf_t *bp)
 		mutex_enter(bp->b_objlock);
 		CLR(bp->b_oflags, BO_DONE | BO_DELWRI);
 		reassignbuf(bp, bp->b_vp);
+		/* Wake anyone trying to busy the buffer via vnode's lists. */
+		cv_broadcast(>b_busy);
 		mutex_exit(_lock);
 	} else {
 		curlwp->l_ru.ru_oublock++;
@@ -988,6 +990,8 @@ bdwrite(buf_t *bp)
 		SET(bp->b_oflags, BO_DELWRI);
 		curlwp->l_ru.ru_oublock++;
 		reassignbuf(bp, bp->b_vp);
+		/* Wake anyone trying to busy the buffer via vnode's lists. */
+		cv_broadcast(>b_busy);
 		mutex_exit(_lock);
 	} else {
 		mutex_enter(bp->b_objlock);
@@ -1411,6 +1415,9 @@ getnewbuf(int slpflag, int slptimeo, int
 
 		/* Buffer is no longer on free lists. */
 		SET(bp->b_cflags, BC_BUSY);
+
+		/* Wake anyone trying to lock the old identity. */
+		cv_broadcast(>b_busy);
 	} else {
 		/*
 		 * XXX: !from_bufq should be removed.



CVS commit: src/sys/arch

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 20:00:56 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: lock_stubs.S
src/sys/arch/i386/i386: lock_stubs.S

Log Message:
After lots of testing I'm not convinced of the benefit to the tweak
I made to rw_enter(), so undo it to return to baseline.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/i386/lock_stubs.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/lock_stubs.S
diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.34 src/sys/arch/amd64/amd64/lock_stubs.S:1.35
--- src/sys/arch/amd64/amd64/lock_stubs.S:1.34	Sat Nov 23 16:36:38 2019
+++ src/sys/arch/amd64/amd64/lock_stubs.S	Sun Dec  8 20:00:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.34 2019/11/23 16:36:38 ad Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.35 2019/12/08 20:00:56 ad Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -191,15 +191,13 @@ END(mutex_spin_exit)
  * Acquire one hold on a RW lock.
  */
 ENTRY(rw_enter)
-	xorl	%eax, %eax
-	testl	%esi, %esi	/* RW_READER = 0 */
+	cmpl	$RW_READER, %esi
 	jne	2f
 
 	/*
-	 * Reader, and no existing readers on the lock: this is a most
-	 * common case.  Instead of reading from the lock word, use cmpxchg
-	 * and get the cache line into the EXCLUSIVE state to begin with.
+	 * Reader: this is the most common case.
 	 */
+	movq	(%rdi), %rax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	3f
@@ -215,6 +213,7 @@ ENTRY(rw_enter)
 	 * Writer: if the compare-and-set fails, don't bother retrying.
 	 */
 2:	movq	CPUVAR(CURLWP), %rcx
+	xorq	%rax, %rax
 	orq	$RW_WRITE_LOCKED, %rcx
 	LOCK
 	cmpxchgq %rcx, (%rdi)
@@ -269,15 +268,13 @@ END(rw_exit)
  * Try to acquire one hold on a RW lock.
  */
 ENTRY(rw_tryenter)
-	xorl	%eax, %eax
-	testl	%esi, %esi	/* RW_READER = 0 */
+	cmpl	$RW_READER, %esi
 	jne	2f
 
 	/*
-	 * Reader, and no existing readers on the lock: this is a most
-	 * common case.  Instead of reading from the lock word, use cmpxchg
-	 * and get the cache line into the EXCLUSIVE state to begin with.
+	 * Reader: this is the most common case.
 	 */
+	movq	(%rdi), %rax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	4f
@@ -294,6 +291,7 @@ ENTRY(rw_tryenter)
 	 * Writer: if the compare-and-set fails, don't bother retrying.
 	 */
 2:	movq	CPUVAR(CURLWP), %rcx
+	xorq	%rax, %rax
 	orq	$RW_WRITE_LOCKED, %rcx
 	LOCK
 	cmpxchgq %rcx, (%rdi)

Index: src/sys/arch/i386/i386/lock_stubs.S
diff -u src/sys/arch/i386/i386/lock_stubs.S:1.31 src/sys/arch/i386/i386/lock_stubs.S:1.32
--- src/sys/arch/i386/i386/lock_stubs.S:1.31	Sat Nov 23 16:36:38 2019
+++ src/sys/arch/i386/i386/lock_stubs.S	Sun Dec  8 20:00:56 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: lock_stubs.S,v 1.31 2019/11/23 16:36:38 ad Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.32 2019/12/08 20:00:56 ad Exp $	*/
 
 /*-
- * Copyright (c) 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.31 2019/11/23 16:36:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.32 2019/12/08 20:00:56 ad Exp $");
 
 #include "opt_lockdebug.h"
 
@@ -104,15 +104,13 @@ END(mutex_exit)
  */
 ENTRY(rw_enter)
 	movl	4(%esp), %edx
-	xorl	%eax, %eax
 	cmpl	$RW_READER, 8(%esp)
 	jne	2f
 
 	/*
-	 * Reader, and no existing readers on the lock: this is a most
-	 * common case.  Instead of reading from the lock word, use cmpxchg
-	 * and get the cache line into the EXCLUSIVE state to begin with.
+	 * Reader
 	 */
+	movl	(%edx), %eax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	3f
@@ -127,7 +125,7 @@ ENTRY(rw_enter)
 	/*
 	 * Writer
 	 */
-2:
+2:	xorl	%eax, %eax
 	movl	%fs:CPU_INFO_CURLWP(%eax), %ecx
 	orl	$RW_WRITE_LOCKED, %ecx
 	LOCK(3)
@@ -188,15 +186,13 @@ END(rw_exit)
  */
 ENTRY(rw_tryenter)
 	movl	4(%esp), %edx
-	xorl	%eax, %eax
 	cmpl	$RW_READER, 8(%esp)
 	jne	2f
 
 	/*
-	 * Reader, and no existing readers on the lock: this is a most
-	 * common case.  Instead of reading from the lock word, use cmpxchg
-	 * and get the cache line into the EXCLUSIVE state to begin with.
+	 * Reader
 	 */
+	movl	(%edx), %eax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	4f
@@ -213,6 +209,7 @@ ENTRY(rw_tryenter)
 	 * Writer
 	 */
 2:
+	xorl	%eax, %eax
 	movl	%fs:CPU_INFO_CURLWP(%eax), %ecx
 	orl	$RW_WRITE_LOCKED, %ecx
 	LOCK(13)



CVS commit: src/sys

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 19:52:37 UTC 2019

Modified Files:
src/sys/dev/qbus: ts.c
src/sys/kern: kern_physio.c
src/sys/ufs/lfs: lfs_segment.c

Log Message:
Revert previous.  No performance gain worth the potential headaches
with buffers in these contexts.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/qbus/ts.c
cvs rdiff -u -r1.96 -r1.97 src/sys/kern/kern_physio.c
cvs rdiff -u -r1.279 -r1.280 src/sys/ufs/lfs/lfs_segment.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/qbus/ts.c
diff -u src/sys/dev/qbus/ts.c:1.32 src/sys/dev/qbus/ts.c:1.33
--- src/sys/dev/qbus/ts.c:1.32	Sun Dec  8 19:23:51 2019
+++ src/sys/dev/qbus/ts.c	Sun Dec  8 19:52:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ts.c,v 1.32 2019/12/08 19:23:51 ad Exp $ */
+/*	$NetBSD: ts.c,v 1.33 2019/12/08 19:52:37 ad Exp $ */
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.32 2019/12/08 19:23:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.33 2019/12/08 19:52:37 ad Exp $");
 
 #undef	TSDEBUG
 
@@ -390,7 +390,7 @@ tscommand(struct ts_softc *sc, dev_t dev
 		return;
 	biowait(bp);
 	mutex_enter(_lock);
-	cv_signal(>b_busy);
+	cv_broadcast(>b_busy);
 	bp->b_cflags = 0;
 	mutex_exit(_lock);
 }

Index: src/sys/kern/kern_physio.c
diff -u src/sys/kern/kern_physio.c:1.96 src/sys/kern/kern_physio.c:1.97
--- src/sys/kern/kern_physio.c:1.96	Sun Dec  8 19:23:51 2019
+++ src/sys/kern/kern_physio.c	Sun Dec  8 19:52:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_physio.c,v 1.96 2019/12/08 19:23:51 ad Exp $	*/
+/*	$NetBSD: kern_physio.c,v 1.97 2019/12/08 19:52:37 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.96 2019/12/08 19:23:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.97 2019/12/08 19:52:37 ad Exp $");
 
 #include 
 #include 
@@ -432,7 +432,7 @@ done_locked:
 		obp->b_cflags &= ~(BC_BUSY | BC_WANTED);
 		obp->b_flags &= ~(B_PHYS | B_RAW);
 		obp->b_iodone = NULL;
-		cv_signal(>b_busy);
+		cv_broadcast(>b_busy);
 		mutex_exit(_lock);
 	}
 

Index: src/sys/ufs/lfs/lfs_segment.c
diff -u src/sys/ufs/lfs/lfs_segment.c:1.279 src/sys/ufs/lfs/lfs_segment.c:1.280
--- src/sys/ufs/lfs/lfs_segment.c:1.279	Sun Dec  8 19:24:26 2019
+++ src/sys/ufs/lfs/lfs_segment.c	Sun Dec  8 19:52:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_segment.c,v 1.279 2019/12/08 19:24:26 ad Exp $	*/
+/*	$NetBSD: lfs_segment.c,v 1.280 2019/12/08 19:52:37 ad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.279 2019/12/08 19:24:26 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.280 2019/12/08 19:52:37 ad Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {		\
@@ -2197,7 +2197,7 @@ lfs_writeseg(struct lfs *fs, struct segm
 		if (unbusybp != NULL) {
 			unbusybp->b_cflags &= ~BC_BUSY;
 			if (unbusybp->b_cflags & BC_WANTED)
-cv_signal(>b_busy);
+cv_broadcast(>b_busy);
 		}
 	}
 	mutex_exit(_lock);



CVS commit: src/sys/kern

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 19:49:25 UTC 2019

Modified Files:
src/sys/kern: vfs_bio.c

Log Message:
Adjustment to previous: if we're going to toss the buffer, then wake
everybody.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/kern/vfs_bio.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/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.280 src/sys/kern/vfs_bio.c:1.281
--- src/sys/kern/vfs_bio.c:1.280	Sun Dec  8 19:26:05 2019
+++ src/sys/kern/vfs_bio.c	Sun Dec  8 19:49:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.280 2019/12/08 19:26:05 ad Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.281 2019/12/08 19:49:25 ad Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.280 2019/12/08 19:26:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.281 2019/12/08 19:49:25 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1107,7 +1107,8 @@ brelsel(buf_t *bp, int set)
 			KASSERT(bp->b_objlock == _lock);
 			mutex_exit(bp->b_objlock);
 		}
-
+		/* We want to dispose of the buffer, so wake everybody. */
+		cv_broadcast(>b_busy);
 		if (bp->b_bufsize <= 0)
 			/* no data */
 			goto already_queued;



CVS commit: src/sys/kern

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 19:26:05 UTC 2019

Modified Files:
src/sys/kern: vfs_bio.c

Log Message:
- Avoid thundering herd: cv_broadcast(>b_busy) -> cv_signal(>b_busy)
- Sprinkle __cacheline_aligned.


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/sys/kern/vfs_bio.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/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.279 src/sys/kern/vfs_bio.c:1.280
--- src/sys/kern/vfs_bio.c:1.279	Mon Aug 26 10:24:39 2019
+++ src/sys/kern/vfs_bio.c	Sun Dec  8 19:26:05 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: vfs_bio.c,v 1.279 2019/08/26 10:24:39 msaitoh Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.280 2019/12/08 19:26:05 ad Exp $	*/
 
 /*-
- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.279 2019/08/26 10:24:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.280 2019/12/08 19:26:05 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -184,7 +184,7 @@ struct bqueue {
 	uint64_t bq_bytes;
 	buf_t *bq_marker;
 };
-static struct bqueue bufqueues[BQUEUES];
+static struct bqueue bufqueues[BQUEUES] __cacheline_aligned;
 
 /* Function prototypes */
 static void buf_setwm(void);
@@ -237,8 +237,8 @@ static kcondvar_t needbuffer_cv;
 /*
  * Buffer queue lock.
  */
-kmutex_t bufcache_lock;
-kmutex_t buffer_lock;
+kmutex_t bufcache_lock __cacheline_aligned;
+kmutex_t buffer_lock __cacheline_aligned;
 
 /* Software ISR for completed transfers. */
 static void *biodone_sih;
@@ -1140,7 +1140,7 @@ already_queued:
 	/* Unlock the buffer. */
 	CLR(bp->b_cflags, BC_AGE|BC_BUSY|BC_NOCACHE);
 	CLR(bp->b_flags, B_ASYNC);
-	cv_broadcast(>b_busy);
+	cv_signal(>b_busy);
 
 	if (bp->b_bufsize <= 0)
 		brele(bp);



CVS commit: src/sys/ufs/lfs

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 19:24:26 UTC 2019

Modified Files:
src/sys/ufs/lfs: lfs_segment.c

Log Message:
Avoid thundering herd: cv_broadcast(>b_busy) -> cv_signal(>b_busy)


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/sys/ufs/lfs/lfs_segment.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/lfs/lfs_segment.c
diff -u src/sys/ufs/lfs/lfs_segment.c:1.278 src/sys/ufs/lfs/lfs_segment.c:1.279
--- src/sys/ufs/lfs/lfs_segment.c:1.278	Mon Sep  3 16:29:37 2018
+++ src/sys/ufs/lfs/lfs_segment.c	Sun Dec  8 19:24:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_segment.c,v 1.278 2018/09/03 16:29:37 riastradh Exp $	*/
+/*	$NetBSD: lfs_segment.c,v 1.279 2019/12/08 19:24:26 ad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.278 2018/09/03 16:29:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.279 2019/12/08 19:24:26 ad Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {		\
@@ -2197,7 +2197,7 @@ lfs_writeseg(struct lfs *fs, struct segm
 		if (unbusybp != NULL) {
 			unbusybp->b_cflags &= ~BC_BUSY;
 			if (unbusybp->b_cflags & BC_WANTED)
-cv_broadcast(>b_busy);
+cv_signal(>b_busy);
 		}
 	}
 	mutex_exit(_lock);



CVS commit: src/sys

2019-12-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  8 19:23:51 UTC 2019

Modified Files:
src/sys/dev/qbus: ts.c
src/sys/kern: kern_physio.c

Log Message:
Avoid thundering herd: cv_broadcast(>b_busy) -> cv_signal(>b_busy)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/qbus/ts.c
cvs rdiff -u -r1.95 -r1.96 src/sys/kern/kern_physio.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/qbus/ts.c
diff -u src/sys/dev/qbus/ts.c:1.31 src/sys/dev/qbus/ts.c:1.32
--- src/sys/dev/qbus/ts.c:1.31	Fri Jul 25 08:10:38 2014
+++ src/sys/dev/qbus/ts.c	Sun Dec  8 19:23:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ts.c,v 1.31 2014/07/25 08:10:38 dholland Exp $ */
+/*	$NetBSD: ts.c,v 1.32 2019/12/08 19:23:51 ad Exp $ */
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.31 2014/07/25 08:10:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.32 2019/12/08 19:23:51 ad Exp $");
 
 #undef	TSDEBUG
 
@@ -390,7 +390,7 @@ tscommand(struct ts_softc *sc, dev_t dev
 		return;
 	biowait(bp);
 	mutex_enter(_lock);
-	cv_broadcast(>b_busy);
+	cv_signal(>b_busy);
 	bp->b_cflags = 0;
 	mutex_exit(_lock);
 }

Index: src/sys/kern/kern_physio.c
diff -u src/sys/kern/kern_physio.c:1.95 src/sys/kern/kern_physio.c:1.96
--- src/sys/kern/kern_physio.c:1.95	Thu Apr  4 12:26:45 2019
+++ src/sys/kern/kern_physio.c	Sun Dec  8 19:23:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_physio.c,v 1.95 2019/04/04 12:26:45 mlelstv Exp $	*/
+/*	$NetBSD: kern_physio.c,v 1.96 2019/12/08 19:23:51 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.95 2019/04/04 12:26:45 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.96 2019/12/08 19:23:51 ad Exp $");
 
 #include 
 #include 
@@ -432,7 +432,7 @@ done_locked:
 		obp->b_cflags &= ~(BC_BUSY | BC_WANTED);
 		obp->b_flags &= ~(B_PHYS | B_RAW);
 		obp->b_iodone = NULL;
-		cv_broadcast(>b_busy);
+		cv_signal(>b_busy);
 		mutex_exit(_lock);
 	}
 



CVS commit: src/sys/arch/arm/sunxi

2019-12-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec  8 18:13:24 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sun50i_a64_ccu.c

Log Message:
Add SUNXI_CCU_NM_ROUND_DOWN to CE clock, fix pll parents to use 2X outputs


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/sunxi/sun50i_a64_ccu.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/sunxi/sun50i_a64_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.21 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.22
--- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.21	Sun Dec  8 00:12:20 2019
+++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c	Sun Dec  8 18:13:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_ccu.c,v 1.21 2019/12/08 00:12:20 jmcneill Exp $ */
+/* $NetBSD: sun50i_a64_ccu.c,v 1.22 2019/12/08 18:13:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.21 2019/12/08 00:12:20 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.22 2019/12/08 18:13:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -157,7 +157,7 @@ static const char *ahb1_parents[] = { "l
 static const char *ahb2_parents[] = { "ahb1", "pll_periph0" };
 static const char *apb1_parents[] = { "ahb1" };
 static const char *apb2_parents[] = { "losc", "hosc", "pll_periph0" };
-static const char *ce_parents[] = { "hosc", "pll_periph0", "pll_periph1", NULL };
+static const char *ce_parents[] = { "hosc", "pll_periph0_2x", "pll_periph1_2x" };
 static const char *mmc_parents[] = { "hosc", "pll_periph0_2x", "pll_periph1_2x" };
 static const char *ths_parents[] = { "hosc", NULL, NULL, NULL };
 static const char *de_parents[] = { "pll_periph0_2x", "pll_de" };
@@ -405,7 +405,7 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	__BITS(3,0),	/* m */
 	__BITS(25,24),	/* sel */
 	__BIT(31),		/* enable */
-	SUNXI_CCU_NM_POWER_OF_TWO),
+	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
 
 	SUNXI_CCU_DIV_GATE(A64_CLK_THS, "ths", ths_parents,
 	THS_CLK_REG,	/* reg */



CVS commit: src/tests/lib/libutil

2019-12-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  8 17:37:16 UTC 2019

Modified Files:
src/tests/lib/libutil: t_snprintb.c

Log Message:
Adjust tests for 0 hex values printing 0 instead of 0x0


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libutil/t_snprintb.c
diff -u src/tests/lib/libutil/t_snprintb.c:1.7 src/tests/lib/libutil/t_snprintb.c:1.8
--- src/tests/lib/libutil/t_snprintb.c:1.7	Fri Dec  6 14:28:11 2019
+++ src/tests/lib/libutil/t_snprintb.c	Sun Dec  8 12:37:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snprintb.c,v 1.7 2019/12/06 19:28:11 christos Exp $ */
+/* $NetBSD: t_snprintb.c,v 1.8 2019/12/08 17:37:16 christos Exp $ */
 
 /*
  * Copyright (c) 2002, 2004, 2008, 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008, 2010\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_snprintb.c,v 1.7 2019/12/06 19:28:11 christos Exp $");
+__RCSID("$NetBSD: t_snprintb.c,v 1.8 2019/12/08 17:37:16 christos Exp $");
 
 #include 
 #include 
@@ -39,16 +39,17 @@ __RCSID("$NetBSD: t_snprintb.c,v 1.7 201
 #include 
 
 static void
-h_snprintb(const char *fmt, uint64_t val, const char *res)
+h_snprintb(const char *fmt, uint64_t val, const char *expected)
 {
-	char buf[1024];
-	int len, slen;
+	char actual[1024];
+	int len, rlen;
 
-	len = snprintb(buf, sizeof(buf), fmt, val);
-	slen = (int) strlen(res);
+	len = snprintb(actual, sizeof(actual), fmt, val);
+	rlen = (int)strlen(actual);
 
-	ATF_REQUIRE_STREQ(res, buf);
-	ATF_REQUIRE_EQ(len, slen);
+	ATF_REQUIRE_STREQ_MSG(expected, actual, "format=%s val=%" PRIu64,
+	fmt, val);
+	ATF_REQUIRE_EQ_MSG(rlen, len, "expected=%d actual=%d", rlen, len);
 }
 
 ATF_TC(snprintb);
@@ -59,7 +60,7 @@ ATF_TC_HEAD(snprintb, tc)
 ATF_TC_BODY(snprintb, tc)
 {
 	h_snprintb("\10\2BITTWO\1BITONE", 3, "03");
-	h_snprintb("\177\20b\0A\0\0", 0, "0x0");
+	h_snprintb("\177\20b\0A\0\0", 0, "0");
 
 	h_snprintb("\177\20b\05NOTBOOT\0b\06FPP\0b\013SDVMA\0b\015VIDEO\0"
 		"b\020LORES\0b\021FPA\0b\022DIAG\0b\016CACHE\0"
@@ -101,15 +102,27 @@ ATF_TC_BODY(snprintb, tc)
 
 static void
 h_snprintb_m(const char *fmt, uint64_t val, int line_max, const char *res,
-	 int res_len)
+ int rlen)
 {
 	char buf[1024];
 	int len;
 
 	len = snprintb_m(buf, sizeof(buf), fmt, val, line_max);
 
-	ATF_REQUIRE_EQ(len, res_len);
-	ATF_REQUIRE_EQ(0, memcmp(res, buf, res_len + 1));
+	const char *expected = res;
+	char *actual = buf;
+	int l = 0;
+	for (size_t i = 0; l < rlen; i++) {
+		l = (int)strlen(actual);
+		if (l == 0)
+			break;
+		ATF_REQUIRE_STREQ_MSG(expected, actual,
+		"%zu: fmt=%s val=%" PRIu64, i, fmt, val);
+		actual += l;
+		expected += l;
+	}
+		
+	ATF_REQUIRE_EQ_MSG(rlen, len, "expected=%d actual=%d", rlen, len);
 }
 
 ATF_TC(snprintb_m);
@@ -124,19 +137,19 @@ ATF_TC_BODY(snprintb_m, tc)
 			"b\x1fMSB\0\0",
  0x800f0701,
 		 33,
-		 "0x800f0701\0"
+		 "0x800f0701\0"
 			"0x800f0701\0\0",
-		 62);
+		 60);
 
 	h_snprintb_m("\177\020b\0LSB\0b\1_BITONE\0f\4\4NIBBLE2\0"
 			"f\x10\4BURST\0=\4FOUR\0=\xfSIXTEEN\0"
 			"b\x1fMSB\0\0",
  0x800f0701,
 		 32,
-		 "0x800f0701\0"
+		 "0x800f0701\0"
 			"0x800f0701\0"
 			"0x800f0701\0\0",
-		 74);
+		 72);
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: [netbsd-9] src

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 15:54:35 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: arc.c
src/external/cddl/osnet/dist/uts/common/os [netbsd-9]: fm.c
src/share/mk [netbsd-9]: bsd.own.mk

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #515):

external/cddl/osnet/dist/uts/common/fs/zfs/arc.c: revision 1.15
share/mk/bsd.own.mk: revision 1.1167
external/cddl/osnet/dist/uts/common/os/fm.c: revision 1.2

Provide a default ptob() implementation
Need sys/atomic.h on NetBSD
Enable ZFS support on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.2.1 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
cvs rdiff -u -r1.1 -r1.1.2.1 src/external/cddl/osnet/dist/uts/common/os/fm.c
cvs rdiff -u -r1.1149.2.1 -r1.1149.2.2 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/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14.2.1
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14	Sun May 26 10:21:00 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Sun Dec  8 15:54:34 2019
@@ -280,6 +280,9 @@ int arc_procfd;
 #ifndef btop
 #define	btop(x)		((x) / PAGE_SIZE)
 #endif
+#ifndef ptob
+#define ptob(x)		((x) * PAGE_SIZE)
+#endif
 //#define	needfree	(uvmexp.free < uvmexp.freetarg ? uvmexp.freetarg : 0)
 #define	buf_init	arc_buf_init
 #define	freemem		uvmexp.free

Index: src/external/cddl/osnet/dist/uts/common/os/fm.c
diff -u src/external/cddl/osnet/dist/uts/common/os/fm.c:1.1 src/external/cddl/osnet/dist/uts/common/os/fm.c:1.1.2.1
--- src/external/cddl/osnet/dist/uts/common/os/fm.c:1.1	Mon Jun 24 08:27:20 2019
+++ src/external/cddl/osnet/dist/uts/common/os/fm.c	Sun Dec  8 15:54:34 2019
@@ -65,6 +65,7 @@
 #include 
 #include 
 #ifdef __NetBSD__
+#include 
 #include 
 #else
 #include 

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1149.2.1 src/share/mk/bsd.own.mk:1.1149.2.2
--- src/share/mk/bsd.own.mk:1.1149.2.1	Sun Sep  1 10:40:00 2019
+++ src/share/mk/bsd.own.mk	Sun Dec  8 15:54:34 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1149.2.1 2019/09/01 10:40:00 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1149.2.2 2019/12/08 15:54:34 martin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -998,9 +998,9 @@ SOFTFLOAT_BITS=	32
 .endif
 
 #
-# We want to build zfs only for amd64 by default for now.
+# We want to build zfs only for amd64 and aarch64 by default for now.
 #
-.if ${MACHINE} == "amd64"
+.if ${MACHINE} == "amd64" || ${MACHINE_ARCH} == "aarch64"
 MKZFS?=		yes
 .endif
 



CVS commit: src/doc

2019-12-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec  8 15:51:50 UTC 2019

Modified Files:
src/doc: TODO.modules

Log Message:
Add another issue that I just remembered, from the time working on the
[pgoyette-compat] branch, regarding inability to get some XEN-related
modules to build.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/doc/TODO.modules

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.modules
diff -u src/doc/TODO.modules:1.20 src/doc/TODO.modules:1.21
--- src/doc/TODO.modules:1.20	Sun Sep 29 00:57:11 2019
+++ src/doc/TODO.modules	Sun Dec  8 15:51:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO.modules,v 1.20 2019/09/29 00:57:11 pgoyette Exp $ */
+/* $NetBSD: TODO.modules,v 1.21 2019/12/08 15:51:49 pgoyette Exp $ */
 
 Some notes on the limitations of our current (as of 7.99.35) module
 subsystem.  This list was triggered by an Email exchange between
@@ -228,3 +228,11 @@ christos and pgoyette.
 have any way to identify which module is needed for which image (ie,
 we can't determine that an image needs compat_linux vs some other
 module).
+
+24. Details are no longer remembered, but there are some issues with
+building xen-variant modules (on amd4, and likely i386).  In some
+cases, wrong headers are included (because a XEN-related #define
+is missing), but even if you add the definition some headers get
+included in the wrong order.  On particular fallout from this is
+the inability to have a compat version of x86_64 cpu-microcode
+module.



CVS commit: src/usr.sbin/sysinst

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 15:09:33 UTC 2019

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
PR install/54745: fix confusion about absolut and NetBSD-partition
relative offsets.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/sysinst/bsddisklabel.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.31 src/usr.sbin/sysinst/bsddisklabel.c:1.32
--- src/usr.sbin/sysinst/bsddisklabel.c:1.31	Wed Nov 13 18:57:26 2019
+++ src/usr.sbin/sysinst/bsddisklabel.c	Sun Dec  8 15:09:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.31 2019/11/13 18:57:26 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.32 2019/12/08 15:09:33 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1342,7 +1342,8 @@ apply_settings_to_partitions(struct pm_d
 	/*
 	 * Now add new inner partitions (and cloned partitions)
 	 */
-	for (i = 0; i < wanted->num && from < wanted->parts->disk_size; i++) {
+	for (i = 0; i < wanted->num && from < 
+	(wanted->parts->disk_size + wanted->parts->disk_start); i++) {
 		struct part_usage_info *want = >infos[i];
 
 		if (want->cur_part_id != NO_PART)



CVS commit: [netbsd-9] src/doc

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 15:05:44 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #494, #495, #497 - #518


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.130 -r1.1.2.131 src/doc/CHANGES-9.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.130 src/doc/CHANGES-9.0:1.1.2.131
--- src/doc/CHANGES-9.0:1.1.2.130	Thu Dec  5 10:29:13 2019
+++ src/doc/CHANGES-9.0	Sun Dec  8 15:05:44 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.130 2019/12/05 10:29:13 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.131 2019/12/08 15:05:44 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -6640,3 +6640,170 @@ doc/CHANGES	(edited manually)
 distrib/cdrom/NetBSD-9.0.mk			1.1
 
 	Add config cloned from -current (for macppc ppc 601 support)
+
+sys/arch/powerpc/oea/ofw_autoconf.c		1.24
+
+	Add a hack for qemu/macppc. OF_finddevice calls will crash
+	depending on the boot loader and kernel being used.
+	This patch allows using -prom-env qemu_boot_hack=y to disable
+	the lookup.
+	[joerg, ticket #494]
+
+distrib/notes/sparc/contents			1.26
+
+	Fix KRUPS kernel name.
+	[uwe, ticket #495]
+
+sys/arch/arm/ti/am3_prcm.c			1.11
+sys/arch/arm/ti/ti_sdhc.c			1.4,1.5
+
+	Fix mmc and timer indexes.
+	Fix inverted ti,needs-special-hs-handling property logic and
+	enable EDMA support.
+	Support 1-bit mode and force all xfers to bounce
+	to workaround a transfer error issue for now.
+	[jmcneill, ticket #497]
+
+sys/arch/arm/rockchip/rk3399_pcie.c		1.7
+
+	Do not crash if the optional vpcie3v3-supply property is missing
+	or the regulator can not be found.
+	[jmcneill, ticket #498]
+
+sys/arch/arm/ti/am3_prcm.c			1.12
+sys/arch/arm/ti/files.ti			1.21
+sys/arch/arm/ti/ti_wdt.c			1.1
+sys/arch/evbarm/conf/GENERIC			1.68
+
+	Add TI OMAP watchdog timer driver.
+	[jmcneill, ticket #499]
+
+usr.bin/calendar/calendars/calendar.birthday	1.30-1.35
+usr.bin/calendar/calendars/calendar.computer	1.8,1.9
+usr.bin/calendar/calendars/calendar.music	1.20
+usr.bin/calendar/calendars/calendar.netbsd	1.41-1.43
+usr.bin/calendar/calendars/calendar.usholiday	1.9
+
+	Various calendar updates.
+	[sevan, ticket #500]
+
+games/fortune/datfiles/fortunes			1.83-1.86
+games/fortune/datfiles/netbsd			1.29
+
+	Various additions.
+	[sevan, ticket #501]
+
+sys/arch/x86/include/genfb_machdep.h		1.4
+sys/arch/x86/x86/genfb_machdep.c		1.15
+sys/arch/x86/x86/hyperv.c			1.5
+
+	Prevent panic when attaching genfb if using a serial console
+	with Hyper-V Gen.2.
+	[nonaka, ticket #502]
+
+sys/stand/efiboot/Makefile.efiboot		1.9
+sys/stand/efiboot/efiacpi.c			1.5
+sys/stand/efiboot/smbios.c			1.1
+sys/stand/efiboot/smbios.h			1.1
+sys/stand/efiboot/version			1.13
+
+	Use SMBIOS system vendor and product strings to create a "model"
+	string for the root node in the fabricated ACPI device tree.
+	[jmcneill, ticket #503]
+
+share/man/man4/rnd.41.25-1.28
+
+	Update man page to reflect switch from CTR_DRBG to Hash_DRBG.
+	Update NIST SP800-90A reference. Various small fixes.
+	[riastradh, ticket #504]
+
+common/lib/libc/hash/murmurhash/murmurhash.c	1.7
+common/lib/libc/hash/murmurhash/murmurhash.c	1.8
+sys/arch/amd64/include/param.h			1.31
+sys/arch/i386/include/param.h			1.85
+sys/sys/param.h	1.610
+
+	New macro ALIGNED_POINTER_LOAD.
+	Fix byte order bug in murmurhash and pacify sanitizers.
+	[riastradh, ticket #505]
+
+lib/libc/gdtoa/Makefile.inc			1.11
+lib/libc/gdtoa/gdtoa_fltrnds.h			1.2
+lib/libc/gdtoa/gdtoaimp.h			1.15,1.17
+
+	Honour the floating-point rounding mode in floating-point formatting.
+	[riastradh, ticket #506]
+
+lib/libm/arch/aarch64/fenv.c			1.5,1.6
+
+	Fix fesetenv, feupdateenv, and feraiseexcept.
+	[riastradh, ticket #507]
+
+distrib/sets/lists/comp/mi			1.2294
+share/man/man9/Makefile1.443
+share/man/man9/atomic_loadstore.9		1.1,1.2
+sys/sys/atomic.h1.18
+
+	New atomic load/store operations for the kernel, intended
+	to match C11 semantics.
+	[riastradh, ticket #508]
+
+sys/arch/arm/imx/if_enet.c			1.29
+
+	Set the multicast filter properly.
+	[ryo, ticket #509]
+
+sys/arch/arm/arm32/fault.c			1.109
+
+	PR/54720: if a Thumb-32 bit instruction is located on a page boundariy,
+	also need to consider the pc + 2 address.
+	[ryo, ticket #510]
+
+distrib/utils/embedded/conf/evbarm.conf		1.34
+
+	Remove the pretty much useless 128MB swap partition from the arm
+	images.
+	[jmcneill, ticket #511]
+
+share/mk/bsd.kmodule.mk1.63
+
+	Build aarch64 modules without fp or simd instructions.
+	[jmcneill, ticket #512]
+
+sys/arch/aarch64/aarch64/kobj_machdep.c		1.3
+
+	Flush insn / data caches after loading modules.
+	[jmcneill, ticket #513]
+
+external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c 1.13
+
+	zfs: avoid crash when creating a zpool on ld(4).
+	

CVS commit: [netbsd-9] xsrc/external/mit/MesaLib/dist/src

2019-12-08 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Dec  8 15:00:33 UTC 2019

Modified Files:
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri [netbsd-9]:
dri_sw_winsys.c
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib [netbsd-9]:
xlib_sw_winsys.c
xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11 [netbsd-9]:
xm_buffer.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #518):

external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c: 
revision 1.2
external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c: 
revision 1.2
external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c: revision 1.2

>From 02c3dad0f3b4d26e0faa5cc51d06bc50d693dcdc Mon Sep 17 00:00:00 2001

From: Brian Paul 
Date: Wed, 9 Oct 2019 12:05:16 -0600
Subject: [PATCH] Call shmget() with permission 0600 instead of 0777

A security advisory (TALOS-2019-0857/CVE-2019-5068) found that
creating shared memory regions with permission mode 0777 could allow
any user to access that memory.  Several Mesa drivers use shared-
memory XImages to implement back buffers for improved performance.

This path changes the shmget() calls to use 0600 (user r/w).
Tested with legacy Xlib driver and llvmpipe.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Kristian H. Kristensen 


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.2.1 \
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.2.1 \
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
cvs rdiff -u -r1.1.1.7 -r1.1.1.7.2.1 \
xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c
diff -u xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.3 xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.3.2.1
--- xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.3	Sun Mar 10 03:42:41 2019
+++ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c	Sun Dec  8 15:00:33 2019
@@ -93,7 +93,8 @@ alloc_shm(struct dri_sw_displaytarget *d
 {
char *addr;
 
-   dri_sw_dt->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777);
+   /* 0600 = user read+write */
+   dri_sw_dt->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600);
if (dri_sw_dt->shmid < 0)
   return NULL;
 

Index: xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
diff -u xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3 xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3.2.1
--- xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3	Sun Mar 10 03:42:41 2019
+++ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c	Sun Dec  8 15:00:33 2019
@@ -126,7 +126,8 @@ alloc_shm(struct xlib_displaytarget *buf
shminfo->shmid = -1;
shminfo->shmaddr = (char *) -1;
 
-   shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777);
+   /* 0600 = user read+write */
+   shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600);
if (shminfo->shmid < 0) {
   return NULL;
}

Index: xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c
diff -u xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7 xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7.2.1
--- xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7	Sun Mar 10 03:42:37 2019
+++ xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c	Sun Dec  8 15:00:33 2019
@@ -89,8 +89,9 @@ alloc_back_shm_ximage(XMesaBuffer b, GLu
   return GL_FALSE;
}
 
+   /* 0600 = user read+write */
b->shminfo.shmid = shmget(IPC_PRIVATE, b->backxrb->ximage->bytes_per_line
-			 * b->backxrb->ximage->height, IPC_CREAT|0777);
+ * b->backxrb->ximage->height, IPC_CREAT | 0600);
if (b->shminfo.shmid < 0) {
   _mesa_warning(NULL, "shmget failed while allocating back buffer.\n");
   XDestroyImage(b->backxrb->ximage);



CVS commit: src/sys/dev/dm

2019-12-08 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 14:59:42 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target_error.c dm_target_mirror.c
dm_target_snapshot.c dm_target_zero.c

Log Message:
dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)

dm_target_insert() has assertions to ensure targets implement all handlers.
Adding dummy ones at least prevents panic on modload(8).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_zero.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/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.37 src/sys/dev/dm/dm.h:1.38
--- src/sys/dev/dm/dm.h:1.37	Sun Dec  8 10:50:21 2019
+++ src/sys/dev/dm/dm.h	Sun Dec  8 14:59:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.37 2019/12/08 10:50:21 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.38 2019/12/08 14:59:42 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -293,6 +293,13 @@ int dm_pdev_destroy(void);
 int dm_pdev_init(void);
 dm_pdev_t* dm_pdev_insert(const char *);
 
+/* XXX dummy */
+static __inline int
+dm_target_dummy_secsize(dm_table_entry_t *table_en, unsigned *secsizep)
+{
+	return 0;
+}
+
 #endif /*_KERNEL*/
 
 #endif /*_DM_DEV_H_*/

Index: src/sys/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.17 src/sys/dev/dm/dm_target_error.c:1.18
--- src/sys/dev/dm/dm_target_error.c:1.17	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm_target_error.c	Sun Dec  8 14:59:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_error.c,v 1.17 2019/12/08 04:41:02 tkusumi Exp $  */
+/*$NetBSD: dm_target_error.c,v 1.18 2019/12/08 14:59:42 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.17 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.18 2019/12/08 14:59:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -88,6 +88,7 @@ dm_target_error_modcmd(modcmd_t cmd, voi
 		dmt->deps = _target_error_deps;
 		dmt->destroy = _target_error_destroy;
 		dmt->upcall = _target_error_upcall;
+		dmt->secsize = dm_target_dummy_secsize;
 
 		r = dm_target_insert(dmt);
 

Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.16 src/sys/dev/dm/dm_target_mirror.c:1.17
--- src/sys/dev/dm/dm_target_mirror.c:1.16	Sun Dec  8 10:50:21 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Sun Dec  8 14:59:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.16 2019/12/08 10:50:21 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.17 2019/12/08 14:59:42 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.16 2019/12/08 10:50:21 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.17 2019/12/08 14:59:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
@@ -100,6 +100,7 @@ dm_target_mirror_modcmd(modcmd_t cmd, vo
 		dmt->deps = _target_mirror_deps;
 		dmt->destroy = _target_mirror_destroy;
 		dmt->upcall = _target_mirror_upcall;
+		dmt->secsize = dm_target_dummy_secsize;
 
 		r = dm_target_insert(dmt);
 

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.28 src/sys/dev/dm/dm_target_snapshot.c:1.29
--- src/sys/dev/dm/dm_target_snapshot.c:1.28	Sun Dec  8 10:50:21 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sun Dec  8 14:59:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.28 2019/12/08 10:50:21 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.29 2019/12/08 14:59:42 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.28 2019/12/08 10:50:21 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.29 2019/12/08 14:59:42 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -90,6 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_sn
 int dm_target_snapshot_init(dm_table_entry_t *, char *);
 char *dm_target_snapshot_status(void *);
 int dm_target_snapshot_strategy(dm_table_entry_t *, struct buf *);
+int dm_target_snapshot_sync(dm_table_entry_t *);
 int dm_target_snapshot_deps(dm_table_entry_t *, prop_array_t);
 int dm_target_snapshot_destroy(dm_table_entry_t 

CVS commit: [netbsd-9] src/sys/arch/emips/ebus

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:43:16 UTC 2019

Modified Files:
src/sys/arch/emips/ebus [netbsd-9]: ace_ebus.c flash_ebus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #517):

sys/arch/emips/ebus/flash_ebus.c: revision 1.21
sys/arch/emips/ebus/ace_ebus.c: revision 1.21

Drop advertisement clause from my licenses


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.20.1 src/sys/arch/emips/ebus/ace_ebus.c
cvs rdiff -u -r1.20 -r1.20.8.1 src/sys/arch/emips/ebus/flash_ebus.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/emips/ebus/ace_ebus.c
diff -u src/sys/arch/emips/ebus/ace_ebus.c:1.20 src/sys/arch/emips/ebus/ace_ebus.c:1.20.20.1
--- src/sys/arch/emips/ebus/ace_ebus.c:1.20	Sun Nov 20 03:30:11 2016
+++ src/sys/arch/emips/ebus/ace_ebus.c	Sun Dec  8 14:43:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ace_ebus.c,v 1.20 2016/11/20 03:30:11 pgoyette Exp $	*/
+/*	$NetBSD: ace_ebus.c,v 1.20.20.1 2019/12/08 14:43:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.20 2016/11/20 03:30:11 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.20.20.1 2019/12/08 14:43:16 martin Exp $");
 
 #include 
 #include 
@@ -1473,11 +1473,6 @@ sysace_send_config(struct ace_softc *sc,
  * 2. Redistributions in binary form must reproduce the above copyright
  *	notice, this list of conditions and the following disclaimer in the
  *	documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *	must display the following acknowledgement:
- *  This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *	derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

Index: src/sys/arch/emips/ebus/flash_ebus.c
diff -u src/sys/arch/emips/ebus/flash_ebus.c:1.20 src/sys/arch/emips/ebus/flash_ebus.c:1.20.8.1
--- src/sys/arch/emips/ebus/flash_ebus.c:1.20	Sun Mar  4 21:41:48 2018
+++ src/sys/arch/emips/ebus/flash_ebus.c	Sun Dec  8 14:43:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: flash_ebus.c,v 1.20 2018/03/04 21:41:48 mrg Exp $	*/
+/*	$NetBSD: flash_ebus.c,v 1.20.8.1 2019/12/08 14:43:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.20 2018/03/04 21:41:48 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.20.8.1 2019/12/08 14:43:16 martin Exp $");
 
 /* Driver for the Intel 28F320/640/128 (J3A150) StrataFlash memory device
  * Extended to include the Intel JS28F256P30T95.
@@ -1313,11 +1313,6 @@ static int eflash_write_at (struct eflas
  * 2. Redistributions in binary form must reproduce the above copyright
  *	notice, this list of conditions and the following disclaimer in the
  *	documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *	must display the following acknowledgement:
- *  This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *	derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES



CVS commit: [netbsd-9] src/etc/rc.d

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:42:02 UTC 2019

Modified Files:
src/etc/rc.d [netbsd-9]: zfs

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #516):

etc/rc.d/zfs: revision 1.2
etc/rc.d/zfs: revision 1.3

Attempt to load the zfs module even if /etc/zfs/zpool.cache is absent. The
module needs to be loaded to create a pool in the first place, and
autoloading won't work after the fact won't work at securelevel=1.

Add missing rcvar=$name


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/etc/rc.d/zfs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/zfs
diff -u src/etc/rc.d/zfs:1.1.2.2 src/etc/rc.d/zfs:1.1.2.3
--- src/etc/rc.d/zfs:1.1.2.2	Fri Sep 27 09:18:37 2019
+++ src/etc/rc.d/zfs	Sun Dec  8 14:42:01 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: zfs,v 1.1.2.2 2019/09/27 09:18:37 martin Exp $
+# $NetBSD: zfs,v 1.1.2.3 2019/12/08 14:42:01 martin Exp $
 #
 
 # PROVIDE: zfs
@@ -10,12 +10,13 @@
 $_rc_subr_loaded . /etc/rc.subr
 
 name="zfs"
+rcvar=$name
 start_cmd="zfs_start"
 stop_cmd="zfs_stop"
 
 zfs_start()
 {
-	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
+	if [ -x /sbin/zfs ]; then
 		# Get ZFS module loaded (and thereby, zvols created).
 		/sbin/zfs list > /dev/null 2>&1
 		if [ $? -ne 0 ]; then



CVS commit: [netbsd-9] src/external/cddl/osnet/dist/uts/common/fs/zfs

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:39:07 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: vdev_disk.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #514):

external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c: revision 1.13

Initialize b_dev before passing buf to d_minphys (ldminphys needs this)


To generate a diff of this commit:
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.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/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11.2.1 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11.2.2
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11.2.1	Tue Aug 20 11:44:14 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Sun Dec  8 14:39:07 2019
@@ -244,6 +244,7 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 			} else {
 pdk = NULL;
 			}
+			buf.b_dev = vp->v_rdev;
 		}
 		if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
 			(*pdk->dk_driver->d_minphys)();



CVS commit: [netbsd-9] src/sys/arch/aarch64/aarch64

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:37:29 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: kobj_machdep.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #513):

sys/arch/aarch64/aarch64/kobj_machdep.c: revision 1.3

Flush insn / data caches after loading modules


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.8.1 src/sys/arch/aarch64/aarch64/kobj_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/kobj_machdep.c
diff -u src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.2 src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.2.8.1
--- src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.2	Sun Aug 19 20:02:22 2018
+++ src/sys/arch/aarch64/aarch64/kobj_machdep.c	Sun Dec  8 14:37:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.2 2018/08/19 20:02:22 ryo Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.2.8.1 2019/12/08 14:37:29 martin Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,19 +27,21 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.2 2018/08/19 20:02:22 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.2.8.1 2019/12/08 14:37:29 martin Exp $");
 
 #define ELFSIZE		ARCH_ELFSIZE
 
 #include "opt_ddb.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -357,8 +359,26 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas
 	return 0;
 }
 
+static void
+kobj_idcache_wbinv_all(void)
+{
+	cpu_idcache_wbinv_all();
+}
+
 int
 kobj_machdep(kobj_t ko, void *base, size_t size, bool load)
 {
+	uint64_t where;
+
+	if (load) {
+		if (cold) {
+			kobj_idcache_wbinv_all();
+		} else {
+			where = xc_broadcast(0,
+			(xcfunc_t)kobj_idcache_wbinv_all, NULL, NULL);
+			xc_wait(where);
+		}
+	}
+
 	return 0;
 }



CVS commit: [netbsd-9] src/share/mk

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:36:21 UTC 2019

Modified Files:
src/share/mk [netbsd-9]: bsd.kmodule.mk

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #512):

share/mk/bsd.kmodule.mk: revision 1.63

Build aarch64 modules without fp or simd instructions.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.62.2.1 src/share/mk/bsd.kmodule.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.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.62 src/share/mk/bsd.kmodule.mk:1.62.2.1
--- src/share/mk/bsd.kmodule.mk:1.62	Fri Jul  5 08:28:16 2019
+++ src/share/mk/bsd.kmodule.mk	Sun Dec  8 14:36:21 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.62 2019/07/05 08:28:16 hannken Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.62.2.1 2019/12/08 14:36:21 martin Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -42,7 +42,9 @@ CFLAGS+=	-fno-strict-aliasing -Wno-point
 # The real solution to this involves generating trampolines for those
 # relocations inside the loader and removing this workaround, as the
 # resulting code would be much faster.
-.if ${MACHINE_CPU} == "arm"
+.if ${MACHINE_CPU} == "aarch64"
+CFLAGS+=	-march=armv8-a+nofp+nosimd
+.elif ${MACHINE_CPU} == "arm"
 CFLAGS+=	-fno-common -fno-unwind-tables
 .elif ${MACHINE_CPU} == "hppa"
 CFLAGS+=	-mlong-calls



CVS commit: [netbsd-9] src/distrib/utils/embedded/conf

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:35:10 UTC 2019

Modified Files:
src/distrib/utils/embedded/conf [netbsd-9]: evbarm.conf

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #511):

distrib/utils/embedded/conf/evbarm.conf: revision 1.34

Remove the pretty much useless 128MB swap partition from the arm images.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.2.1 src/distrib/utils/embedded/conf/evbarm.conf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/embedded/conf/evbarm.conf
diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.33 src/distrib/utils/embedded/conf/evbarm.conf:1.33.2.1
--- src/distrib/utils/embedded/conf/evbarm.conf:1.33	Tue Jun 11 10:50:57 2019
+++ src/distrib/utils/embedded/conf/evbarm.conf	Sun Dec  8 14:35:10 2019
@@ -1,15 +1,14 @@
-# $NetBSD: evbarm.conf,v 1.33 2019/06/11 10:50:57 mrg Exp $
+# $NetBSD: evbarm.conf,v 1.33.2.1 2019/12/08 14:35:10 martin Exp $
 # evbarm shared config
 #
 image=$HOME/${board}.img
 
 MACHINE=evbarm
 
-swap=256
 extra=48		# spare space
 init=32
 boot=$((192 - ${init}))
-ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m
+ffsoffset=$(( (${init} + ${boot}) / 2 ))m
 
 size=0		# autocompute
 msdosid=12
@@ -20,14 +19,12 @@ make_label_evbarm() {
 	# compute all sizes in terms of sectors
 	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
 
-	local swapsize=$(( ${swap} * 1024 ))
 	local bootsize=$(( ${boot} * 1024 ))
 
 	local bootoffset=$(( ${init} * 1024 ))
-	local swapoffset=$(( ${bootoffset} + ${bootsize} ))
 
-	local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} ))
-	local aoffset=$(( ${swapoffset} + ${swapsize} ))
+	local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} ))
+	local aoffset=$(( ${bootoffset} + ${bootsize} ))
 
 	local bps=512
 	local spt=32
@@ -57,7 +54,6 @@ drivedata: 0 
 8 partitions:
 # size offsetfstype [fsize bsize cpg/sgs]
  a:   ${asize} ${aoffset}4.2BSD  ${fsize} ${bsize} 0  # 
- b:   ${swapsize}  ${swapoffset} swap #
  c:   ${totalsize} 0 unused  0 0  #
  e:   ${bootsize}  ${bootoffset} MSDOS#
 EOF
@@ -68,7 +64,6 @@ make_fstab_evbarm_normal() {
 # NetBSD /etc/fstab
 # See /usr/share/examples/fstab/ for more examples.
 ROOT.a		/		ffs	rw,noatime	1 1
-ROOT.b		none		swap	sw	0 0
 ROOT.e		/boot		msdos	rw	1 1
 kernfs		/kern		kernfs	rw
 ptyfs		/dev/pts	ptyfs	rw
@@ -85,7 +80,6 @@ make_fstab_evbarm_minwrites() {
 # NetBSD /etc/fstab
 # See /usr/share/examples/fstab/ for more examples.
 ROOT.a		/			ffs	rw,log,noatime,nodevmtime 1 1
-ROOT.b		none			swap	sw			  0 0
 ROOT.e		/boot			msdos	rw			  1 1
 kernfs		/kern			kernfs	rw
 ptyfs		/dev/pts		ptyfs	rw
@@ -137,6 +131,8 @@ dev_exists() {
 
 rc_configured=YES
 hostname=${board}
+no_swap=YES
+savecore=NO
 sshd=YES
 dhcpcd=YES
 ntpd=YES



CVS commit: [netbsd-9] src/sys/arch/arm/arm32

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:31:58 UTC 2019

Modified Files:
src/sys/arch/arm/arm32 [netbsd-9]: fault.c

Log Message:
Pull up following revision(s) (requested by ryo in ticket #510):

sys/arch/arm/arm32/fault.c: revision 1.109

if Thumb-32 bit instruction located on a page boundariy, also need to consider 
the pc + 2 address.
Fix PR/54720. more detail and PoC are descrived in the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.108.4.1 src/sys/arch/arm/arm32/fault.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/arm32/fault.c
diff -u src/sys/arch/arm/arm32/fault.c:1.108 src/sys/arch/arm/arm32/fault.c:1.108.4.1
--- src/sys/arch/arm/arm32/fault.c:1.108	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/arm/arm32/fault.c	Sun Dec  8 14:31:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.108 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: fault.c,v 1.108.4.1 2019/12/08 14:31:57 martin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
 #include "opt_kgdb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.108 2019/04/06 03:06:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.108.4.1 2019/12/08 14:31:57 martin Exp $");
 
 #include 
 #include 
@@ -838,6 +838,9 @@ prefetch_abort_handler(trapframe_t *tf)
 	UVMHIST_LOG(maphist, " (pc=0x%jx, l=0x%#jx, tf=0x%#jx)",
 	fault_pc, (uintptr_t)l, (uintptr_t)tf, 0);
 
+#ifdef THUMB_CODE
+ recheck:
+#endif
 	/* Ok validate the address, can only execute in USER space */
 	if (__predict_false(fault_pc >= VM_MAXUSER_ADDRESS ||
 	(fault_pc < VM_MIN_ADDRESS && vector_page == ARM_VECTORS_LOW))) {
@@ -897,6 +900,18 @@ do_trapsignal:
 	call_trapsignal(l, tf, );
 
 out:
+
+#ifdef THUMB_CODE
+#define THUMB_32BIT(hi) (((hi) & 0xe000) == 0xe000 && ((hi) & 0x1800))
+	/* thumb-32 instruction was located on page boundary? */
+	if ((tf->tf_spsr & PSR_T_bit) &&
+	((fault_pc & PAGE_MASK) == (PAGE_SIZE - THUMB_INSN_SIZE)) &&
+	THUMB_32BIT(*(uint16_t *)tf->tf_pc)) {
+		fault_pc = tf->tf_pc + THUMB_INSN_SIZE;
+		goto recheck;
+	}
+#endif /* THUMB_CODE */
+
 	KASSERT(!TRAP_USERMODE(tf) || VALID_R15_PSR(tf->tf_pc, tf->tf_spsr));
 	userret(l);
 }



CVS commit: [netbsd-9] src/sys/arch/arm/imx

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:29:37 UTC 2019

Modified Files:
src/sys/arch/arm/imx [netbsd-9]: if_enet.c

Log Message:
Pull up following revision(s) (requested by ryo in ticket #509):

sys/arch/arm/imx/if_enet.c: revision 1.29

set the multicast filter properly.

don't always IFF_ALLMULTI if multicast is configured.
fix the handling of GAUR and GALR.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/arch/arm/imx/if_enet.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/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.25 src/sys/arch/arm/imx/if_enet.c:1.25.2.1
--- src/sys/arch/arm/imx/if_enet.c:1.25	Tue Jul 30 06:26:31 2019
+++ src/sys/arch/arm/imx/if_enet.c	Sun Dec  8 14:29:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.25.2.1 2019/12/08 14:29:36 martin Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.25.2.1 2019/12/08 14:29:36 martin Exp $");
 
 #include "vlan.h"
 
@@ -714,15 +714,14 @@ enet_setmulti(struct enet_softc *sc)
 	struct ifnet *ifp = >ec_if;
 	struct ether_multi *enm;
 	struct ether_multistep step;
-	int promisc;
-	uint32_t crc;
+	uint32_t crc, hashidx;
 	uint32_t gaddr[2];
 
-	promisc = 0;
-	if ((ifp->if_flags & IFF_PROMISC) || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
-			promisc = 1;
+	if (ifp->if_flags & IFF_PROMISC) {
+		/* receive all unicast packet */
+		ENET_REG_WRITE(sc, ENET_IAUR, 0x);
+		ENET_REG_WRITE(sc, ENET_IALR, 0x);
+		/* receive all multicast packet */
 		gaddr[0] = gaddr[1] = 0x;
 	} else {
 		gaddr[0] = gaddr[1] = 0;
@@ -730,25 +729,38 @@ enet_setmulti(struct enet_softc *sc)
 		ETHER_LOCK(ec);
 		ETHER_FIRST_MULTI(step, ec, enm);
 		while (enm != NULL) {
+			if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
+			ETHER_ADDR_LEN)) {
+/*
+ * if specified by range, give up setting hash,
+ * and fallback to allmulti.
+ */
+gaddr[0] = gaddr[1] = 0x;
+break;
+			}
+
 			crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
-			gaddr[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+			hashidx = __SHIFTOUT(crc, __BITS(30,26));
+			gaddr[__SHIFTOUT(crc, __BIT(31))] |= __BIT(hashidx);
+
 			ETHER_NEXT_MULTI(step, enm);
 		}
 		ETHER_UNLOCK(ec);
-	}
-
-	ENET_REG_WRITE(sc, ENET_GAUR, gaddr[0]);
-	ENET_REG_WRITE(sc, ENET_GALR, gaddr[1]);
 
-	if (promisc) {
-		/* match all packet */
-		ENET_REG_WRITE(sc, ENET_IAUR, 0x);
-		ENET_REG_WRITE(sc, ENET_IALR, 0x);
-	} else {
-		/* don't match any packet */
+		/* dont't receive any unicast packet (except own address) */
 		ENET_REG_WRITE(sc, ENET_IAUR, 0);
 		ENET_REG_WRITE(sc, ENET_IALR, 0);
 	}
+
+	if (gaddr[0] == 0x && gaddr[1] == 0x)
+		ifp->if_flags |= IFF_ALLMULTI;
+	else
+		ifp->if_flags &= ~IFF_ALLMULTI;
+
+	/* receive multicast packets according to multicast filter */
+	ENET_REG_WRITE(sc, ENET_GAUR, gaddr[1]);
+	ENET_REG_WRITE(sc, ENET_GALR, gaddr[0]);
+
 }
 
 static void



CVS commit: [netbsd-9] src

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 14:26:39 UTC 2019

Modified Files:
src/distrib/sets/lists/comp [netbsd-9]: mi
src/share/man/man9 [netbsd-9]: Makefile
src/sys/sys [netbsd-9]: atomic.h
Added Files:
src/share/man/man9 [netbsd-9]: atomic_loadstore.9

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #508):

distrib/sets/lists/comp/mi: revision 1.2294
share/man/man9/Makefile: revision 1.443
sys/sys/atomic.h: revision 1.18
share/man/man9/atomic_loadstore.9: revision 1.1
share/man/man9/atomic_loadstore.9: revision 1.2

New atomic load/store operations for the kernel.

Guarantee no fusing and no tearing, and can optionally impose
ordering relative to other memory operations.

Unordered:
- atomic_load_relaxed
- atomic_store_relaxed

Ordered:
- atomic_load_acquire
- atomic_load_consume
- atomic_store_release

These are intended to match C11 semantics, and can be defined in
terms of the C11 atomic API when ready.

Document relation to atomic_ops(3) and membar_ops(3).


To generate a diff of this commit:
cvs rdiff -u -r1.2278.2.4 -r1.2278.2.5 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.437.2.2 -r1.437.2.3 src/share/man/man9/Makefile
cvs rdiff -u -r0 -r1.5.2.2 src/share/man/man9/atomic_loadstore.9
cvs rdiff -u -r1.13 -r1.13.22.1 src/sys/sys/atomic.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2278.2.4 src/distrib/sets/lists/comp/mi:1.2278.2.5
--- src/distrib/sets/lists/comp/mi:1.2278.2.4	Sun Sep  1 13:00:37 2019
+++ src/distrib/sets/lists/comp/mi	Sun Dec  8 14:26:38 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2278.2.4 2019/09/01 13:00:37 martin Exp $
+#	$NetBSD: mi,v 1.2278.2.5 2019/12/08 14:26:38 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -10670,6 +10670,12 @@
 ./usr/share/man/cat9/arp_ifinit.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/arpintr.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/arpresolve.0		comp-sys-catman		.cat
+./usr/share/man/cat9/atomic_load_acquire.0	comp-sys-catman		.cat
+./usr/share/man/cat9/atomic_load_consume.0	comp-sys-catman		.cat
+./usr/share/man/cat9/atomic_load_relaxed.0	comp-sys-catman		.cat
+./usr/share/man/cat9/atomic_loadstore.0		comp-sys-catman		.cat
+./usr/share/man/cat9/atomic_store_relaxed.0	comp-sys-catman		.cat
+./usr/share/man/cat9/atomic_store_release.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/atop.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/audio.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/audio_system.0		comp-sys-catman		obsolete
@@ -18610,6 +18616,12 @@
 ./usr/share/man/html9/arp_ifinit.html		comp-sys-htmlman	html
 ./usr/share/man/html9/arpintr.html		comp-sys-htmlman	html
 ./usr/share/man/html9/arpresolve.html		comp-sys-htmlman	html
+./usr/share/man/html9/atomic_load_acquire.html	comp-sys-htmlman	html
+./usr/share/man/html9/atomic_load_consume.html	comp-sys-htmlman	html
+./usr/share/man/html9/atomic_load_relaxed.html	comp-sys-htmlman	html
+./usr/share/man/html9/atomic_loadstore.html	comp-sys-htmlman	html
+./usr/share/man/html9/atomic_store_relaxed.html	comp-sys-htmlman	html
+./usr/share/man/html9/atomic_store_release.html	comp-sys-htmlman	html
 ./usr/share/man/html9/atop.html			comp-sys-htmlman	html
 ./usr/share/man/html9/audio.html		comp-sys-htmlman	html
 ./usr/share/man/html9/audio_system.html		comp-sys-htmlman	obsolete
@@ -26653,6 +26665,12 @@
 ./usr/share/man/man9/arp_ifinit.9		comp-sys-man		.man
 ./usr/share/man/man9/arpintr.9			comp-sys-man		.man
 ./usr/share/man/man9/arpresolve.9		comp-sys-man		.man
+./usr/share/man/man9/atomic_load_acquire.9	comp-sys-man		.man
+./usr/share/man/man9/atomic_load_consume.9	comp-sys-man		.man
+./usr/share/man/man9/atomic_load_relaxed.9	comp-sys-man		.man
+./usr/share/man/man9/atomic_loadstore.9		comp-sys-man		.man
+./usr/share/man/man9/atomic_store_relaxed.9	comp-sys-man		.man
+./usr/share/man/man9/atomic_store_release.9	comp-sys-man		.man
 ./usr/share/man/man9/atop.9			comp-sys-man		.man
 ./usr/share/man/man9/audio.9			comp-sys-man		.man
 ./usr/share/man/man9/audio_system.9		comp-sys-man		obsolete

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.437.2.2 src/share/man/man9/Makefile:1.437.2.3
--- src/share/man/man9/Makefile:1.437.2.2	Sun Sep  1 19:31:43 2019
+++ src/share/man/man9/Makefile	Sun Dec  8 14:26:38 2019
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.437.2.2 2019/09/01 19:31:43 martin Exp $
+#   $NetBSD: Makefile,v 1.437.2.3 2019/12/08 14:26:38 martin Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -67,6 +67,13 @@ MAN=	accept_filter.9 accf_data.9 accf_ht
 	wsbell.9 wscons.9 wsdisplay.9 wsfont.9 wskbd.9 wsmouse.9 \
 	xcall.9
 
+MAN+=	atomic_loadstore.9

CVS commit: [netbsd-9] src/lib/libm/arch/aarch64

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:37:46 UTC 2019

Modified Files:
src/lib/libm/arch/aarch64 [netbsd-9]: fenv.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #507):

lib/libm/arch/aarch64/fenv.c: revision 1.5
lib/libm/arch/aarch64/fenv.c: revision 1.6

Fix fesetenv and feupdateenv.
- fesetenv is supposed to set the stored rounding mode (and stored trap
  settings, but they have no effect on any ARMv8 I know).
- feupdateenv is supposed to re-raise the exceptions that were raised
  in the environment when it was called.
XXX atf test
XXX pullup-9

Fix feraiseexcept.
- Don't touch the trap flags (though on all ARMv8 I know they have no
  effect anyway).
- Don't clear any existing raised exception flags; just add to them.
XXX atf test
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/lib/libm/arch/aarch64/fenv.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/libm/arch/aarch64/fenv.c
diff -u src/lib/libm/arch/aarch64/fenv.c:1.4 src/lib/libm/arch/aarch64/fenv.c:1.4.2.1
--- src/lib/libm/arch/aarch64/fenv.c:1.4	Wed Nov  7 06:47:38 2018
+++ src/lib/libm/arch/aarch64/fenv.c	Sun Dec  8 13:37:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.4 2018/11/07 06:47:38 riastradh Exp $ */
+/* $NetBSD: fenv.c,v 1.4.2.1 2019/12/08 13:37:46 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fenv.c,v 1.4 2018/11/07 06:47:38 riastradh Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.4.2.1 2019/12/08 13:37:46 martin Exp $");
 
 #include "namespace.h"
 
@@ -107,11 +107,9 @@ feraiseexcept(int excepts)
 	_DIAGASSERT((except & ~FE_ALL_EXCEPT) == 0);
 #endif
 	unsigned int fpsr = reg_fpsr_read();
-	fpsr = (fpsr & ~FPSR_CSUM) | __SHIFTIN(excepts, FPSR_CSUM);
+	excepts &= FE_ALL_EXCEPT; /* paranoia */
+	fpsr |= __SHIFTIN(excepts, FPSR_CSUM);
 	reg_fpsr_write(fpsr);
-	unsigned int fpcr = reg_fpcr_read();
-	fpcr = (fpcr & ~FPCR_ESUM) | __SHIFTIN(excepts, FPCR_ESUM);
-	reg_fpcr_write(fpcr);
 	return 0;
 }
 
@@ -213,6 +211,7 @@ int
 fesetenv(const fenv_t *envp)
 {
 	reg_fpsr_write(envp->__fpsr);
+	reg_fpcr_write(envp->__fpcr);
 	return 0;
 }
 
@@ -225,11 +224,10 @@ fesetenv(const fenv_t *envp)
 int
 feupdateenv(const fenv_t *envp)
 {
-#ifndef lint
-	_DIAGASSERT(envp != NULL);
-#endif
-	reg_fpsr_write(envp->__fpsr);
-	reg_fpcr_write(envp->__fpcr);
+	int except = fetestexcept(FE_ALL_EXCEPT);
+
+	fesetenv(envp);
+	feraiseexcept(except);
 
 	/* Success */
 	return 0;



CVS commit: [netbsd-9] src/lib/libc/gdtoa

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:35:51 UTC 2019

Modified Files:
src/lib/libc/gdtoa [netbsd-9]: Makefile.inc gdtoa_fltrnds.h gdtoaimp.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #506):

lib/libc/gdtoa/Makefile.inc: revision 1.11
lib/libc/gdtoa/gdtoa_fltrnds.h: revision 1.2
lib/libc/gdtoa/gdtoaimp.h: revision 1.15
lib/libc/gdtoa/gdtoaimp.h: revision 1.17

Honour the floating-point rounding mode in floating-point formatting.

C99, Sec. 7.19.6.1 `The fprintf function', paragraph 13, p. 281:
   (Recommended practice)
   For e, E, f, F, g, and G conversions, if the number of significant
   decimal digits is at most DECIMAL_DIG, then the result should be
   correctly rounded.  If the number of significant decimal digits is
   more than DECIMAL_DIG but the source value is exactly
   representable with DECIMAL_DIG digits, then the result should be
   an exact representation with trailing zeros.  Otherwise, the
   source value is bounded by two adjacent decimal strings L < U,
   both having DECIMAL_DIG significant idgits; the value of the
   resultant decimal string D should satisfy L <= D <= U, _with the
   extra stipulation that the error should have a correct sign for
   the current rounding direction_.  [emphasis added]

The gdtoa code base already supports respecting the floating-point
rounding mode, as long as we compile it with Honor_FLT_ROUNDS
defined.  However, for this to work, fegetround must be available in
libc, which it is not currently -- the fenv logic is in libm.

Fortunately, we don't have to move all of fenv from libm to libc --
programs that do not link against libm don't have fesetround, so the
rounding mode is always the default (barring asm shenanigans that
bypass the API -- tough).  So use a weak reference to fegetround; by
default, assume FE_TONEAREST if it is not defined.

Mark the libc fegetround weak reference unused.
Not all .c files that include gdtoaimp.h use it, which makes clang
unhappy.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.28.1 src/lib/libc/gdtoa/Makefile.inc
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.46.1 src/lib/libc/gdtoa/gdtoa_fltrnds.h
cvs rdiff -u -r1.14 -r1.14.30.1 src/lib/libc/gdtoa/gdtoaimp.h

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/gdtoa/Makefile.inc
diff -u src/lib/libc/gdtoa/Makefile.inc:1.10 src/lib/libc/gdtoa/Makefile.inc:1.10.28.1
--- src/lib/libc/gdtoa/Makefile.inc:1.10	Thu Jan 16 20:31:42 2014
+++ src/lib/libc/gdtoa/Makefile.inc	Sun Dec  8 13:35:51 2019
@@ -1,10 +1,14 @@
-#	$NetBSD: Makefile.inc,v 1.10 2014/01/16 20:31:42 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.10.28.1 2019/12/08 13:35:51 martin Exp $
 
 # gdtoa sources
 .PATH: ${.CURDIR}/gdtoa
 CPPFLAGS+=-I${.CURDIR}/gdtoa -I${.CURDIR}/locale
 
+.if ${MACHINE_ARCH} == "vax"
 CPPFLAGS+=-DNO_FENV_H
+.else
+CPPFLAGS+=-DHonor_FLT_ROUNDS
+.endif
 
 # machine-dependent directory must provide the following:
 # 	arith.h gd_qnan.h

Index: src/lib/libc/gdtoa/gdtoa_fltrnds.h
diff -u src/lib/libc/gdtoa/gdtoa_fltrnds.h:1.1.1.1 src/lib/libc/gdtoa/gdtoa_fltrnds.h:1.1.1.1.46.1
--- src/lib/libc/gdtoa/gdtoa_fltrnds.h:1.1.1.1	Sat Mar 19 16:26:37 2011
+++ src/lib/libc/gdtoa/gdtoa_fltrnds.h	Sun Dec  8 13:35:51 2019
@@ -1,4 +1,5 @@
-	FPI *fpi, fpi1;
+	CONST FPI *fpi;
+	FPI fpi1;
 	int Rounding;
 #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
 	Rounding = Flt_Rounds;

Index: src/lib/libc/gdtoa/gdtoaimp.h
diff -u src/lib/libc/gdtoa/gdtoaimp.h:1.14 src/lib/libc/gdtoa/gdtoaimp.h:1.14.30.1
--- src/lib/libc/gdtoa/gdtoaimp.h:1.14	Fri Apr 19 10:41:53 2013
+++ src/lib/libc/gdtoa/gdtoaimp.h	Sun Dec  8 13:35:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gdtoaimp.h,v 1.14 2013/04/19 10:41:53 joerg Exp $ */
+/* $NetBSD: gdtoaimp.h,v 1.14.30.1 2019/12/08 13:35:51 martin Exp $ */
 
 /
 
@@ -200,6 +200,10 @@ THIS SOFTWARE.
 #include "gd_qnan.h"
 #ifdef Honor_FLT_ROUNDS
 #include 
+__unused __weakref_visible int __libc_fegetround_ref(void)
+  __weak_reference(fegetround);
+#define fegetround()			\
+	(__libc_fegetround_ref ? __libc_fegetround_ref() : FE_TONEAREST)
 #endif
 
 #ifdef DEBUG



CVS commit: [netbsd-9] src

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:23:23 UTC 2019

Modified Files:
src/common/lib/libc/hash/murmurhash [netbsd-9]: murmurhash.c
src/sys/arch/amd64/include [netbsd-9]: param.h
src/sys/arch/i386/include [netbsd-9]: param.h
src/sys/sys [netbsd-9]: param.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #505):

common/lib/libc/hash/murmurhash/murmurhash.c: revision 1.7
common/lib/libc/hash/murmurhash/murmurhash.c: revision 1.8
sys/sys/param.h: revision 1.610
sys/arch/amd64/include/param.h: revision 1.31
sys/arch/i386/include/param.h: revision 1.85

New macro ALIGNED_POINTER_LOAD.

To be used with ALIGNED_POINTER(p,t) instead of writing *(const t *)p
directly.  This way, on machines without strict alignment, we can use
memcpy to pacify sanitizers, while getting the same compiled code in
the end with a single (say) MOV instruction.

Fix byte order bug in murmurhash and pacify sanitizers.
add now required includes for memcpy prototypes analogue to other hash functions
(fix the build)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.28.1 \
src/common/lib/libc/hash/murmurhash/murmurhash.c
cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.84 -r1.84.4.1 src/sys/arch/i386/include/param.h
cvs rdiff -u -r1.599.2.2 -r1.599.2.3 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/hash/murmurhash/murmurhash.c
diff -u src/common/lib/libc/hash/murmurhash/murmurhash.c:1.6 src/common/lib/libc/hash/murmurhash/murmurhash.c:1.6.28.1
--- src/common/lib/libc/hash/murmurhash/murmurhash.c:1.6	Sat Oct 26 21:06:38 2013
+++ src/common/lib/libc/hash/murmurhash/murmurhash.c	Sun Dec  8 13:23:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: murmurhash.c,v 1.6 2013/10/26 21:06:38 rmind Exp $	*/
+/*	$NetBSD: murmurhash.c,v 1.6.28.1 2019/12/08 13:23:23 martin Exp $	*/
 
 /*
  * MurmurHash2 -- from the original code:
@@ -14,15 +14,19 @@
 #include 
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: murmurhash.c,v 1.6 2013/10/26 21:06:38 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: murmurhash.c,v 1.6.28.1 2019/12/08 13:23:23 martin Exp $");
+
+#include 
 
 #else
 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: murmurhash.c,v 1.6 2013/10/26 21:06:38 rmind Exp $");
+__RCSID("$NetBSD: murmurhash.c,v 1.6.28.1 2019/12/08 13:23:23 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
+#include 
+
 #endif
 
 #include 
@@ -51,7 +55,10 @@ murmurhash2(const void *key, size_t len,
 
 	if (__predict_true(ALIGNED_POINTER(key, uint32_t))) {
 		while (len >= sizeof(uint32_t)) {
-			uint32_t k = *(const uint32_t *)data;
+			uint32_t k;
+
+			ALIGNED_POINTER_LOAD(, data, uint32_t);
+			k = htole32(k);
 
 			k *= m;
 			k ^= k >> r;

Index: src/sys/arch/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.30 src/sys/arch/amd64/include/param.h:1.30.4.1
--- src/sys/arch/amd64/include/param.h:1.30	Sat Mar 16 11:50:48 2019
+++ src/sys/arch/amd64/include/param.h	Sun Dec  8 13:23:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.30 2019/03/16 11:50:48 rin Exp $	*/
+/*	$NetBSD: param.h,v 1.30.4.1 2019/12/08 13:23:23 martin Exp $	*/
 
 #ifdef __x86_64__
 
@@ -21,7 +21,8 @@
 #define	MACHINE_ARCH	"x86_64"
 #define MID_MACHINE	MID_X86_64
 
-#define ALIGNED_POINTER(p,t)	1
+#define ALIGNED_POINTER(p,t)		1
+#define ALIGNED_POINTER_LOAD(q,p,t)	memcpy((q), (p), sizeof(t))
 
 /*
  * Align stack as required by AMD64 System V ABI. This is because

Index: src/sys/arch/i386/include/param.h
diff -u src/sys/arch/i386/include/param.h:1.84 src/sys/arch/i386/include/param.h:1.84.4.1
--- src/sys/arch/i386/include/param.h:1.84	Mon Jan  7 22:00:31 2019
+++ src/sys/arch/i386/include/param.h	Sun Dec  8 13:23:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.84 2019/01/07 22:00:31 jdolecek Exp $	*/
+/*	$NetBSD: param.h,v 1.84.4.1 2019/12/08 13:23:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -58,7 +58,8 @@
 #define	MACHINE_ARCH	"i386"
 #define	MID_MACHINE	MID_I386
 
-#define ALIGNED_POINTER(p,t)	1
+#define ALIGNED_POINTER(p,t)		1
+#define ALIGNED_POINTER_LOAD(q,p,t)	memcpy((q), (p), sizeof(t))
 
 #define	PGSHIFT		12		/* LOG2(NBPG) */
 #define	NBPG		(1 << PGSHIFT)	/* bytes/page */

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.599.2.2 src/sys/sys/param.h:1.599.2.3
--- src/sys/sys/param.h:1.599.2.2	Wed Nov 27 14:34:31 2019
+++ src/sys/sys/param.h	Sun Dec  8 13:23:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.599.2.2 2019/11/27 14:34:31 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.599.2.3 2019/12/08 13:23:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -253,9 +253,22 @@
  * any desired pointer type.
  *
  * ALIGNED_POINTER is a boolean macro 

CVS commit: src/sys/sys

2019-12-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec  8 13:19:59 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome 9.99.21. dk_lookup() has been replaced.


To generate a diff of this commit:
cvs rdiff -u -r1.621 -r1.622 src/sys/sys/param.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/param.h
diff -u src/sys/sys/param.h:1.621 src/sys/sys/param.h:1.622
--- src/sys/sys/param.h:1.621	Fri Dec  6 21:07:07 2019
+++ src/sys/sys/param.h	Sun Dec  8 13:19:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.621 2019/12/06 21:07:07 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.622 2019/12/08 13:19:59 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999002000	/* NetBSD 9.99.20 */
+#define	__NetBSD_Version__	999002100	/* NetBSD 9.99.21 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: [netbsd-9] src/share/man/man4

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:16:53 UTC 2019

Modified Files:
src/share/man/man4 [netbsd-9]: rnd.4

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #504):

share/man/man4/rnd.4: revision 1.26
share/man/man4/rnd.4: revision 1.27
share/man/man4/rnd.4: revision 1.28
share/man/man4/rnd.4: revision 1.25

Update man page to reflect switch from CTR_DRBG to Hash_DRBG.

Replace slightly wrong rant by shorter and slightly less long rant.
(If X and Y in Z/2Z are independent, then so are X and X+Y.  What was
I thinking.)

Update NIST SP800-90A reference.

New sentence, new line. Use \(em.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.14.1 src/share/man/man4/rnd.4

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/man4/rnd.4
diff -u src/share/man/man4/rnd.4:1.24 src/share/man/man4/rnd.4:1.24.14.1
--- src/share/man/man4/rnd.4:1.24	Wed Jan 18 22:38:00 2017
+++ src/share/man/man4/rnd.4	Sun Dec  8 13:16:53 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rnd.4,v 1.24 2017/01/18 22:38:00 abhinav Exp $
+.\"	$NetBSD: rnd.4,v 1.24.14.1 2019/12/08 13:16:53 martin Exp $
 .\"
 .\" Copyright (c) 2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 16, 2014
+.Dd September 3, 2019
 .Dt RND 4
 .Os
 .Sh NAME
@@ -187,8 +187,8 @@ quantum computers.
 Systems with nonvolatile storage should store a secret from
 .Pa /dev/urandom
 on disk during installation or shutdown, and feed it back during boot,
-so that the work the operating system has done to gather entropy --
-including the work its operator may have done to flip a coin! -- can be
+so that the work the operating system has done to gather entropy \(em
+including the work its operator may have done to flip a coin! \(em can be
 saved from one boot to the next, and so that newly installed systems
 are not vulnerable to generating cryptographic keys predictably.
 .Pp
@@ -205,7 +205,7 @@ in
 which is enabled by default; see
 .Xr rc.conf 5 .
 .Sh LIMITATIONS
-Some people worry about recovery from state compromise -- that is,
+Some people worry about recovery from state compromise \(em that is,
 ensuring that even if an attacker sees the entire state of the
 operating system, then the attacker will be unable to predict any new
 future outputs as long as the operating system gathers fresh entropy
@@ -404,9 +404,9 @@ When a user process opens
 or
 .Pa /dev/urandom
 and first reads from it, the kernel draws from the entropy pool to seed
-a cryptographic pseudorandom number generator, the NIST CTR_DRBG
-(counter-mode deterministic random bit generator) with AES-128 as the
-block cipher, and uses that to generate data.
+a cryptographic pseudorandom number generator, the NIST Hash_DRBG
+(hash-based deterministic random bit generator) with SHA-256 as the
+hash function, and uses that to generate data.
 .Pp
 To draw a seed from the entropy pool, the kernel
 .Bl -bullet -offset abcd -compact
@@ -489,10 +489,10 @@ Never blocks.
 .%A Elaine Barker
 .%A John Kelsey
 .%T Recommendation for Random Number Generation Using Deterministic Random Bit Generators
-.%D January 2012
+.%D June 2015
 .%I National Institute of Standards and Technology
-.%O NIST Special Publication 800-90A
-.%U http://csrc.nist.gov/publications/nistpubs/800-90A/SP800-90A.pdf
+.%O NIST Special Publication 800-90A, Revision 1
+.%U https://csrc.nist.gov/publications/detail/sp/800-90a/rev-1/final
 .Re
 .Rs
 .%A Daniel J. Bernstein
@@ -551,59 +551,33 @@ Unfortunately, no amount of software eng
 .Sh ENTROPY ACCOUNTING
 The entropy accounting described here is not grounded in any
 cryptography theory.
-It is done because it was always done, and because it gives people a
-warm fuzzy feeling about information theory.
+.Sq Entropy estimation
+doesn't mean much: the kernel hypothesizes an extremely simple-minded
+parametric model for all entropy sources which bears little relation to
+any physical processes, implicitly fits parameters from data, and
+accounts for the entropy of the fitted model.
 .Pp
-The folklore is that every
-.Fa n Ns -bit
-output of
-.Fa /dev/random
-is not merely indistinguishable from uniform random to a
-computationally bounded attacker, but information-theoretically is
-independent and has
-.Fa n
-bits of entropy even to a computationally
-.Em unbounded
-attacker -- that is, an attacker who can recover AES keys, compute
-SHA-1 preimages, etc.
-This property is not provided, nor was it ever provided in any
-implementation of
-.Fa /dev/random
-known to the author.
-.Pp
-This property would require that, after each read, the system discard
-all measurements from hardware in the entropy pool and begin anew.
-All work done to make the system unpredictable 

CVS commit: [netbsd-9] src/sys/stand/efiboot

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:13:06 UTC 2019

Modified Files:
src/sys/stand/efiboot [netbsd-9]: Makefile.efiboot efiacpi.c version
Added Files:
src/sys/stand/efiboot [netbsd-9]: smbios.c smbios.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #503):

sys/stand/efiboot/Makefile.efiboot: revision 1.9
sys/stand/efiboot/efiacpi.c: revision 1.5
sys/stand/efiboot/version: revision 1.13
sys/stand/efiboot/smbios.h: revision 1.1
sys/stand/efiboot/smbios.c: revision 1.1

Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.3.6.1 -r1.3.6.2 src/sys/stand/efiboot/efiacpi.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/stand/efiboot/smbios.c \
src/sys/stand/efiboot/smbios.h
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/stand/efiboot/version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.8 src/sys/stand/efiboot/Makefile.efiboot:1.8.2.1
--- src/sys/stand/efiboot/Makefile.efiboot:1.8	Sun Jul 21 17:01:39 2019
+++ src/sys/stand/efiboot/Makefile.efiboot	Sun Dec  8 13:13:06 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.8 2019/07/21 17:01:39 rin Exp $
+# $NetBSD: Makefile.efiboot,v 1.8.2.1 2019/12/08 13:13:06 martin Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -22,7 +22,7 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 .PATH: ${EFIDIR}/gnuefi
 SOURCES=	crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c
 SOURCES+=	boot.c conf.c console.c dev_net.c devopen.c exec.c panic.c prompt.c
-SOURCES+=	efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c efifile.c efiblock.c efinet.c efipxe.c efiacpi.c
+SOURCES+=	efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c efifile.c efiblock.c efinet.c efipxe.c efiacpi.c smbios.c
 
 .PATH: ${S}/external/bsd/libfdt/dist
 CPPFLAGS+=	-I${S}/external/bsd/libfdt/dist

Index: src/sys/stand/efiboot/efiacpi.c
diff -u src/sys/stand/efiboot/efiacpi.c:1.3.6.1 src/sys/stand/efiboot/efiacpi.c:1.3.6.2
--- src/sys/stand/efiboot/efiacpi.c:1.3.6.1	Sun Aug  4 11:37:56 2019
+++ src/sys/stand/efiboot/efiacpi.c	Sun Dec  8 13:13:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: efiacpi.c,v 1.3.6.1 2019/08/04 11:37:56 martin Exp $ */
+/* $NetBSD: efiacpi.c,v 1.3.6.2 2019/12/08 13:13:06 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #include "efiboot.h"
 #include "efiacpi.h"
 #include "efifdt.h"
+#include "smbios.h"
 
 #include 
 
@@ -77,6 +78,39 @@ efi_acpi_show(void)
 	printf("\n");
 }
 
+static char model_buf[128];
+
+static const char *
+efi_acpi_get_model(void)
+{
+	struct smbtable smbios;
+	struct smbios_sys *psys;
+	const char *s;
+	char *buf;
+
+	memset(model_buf, 0, sizeof(model_buf));
+
+	if (smbios3_table != NULL) {
+		smbios_init(smbios3_table);
+
+		buf = model_buf;
+		smbios.cookie = 0;
+		if (smbios_find_table(SMBIOS_TYPE_SYSTEM, )) {
+			psys = smbios.tblhdr;
+			if ((s = smbios_get_string(, psys->vendor, buf, 64)) != NULL) {
+buf += strlen(s);
+*buf++ = ' ';
+			}
+			smbios_get_string(, psys->product, buf, 64);
+		}
+	}
+
+	if (model_buf[0] == '\0')
+		strcpy(model_buf, "ACPI");
+
+	return model_buf;
+}
+
 int
 efi_acpi_create_fdt(void)
 {
@@ -94,8 +128,10 @@ efi_acpi_create_fdt(void)
 	if (error)
 		return EIO;
 
+	const char *model = efi_acpi_get_model();
+
 	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "compatible", "netbsd,generic-acpi");
-	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", "ACPI");
+	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", model);
 	fdt_setprop_cell(fdt, fdt_path_offset(fdt, "/"), "#address-cells", 2);
 	fdt_setprop_cell(fdt, fdt_path_offset(fdt, "/"), "#size-cells", 2);
 

Index: src/sys/stand/efiboot/version
diff -u src/sys/stand/efiboot/version:1.11.2.1 src/sys/stand/efiboot/version:1.11.2.2
--- src/sys/stand/efiboot/version:1.11.2.1	Sun Aug  4 11:37:56 2019
+++ src/sys/stand/efiboot/version	Sun Dec  8 13:13:06 2019
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.11.2.1 2019/08/04 11:37:56 martin Exp $
+$NetBSD: version,v 1.11.2.2 2019/12/08 13:13:06 martin Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -16,3 +16,4 @@ is taken as the current.
 1.9:	Add support for efiboot.plist and loading device tree overlays.
 1.10:	Add support for EFI GOP framebuffers in ACPI mode.
 1.11:	Add full UEFI memory map to /chosen node.
+1.12:	Derive ACPI model string from SMBIOS.

Added files:

Index: src/sys/stand/efiboot/smbios.c
diff -u /dev/null src/sys/stand/efiboot/smbios.c:1.1.2.2
--- /dev/null	Sun Dec  8 

CVS commit: [netbsd-9] src/sys/arch/x86

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:09:28 UTC 2019

Modified Files:
src/sys/arch/x86/include [netbsd-9]: genfb_machdep.h
src/sys/arch/x86/x86 [netbsd-9]: genfb_machdep.c hyperv.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #502):
sys/arch/x86/x86/hyperv.c: revision 1.5
sys/arch/x86/include/genfb_machdep.h: revision 1.4
sys/arch/x86/x86/genfb_machdep.c: revision 1.15
Prevent panic when attaching genfb if using a serial console with Hyper-V Gen.2.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.60.1 src/sys/arch/x86/include/genfb_machdep.h
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/arch/x86/x86/hyperv.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/genfb_machdep.h
diff -u src/sys/arch/x86/include/genfb_machdep.h:1.3 src/sys/arch/x86/include/genfb_machdep.h:1.3.60.1
--- src/sys/arch/x86/include/genfb_machdep.h:1.3	Wed Feb  9 13:24:23 2011
+++ src/sys/arch/x86/include/genfb_machdep.h	Sun Dec  8 13:09:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.h,v 1.3 2011/02/09 13:24:23 jmcneill Exp $ */
+/* $NetBSD: genfb_machdep.h,v 1.3.60.1 2019/12/08 13:09:28 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -29,6 +29,7 @@
 #ifndef _X86_GENFB_MACHDEP_H
 #define _X86_GENFB_MACHDEP_H
 
+int	x86_genfb_init(void);
 int	x86_genfb_cnattach(void);
 void	x86_genfb_mtrr_init(uint64_t, uint32_t);
 void	x86_genfb_set_console_dev(device_t);

Index: src/sys/arch/x86/x86/genfb_machdep.c
diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.13 src/sys/arch/x86/x86/genfb_machdep.c:1.13.2.1
--- src/sys/arch/x86/x86/genfb_machdep.c:1.13	Sun May 19 07:43:17 2019
+++ src/sys/arch/x86/x86/genfb_machdep.c	Sun Dec  8 13:09:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.13 2019/05/19 07:43:17 mlelstv Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.13.2.1 2019/12/08 13:09:28 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.13 2019/05/19 07:43:17 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.13.2.1 2019/12/08 13:09:28 martin Exp $");
 
 #include "opt_mtrr.h"
 
@@ -136,23 +136,19 @@ x86_genfb_mtrr_init(uint64_t physaddr, u
 }
 
 int
-x86_genfb_cnattach(void)
+x86_genfb_init(void)
 {
-	static int ncalls = 0;
+	static int inited, attached;
 	struct rasops_info *ri = _genfb_console_screen.scr_ri;
 	const struct btinfo_framebuffer *fbinfo;
 	bus_space_tag_t t = x86_bus_space_mem;
 	bus_space_handle_t h;
 	void *bits;
-	long defattr;
 	int err;
 
-	/* XXX jmcneill
-	 *  Defer console initialization until UVM is initialized
-	 */
-	++ncalls;
-	if (ncalls < 3)
-		return -1;
+	if (inited)
+		return attached;
+	inited = 1;
 
 	memset(_genfb_console_screen, 0, sizeof(x86_genfb_console_screen));
 
@@ -206,6 +202,27 @@ x86_genfb_cnattach(void)
 	x86_genfb_stdscreen.textops = >ri_ops;
 	x86_genfb_stdscreen.capabilities = ri->ri_caps;
 
+	attached = 1;
+	return 1;
+}
+
+int
+x86_genfb_cnattach(void)
+{
+	static int ncalls = 0;
+	struct rasops_info *ri = _genfb_console_screen.scr_ri;
+	long defattr;
+
+	/* XXX jmcneill
+	 *  Defer console initialization until UVM is initialized
+	 */
+	++ncalls;
+	if (ncalls < 3)
+		return -1;
+
+	if (!x86_genfb_init())
+		return 0;
+
 	ri->ri_ops.allocattr(ri, 0, 0, 0, );
 	wsdisplay_preattach(_genfb_stdscreen, ri, 0, 0, defattr);
 
@@ -213,6 +230,12 @@ x86_genfb_cnattach(void)
 }
 #else	/* NWSDISPLAY > 0 && NGENFB > 0 */
 int
+x86_genfb_init(void)
+{
+	return 0;
+}
+
+int
 x86_genfb_cnattach(void)
 {
 	return 0;

Index: src/sys/arch/x86/x86/hyperv.c
diff -u src/sys/arch/x86/x86/hyperv.c:1.4 src/sys/arch/x86/x86/hyperv.c:1.4.4.1
--- src/sys/arch/x86/x86/hyperv.c:1.4	Mon Jun  3 09:51:04 2019
+++ src/sys/arch/x86/x86/hyperv.c	Sun Dec  8 13:09:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $	*/
+/*	$NetBSD: hyperv.c,v 1.4.4.1 2019/12/08 13:09:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
  */
 #include 
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.4.4.1 2019/12/08 13:09:28 martin Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD: head/sys/dev/hyperv/
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -1103,6 +1103,9 @@ device_hyperv_register(device_t dev, voi
 		sizeof(*aa->aa_type)) == 0) {
 			prop_dictionary_t dict = device_properties(dev);
 
+			/* Initialize genfb for serial console */
+			x86_genfb_init();
+
 			/*
 			 * framebuffer drivers other than genfb can work
 

CVS commit: [netbsd-9] src/games/fortune/datfiles

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:06:37 UTC 2019

Modified Files:
src/games/fortune/datfiles [netbsd-9]: fortunes netbsd

Log Message:
Pull up following revision(s) (requested by sevan in ticket #501):

games/fortune/datfiles/fortunes: revision 1.83
games/fortune/datfiles/fortunes: revision 1.84
games/fortune/datfiles/fortunes: revision 1.85
games/fortune/datfiles/fortunes: revision 1.86
games/fortune/datfiles/netbsd: revision 1.29

Donnie Darko

Chris' happiest moment
http://bbc.co.uk/programmes/b09b1zbb

Definition of austerity by Alexei Sayle on Radio 4
https://web.archive.org/web/20190916192807/https://www.bbc.co.uk/sounds/play/m0008bbc

https://twitter.com/sei6r/status/1182433546331279360

Introspection. From "Surely You're Joking, Mr. Feynman!"


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.82.2.1 src/games/fortune/datfiles/fortunes
cvs rdiff -u -r1.28 -r1.28.14.1 src/games/fortune/datfiles/netbsd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.82 src/games/fortune/datfiles/fortunes:1.82.2.1
--- src/games/fortune/datfiles/fortunes:1.82	Fri Jul 26 07:41:22 2019
+++ src/games/fortune/datfiles/fortunes	Sun Dec  8 13:06:37 2019
@@ -16271,3 +16271,21 @@ that was instantly responsive to every a
 you derive from that?
 		-- Douglas Engelbart, Fall Joint Computer Conference,
 		   December 9th, 1968
+%
+They made me do it
+%
+It was the first thing that I formed a really powerful bond with.
+It was some sort of mental love missile and I just lit the touch paper and
+fired myself into it, at oblivious speed, and it exploded, and sparkled and it
+was totally beautiful.
+		-- Chris Packham and the kestrel
+%
+Austerity is the idea that the global financial crash of 2008 was caused by
+there being too many libraries in Wolverhampton.
+		-- Alexei Sayle
+%
+I wonder why. I wonder why.
+I wonder why I wonder.
+I wonder why I wonder why
+I wonder why I wonder!
+		-- Richard P. Feynman, "Always Trying to Escape"

Index: src/games/fortune/datfiles/netbsd
diff -u src/games/fortune/datfiles/netbsd:1.28 src/games/fortune/datfiles/netbsd:1.28.14.1
--- src/games/fortune/datfiles/netbsd:1.28	Sun Apr 16 20:08:59 2017
+++ src/games/fortune/datfiles/netbsd	Sun Dec  8 13:06:37 2019
@@ -552,3 +552,6 @@ NetBSD: Dead on Target
 		-- Gimpy
 %
 NetBSD JIHBED
+%
+It's my happy place.
+		-- zmh



CVS commit: [netbsd-9] src/usr.bin/calendar/calendars

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 13:01:10 UTC 2019

Modified Files:
src/usr.bin/calendar/calendars [netbsd-9]: calendar.birthday
calendar.computer calendar.music calendar.netbsd calendar.usholiday

Log Message:
Pull up following revision(s) (requested by sevan in ticket #500):

usr.bin/calendar/calendars/calendar.music: revision 1.20
usr.bin/calendar/calendars/calendar.computer: revision 1.8
usr.bin/calendar/calendars/calendar.computer: revision 1.9
usr.bin/calendar/calendars/calendar.usholiday: revision 1.9
usr.bin/calendar/calendars/calendar.birthday: revision 1.30
usr.bin/calendar/calendars/calendar.birthday: revision 1.31
usr.bin/calendar/calendars/calendar.birthday: revision 1.32
usr.bin/calendar/calendars/calendar.birthday: revision 1.33
usr.bin/calendar/calendars/calendar.birthday: revision 1.34
usr.bin/calendar/calendars/calendar.birthday: revision 1.35
usr.bin/calendar/calendars/calendar.netbsd: revision 1.41
usr.bin/calendar/calendars/calendar.netbsd: revision 1.42
usr.bin/calendar/calendars/calendar.netbsd: revision 1.43

Add Danny Cohen
https://www.nytimes.com/2019/08/16/obituaries/danny-cohen-who-helped-set-the-stage-for-a-digital-era-dies-at-81.html

Add 8.1 release

sort

We use spaces, not tabs here

Add Alan Perlis

Add SICP
https://twitter.com/mit_csail/status/1164226910035087360

Add Ted Nelson's birthday

Belatedly update several entries that move from year to year.

Add Aaron Swartz and Steve Jobs

Add Grace Hopper and Richard Feynman

Sort


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.2.1 \
src/usr.bin/calendar/calendars/calendar.birthday
cvs rdiff -u -r1.7 -r1.7.2.1 src/usr.bin/calendar/calendars/calendar.computer
cvs rdiff -u -r1.19 -r1.19.2.1 src/usr.bin/calendar/calendars/calendar.music
cvs rdiff -u -r1.40 -r1.40.2.1 src/usr.bin/calendar/calendars/calendar.netbsd
cvs rdiff -u -r1.8 -r1.8.4.1 \
src/usr.bin/calendar/calendars/calendar.usholiday

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.29 src/usr.bin/calendar/calendars/calendar.birthday:1.29.2.1
--- src/usr.bin/calendar/calendars/calendar.birthday:1.29	Sun Jul 14 10:43:01 2019
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sun Dec  8 13:01:10 2019
@@ -1,6 +1,7 @@
+01/01	Grace Brewster Murray Hopper died in Arlington, Virginia, 1992
+01/01	Heinz Zemanek born in Vienna, Austria, 1920
 01/01	J.D. Salinger born, 1919
 01/01	Paul Revere born in Boston, 1735
-01/01	Heinz Zemanek born in Vienna, Austria, 1920
 01/02	Isaac Asimov born in Petrovichi, Russian SFSR (now Russia), 1920
 01/04	George Washington Carver born in Missouri, 1864
 01/04	Jakob Grimm born, 1785
@@ -8,6 +9,7 @@
 01/05	DeWitt B. Brace born, 1859, inventor of spectrophotometer
 01/08	Stephen Hawking born in Oxford, England, 1942
 01/10	Ethan Allen born, 1738
+01/11	Aaron Hillel Swartz died in Brooklyn, New York, 2013
 01/11	Alexander Hamilton born in Nevis, British West Indies, 1757?
 01/12	"Long" John Baldry born in London, 1941
 01/13	Horatio Alger born, 1834
@@ -20,8 +22,8 @@
 01/19	Robert Edward Lee born in Stratford Estate, Virginia, 1807
 01/20	Buzz Aldrin born, 1930
 01/20	George Burns born, 1898
-01/21	Vladimir Lenin died, 1924
 01/21	Thomas Jonathan "Stonewall" Jackson born in Clarksburg, VA, 1824
+01/21	Vladimir Lenin died, 1924
 01/22	Sir Francis Bacon born, 1561
 01/23	Ernst Abbe born, 1840, formulated diffraction theory
 01/23	Humphrey Bogart born in New York City, 1899
@@ -37,6 +39,7 @@
 02/03	Gertrude Stein born, 1874
 02/05	Alex Harvey (SAHB) born in Glasgow, Scotland, 1935
 02/06	King George VI of UK dies;  his daughter becomes Elizabeth II, 1952
+02/07	Alay Jay Perlis died in New Haven, Connecticut, 1990
 02/07	Sinclair Lewis born, 1885
 02/08	Friedleib F. Runge born, 1795, father of paper chromatography
 02/08	John von Neumann died, 1957
@@ -49,6 +52,7 @@
 02/12	Abraham Lincoln born, 1809
 02/12	Charles Darwin born in Shrewsbury, England, 1809
 02/15	Galileo Galilei born in Pisa, Italy, 1564
+02/15	Richard Philips Feynman died in Los Angeles, California, 1988
 02/15	Susan B. Anthony born, 1820
 02/16	Pierre Bouguer born, 1698, founder of photometry
 02/17	Frederick Eugene Ives born, 1856, pioneer of halftone
@@ -61,6 +65,7 @@
 02/22	George Washington born, 1732
 02/22	Pierre Jules Cesar Janssen born, 1838, found hydrogen in the sun
 02/23	W.E.B. DuBois born, 1868
+02/24	Steven Paul Jobs was born in San Francisco, California, 1955
 02/24	Winslow Homer born, 1836
 02/25	George Harrison born in Liverpool, England, 1943
 02/25	Renoir born, 1841
@@ -75,17 +80,17 @@
 03/07	Sir John Frederick William Herschel born, 1792, astronomer
 03/08	Alvan Clark born, 1804, astronomer 

CVS commit: [netbsd-9] src/sys/arch

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 12:57:21 UTC 2019

Modified Files:
src/sys/arch/arm/ti [netbsd-9]: am3_prcm.c files.ti
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC
Added Files:
src/sys/arch/arm/ti [netbsd-9]: ti_wdt.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #499):

sys/arch/arm/ti/ti_wdt.c: revision 1.1
sys/arch/arm/ti/am3_prcm.c: revision 1.12
sys/arch/arm/ti/files.ti: revision 1.21
sys/arch/evbarm/conf/GENERIC: revision 1.68

Add TI OMAP watchdog timer driver.
Add tiwdt


To generate a diff of this commit:
cvs rdiff -u -r1.1.10.2 -r1.1.10.3 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.4.4.1 -r1.4.4.2 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/ti/ti_wdt.c
cvs rdiff -u -r1.48.2.4 -r1.48.2.5 src/sys/arch/evbarm/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/arm/ti/am3_prcm.c
diff -u src/sys/arch/arm/ti/am3_prcm.c:1.1.10.2 src/sys/arch/arm/ti/am3_prcm.c:1.1.10.3
--- src/sys/arch/arm/ti/am3_prcm.c:1.1.10.2	Sun Dec  8 12:54:10 2019
+++ src/sys/arch/arm/ti/am3_prcm.c	Sun Dec  8 12:57:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: am3_prcm.c,v 1.1.10.2 2019/12/08 12:54:10 martin Exp $ */
+/* $NetBSD: am3_prcm.c,v 1.1.10.3 2019/12/08 12:57:21 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.1.10.2 2019/12/08 12:54:10 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.1.10.3 2019/12/08 12:57:21 martin Exp $");
 
 #include 
 #include 
@@ -169,6 +169,8 @@ static struct ti_prcm_clk am3_prcm_clks[
 	AM3_PRCM_HWMOD_PER("timer6", 0xf0, "FIXED_24MHZ"),
 	AM3_PRCM_HWMOD_PER("timer7", 0x7c, "FIXED_24MHZ"),
 
+	AM3_PRCM_HWMOD_WKUP("wd_timer2", 0xd4, "FIXED_32K"),
+
 	AM3_PRCM_HWMOD_PER("mmc1", 0x3c, "MMC_CLK"),
 	AM3_PRCM_HWMOD_PER("mmc2", 0xf4, "MMC_CLK"),
 	AM3_PRCM_HWMOD_PER("mmc3", 0xf8, "MMC_CLK"),

Index: src/sys/arch/arm/ti/files.ti
diff -u src/sys/arch/arm/ti/files.ti:1.4.4.1 src/sys/arch/arm/ti/files.ti:1.4.4.2
--- src/sys/arch/arm/ti/files.ti:1.4.4.1	Wed Nov 27 13:46:44 2019
+++ src/sys/arch/arm/ti/files.ti	Sun Dec  8 12:57:21 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ti,v 1.4.4.1 2019/11/27 13:46:44 martin Exp $
+#	$NetBSD: files.ti,v 1.4.4.2 2019/12/08 12:57:21 martin Exp $
 #
 
 file	arch/arm/ti/ti_cpufreq.c	soc_ti
@@ -131,6 +131,11 @@ device	omapnand: nandbus
 attach	omapnand at fdt
 file	arch/arm/ti/omap2_nand.c	omapnand
 
+# Watchdog timer
+device	tiwdt: sysmon_wdog
+attach	tiwdt at fdt with ti_wdt
+file	arch/arm/ti/ti_wdt.c		ti_wdt
+
 # SOC parameters
 defflag	opt_soc.h			SOC_TI
 defflag	opt_soc.h			SOC_AM33XX: SOC_TI

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.48.2.4 src/sys/arch/evbarm/conf/GENERIC:1.48.2.5
--- src/sys/arch/evbarm/conf/GENERIC:1.48.2.4	Wed Nov 27 13:46:44 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Sun Dec  8 12:57:21 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.48.2.4 2019/11/27 13:46:44 martin Exp $
+#	$NetBSD: GENERIC,v 1.48.2.5 2019/12/08 12:57:21 martin Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -399,10 +399,11 @@ sunxihstimer* 	at fdt?			# Allwinner Hig
 tegratimer* 	at fdt?			# Timers
 
 # Watchdog
+bcmpmwdog* 	at fdt?			# Broadcom BCM283x watchdog
 dwcwdt* 	at fdt?			# DesignWare watchdog
 mesonwdt* 	at fdt?			# Amlogic Meson watchdog
 sunxiwdt* 	at fdt?			# Allwinner watchdog
-bcmpmwdog* 	at fdt?			# Broadcom BCM283x watchdog
+tiwdt*		at fdt?			# TI OMAP watchdog
 
 # Interrupt controller
 gic*		at fdt? pass 1		# ARM GIC

Added files:

Index: src/sys/arch/arm/ti/ti_wdt.c
diff -u /dev/null src/sys/arch/arm/ti/ti_wdt.c:1.1.2.2
--- /dev/null	Sun Dec  8 12:57:21 2019
+++ src/sys/arch/arm/ti/ti_wdt.c	Sun Dec  8 12:57:21 2019
@@ -0,0 +1,259 @@
+/* $NetBSD: ti_wdt.c,v 1.1.2.2 2019/12/08 12:57:21 martin Exp $ */
+
+/*-
+ * Copyright (c) 2019 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, 

CVS commit: [netbsd-9] src/sys/arch/arm/rockchip

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 12:55:30 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip [netbsd-9]: rk3399_pcie.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #498):

sys/arch/arm/rockchip/rk3399_pcie.c: revision 1.7

Do not crash if the optional vpcie3v3-supply property is missing or the
regulator can not be found.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/rockchip/rk3399_pcie.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/rk3399_pcie.c
diff -u src/sys/arch/arm/rockchip/rk3399_pcie.c:1.6 src/sys/arch/arm/rockchip/rk3399_pcie.c:1.6.2.1
--- src/sys/arch/arm/rockchip/rk3399_pcie.c:1.6	Sun Jun 23 16:15:43 2019
+++ src/sys/arch/arm/rockchip/rk3399_pcie.c	Sun Dec  8 12:55:30 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_pcie.c,v 1.6 2019/06/23 16:15:43 jmcneill Exp $ */
+/* $NetBSD: rk3399_pcie.c,v 1.6.2.1 2019/12/08 12:55:30 martin Exp $ */
 /*
  * Copyright (c) 2018 Mark Kettenis 
  *
@@ -17,7 +17,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.6 2019/06/23 16:15:43 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.6.2.1 2019/12/08 12:55:30 martin Exp $");
 
 #include 
 #include 
@@ -241,8 +241,10 @@ rkpcie_attach(device_t parent, device_t 
 
 	struct fdtbus_regulator *regulator;
 	regulator = fdtbus_regulator_acquire(phandle, "vpcie3v3-supply");
-	fdtbus_regulator_enable(regulator);
-	fdtbus_regulator_release(regulator);
+	if (regulator != NULL) {
+		fdtbus_regulator_enable(regulator);
+		fdtbus_regulator_release(regulator);
+	}
 		
 	fdtbus_clock_assign(phandle);
 	clock_enable_all(phandle);



CVS commit: [netbsd-9] src/sys/arch/arm/ti

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 12:54:10 UTC 2019

Modified Files:
src/sys/arch/arm/ti [netbsd-9]: am3_prcm.c ti_sdhc.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #497):

sys/arch/arm/ti/ti_sdhc.c: revision 1.4
sys/arch/arm/ti/ti_sdhc.c: revision 1.5
sys/arch/arm/ti/am3_prcm.c: revision 1.11

Fix mmc and timer indexes.
Fix inverted ti,needs-special-hs-handling property logic and enable EDMA support
Support 1-bit mode and force all xfers to bounce to workaround a transfer error 
issue for now


To generate a diff of this commit:
cvs rdiff -u -r1.1.10.1 -r1.1.10.2 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/arch/arm/ti/ti_sdhc.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/ti/am3_prcm.c
diff -u src/sys/arch/arm/ti/am3_prcm.c:1.1.10.1 src/sys/arch/arm/ti/am3_prcm.c:1.1.10.2
--- src/sys/arch/arm/ti/am3_prcm.c:1.1.10.1	Wed Nov 27 13:46:44 2019
+++ src/sys/arch/arm/ti/am3_prcm.c	Sun Dec  8 12:54:10 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: am3_prcm.c,v 1.1.10.1 2019/11/27 13:46:44 martin Exp $ */
+/* $NetBSD: am3_prcm.c,v 1.1.10.2 2019/12/08 12:54:10 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.1.10.1 2019/11/27 13:46:44 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.1.10.2 2019/12/08 12:54:10 martin Exp $");
 
 #include 
 #include 
@@ -161,7 +161,7 @@ static struct ti_prcm_clk am3_prcm_clks[
 	AM3_PRCM_HWMOD_PER("gpio3", 0xb0, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("gpio4", 0xb4, "PERIPH_CLK"),
 
-	AM3_PRCM_HWMOD_WKUP("timer0", 0x10, "FIXED_32K"),
+	AM3_PRCM_HWMOD_WKUP("timer1", 0x10, "FIXED_32K"),
 	AM3_PRCM_HWMOD_PER("timer2", 0x80, "FIXED_24MHZ"),
 	AM3_PRCM_HWMOD_PER("timer3", 0x84, "FIXED_24MHZ"),
 	AM3_PRCM_HWMOD_PER("timer4", 0x88, "FIXED_24MHZ"),
@@ -169,9 +169,9 @@ static struct ti_prcm_clk am3_prcm_clks[
 	AM3_PRCM_HWMOD_PER("timer6", 0xf0, "FIXED_24MHZ"),
 	AM3_PRCM_HWMOD_PER("timer7", 0x7c, "FIXED_24MHZ"),
 
-	AM3_PRCM_HWMOD_PER("mmc0", 0x3c, "MMC_CLK"),
-	AM3_PRCM_HWMOD_PER("mmc1", 0xf4, "MMC_CLK"),
-	AM3_PRCM_HWMOD_PER("mmc2", 0xf8, "MMC_CLK"),
+	AM3_PRCM_HWMOD_PER("mmc1", 0x3c, "MMC_CLK"),
+	AM3_PRCM_HWMOD_PER("mmc2", 0xf4, "MMC_CLK"),
+	AM3_PRCM_HWMOD_PER("mmc3", 0xf8, "MMC_CLK"),
 
 	AM3_PRCM_HWMOD_PER("tpcc", 0xbc, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("tptc0", 0x24, "PERIPH_CLK"),

Index: src/sys/arch/arm/ti/ti_sdhc.c
diff -u src/sys/arch/arm/ti/ti_sdhc.c:1.3.2.2 src/sys/arch/arm/ti/ti_sdhc.c:1.3.2.3
--- src/sys/arch/arm/ti/ti_sdhc.c:1.3.2.2	Wed Nov 27 13:46:44 2019
+++ src/sys/arch/arm/ti/ti_sdhc.c	Sun Dec  8 12:54:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ti_sdhc.c,v 1.3.2.2 2019/11/27 13:46:44 martin Exp $	*/
+/*	$NetBSD: ti_sdhc.c,v 1.3.2.3 2019/12/08 12:54:10 martin Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.3.2.2 2019/11/27 13:46:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.3.2.3 2019/12/08 12:54:10 martin Exp $");
 
 #include 
 #include 
@@ -180,7 +180,6 @@ ti_sdhc_attach(device_t parent, device_t
 	sc->sc_addr = addr;
 	sc->sc_bst = faa->faa_bst;
 
-#if notyet
 	/* XXX use fdtbus_dma API */
 	int len;
 	const u_int *dmas = fdtbus_get_prop(phandle, "dmas", );
@@ -198,10 +197,6 @@ ti_sdhc_attach(device_t parent, device_t
 		sc->sc_edma_chan[EDMA_CHAN_RX] = -1;
 		break;
 	}
-#else
-	sc->sc_edma_chan[EDMA_CHAN_TX] = -1;
-	sc->sc_edma_chan[EDMA_CHAN_RX] = -1;
-#endif
 
 	if (bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh) != 0) {
 		aprint_error(": couldn't map registers\n");
@@ -219,7 +214,7 @@ ti_sdhc_attach(device_t parent, device_t
 		sc->sc.sc_flags |= SDHC_FLAG_8BIT_MODE;
 	if (of_hasprop(phandle, "ti,needs-special-reset"))
 		sc->sc.sc_flags |= SDHC_FLAG_WAIT_RESET;
-	if (of_hasprop(phandle, "ti,needs-special-hs-handling"))
+	if (!of_hasprop(phandle, "ti,needs-special-hs-handling"))
 		sc->sc.sc_flags |= SDHC_FLAG_NO_HS_BIT;
 	if (of_hasprop(phandle, "ti,dual-volt"))
 		sc->sc.sc_caps = SDHC_VOLTAGE_SUPP_3_0V;
@@ -433,15 +428,21 @@ static int
 ti_sdhc_bus_width(struct sdhc_softc *sc, int width)
 {
 	struct ti_sdhc_softc *hmsc = (struct ti_sdhc_softc *)sc;
-	uint32_t con;
+	uint32_t con, hctl;
 
 	con = bus_space_read_4(hmsc->sc_bst, hmsc->sc_bsh, MMCHS_CON);
+	hctl = SDHC_READ(hmsc, SDHC_HOST_CTL);
 	if (width == 8) {
 		con |= CON_DW8;
+	} else if (width == 4) {
+		con &= ~CON_DW8;
+		hctl |= SDHC_4BIT_MODE;
 	} else {
 		con &= ~CON_DW8;
+		hctl &= ~SDHC_4BIT_MODE;
 	}
 	bus_space_write_4(hmsc->sc_bst, hmsc->sc_bsh, MMCHS_CON, con);
+	SDHC_WRITE(hmsc, SDHC_HOST_CTL, hctl);
 
 	return 0;
 }
@@ -492,6 +493,13 @@ ti_sdhc_edma_init(struct ti_sdhc_softc *
 		error);
 		return error;
 	}
+	error = 

CVS commit: [netbsd-9] src/distrib/notes/sparc

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 12:50:44 UTC 2019

Modified Files:
src/distrib/notes/sparc [netbsd-9]: contents

Log Message:
Pull up following revision(s) (requested by uwe in ticket #495):

distrib/notes/sparc/contents: revision 1.26

It's KRUPS not GENERIC-KRUPS.


To generate a diff of this commit:
cvs rdiff -u -r1.23.4.2 -r1.23.4.3 src/distrib/notes/sparc/contents

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/notes/sparc/contents
diff -u src/distrib/notes/sparc/contents:1.23.4.2 src/distrib/notes/sparc/contents:1.23.4.3
--- src/distrib/notes/sparc/contents:1.23.4.2	Mon Nov 25 05:50:15 2019
+++ src/distrib/notes/sparc/contents	Sun Dec  8 12:50:44 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.23.4.2 2019/11/25 05:50:15 msaitoh Exp $
+.\"	$NetBSD: contents,v 1.23.4.3 2019/12/08 12:50:44 martin Exp $
 .\"
 .\" Copyright (c) 1999-2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -240,7 +240,7 @@ kernel, which supports only UltraSPARC s
 This set contains a
 .Nx*M
 \*V
-.Li GENERIC-KRUPS
+.Li KRUPS
 kernel, which supports the JavaStation-NC, named
 .Pa /netbsd .
 .It Sy kern-MRCOFFEE



CVS commit: [netbsd-9] src/sys/arch/powerpc/oea

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 12:48:14 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea [netbsd-9]: ofw_autoconf.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #494):

sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.24

Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.4.1 src/sys/arch/powerpc/oea/ofw_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/powerpc/oea/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.23 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.23.4.1
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.23	Wed Nov 21 17:54:42 2018
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sun Dec  8 12:48:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.23 2018/11/21 17:54:42 scole Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.23.4.1 2019/12/08 12:48:14 martin Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.23 2018/11/21 17:54:42 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.23.4.1 2019/12/08 12:48:14 martin Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -137,10 +137,17 @@ canonicalize_bootpath(void)
 	 *   /pci/mac-io/ata-3@2000/disk@0:0/netbsd.new		(OF-3.x)
 	 */
 	strcpy(cbootpath, bootpath);
-	while ((node = OF_finddevice(cbootpath)) == -1) {
-		if ((p = strrchr(cbootpath, '/')) == NULL)
-			break;
-		*p = '\0';
+
+	if ((node = OF_finddevice("/options")) == -1 ||
+	OF_getprop(node, "qemu_boot_hack", type, sizeof(type) - 1) == -1 ||
+	type[0] != 'y') {
+		while ((node = OF_finddevice(cbootpath)) == -1) {
+			if ((p = strrchr(cbootpath, '/')) == NULL)
+break;
+			*p = '\0';
+		}
+	} else {
+		node = -1;
 	}
 
 	printf("bootpath: %s\n", bootpath);



CVS commit: src/share/man/man9

2019-12-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec  8 12:23:00 UTC 2019

Modified Files:
src/share/man/man9: dksubr.9

Log Message:
Drop comment about dk_lookup being in the wrong place.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man9/dksubr.9

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/man9/dksubr.9
diff -u src/share/man/man9/dksubr.9:1.6 src/share/man/man9/dksubr.9:1.7
--- src/share/man/man9/dksubr.9:1.6	Sat Oct 21 21:18:33 2017
+++ src/share/man/man9/dksubr.9	Sun Dec  8 12:23:00 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dksubr.9,v 1.6 2017/10/21 21:18:33 wiz Exp $
+.\"	$NetBSD: dksubr.9,v 1.7 2019/12/08 12:23:00 mlelstv Exp $
 .\"
 .\" Copyright (c) 2016 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -307,11 +307,3 @@ to support other disk drivers.
 The callback interface used by the
 .Xr disk 9
 framework has been merged as well.
-.Sh BUGS
-The framework includes a
-.Nm dk_lookup
-helper function, that is used by the
-.Xr cgd 4
-driver to open a vnode for a block device.
-This looks too generic
-and should be put somewhere better (and be renamed).



CVS commit: src/sys/dev

2019-12-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec  8 12:14:41 UTC 2019

Modified Files:
src/sys/dev: ccd.c cgd.c
src/sys/dev/dm: dm_pdev.c
src/sys/dev/raidframe: rf_copyback.c rf_disks.c rf_reconstruct.c

Log Message:
Switch to vn_bdev_open* functions.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/dev/ccd.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/cgd.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/raidframe/rf_copyback.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/raidframe/rf_disks.c
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/raidframe/rf_reconstruct.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/ccd.c
diff -u src/sys/dev/ccd.c:1.180 src/sys/dev/ccd.c:1.181
--- src/sys/dev/ccd.c:1.180	Wed Aug  7 00:38:01 2019
+++ src/sys/dev/ccd.c	Sun Dec  8 12:14:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd.c,v 1.180 2019/08/07 00:38:01 pgoyette Exp $	*/
+/*	$NetBSD: ccd.c,v 1.181 2019/12/08 12:14:40 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.180 2019/08/07 00:38:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.181 2019/12/08 12:14:40 mlelstv Exp $");
 
 #include 
 #include 
@@ -1222,7 +1222,7 @@ ccdioctl(dev_t dev, u_long cmd, void *da
 #endif
 			error = pathbuf_copyin(cpp[i], );
 			if (error == 0) {
-error = dk_lookup(pb, l, [i]);
+error = vn_bdev_openpath(pb, [i], l);
 			}
 			pathbuf_destroy(pb);
 			if (error != 0) {

Index: src/sys/dev/cgd.c
diff -u src/sys/dev/cgd.c:1.116 src/sys/dev/cgd.c:1.117
--- src/sys/dev/cgd.c:1.116	Tue Jan 23 22:42:29 2018
+++ src/sys/dev/cgd.c	Sun Dec  8 12:14:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.116 2018/01/23 22:42:29 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.117 2019/12/08 12:14:40 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116 2018/01/23 22:42:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.117 2019/12/08 12:14:40 mlelstv Exp $");
 
 #include 
 #include 
@@ -782,7 +782,7 @@ cgd_ioctl_set(struct cgd_softc *cs, void
 	if (ret != 0) {
 		return ret;
 	}
-	ret = dk_lookup(pb, l, );
+	ret = vn_bdev_openpath(pb, , l);
 	pathbuf_destroy(pb);
 	if (ret != 0) {
 		return ret;

Index: src/sys/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.18 src/sys/dev/dm/dm_pdev.c:1.19
--- src/sys/dev/dm/dm_pdev.c:1.18	Sat Dec  7 15:28:39 2019
+++ src/sys/dev/dm/dm_pdev.c	Sun Dec  8 12:14:40 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.18 2019/12/07 15:28:39 tkusumi Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.18 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $");
 
 #include 
 #include 
@@ -116,10 +116,10 @@ dm_pdev_insert(const char *dev_name)
 		kmem_free(dmp, sizeof(dm_pdev_t));
 		return NULL;
 	}
-	error = dk_lookup(dev_pb, curlwp, >pdev_vnode);
+	error = vn_bdev_openpath(dev_pb, >pdev_vnode, curlwp);
 	pathbuf_destroy(dev_pb);
 	if (error) {
-		aprint_debug("%s: dk_lookup on device: %s (error %d)\n",
+		aprint_debug("%s: lookup on device: %s (error %d)\n",
 		__func__, dev_name, error);
 		mutex_exit(_pdev_mutex);
 		kmem_free(dmp, sizeof(dm_pdev_t));

Index: src/sys/dev/raidframe/rf_copyback.c
diff -u src/sys/dev/raidframe/rf_copyback.c:1.52 src/sys/dev/raidframe/rf_copyback.c:1.53
--- src/sys/dev/raidframe/rf_copyback.c:1.52	Thu Oct 10 03:43:59 2019
+++ src/sys/dev/raidframe/rf_copyback.c	Sun Dec  8 12:14:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_copyback.c,v 1.52 2019/10/10 03:43:59 christos Exp $	*/
+/*	$NetBSD: rf_copyback.c,v 1.53 2019/12/08 12:14:40 mlelstv Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -38,7 +38,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.52 2019/10/10 03:43:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.53 2019/12/08 12:14:40 mlelstv Exp $");
 
 #include 
 
@@ -144,11 +144,11 @@ rf_CopybackReconstructedData(RF_Raid_t *
 		   ENOMEM);
 		return;
 	}
-	retcode = dk_lookup(dev_pb, curlwp, );
+	retcode = vn_bdev_openpath(dev_pb, , curlwp);
 	pathbuf_destroy(dev_pb);
 
 	if (retcode) {
-		printf("raid%d: copyback: dk_lookup on device: %s failed: %d!\n",
+		printf("raid%d: copyback: open device: %s failed: %d!\n",
 		   raidPtr->raidid, raidPtr->Disks[fcol].devname,
 		   retcode);
 

Index: src/sys/dev/raidframe/rf_disks.c

CVS commit: src/sys/dev

2019-12-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec  8 12:15:24 UTC 2019

Modified Files:
src/sys/dev: dksubr.c dkvar.h

Log Message:
Drop now unused dk_lookup function.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/dksubr.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dkvar.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/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.110 src/sys/dev/dksubr.c:1.111
--- src/sys/dev/dksubr.c:1.110	Sat Oct  5 05:28:44 2019
+++ src/sys/dev/dksubr.c	Sun Dec  8 12:15:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.111 2019/12/08 12:15:24 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.111 2019/12/08 12:15:24 mlelstv Exp $");
 
 #include 
 #include 
@@ -999,66 +999,6 @@ dk_makedisklabel(struct dk_softc *dksc)
 	lp->d_checksum = dkcksum(lp);
 }
 
-/* This function is taken from ccd.c:1.76  --rcd */
-
-/*
- * XXX this function looks too generic for dksubr.c, shouldn't we
- * put it somewhere better?
- */
-
-/*
- * Lookup the provided name in the filesystem.  If the file exists,
- * is a valid block device, and isn't being used by anyone else,
- * set *vpp to the file's vnode.
- */
-int
-dk_lookup(struct pathbuf *pb, struct lwp *l, struct vnode **vpp)
-{
-	struct nameidata nd;
-	struct vnode *vp;
-	int error;
-
-	if (l == NULL)
-		return ESRCH;	/* Is ESRCH the best choice? */
-
-	NDINIT(, LOOKUP, FOLLOW, pb);
-	if ((error = vn_open(, FREAD | FWRITE, 0)) != 0) {
-		DPRINTF((DKDB_FOLLOW|DKDB_INIT),
-		("%s: vn_open error = %d\n", __func__, error));
-		return error;
-	}
-
-	vp = nd.ni_vp;
-	if (vp->v_type != VBLK) {
-		error = ENOTBLK;
-		goto out;
-	}
-
-	/* Reopen as anonymous vnode to protect against forced unmount. */
-	if ((error = bdevvp(vp->v_rdev, vpp)) != 0)
-		goto out;
-	VOP_UNLOCK(vp);
-	if ((error = vn_close(vp, FREAD | FWRITE, l->l_cred)) != 0) {
-		vrele(*vpp);
-		return error;
-	}
-	if ((error = VOP_OPEN(*vpp, FREAD | FWRITE, l->l_cred)) != 0) {
-		vrele(*vpp);
-		return error;
-	}
-	mutex_enter((*vpp)->v_interlock);
-	(*vpp)->v_writecount++;
-	mutex_exit((*vpp)->v_interlock);
-
-	IFDEBUG(DKDB_VNODE, vprint("dk_lookup: vnode info", *vpp));
-
-	return 0;
-out:
-	VOP_UNLOCK(vp);
-	(void) vn_close(vp, FREAD | FWRITE, l->l_cred);
-	return error;
-}
-
 MODULE(MODULE_CLASS_MISC, dk_subr, NULL);
 
 static int

Index: src/sys/dev/dkvar.h
diff -u src/sys/dev/dkvar.h:1.30 src/sys/dev/dkvar.h:1.31
--- src/sys/dev/dkvar.h:1.30	Wed Nov  1 19:15:31 2017
+++ src/sys/dev/dkvar.h	Sun Dec  8 12:15:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dkvar.h,v 1.30 2017/11/01 19:15:31 mlelstv Exp $ */
+/* $NetBSD: dkvar.h,v 1.31 2019/12/08 12:15:24 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -110,6 +110,4 @@ int	dk_dump(struct dk_softc *, dev_t,
 void	dk_getdisklabel(struct dk_softc *, dev_t);
 void	dk_getdefaultlabel(struct dk_softc *, struct disklabel *);
 
-int	dk_lookup(struct pathbuf *, struct lwp *, struct vnode **);
-
 #endif /* ! _DEV_DKVAR_H_ */   



CVS commit: src/sys

2019-12-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec  8 11:53:54 UTC 2019

Modified Files:
src/sys/arch/amd64/include: cpu.h
src/sys/kern: subr_msan.c

Log Message:
Use the inlines; it is actually fine, since the compiler drops the inlines
if the caller is kmsan-instrumented, forcing a white-listing of the memory
access.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/amd64/include/cpu.h
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_msan.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/include/cpu.h
diff -u src/sys/arch/amd64/include/cpu.h:1.66 src/sys/arch/amd64/include/cpu.h:1.67
--- src/sys/arch/amd64/include/cpu.h:1.66	Thu Nov 21 19:23:58 2019
+++ src/sys/arch/amd64/include/cpu.h	Sun Dec  8 11:53:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.66 2019/11/21 19:23:58 ad Exp $	*/
+/*	$NetBSD: cpu.h,v 1.67 2019/12/08 11:53:54 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -43,23 +43,12 @@
 
 #ifdef _KERNEL
 
-#ifdef _KERNEL_OPT
-#include "opt_kmsan.h"
-#endif
-
 #if defined(__GNUC__) && !defined(_MODULE)
 
-/*
- * KMSAN: disable the inlines below, to force the use of the ASM functions,
- * where no KMSAN instrumentation is added. This is because the instrumentation
- * does not handle the segment registers correctly. And there appears to be no
- * way to tell LLVM not to add KMSAN instrumentation in these __asm blocks.
- */
-#if !defined(KMSAN) || defined(KMSAN_NO_INST)
 static struct cpu_info *x86_curcpu(void);
 static lwp_t *x86_curlwp(void);
 
-__inline static struct cpu_info * __unused
+__inline static struct cpu_info * __unused __nomsan
 x86_curcpu(void)
 {
 	struct cpu_info *ci;
@@ -71,7 +60,7 @@ x86_curcpu(void)
 	return ci;
 }
 
-__inline static lwp_t * __unused __attribute__ ((const))
+__inline static lwp_t * __unused __nomsan __attribute__ ((const))
 x86_curlwp(void)
 {
 	lwp_t *l;
@@ -82,10 +71,6 @@ x86_curlwp(void)
 	(*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));
 	return l;
 }
-#else
-struct cpu_info *x86_curcpu(void);
-lwp_t *x86_curlwp(void);
-#endif
 
 #endif	/* __GNUC__ && !_MODULE */
 

Index: src/sys/kern/subr_msan.c
diff -u src/sys/kern/subr_msan.c:1.4 src/sys/kern/subr_msan.c:1.5
--- src/sys/kern/subr_msan.c:1.4	Fri Dec  6 16:54:47 2019
+++ src/sys/kern/subr_msan.c	Sun Dec  8 11:53:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_msan.c,v 1.4 2019/12/06 16:54:47 maxv Exp $	*/
+/*	$NetBSD: subr_msan.c,v 1.5 2019/12/08 11:53:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -29,10 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define KMSAN_NO_INST
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.4 2019/12/06 16:54:47 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.5 2019/12/08 11:53:54 maxv Exp $");
 
 #include 
 #include 



CVS commit: src/sys/sys

2019-12-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec  8 11:48:15 UTC 2019

Modified Files:
src/sys/sys: cdefs.h

Log Message:
Fix __nomsan: missing opt_kmsan.h, and the attribute should be
kernel-memory.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/sys/cdefs.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/cdefs.h
diff -u src/sys/sys/cdefs.h:1.149 src/sys/sys/cdefs.h:1.150
--- src/sys/sys/cdefs.h:1.149	Thu Nov 14 16:23:53 2019
+++ src/sys/sys/cdefs.h	Sun Dec  8 11:48:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.149 2019/11/14 16:23:53 maxv Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.150 2019/12/08 11:48:15 maxv Exp $	*/
 
 /* * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -40,6 +40,7 @@
 #include "opt_diagnostic.h"
 #include "opt_kasan.h"
 #include "opt_kcsan.h"
+#include "opt_kmsan.h"
 #endif
 
 /*
@@ -349,7 +350,7 @@
 #endif
 
 #if defined(__clang__) && defined(KMSAN)
-#define	__nomsan	__attribute__((no_sanitize("memory")))
+#define	__nomsan	__attribute__((no_sanitize("kernel-memory")))
 #else
 #define	__nomsan	/* nothing */
 #endif



CVS commit: src/share/man/man4

2019-12-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Dec  8 10:57:17 UTC 2019

Modified Files:
src/share/man/man4: audio.4

Log Message:
Sort SEE ALSO.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/share/man/man4/audio.4

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/man4/audio.4
diff -u src/share/man/man4/audio.4:1.94 src/share/man/man4/audio.4:1.95
--- src/share/man/man4/audio.4:1.94	Sun Dec  8 02:57:52 2019
+++ src/share/man/man4/audio.4	Sun Dec  8 10:57:17 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.94 2019/12/08 02:57:52 nia Exp $
+.\"	$NetBSD: audio.4,v 1.95 2019/12/08 10:57:17 wiz Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -786,11 +786,11 @@ string values.
 .\" .Xr evbarm/pxaacu 4 ,
 .\" .Xr evbarm/udassio 4 ,
 .Xr fms 4 ,
-.Xr hdaudio 4 ,
 .Xr gcscaudio 4 ,
 .Xr gus 4 ,
 .Xr guspnp 4 ,
 .Xr hdafg 4 ,
+.Xr hdaudio 4 ,
 .Xr hppa/harmony 4 ,
 .Xr macppc/awacs 4 ,
 .Xr macppc/snapper 4 ,



CVS commit: src/sys/dev/dm

2019-12-08 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 10:50:21 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target_mirror.c dm_target_snapshot.c
dm_target_stripe.c

Log Message:
dm: Move targets specific structs to .c files

These don't need to be defined and exposed in dm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target_stripe.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/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.36 src/sys/dev/dm/dm.h:1.37
--- src/sys/dev/dm/dm.h:1.36	Sun Dec  8 10:35:53 2019
+++ src/sys/dev/dm/dm.h	Sun Dec  8 10:50:21 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.36 2019/12/08 10:35:53 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.37 2019/12/08 10:50:21 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -170,45 +170,6 @@ TAILQ_HEAD(target_linear_devs, target_li
 
 typedef struct target_linear_devs dm_target_linear_devs_t;
 
-/* for stripe : */
-typedef struct target_stripe_config {
-#define DM_STRIPE_DEV_OFFSET 2
-	struct target_linear_devs stripe_devs;
-	uint8_t stripe_num;
-	uint64_t stripe_chunksize;
-	size_t params_len;
-} dm_target_stripe_config_t;
-
-/* for mirror : */
-typedef struct target_mirror_config {
-#define MAX_MIRROR_COPIES 4
-	dm_pdev_t *orig;
-	dm_pdev_t *copies[MAX_MIRROR_COPIES];
-
-	/* copied blocks bitmaps administration etc*/
-	dm_pdev_t *log_pdev;	/* for administration */
-	uint64_t log_regionsize;	/* blocksize of mirror */
-
-	/* list of parts that still need copied etc.; run length encoded? */
-} dm_target_mirror_config_t;
-
-
-/* for snapshot : */
-typedef struct target_snapshot_config {
-	dm_pdev_t *tsc_snap_dev;
-	/* cow dev is set only for persistent snapshot devices */
-	dm_pdev_t *tsc_cow_dev;
-
-	uint64_t tsc_chunk_size;
-	uint32_t tsc_persistent_dev;
-} dm_target_snapshot_config_t;
-
-/* for snapshot-origin devices */
-typedef struct target_snapshot_origin_config {
-	dm_pdev_t *tsoc_real_dev;
-	/* list of snapshots ? */
-} dm_target_snapshot_origin_config_t;
-
 /* constant dm_target structures for error, zero, linear, stripes etc. */
 typedef struct dm_target {
 	char name[DM_MAX_TYPE_NAME];

Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.15 src/sys/dev/dm/dm_target_mirror.c:1.16
--- src/sys/dev/dm/dm_target_mirror.c:1.15	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Sun Dec  8 10:50:21 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.15 2019/12/08 04:41:02 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.16 2019/12/08 10:50:21 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.15 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.16 2019/12/08 10:50:21 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
@@ -50,6 +50,18 @@ int dm_target_mirror_deps(dm_table_entry
 int dm_target_mirror_destroy(dm_table_entry_t *);
 int dm_target_mirror_upcall(dm_table_entry_t *, struct buf *);
 
+typedef struct target_mirror_config {
+#define MAX_MIRROR_COPIES 4
+	dm_pdev_t *orig;
+	dm_pdev_t *copies[MAX_MIRROR_COPIES];
+
+	/* copied blocks bitmaps administration etc*/
+	dm_pdev_t *log_pdev;	/* for administration */
+	uint64_t log_regionsize;	/* blocksize of mirror */
+
+	/* list of parts that still need copied etc.; run length encoded? */
+} dm_target_mirror_config_t;
+
 #ifdef DM_TARGET_MODULE
 /*
  * Every target can be compiled directly to dm driver or as a

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.27 src/sys/dev/dm/dm_target_snapshot.c:1.28
--- src/sys/dev/dm/dm_target_snapshot.c:1.27	Sun Dec  8 10:35:53 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sun Dec  8 10:50:21 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.28 2019/12/08 10:50:21 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.28 2019/12/08 10:50:21 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -103,6 +103,20 @@ int dm_target_snapshot_orig_deps(dm_tabl
 int dm_target_snapshot_orig_destroy(dm_table_entry_t *);
 int dm_target_snapshot_orig_upcall(dm_table_entry_t *, struct buf *);
 

CVS commit: src/sys/arch/aarch64/aarch64

2019-12-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec  8 10:37:19 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
Mark FDT as non-exec and create KVA=VA mapping of same size as identity
mapping, i.e. include BOOTPAGE_ALLOC_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.45 src/sys/arch/aarch64/aarch64/locore.S:1.46
--- src/sys/arch/aarch64/aarch64/locore.S:1.45	Fri Nov 22 05:21:19 2019
+++ src/sys/arch/aarch64/aarch64/locore.S	Sun Dec  8 10:37:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.45 2019/11/22 05:21:19 mlelstv Exp $	*/
+/*	$NetBSD: locore.S,v 1.46 2019/12/08 10:37:19 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.45 2019/11/22 05:21:19 mlelstv Exp $")
+RCSID("$NetBSD: locore.S,v 1.46 2019/12/08 10:37:19 skrll Exp $")
 
 
 /*#define DEBUG_LOCORE			/* debug print */
@@ -826,6 +826,7 @@ init_mmutable:
 	adr	x6, bootpage_alloc		/* allocator */
 	mov	x5, xzr/* flags = 0 */
 	mov	x4, #LX_BLKPAG_ATTR_NORMAL_NC|LX_BLKPAG_AP_RW	/* attr */
+	orr	x4, x4, #LX_BLKPAG_UXN|LX_BLKPAG_PXN
 	mov	x3, #L2_SIZE			/* blocksize */
 	mov	x2, #L2_SIZE			/* size */
 	mov	x1, x8/* pa */
@@ -844,6 +845,7 @@ init_mmutable:
 	adr	x1, start			/* pa = start */
 	ADDR	x2, _end
 	sub	x2, x2, x1			/* size = _end - start */
+	add	x2, x2, #BOOTPAGE_ALLOC_MAX	/* for bootpage_alloc() */
 	ldr	x0, =start			/* va */
 	bl	pmapboot_enter
 	cbnz	x0, init_mmutable_error



CVS commit: src/sys/dev/dm

2019-12-08 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 10:35:53 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target.c dm_target_snapshot.c

Log Message:
dm: Unbreak compilation of kernel modules

The dm kernel modules (MK_DM_TARGETS enabled in sys/modules/dm/Makefile)
have been broken. Unbreak the build.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_snapshot.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/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.35 src/sys/dev/dm/dm.h:1.36
--- src/sys/dev/dm/dm.h:1.35	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm.h	Sun Dec  8 10:35:53 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.35 2019/12/08 04:41:02 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.36 2019/12/08 10:35:53 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -265,7 +265,7 @@ int dm_target_destroy(void);
 int dm_target_insert(dm_target_t *);
 prop_array_t dm_target_prop_list(void);
 dm_target_t* dm_target_lookup(const char *);
-int dm_target_rem(char *);
+int dm_target_rem(const char *);
 void dm_target_unbusy(dm_target_t *);
 void dm_target_busy(dm_target_t *);
 

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.25 src/sys/dev/dm/dm_target.c:1.26
--- src/sys/dev/dm/dm_target.c:1.25	Sat Dec  7 15:28:39 2019
+++ src/sys/dev/dm/dm_target.c	Sun Dec  8 10:35:53 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.25 2019/12/07 15:28:39 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.26 2019/12/08 10:35:53 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.25 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.26 2019/12/08 10:35:53 tkusumi Exp $");
 
 #include 
 #include 
@@ -183,7 +183,7 @@ dm_target_insert(dm_target_t *dm_target)
  * Remove target from TAIL, target is selected with its name.
  */
 int
-dm_target_rem(char *dm_target_name)
+dm_target_rem(const char *dm_target_name)
 {
 	dm_target_t *dmt;
 

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.26 src/sys/dev/dm/dm_target_snapshot.c:1.27
--- src/sys/dev/dm/dm_target_snapshot.c:1.26	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sun Dec  8 10:35:53 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.26 2019/12/08 04:41:02 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.26 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -240,8 +240,6 @@ dm_target_snapshot_init(dm_table_entry_t
 
 	table_en->target_config = tsc;
 
-	dmv->sec_size = dmp_snap->dmp_secsize;
-
 	return 0;
 }
 
@@ -258,14 +256,13 @@ dm_target_snapshot_status(void *target_c
 	uint32_t i;
 	uint32_t count;
 	size_t prm_len, cow_len;
-	char *params, *cow_name;
+	char *params;
 
 	tsc = target_config;
 
 	prm_len = 0;
 	cow_len = 0;
 	count = 0;
-	cow_name = NULL;
 
 	printf("Snapshot target status function called\n");
 



CVS commit: [netbsd-8] src/doc

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:33:35 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Ticket #1470


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.77 -r1.1.2.78 src/doc/CHANGES-8.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.77 src/doc/CHANGES-8.2:1.1.2.78
--- src/doc/CHANGES-8.2:1.1.2.77	Sun Dec  8 10:31:02 2019
+++ src/doc/CHANGES-8.2	Sun Dec  8 10:33:35 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.77 2019/12/08 10:31:02 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.78 2019/12/08 10:33:35 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1780,3 +1780,8 @@ sys/dev/cons.c	1.76,1.77
 	Fix reference count leak in cons(4).
 	[riastradh, ticket #1469]
 
+include/monetary.h1.4
+
+	PR lib/54744: add missing __END_DECLS for C++ compiles.
+	[kre, ticket #1470]
+



CVS commit: [netbsd-8] src/include

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:32:41 UTC 2019

Modified Files:
src/include [netbsd-8]: monetary.h

Log Message:
Pull up following revision(s) (requested by kre in ticket #1470):

include/monetary.h: revision 1.4

PR lib/54744  (br...@haible.de)
Add missing __END_DECLS for C++ compiles.

XXX pullup -9 XXX pullup -8 (bug not present in -7).


To generate a diff of this commit:
cvs rdiff -u -r1.2.56.1 -r1.2.56.2 src/include/monetary.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/monetary.h
diff -u src/include/monetary.h:1.2.56.1 src/include/monetary.h:1.2.56.2
--- src/include/monetary.h:1.2.56.1	Tue Aug 29 11:51:51 2017
+++ src/include/monetary.h	Sun Dec  8 10:32:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: monetary.h,v 1.2.56.1 2017/08/29 11:51:51 martin Exp $	*/
+/*	$NetBSD: monetary.h,v 1.2.56.2 2019/12/08 10:32:41 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 Alexey Zelkin 
@@ -52,6 +52,7 @@ typedef struct _locale		*locale_t;
 __BEGIN_DECLS
 ssize_t	strfmon_l(char * __restrict, size_t, locale_t, const char * __restrict, ...)
 __attribute__((__format__(__strfmon__, 4, 5)));
+__END_DECLS
 #endif
 
 __BEGIN_DECLS



CVS commit: [netbsd-8] src/doc

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:31:02 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Ticket #1469


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.76 -r1.1.2.77 src/doc/CHANGES-8.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.76 src/doc/CHANGES-8.2:1.1.2.77
--- src/doc/CHANGES-8.2:1.1.2.76	Sat Dec  7 08:47:39 2019
+++ src/doc/CHANGES-8.2	Sun Dec  8 10:31:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.76 2019/12/07 08:47:39 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.77 2019/12/08 10:31:02 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1775,3 +1775,8 @@ sys/external/bsd/dwc2/dwc2.c			1.60 - 1.
 	PR/54696: Kernel panic in bus_dma.c on Raspberry Pi 3B/3B+
 	[skrll, ticket #1468]
 
+sys/dev/cons.c	1.76,1.77
+
+	Fix reference count leak in cons(4).
+	[riastradh, ticket #1469]
+



CVS commit: [netbsd-8] src/sys/dev

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:30:31 UTC 2019

Modified Files:
src/sys/dev [netbsd-8]: cons.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1469):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.75.10.1 src/sys/dev/cons.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/cons.c
diff -u src/sys/dev/cons.c:1.75 src/sys/dev/cons.c:1.75.10.1
--- src/sys/dev/cons.c:1.75	Fri May 29 16:26:45 2015
+++ src/sys/dev/cons.c	Sun Dec  8 10:30:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.75 2015/05/29 16:26:45 macallan Exp $	*/
+/*	$NetBSD: cons.c,v 1.75.10.1 2019/12/08 10:30:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.75 2015/05/29 16:26:45 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.75.10.1 2019/12/08 10:30:31 martin Exp $");
 
 #include 
 #include 
@@ -158,6 +158,7 @@ cnclose(dev_t dev, int flag, int mode, s
 	if (error == 0) {
 		error = VOP_CLOSE(vp, flag, kauth_cred_get());
 		VOP_UNLOCK(vp);
+		vrele(vp);
 	}
 	return error;
 }



CVS commit: [netbsd-7-0] src/doc

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:27:54 UTC 2019

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1717


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.156 -r1.1.2.157 src/doc/CHANGES-7.0.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.156 src/doc/CHANGES-7.0.3:1.1.2.157
--- src/doc/CHANGES-7.0.3:1.1.2.156	Thu Dec  5 16:23:51 2019
+++ src/doc/CHANGES-7.0.3	Sun Dec  8 10:27:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.156 2019/12/05 16:23:51 bouyer Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.157 2019/12/08 10:27:54 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5926,3 +5926,8 @@ share/man/man4/rnd.41.25 - 1.28
 	Update NIST SP800-90A reference.
 	[riastradh, ticket #1715]
 
+sys/dev/cons.c	1.76,1.77
+
+	Fix reference count leak in cons(4).
+	[riastradh, ticket #1717]
+



CVS commit: [netbsd-7-0] src/sys/dev

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:27:32 UTC 2019

Modified Files:
src/sys/dev [netbsd-7-0]: cons.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1717):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.


To generate a diff of this commit:
cvs rdiff -u -r1.72.2.1 -r1.72.2.1.2.1 src/sys/dev/cons.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/cons.c
diff -u src/sys/dev/cons.c:1.72.2.1 src/sys/dev/cons.c:1.72.2.1.2.1
--- src/sys/dev/cons.c:1.72.2.1	Mon Mar  9 08:00:46 2015
+++ src/sys/dev/cons.c	Sun Dec  8 10:27:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $	*/
+/*	$NetBSD: cons.c,v 1.72.2.1.2.1 2019/12/08 10:27:32 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.1.2.1 2019/12/08 10:27:32 martin Exp $");
 
 #include 
 #include 
@@ -150,6 +150,7 @@ cnclose(dev_t dev, int flag, int mode, s
 	if (error == 0) {
 		error = VOP_CLOSE(vp, flag, kauth_cred_get());
 		VOP_UNLOCK(vp);
+		vrele(vp);
 	}
 	return error;
 }



CVS commit: [netbsd-7-1] src/doc

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:27:05 UTC 2019

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1717


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.63 -r1.1.2.64 src/doc/CHANGES-7.1.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.63 src/doc/CHANGES-7.1.3:1.1.2.64
--- src/doc/CHANGES-7.1.3:1.1.2.63	Thu Dec  5 16:24:46 2019
+++ src/doc/CHANGES-7.1.3	Sun Dec  8 10:27:05 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.63 2019/12/05 16:24:46 bouyer Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.64 2019/12/08 10:27:05 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -618,3 +618,8 @@ share/man/man4/rnd.41.25 - 1.28
 	Update NIST SP800-90A reference.
 	[riastradh, ticket #1715]
 
+sys/dev/cons.c	1.76,1.77
+
+	Fix reference count leak in cons(4).
+	[riastradh, ticket #1717]
+



CVS commit: [netbsd-7-1] src/sys/dev

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:26:37 UTC 2019

Modified Files:
src/sys/dev [netbsd-7-1]: cons.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1717):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.


To generate a diff of this commit:
cvs rdiff -u -r1.72.2.1 -r1.72.2.1.6.1 src/sys/dev/cons.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/cons.c
diff -u src/sys/dev/cons.c:1.72.2.1 src/sys/dev/cons.c:1.72.2.1.6.1
--- src/sys/dev/cons.c:1.72.2.1	Mon Mar  9 08:00:46 2015
+++ src/sys/dev/cons.c	Sun Dec  8 10:26:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $	*/
+/*	$NetBSD: cons.c,v 1.72.2.1.6.1 2019/12/08 10:26:36 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.1.6.1 2019/12/08 10:26:36 martin Exp $");
 
 #include 
 #include 
@@ -150,6 +150,7 @@ cnclose(dev_t dev, int flag, int mode, s
 	if (error == 0) {
 		error = VOP_CLOSE(vp, flag, kauth_cred_get());
 		VOP_UNLOCK(vp);
+		vrele(vp);
 	}
 	return error;
 }



CVS commit: [netbsd-7] src/sys/dev

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:25:38 UTC 2019

Modified Files:
src/sys/dev [netbsd-7]: cons.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1717):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.


To generate a diff of this commit:
cvs rdiff -u -r1.72.2.1 -r1.72.2.2 src/sys/dev/cons.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/cons.c
diff -u src/sys/dev/cons.c:1.72.2.1 src/sys/dev/cons.c:1.72.2.2
--- src/sys/dev/cons.c:1.72.2.1	Mon Mar  9 08:00:46 2015
+++ src/sys/dev/cons.c	Sun Dec  8 10:25:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $	*/
+/*	$NetBSD: cons.c,v 1.72.2.2 2019/12/08 10:25:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.2 2019/12/08 10:25:38 martin Exp $");
 
 #include 
 #include 
@@ -150,6 +150,7 @@ cnclose(dev_t dev, int flag, int mode, s
 	if (error == 0) {
 		error = VOP_CLOSE(vp, flag, kauth_cred_get());
 		VOP_UNLOCK(vp);
+		vrele(vp);
 	}
 	return error;
 }



CVS commit: [netbsd-7] src/doc

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:26:08 UTC 2019

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1717


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.71 -r1.1.2.72 src/doc/CHANGES-7.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.71 src/doc/CHANGES-7.3:1.1.2.72
--- src/doc/CHANGES-7.3:1.1.2.71	Thu Dec  5 16:30:45 2019
+++ src/doc/CHANGES-7.3	Sun Dec  8 10:26:08 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.71 2019/12/05 16:30:45 bouyer Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.72 2019/12/08 10:26:08 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -744,3 +744,8 @@ sys/external/bsd/dwc2/dwc2.c			1.60 - 1.
 	PR/54696: Kernel panic in bus_dma.c on Raspberry Pi 3B/3B+
 	[skrll, ticket #1716]
 
+sys/dev/cons.c	1.76,1.77
+
+	Fix reference count leak in cons(4).
+	[riastradh, ticket #1717]
+



CVS commit: src/sys/arch/arm/arm

2019-12-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec  8 10:12:19 UTC 2019

Modified Files:
src/sys/arch/arm/arm: lock_cas.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/arm/lock_cas.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/arm/arm/lock_cas.S
diff -u src/sys/arch/arm/arm/lock_cas.S:1.13 src/sys/arch/arm/arm/lock_cas.S:1.14
--- src/sys/arch/arm/arm/lock_cas.S:1.13	Sat Apr  6 03:06:24 2019
+++ src/sys/arch/arm/arm/lock_cas.S	Sun Dec  8 10:12:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_cas.S,v 1.13 2019/04/06 03:06:24 thorpej Exp $	*/
+/*	$NetBSD: lock_cas.S,v 1.14 2019/12/08 10:12:19 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -127,7 +127,7 @@ ENTRY(_ucas_32_mp)
 	bne	1b
 2:
 	str	r5, [r3]
-	mov	r0, #0			/* return value in case if miscompare */
+	mov	r0, #0			/* return value in case of miscompare */
 .Lucasfault:
 	movs	r3, #0
 	str	r3, [r4, #PCB_ONFAULT]