re: CVS commit: src/sys/dev

2020-07-28 Thread matthew green
"Jaromir Dolecek" writes:
> Module Name:  src
> Committed By: jdolecek
> Date: Tue Jul 28 09:36:05 UTC 2020
> 
> Modified Files:
>   src/sys/dev/ic: nvmevar.h
>   src/sys/dev/pci: nvme_pci.c
> 
> Log Message:
> add a quirk to disable MSI, and enable it for Intel SSD DC P4500
> 
> this device seems to cause serious system responsiveness issues when 
> configured
> to use MSI, while it works fine when configured for either INTx or MSI-X
> 
> this is important so this works well under Xen Dom0, which doesn't
> support MSI-X yet
> 
> fixes another issue reported as feedback for PR port-xen/55285 by Frank Kardel

i wonder if the label "force_intx" should be renamed now
that it can be active _after_ msi-x.

can't think of a good name, "skip_to_intx" maybe useful?

thanks.


.mrg.


CVS commit: src/sys/dev

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jul 29 01:55:58 UTC 2020

Modified Files:
src/sys/dev: cninit.c

Log Message:
cninit - don't reset cn_tab on entry.

cn_tab can be already set up by the MD startup code to point to an
early console vtable that can still be useful for debugging and as a
fallback.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/cninit.c

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



CVS commit: src/sys/dev

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jul 29 01:55:58 UTC 2020

Modified Files:
src/sys/dev: cninit.c

Log Message:
cninit - don't reset cn_tab on entry.

cn_tab can be already set up by the MD startup code to point to an
early console vtable that can still be useful for debugging and as a
fallback.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/cninit.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/cninit.c
diff -u src/sys/dev/cninit.c:1.13 src/sys/dev/cninit.c:1.14
--- src/sys/dev/cninit.c:1.13	Fri Jul 17 02:16:57 2020
+++ src/sys/dev/cninit.c	Wed Jul 29 01:55:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cninit.c,v 1.13 2020/07/17 02:16:57 uwe Exp $	*/
+/*	$NetBSD: cninit.c,v 1.14 2020/07/29 01:55:58 uwe Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cninit.c,v 1.13 2020/07/17 02:16:57 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cninit.c,v 1.14 2020/07/29 01:55:58 uwe Exp $");
 
 #include 
 #include 
@@ -59,8 +59,6 @@ cninit(void)
 	struct consdev *bestMatch;
 	struct consdev *cp;
 
-	cn_tab = NULL;
-
 	/*
 	 * Collect information about all possible consoles
 	 * and find the one with highest priority
@@ -84,7 +82,6 @@ cninit(void)
 	 * Turn on console
 	 */
 	{
-		/* XXX: can this ever be non-NULL? */
 		struct consdev *old_cn_tab = cn_tab;
 
 		/* cn_init may set cn_tab to self */



CVS commit: src

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 22:44:45 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: cmdline.exp cmdline.mk

Log Message:
make(1): add test for setting .OBJDIR via the command line


To generate a diff of this commit:
cvs rdiff -u -r1.880 -r1.881 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cmdline.exp \
src/usr.bin/make/unit-tests/cmdline.mk

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



CVS commit: src

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 22:44:45 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: cmdline.exp cmdline.mk

Log Message:
make(1): add test for setting .OBJDIR via the command line


To generate a diff of this commit:
cvs rdiff -u -r1.880 -r1.881 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cmdline.exp \
src/usr.bin/make/unit-tests/cmdline.mk

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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.880 src/distrib/sets/lists/tests/mi:1.881
--- src/distrib/sets/lists/tests/mi:1.880	Mon Jul 27 20:46:18 2020
+++ src/distrib/sets/lists/tests/mi	Tue Jul 28 22:44:44 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.880 2020/07/27 20:46:18 rillig Exp $
+# $NetBSD: mi,v 1.881 2020/07/28 22:44:44 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4524,6 +4524,8 @@
 ./usr/tests/usr.bin/make/unit-tests/Makefile	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmdline.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmdline.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-late.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.74 src/usr.bin/make/unit-tests/Makefile:1.75
--- src/usr.bin/make/unit-tests/Makefile:1.74	Tue Jul 28 18:39:56 2020
+++ src/usr.bin/make/unit-tests/Makefile	Tue Jul 28 22:44:44 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.74 2020/07/28 18:39:56 sjg Exp $
+# $NetBSD: Makefile,v 1.75 2020/07/28 22:44:44 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -31,6 +31,7 @@
 # Each test is in a sub-makefile.
 # Keep the list sorted.
 TESTS+=		# archive	# broken on FreeBSD
+TESTS+=		cmdline
 TESTS+=		comment
 TESTS+=		cond-late
 TESTS+=		cond-short

Added files:

Index: src/usr.bin/make/unit-tests/cmdline.exp
diff -u /dev/null src/usr.bin/make/unit-tests/cmdline.exp:1.1
--- /dev/null	Tue Jul 28 22:44:45 2020
+++ src/usr.bin/make/unit-tests/cmdline.exp	Tue Jul 28 22:44:44 2020
@@ -0,0 +1,5 @@
+makeobjdir-direct:
+show-objdir: /tmp/6a8899d2-d227-4b55-9b6b-f3c8eeb83fd5
+makeobjdir-indirect:
+show-objdir: /tmp/a7b41170-53f8-4cc2-bc5c-e4c3dd93ec45/
+exit status 0
Index: src/usr.bin/make/unit-tests/cmdline.mk
diff -u /dev/null src/usr.bin/make/unit-tests/cmdline.mk:1.1
--- /dev/null	Tue Jul 28 22:44:45 2020
+++ src/usr.bin/make/unit-tests/cmdline.mk	Tue Jul 28 22:44:44 2020
@@ -0,0 +1,37 @@
+# $NetBSD: cmdline.mk,v 1.1 2020/07/28 22:44:44 rillig Exp $
+#
+# Tests for command line parsing and related special variables.
+
+RUN?=		@set -eu;
+TMPBASE?=	/tmp
+SUB1=		a7b41170-53f8-4cc2-bc5c-e4c3dd93ec45	# just a random UUID
+SUB2=		6a8899d2-d227-4b55-9b6b-f3c8eeb83fd5	# just a random UUID
+MAKE_CMD=	env TMPBASE=${TMPBASE}/${SUB1} ${.MAKE} -f ${MAKEFILE} -r
+DIR2=		${TMPBASE}/${SUB2}
+DIR12=		${TMPBASE}/${SUB1}/${SUB2}
+
+all: prepare-dirs
+all: makeobjdir-direct makeobjdir-indirect
+
+prepare-dirs:
+	${RUN} rm -rf ${DIR2} ${DIR12}
+	${RUN} mkdir -p ${DIR2} ${DIR12}
+
+# The .OBJDIR can be set via the MAKEOBJDIR command line variable.
+# It must be a command line variable; an environment variable would not work.
+makeobjdir-direct:
+	@echo $@:
+	${RUN} ${MAKE_CMD} MAKEOBJDIR=${DIR2} show-objdir
+
+# The .OBJDIR can be set via the MAKEOBJDIR command line variable,
+# and that variable could even contain the usual modifiers.
+# Since the .OBJDIR=MAKEOBJDIR assignment happens very early,
+# the SUB2 variable in the modifier is not defined yet and is therefore empty.
+# The SUB1 in the resulting path comes from the environment variable TMPBASE,
+# see MAKE_CMD.
+makeobjdir-indirect:
+	@echo $@:
+	${RUN} ${MAKE_CMD} MAKEOBJDIR='$${TMPBASE}/$${SUB2}' show-objdir
+
+show-objdir:
+	@echo $@: ${.OBJDIR:Q}



CVS commit: src/tools

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jul 28 21:38:15 UTC 2020

Modified Files:
src/tools: Makefile

Log Message:
Build mkubootimage for evbsh3 too.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/tools/Makefile

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

Modified files:

Index: src/tools/Makefile
diff -u src/tools/Makefile:1.205 src/tools/Makefile:1.206
--- src/tools/Makefile:1.205	Mon Nov 11 22:45:27 2019
+++ src/tools/Makefile	Tue Jul 28 21:38:15 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.205 2019/11/11 22:45:27 joerg Exp $
+#	$NetBSD: Makefile,v 1.206 2020/07/28 21:38:15 uwe Exp $
 
 .include 
 .include 
@@ -214,7 +214,8 @@ SUBDIR+=	elftosb
 .endif
 
 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
-${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
+${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \
+${MACHINE} == "sandpoint"
 SUBDIR+=	mkubootimage
 SUBDIR+=	libfdt .WAIT
 SUBDIR+=	dtc



CVS commit: src/tools

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jul 28 21:38:15 UTC 2020

Modified Files:
src/tools: Makefile

Log Message:
Build mkubootimage for evbsh3 too.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/tools/Makefile

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



CVS commit: src/sys/arch/evbsh3/evbsh3

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jul 28 21:25:48 UTC 2020

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

Log Message:
Don't write SR twice.

__INTR_MASK sets PSL_IMASK bits in SR but then in the next instruction
we overwrite SR anyway, so drop that redundant __INTR_MASK.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbsh3/evbsh3/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/evbsh3/evbsh3/locore.S
diff -u src/sys/arch/evbsh3/evbsh3/locore.S:1.14 src/sys/arch/evbsh3/evbsh3/locore.S:1.15
--- src/sys/arch/evbsh3/evbsh3/locore.S:1.14	Tue Jul 28 20:36:43 2020
+++ src/sys/arch/evbsh3/evbsh3/locore.S	Tue Jul 28 21:25:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.14 2020/07/28 20:36:43 uwe Exp $	*/
+/*	$NetBSD: locore.S,v 1.15 2020/07/28 21:25:48 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -97,10 +97,7 @@ ALTENTRY(kernel_text)
 	/* Set SP to initial position */
 	mov.l	XLtmpstk, r15
 
-	/* Mask all interrupt */
-	__INTR_MASK(r0, r1)
-
-	/* Set Register Bank to Bank 0 */
+	/* Set Status Register */
 	mov.l	SR_init, r0
 	ldc	r0, sr
 



CVS commit: src/sys/arch/evbsh3/evbsh3

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jul 28 21:25:48 UTC 2020

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

Log Message:
Don't write SR twice.

__INTR_MASK sets PSL_IMASK bits in SR but then in the next instruction
we overwrite SR anyway, so drop that redundant __INTR_MASK.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbsh3/evbsh3/locore.S

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 20:57:59 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.exp directives.mk

Log Message:
make(1): add test for including a nonexistent or empty file


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directives.exp \
src/usr.bin/make/unit-tests/directives.mk

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/make/unit-tests/directives.exp
diff -u src/usr.bin/make/unit-tests/directives.exp:1.4 src/usr.bin/make/unit-tests/directives.exp:1.5
--- src/usr.bin/make/unit-tests/directives.exp:1.4	Tue Jul 28 18:25:33 2020
+++ src/usr.bin/make/unit-tests/directives.exp	Tue Jul 28 20:57:59 2020
@@ -35,7 +35,8 @@ make: "directives.mk" line 140: Unknown 
 make: "directives.mk" line 141: Unknown directive "indented"
 make: "directives.mk" line 142: Unknown directive "indented"
 make: "directives.mk" line 143: Unknown directive "info"
-make: "directives.mk" line 150: end of the tests
+make: "directives.mk" line 150: Could not find nonexistent.mk
+make: "directives.mk" line 160: end of the tests
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
Index: src/usr.bin/make/unit-tests/directives.mk
diff -u src/usr.bin/make/unit-tests/directives.mk:1.4 src/usr.bin/make/unit-tests/directives.mk:1.5
--- src/usr.bin/make/unit-tests/directives.mk:1.4	Tue Jul 28 19:19:30 2020
+++ src/usr.bin/make/unit-tests/directives.mk	Tue Jul 28 20:57:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directives.mk,v 1.4 2020/07/28 19:19:30 rillig Exp $
+# $NetBSD: directives.mk,v 1.5 2020/07/28 20:57:59 rillig Exp $
 #
 # Tests for parsing directives, in the same order as in the manual page.
 #
@@ -147,6 +147,16 @@
 
 
 
+.include "nonexistent.mk"
+.include "/dev/null"		# size 0
+# including a directory technically succeeds, but shouldn't.
+#.include "."			# directory
+
+
+
+
+
+
 .info end of the tests
 
 all:



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 20:57:59 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.exp directives.mk

Log Message:
make(1): add test for including a nonexistent or empty file


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directives.exp \
src/usr.bin/make/unit-tests/directives.mk

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



CVS commit: src/sys/arch/evbsh3/evbsh3

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jul 28 20:36:43 UTC 2020

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

Log Message:
G/c trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbsh3/evbsh3/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/evbsh3/evbsh3/locore.S
diff -u src/sys/arch/evbsh3/evbsh3/locore.S:1.13 src/sys/arch/evbsh3/evbsh3/locore.S:1.14
--- src/sys/arch/evbsh3/evbsh3/locore.S:1.13	Sun Jul 12 03:52:51 2020
+++ src/sys/arch/evbsh3/evbsh3/locore.S	Tue Jul 28 20:36:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.13 2020/07/12 03:52:51 uwe Exp $	*/
+/*	$NetBSD: locore.S,v 1.14 2020/07/28 20:36:43 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -76,8 +76,8 @@
 #include "opt_memsize.h"
 #include "assym.h"
 
-#if defined(SH3) && defined(SH4)	
-#error "evbsh3 port don't support SH3,SH4 common kernel."	
+#if defined(SH3) && defined(SH4)
+#error "evbsh3 port don't support SH3,SH4 common kernel."
 #endif
 
 #include 
@@ -142,7 +142,7 @@ start1:
 	mov.l	___start, r3
 	sub	r2, r3
 	mov.l	XL_ram_start, r4
-	mov.l	@r4, r4	
+	mov.l	@r4, r4
 	add	r4, r3		/* dest address */
 1:
 	mov.l	@r1+, r4
@@ -159,7 +159,7 @@ start1:
 	.align	2
 LXstart_in_RAM:
 	.long	start_in_RAM
-XL_ram_start:	
+XL_ram_start:
 	.long	_C_LABEL(ram_start)
 #else /* ROMIMAGE */
 #ifndef	DONT_INIT_BSC
@@ -206,7 +206,7 @@ cache_on:
 	nop
 	jmp @r2
 	nop
-	
+
 	.align	2
 main_label:
 #endif /* SH4 */



CVS commit: src/sys/arch/evbsh3/evbsh3

2020-07-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jul 28 20:36:43 UTC 2020

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

Log Message:
G/c trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbsh3/evbsh3/locore.S

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



CVS commit: src/sys

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:15:07 UTC 2020

Modified Files:
src/sys/crypto/cprng_fast: cprng_fast.c files.cprng_fast
src/sys/kern: files.kern
src/sys/rump/kern/lib/libcrypto: Makefile
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
Rewrite cprng_fast in terms of new ChaCha API.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/crypto/cprng_fast/cprng_fast.c
cvs rdiff -u -r1.2 -r1.3 src/sys/crypto/cprng_fast/files.cprng_fast
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/files.kern
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/kern/lib/libcrypto/Makefile
cvs rdiff -u -r1.183 -r1.184 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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

Modified files:

Index: src/sys/crypto/cprng_fast/cprng_fast.c
diff -u src/sys/crypto/cprng_fast/cprng_fast.c:1.15 src/sys/crypto/cprng_fast/cprng_fast.c:1.16
--- src/sys/crypto/cprng_fast/cprng_fast.c:1.15	Thu Apr 30 03:29:45 2020
+++ src/sys/crypto/cprng_fast/cprng_fast.c	Tue Jul 28 20:15:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cprng_fast.c,v 1.15 2020/04/30 03:29:45 riastradh Exp $	*/
+/*	$NetBSD: cprng_fast.c,v 1.16 2020/07/28 20:15:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.15 2020/04/30 03:29:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.16 2020/07/28 20:15:07 riastradh Exp $");
 
 #include 
 #include 
@@ -42,170 +42,21 @@ __KERNEL_RCSID(0, "$NetBSD: cprng_fast.c
 #include 
 #include 
 #include 
-
-/* ChaCha core */
-
-#define	crypto_core_OUTPUTWORDS	16
-#define	crypto_core_INPUTWORDS	4
-#define	crypto_core_KEYWORDS	8
-#define	crypto_core_CONSTWORDS	4
-
-#define	crypto_core_ROUNDS	8
-
-static uint32_t
-rotate(uint32_t u, unsigned c)
-{
-
-	return (u << c) | (u >> (32 - c));
-}
-
-#define	QUARTERROUND(a, b, c, d) do {	  \
-	(a) += (b); (d) ^= (a); (d) = rotate((d), 16);			  \
-	(c) += (d); (b) ^= (c); (b) = rotate((b), 12);			  \
-	(a) += (b); (d) ^= (a); (d) = rotate((d),  8);			  \
-	(c) += (d); (b) ^= (c); (b) = rotate((b),  7);			  \
-} while (0)
-
-static void
-crypto_core(uint32_t *out, const uint32_t *in, const uint32_t *k,
-const uint32_t *c)
-{
-	uint32_t x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15;
-	int i;
-
-	x0 = c[0];
-	x1 = c[1];
-	x2 = c[2];
-	x3 = c[3];
-	x4 = k[0];
-	x5 = k[1];
-	x6 = k[2];
-	x7 = k[3];
-	x8 = k[4];
-	x9 = k[5];
-	x10 = k[6];
-	x11 = k[7];
-	x12 = in[0];
-	x13 = in[1];
-	x14 = in[2];
-	x15 = in[3];
-
-	for (i = crypto_core_ROUNDS; i > 0; i -= 2) {
-		QUARTERROUND( x0, x4, x8,x12);
-		QUARTERROUND( x1, x5, x9,x13);
-		QUARTERROUND( x2, x6,x10,x14);
-		QUARTERROUND( x3, x7,x11,x15);
-		QUARTERROUND( x0, x5,x10,x15);
-		QUARTERROUND( x1, x6,x11,x12);
-		QUARTERROUND( x2, x7, x8,x13);
-		QUARTERROUND( x3, x4, x9,x14);
-	}
-
-	out[0] = x0 + c[0];
-	out[1] = x1 + c[1];
-	out[2] = x2 + c[2];
-	out[3] = x3 + c[3];
-	out[4] = x4 + k[0];
-	out[5] = x5 + k[1];
-	out[6] = x6 + k[2];
-	out[7] = x7 + k[3];
-	out[8] = x8 + k[4];
-	out[9] = x9 + k[5];
-	out[10] = x10 + k[6];
-	out[11] = x11 + k[7];
-	out[12] = x12 + in[0];
-	out[13] = x13 + in[1];
-	out[14] = x14 + in[2];
-	out[15] = x15 + in[3];
-}
-
-/* `expand 32-byte k' */
-static const uint32_t crypto_core_constant32[4] = {
-	0x61707865U, 0x3320646eU, 0x79622d32U, 0x6b206574U,
-};
-
-/*
- * Test vector for ChaCha20 from
- * ,
- * test vectors for ChaCha12 and ChaCha8 generated by the same
- * crypto_core code with crypto_core_ROUNDS varied.
- */
-
-#define	check(E)	do		\
-{	\
-	if (!(E))			\
-		panic("crypto self-test failed: %s", #E);		\
-} while (0)
-
-static void
-crypto_core_selftest(void)
-{
-	const uint32_t zero32[8] = {0};
-	const uint8_t sigma[] = "expand 32-byte k";
-	uint32_t block[16];
-	unsigned i;
-
-#if crypto_core_ROUNDS == 8
-	static const uint8_t out[64] = {
-		0x3e,0x00,0xef,0x2f,0x89,0x5f,0x40,0xd6,
-		0x7f,0x5b,0xb8,0xe8,0x1f,0x09,0xa5,0xa1,
-		0x2c,0x84,0x0e,0xc3,0xce,0x9a,0x7f,0x3b,
-		0x18,0x1b,0xe1,0x88,0xef,0x71,0x1a,0x1e,
-		0x98,0x4c,0xe1,0x72,0xb9,0x21,0x6f,0x41,
-		0x9f,0x44,0x53,0x67,0x45,0x6d,0x56,0x19,
-		0x31,0x4a,0x42,0xa3,0xda,0x86,0xb0,0x01,
-		0x38,0x7b,0xfd,0xb8,0x0e,0x0c,0xfe,0x42,
-	};
-#elif crypto_core_ROUNDS == 12
-	static const uint8_t out[64] = {
-		0x9b,0xf4,0x9a,0x6a,0x07,0x55,0xf9,0x53,
-		0x81,0x1f,0xce,0x12,0x5f,0x26,0x83,0xd5,
-		0x04,0x29,0xc3,0xbb,0x49,0xe0,0x74,0x14,
-		0x7e,0x00,0x89,0xa5,0x2e,0xae,0x15,0x5f,
-		0x05,0x64,0xf8,0x79,0xd2,0x7a,0xe3,0xc0,
-		0x2c,0xe8,0x28,0x34,0xac,0xfa,0x8c,0x79,
-		0x3a,0x62,0x9f,0x2c,0xa0,0xde,0x69,0x19,
-		0x61,0x0b,0xe8,0x2f,0x41,0x13,0x26,0xbe,
-	};
-#elif crypto_core_ROUNDS == 20
-	static const uint8_t out[64] = {
-		

CVS commit: src/sys

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:15:07 UTC 2020

Modified Files:
src/sys/crypto/cprng_fast: cprng_fast.c files.cprng_fast
src/sys/kern: files.kern
src/sys/rump/kern/lib/libcrypto: Makefile
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
Rewrite cprng_fast in terms of new ChaCha API.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/crypto/cprng_fast/cprng_fast.c
cvs rdiff -u -r1.2 -r1.3 src/sys/crypto/cprng_fast/files.cprng_fast
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/files.kern
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/kern/lib/libcrypto/Makefile
cvs rdiff -u -r1.183 -r1.184 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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



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

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:11:09 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon.c aes_neon_impl.h aes_neon_subr.c
arm_neon.h

Log Message:
Draft 2x vectorized neon vpaes for aarch64.

Gives a modest speed boost on rk3399 (Cortex-A53/A72), around 20% in
cgd tests, for parallelizable operations like CBC decryption; same
improvement should probably carry over to rpi4 CPU which lacks
ARMv8.0-AES.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/crypto/aes/arch/arm/aes_neon.c \
src/sys/crypto/aes/arch/arm/aes_neon_subr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/crypto/aes/arch/arm/aes_neon_impl.h
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/aes/arch/arm/arm_neon.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/crypto/aes/arch/arm/aes_neon.c
diff -u src/sys/crypto/aes/arch/arm/aes_neon.c:1.3 src/sys/crypto/aes/arch/arm/aes_neon.c:1.4
--- src/sys/crypto/aes/arch/arm/aes_neon.c:1.3	Tue Jun 30 20:32:11 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon.c	Tue Jul 28 20:11:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_neon.c,v 1.3 2020/06/30 20:32:11 riastradh Exp $	*/
+/*	$NetBSD: aes_neon.c,v 1.4 2020/07/28 20:11:09 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aes_neon.c,v 1.3 2020/06/30 20:32:11 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_neon.c,v 1.4 2020/07/28 20:11:09 riastradh Exp $");
 
 #include 
 
@@ -589,6 +589,59 @@ aes_neon_enc1(const struct aesenc *enc, 
 	return vqtbl1q_u8(x, sr[rmod4]);
 }
 
+uint8x16x2_t
+aes_neon_enc2(const struct aesenc *enc, uint8x16x2_t x, unsigned nrounds)
+{
+	const uint32_t *rk32 = enc->aese_aes.aes_rk;
+	uint8x16_t inv_ = *(const volatile uint8x16_t *)
+	uint8x16_t inva_ = *(const volatile uint8x16_t *)
+	uint8x16_t sb1_0 = ((const volatile uint8x16_t *)sb1)[0];
+	uint8x16_t sb1_1 = ((const volatile uint8x16_t *)sb1)[1];
+	uint8x16_t sb2_0 = ((const volatile uint8x16_t *)sb2)[0];
+	uint8x16_t sb2_1 = ((const volatile uint8x16_t *)sb2)[1];
+	uint8x16_t x0 = x.val[0], x1 = x.val[1];
+	uint8x16_t io0, jo0, io1, jo1;
+	unsigned rmod4 = 0;
+
+	x0 = aes_schedule_transform(x0, ipt);
+	x1 = aes_schedule_transform(x1, ipt);
+	x0 ^= loadroundkey(rk32);
+	x1 ^= loadroundkey(rk32);
+	for (;;) {
+		uint8x16_t A_0, A2_0, A2_B_0, A2_B_D_0;
+		uint8x16_t A_1, A2_1, A2_B_1, A2_B_D_1;
+
+		subbytes(, , x0, inv_, inva_);
+		subbytes(, , x1, inv_, inva_);
+
+		rk32 += 4;
+		rmod4 = (rmod4 + 1) % 4;
+		if (--nrounds == 0)
+			break;
+
+		A_0 = vqtbl1q_u8(sb1_0, io0) ^ vqtbl1q_u8(sb1_1, jo0);
+		A_1 = vqtbl1q_u8(sb1_0, io1) ^ vqtbl1q_u8(sb1_1, jo1);
+		A_0 ^= loadroundkey(rk32);
+		A_1 ^= loadroundkey(rk32);
+		A2_0 = vqtbl1q_u8(sb2_0, io0) ^ vqtbl1q_u8(sb2_1, jo0);
+		A2_1 = vqtbl1q_u8(sb2_0, io1) ^ vqtbl1q_u8(sb2_1, jo1);
+		A2_B_0 = A2_0 ^ vqtbl1q_u8(A_0, mc_forward[rmod4]);
+		A2_B_1 = A2_1 ^ vqtbl1q_u8(A_1, mc_forward[rmod4]);
+		A2_B_D_0 = A2_B_0 ^ vqtbl1q_u8(A_0, mc_backward[rmod4]);
+		A2_B_D_1 = A2_B_1 ^ vqtbl1q_u8(A_1, mc_backward[rmod4]);
+		x0 = A2_B_D_0 ^ vqtbl1q_u8(A2_B_0, mc_forward[rmod4]);
+		x1 = A2_B_D_1 ^ vqtbl1q_u8(A2_B_1, mc_forward[rmod4]);
+	}
+	x0 = vqtbl1q_u8(sbo[0], io0) ^ vqtbl1q_u8(sbo[1], jo0);
+	x1 = vqtbl1q_u8(sbo[0], io1) ^ vqtbl1q_u8(sbo[1], jo1);
+	x0 ^= loadroundkey(rk32);
+	x1 ^= loadroundkey(rk32);
+	return (uint8x16x2_t) { .val = {
+		[0] = vqtbl1q_u8(x0, sr[rmod4]),
+		[1] = vqtbl1q_u8(x1, sr[rmod4]),
+	} };
+}
+
 uint8x16_t
 aes_neon_dec1(const struct aesdec *dec, uint8x16_t x, unsigned nrounds)
 {
@@ -628,4 +681,60 @@ aes_neon_dec1(const struct aesdec *dec, 
 	return vqtbl1q_u8(x, sr[i]);
 }
 
+uint8x16x2_t
+aes_neon_dec2(const struct aesdec *dec, uint8x16x2_t x, unsigned nrounds)
+{
+	const uint32_t *rk32 = dec->aesd_aes.aes_rk;
+	unsigned i = 3 & ~(nrounds - 1);
+	uint8x16_t inv_ = *(const volatile uint8x16_t *)
+	uint8x16_t inva_ = *(const volatile uint8x16_t *)
+	uint8x16_t x0 = x.val[0], x1 = x.val[1];
+	uint8x16_t io0, jo0, io1, jo1, mc;
+
+	x0 = aes_schedule_transform(x0, dipt);
+	x1 = aes_schedule_transform(x1, dipt);
+	x0 ^= loadroundkey(rk32);
+	x1 ^= loadroundkey(rk32);
+	rk32 += 4;
+
+	mc = mc_forward[3];
+	for (;;) {
+		subbytes(, , x0, inv_, inva_);
+		subbytes(, , x1, inv_, inva_);
+		if (--nrounds == 0)
+			break;
+
+		x0 = vqtbl1q_u8(dsb9[0], io0) ^ vqtbl1q_u8(dsb9[1], jo0);
+		x1 = vqtbl1q_u8(dsb9[0], io1) ^ vqtbl1q_u8(dsb9[1], jo1);
+		x0 ^= loadroundkey(rk32);
+		x1 ^= loadroundkey(rk32);
+		rk32 += 4;/* next round key */
+
+		x0 = vqtbl1q_u8(x0, mc);
+		x1 = vqtbl1q_u8(x1, mc);
+		x0 ^= vqtbl1q_u8(dsbd[0], io0) ^ vqtbl1q_u8(dsbd[1], jo0);
+		x1 ^= vqtbl1q_u8(dsbd[0], io1) ^ vqtbl1q_u8(dsbd[1], jo1);
+
+		x0 = vqtbl1q_u8(x0, mc);
+		x1 = vqtbl1q_u8(x1, mc);
+		x0 ^= vqtbl1q_u8(dsbb[0], io0) ^ vqtbl1q_u8(dsbb[1], jo0);
+		x1 ^= vqtbl1q_u8(dsbb[0], 

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

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:11:09 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon.c aes_neon_impl.h aes_neon_subr.c
arm_neon.h

Log Message:
Draft 2x vectorized neon vpaes for aarch64.

Gives a modest speed boost on rk3399 (Cortex-A53/A72), around 20% in
cgd tests, for parallelizable operations like CBC decryption; same
improvement should probably carry over to rpi4 CPU which lacks
ARMv8.0-AES.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/crypto/aes/arch/arm/aes_neon.c \
src/sys/crypto/aes/arch/arm/aes_neon_subr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/crypto/aes/arch/arm/aes_neon_impl.h
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/aes/arch/arm/arm_neon.h

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



CVS commit: src

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:08:48 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon.c chacha_neon.h
files.chacha_arm
src/tests/sys/crypto/chacha: Makefile
Added Files:
src/sys/crypto/chacha/arch/arm: chacha_neon_32.S

Log Message:
Implement 4-way vectorization of ChaCha for armv7 NEON.

cgd performance is not as good as I was hoping (~4% improvement over
chacha_ref.c) but it should improve substantially more if we let the
cgd worker thread keep fpu state so we don't have to pay the cost of
isb and zero-the-fpu on every 512-byte cgd block.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/chacha/arch/arm/chacha_neon.c
cvs rdiff -u -r1.2 -r1.3 src/sys/crypto/chacha/arch/arm/chacha_neon.h \
src/sys/crypto/chacha/arch/arm/files.chacha_arm
cvs rdiff -u -r0 -r1.1 src/sys/crypto/chacha/arch/arm/chacha_neon_32.S
cvs rdiff -u -r1.2 -r1.3 src/tests/sys/crypto/chacha/Makefile

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

Modified files:

Index: src/sys/crypto/chacha/arch/arm/chacha_neon.c
diff -u src/sys/crypto/chacha/arch/arm/chacha_neon.c:1.6 src/sys/crypto/chacha/arch/arm/chacha_neon.c:1.7
--- src/sys/crypto/chacha/arch/arm/chacha_neon.c:1.6	Tue Jul 28 20:05:33 2020
+++ src/sys/crypto/chacha/arch/arm/chacha_neon.c	Tue Jul 28 20:08:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: chacha_neon.c,v 1.6 2020/07/28 20:05:33 riastradh Exp $	*/
+/*	$NetBSD: chacha_neon.c,v 1.7 2020/07/28 20:08:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -221,10 +221,8 @@ chacha_stream_neon(uint8_t *restrict s, 
 unsigned nr)
 {
 
-#ifdef __aarch64__
 	for (; n >= 256; s += 256, n -= 256, blkno += 4)
 		chacha_stream256_neon(s, blkno, nonce, k, chacha_const32, nr);
-#endif
 
 	if (n) {
 		const uint32x4_t blkno_inc = {1,0,0,0};
@@ -281,11 +279,9 @@ chacha_stream_xor_neon(uint8_t *s, const
 unsigned nr)
 {
 
-#ifdef __aarch64__
 	for (; n >= 256; s += 256, p += 256, n -= 256, blkno += 4)
 		chacha_stream_xor256_neon(s, p, blkno, nonce, k,
 		chacha_const32, nr);
-#endif
 
 	if (n) {
 		const uint32x4_t blkno_inc = {1,0,0,0};

Index: src/sys/crypto/chacha/arch/arm/chacha_neon.h
diff -u src/sys/crypto/chacha/arch/arm/chacha_neon.h:1.2 src/sys/crypto/chacha/arch/arm/chacha_neon.h:1.3
--- src/sys/crypto/chacha/arch/arm/chacha_neon.h:1.2	Mon Jul 27 20:51:29 2020
+++ src/sys/crypto/chacha/arch/arm/chacha_neon.h	Tue Jul 28 20:08:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: chacha_neon.h,v 1.2 2020/07/27 20:51:29 riastradh Exp $	*/
+/*	$NetBSD: chacha_neon.h,v 1.3 2020/07/28 20:08:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -64,8 +64,7 @@ void	xchacha_stream_xor_neon(uint8_t *, 
 	const uint8_t[static 32],
 	unsigned);
 
-#ifdef __aarch64__
-/* Assembly helpers -- aarch64 only for now */
+/* Assembly helpers */
 void	chacha_stream256_neon(uint8_t[restrict static 256], uint32_t,
 	const uint8_t[static 12],
 	const uint8_t[static 32],
@@ -78,7 +77,6 @@ void	chacha_stream_xor256_neon(uint8_t[r
 	const uint8_t[static 32],
 	const uint8_t[static 16],
 	unsigned);
-#endif	/* __aarch64__ */
 
 extern const struct chacha_impl chacha_neon_impl;
 
Index: src/sys/crypto/chacha/arch/arm/files.chacha_arm
diff -u src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.2 src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.3
--- src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.2	Mon Jul 27 20:51:29 2020
+++ src/sys/crypto/chacha/arch/arm/files.chacha_arm	Tue Jul 28 20:08:48 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.chacha_arm,v 1.2 2020/07/27 20:51:29 riastradh Exp $
+#	$NetBSD: files.chacha_arm,v 1.3 2020/07/28 20:08:48 riastradh Exp $
 
 ifdef aarch64
 makeoptions	chacha	"COPTS.chacha_neon.c"+="-march=armv8-a"
@@ -7,5 +7,6 @@ makeoptions	aes	"COPTS.chacha_neon.c"+="
 endif
 
 file	crypto/chacha/arch/arm/chacha_neon.c	chacha & (cpu_cortex | aarch64)
+file	crypto/chacha/arch/arm/chacha_neon_32.S	chacha & cpu_cortex & !aarch64
 file	crypto/chacha/arch/arm/chacha_neon_64.S	chacha & aarch64
 file	crypto/chacha/arch/arm/chacha_neon_impl.c chacha & (cpu_cortex | aarch64)

Index: src/tests/sys/crypto/chacha/Makefile
diff -u src/tests/sys/crypto/chacha/Makefile:1.2 src/tests/sys/crypto/chacha/Makefile:1.3
--- src/tests/sys/crypto/chacha/Makefile:1.2	Mon Jul 27 20:51:29 2020
+++ src/tests/sys/crypto/chacha/Makefile	Tue Jul 28 20:08:48 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2020/07/27 20:51:29 riastradh Exp $
+#	$NetBSD: Makefile,v 1.3 2020/07/28 20:08:48 riastradh Exp $
 
 .include 
 
@@ -22,7 +22,9 @@ SRCS.t_chacha+=	chacha_selftest.c
 CPPFLAGS+=	-I${NETBSDSRCDIR}/sys/crypto/chacha/arch/arm
 
 SRCS.t_chacha+=	chacha_neon.c
-.if !empty(MACHINE_ARCH:Maarch64*)
+.if !empty(MACHINE_ARCH:Mearmv7*)
+SRCS.t_chacha+=	chacha_neon_32.S
+.elif !empty(MACHINE_ARCH:Maarch64*)
 

CVS commit: src

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:08:48 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon.c chacha_neon.h
files.chacha_arm
src/tests/sys/crypto/chacha: Makefile
Added Files:
src/sys/crypto/chacha/arch/arm: chacha_neon_32.S

Log Message:
Implement 4-way vectorization of ChaCha for armv7 NEON.

cgd performance is not as good as I was hoping (~4% improvement over
chacha_ref.c) but it should improve substantially more if we let the
cgd worker thread keep fpu state so we don't have to pay the cost of
isb and zero-the-fpu on every 512-byte cgd block.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/chacha/arch/arm/chacha_neon.c
cvs rdiff -u -r1.2 -r1.3 src/sys/crypto/chacha/arch/arm/chacha_neon.h \
src/sys/crypto/chacha/arch/arm/files.chacha_arm
cvs rdiff -u -r0 -r1.1 src/sys/crypto/chacha/arch/arm/chacha_neon_32.S
cvs rdiff -u -r1.2 -r1.3 src/tests/sys/crypto/chacha/Makefile

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



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

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:05:33 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon.c

Log Message:
Fix big-endian build with appropriate casts around vrev32q_u8.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/crypto/chacha/arch/arm/chacha_neon.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/crypto/chacha/arch/arm/chacha_neon.c
diff -u src/sys/crypto/chacha/arch/arm/chacha_neon.c:1.5 src/sys/crypto/chacha/arch/arm/chacha_neon.c:1.6
--- src/sys/crypto/chacha/arch/arm/chacha_neon.c:1.5	Mon Jul 27 20:58:56 2020
+++ src/sys/crypto/chacha/arch/arm/chacha_neon.c	Tue Jul 28 20:05:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: chacha_neon.c,v 1.5 2020/07/27 20:58:56 riastradh Exp $	*/
+/*	$NetBSD: chacha_neon.c,v 1.6 2020/07/28 20:05:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@ vhtole_u32(uint32x4_t x)
 #if _BYTE_ORDER == _LITTLE_ENDIAN
 	return x;
 #elif _BYTE_ORDER == _BIG_ENDIAN
-	return vrev32q_u8(x);
+	return vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(x)));
 #endif
 }
 
@@ -63,7 +63,7 @@ vletoh_u32(uint32x4_t x)
 #if _BYTE_ORDER == _LITTLE_ENDIAN
 	return x;
 #elif _BYTE_ORDER == _BIG_ENDIAN
-	return vrev32q_u8(x);
+	return vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(x)));
 #endif
 }
 



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

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 20:05:33 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon.c

Log Message:
Fix big-endian build with appropriate casts around vrev32q_u8.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/crypto/chacha/arch/arm/chacha_neon.c

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 19:39:43 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmisc.mk

Log Message:
make(1): add test for missing argument validation in .undef


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varmisc.mk

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/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.18 src/usr.bin/make/unit-tests/varmisc.mk:1.19
--- src/usr.bin/make/unit-tests/varmisc.mk:1.18	Tue Jul 28 17:18:40 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Tue Jul 28 19:39:43 2020
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.18 2020/07/28 17:18:40 rillig Exp $
+# $Id: varmisc.mk,v 1.19 2020/07/28 19:39:43 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -206,3 +206,14 @@ varerror-unclosed:
 	@echo ${UNCLOSED.${i}
 .endfor
 	@echo $@:end
+
+# As of 2020-07-28, .undef only undefines the first variable.
+# All further variable names are silently ignored.
+# See parse.c, string literal "undef".
+1=		1
+2=		2
+3=		3
+.undef 1 2 3
+.if ${1:U_}${2:U_}${3:U_} != _23
+.warning $1$2$3
+.endif



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 19:39:43 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmisc.mk

Log Message:
make(1): add test for missing argument validation in .undef


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varmisc.mk

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 19:19:30 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.mk

Log Message:
make(1): add test about possibly ambiguous suffix rule


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directives.mk

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/make/unit-tests/directives.mk
diff -u src/usr.bin/make/unit-tests/directives.mk:1.3 src/usr.bin/make/unit-tests/directives.mk:1.4
--- src/usr.bin/make/unit-tests/directives.mk:1.3	Tue Jul 28 18:25:33 2020
+++ src/usr.bin/make/unit-tests/directives.mk	Tue Jul 28 19:19:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directives.mk,v 1.3 2020/07/28 18:25:33 rillig Exp $
+# $NetBSD: directives.mk,v 1.4 2020/07/28 19:19:30 rillig Exp $
 #
 # Tests for parsing directives, in the same order as in the manual page.
 #
@@ -44,7 +44,7 @@
 .info		indented message
 .information
 .information message		# oops: misspelled
-
+.info.man:			# not a message, but a suffix rule
 
 
 .info begin .undef tests



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 19:19:30 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.mk

Log Message:
make(1): add test about possibly ambiguous suffix rule


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directives.mk

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



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 19:13:49 UTC 2020

Modified Files:
src/usr.bin/make: parse.c

Log Message:
make(1): remove unnecessary parentheses in obvious cases


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/parse.c

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



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 19:13:49 UTC 2020

Modified Files:
src/usr.bin/make: parse.c

Log Message:
make(1): remove unnecessary parentheses in obvious cases


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/parse.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.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.241 src/usr.bin/make/parse.c:1.242
--- src/usr.bin/make/parse.c:1.241	Tue Jul 28 18:31:16 2020
+++ src/usr.bin/make/parse.c	Tue Jul 28 19:13:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.241 2020/07/28 18:31:16 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.242 2020/07/28 19:13:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.241 2020/07/28 18:31:16 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.242 2020/07/28 19:13:49 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.241 2020/07/28 18:31:16 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.242 2020/07/28 19:13:49 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -393,7 +393,7 @@ loadedfile_create(const char *path)
 	struct loadedfile *lf;
 
 	lf = bmake_malloc(sizeof(*lf));
-	lf->path = (path == NULL ? "(stdin)" : path);
+	lf->path = path == NULL ? "(stdin)" : path;
 	lf->buf = NULL;
 	lf->len = 0;
 	lf->maplen = 0;
@@ -914,7 +914,7 @@ ParseDoOp(void *gnp, void *opp)
 	return 1;
 }
 
-if ((op == OP_DOUBLEDEP) && ((gn->type & OP_OPMASK) == OP_DOUBLEDEP)) {
+if (op == OP_DOUBLEDEP && (gn->type & OP_OPMASK) == OP_DOUBLEDEP) {
 	/*
 	 * If the node was the object of a :: operator, we need to create a
 	 * new instance of it for the children and commands on this dependency
@@ -1105,7 +1105,7 @@ static int
 ParseFindMain(void *gnp, void *dummy MAKE_ATTR_UNUSED)
 {
 GNode   	  *gn = (GNode *)gnp;
-if ((gn->type & OP_NOTARGET) == 0) {
+if (!(gn->type & OP_NOTARGET)) {
 	mainNode = gn;
 	Targ_SetMain(gn);
 	return 1;
@@ -1430,7 +1430,7 @@ ParseDoDependency(char *line)
 	 * Have word in line. Get or create its node and stick it at
 	 * the end of the targets list
 	 */
-	if ((specType == Not) && (*line != '\0')) {
+	if (specType == Not && *line != '\0') {
 	if (Dir_HasWildcards(line)) {
 		/*
 		 * Targets are to be sought only in the current directory,
@@ -1481,7 +1481,7 @@ ParseDoDependency(char *line)
 	Boolean warning = FALSE;
 
 	while (*cp && (ParseIsEscaped(lstart, cp) ||
-		((*cp != '!') && (*cp != ':' {
+		(*cp != '!' && *cp != ':'))) {
 		if (ParseIsEscaped(lstart, cp) ||
 		(*cp != ' ' && *cp != '\t')) {
 		warning = TRUE;
@@ -1498,7 +1498,7 @@ ParseDoDependency(char *line)
 	}
 	line = cp;
 } while (*line && (ParseIsEscaped(lstart, line) ||
-	((*line != '!') && (*line != ':';
+	(*line != '!' && *line != ':')));
 
 /*
  * Don't need the list of target names anymore...
@@ -1618,17 +1618,17 @@ ParseDoDependency(char *line)
 	goto out;
 	}
 	*line = '\0';
-} else if ((specType == NotParallel) || (specType == SingleShell) ||
-	(specType == DeleteOnError)) {
+} else if (specType == NotParallel || specType == SingleShell ||
+	specType == DeleteOnError) {
 	*line = '\0';
 }
 
 /*
  * NOW GO FOR THE SOURCES
  */
-if ((specType == Suffixes) || (specType == ExPath) ||
-	(specType == Includes) || (specType == Libs) ||
-	(specType == Null) || (specType == ExObjdir))
+if (specType == Suffixes || specType == ExPath ||
+	specType == Includes || specType == Libs ||
+	specType == Null || specType == ExObjdir)
 {
 	while (*line) {
 	/*
@@ -1709,7 +1709,7 @@ ParseDoDependency(char *line)
 	 * and handle them accordingly.
 	 */
 	for (; *cp && !isspace ((unsigned char)*cp); cp++) {
-		if ((*cp == LPAREN) && (cp > line) && (cp[-1] != '$')) {
+		if (*cp == LPAREN && cp > line && cp[-1] != '$') {
 		/*
 		 * Only stop for a left parenthesis if it isn't at the
 		 * start of a word (that'll be for variable changes
@@ -1797,8 +1797,8 @@ Parse_IsVar(char *line)
 /*
  * Skip to variable name
  */
-for (;(*line == ' ') || (*line == '\t'); line++)
-	continue;
+while (*line == ' ' || *line == '\t')
+	line++;
 
 /* Scan for one of the assignment operators outside a variable expansion */
 while ((ch = *line++) != 0) {
@@ -1875,9 +1875,8 @@ Parse_DoVar(char *line, GNode *ctxt)
 /*
  * Skip to variable name
  */
-while ((*line == ' ') || (*line == '\t')) {
+while (*line == ' ' || *line == '\t')
 	line++;
-}
 
 /*
  * Skip to operator character, nulling out whitespace as we go
@@ -2290,7 +2289,7 @@ ParseDoInclude(char *line)
 {
 char  endc;		/* the character 

CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Tue Jul 28 18:53:07 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: export.mk

Log Message:
Use egrep rather than grep -E

Also we need to exclude noise that some shells include.
This is why the original test restricted itself to checking
for UT_* in env.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/export.mk

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Tue Jul 28 18:53:07 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: export.mk

Log Message:
Use egrep rather than grep -E

Also we need to exclude noise that some shells include.
This is why the original test restricted itself to checking
for UT_* in env.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/export.mk

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/make/unit-tests/export.mk
diff -u src/usr.bin/make/unit-tests/export.mk:1.3 src/usr.bin/make/unit-tests/export.mk:1.4
--- src/usr.bin/make/unit-tests/export.mk:1.3	Mon Jul 27 19:53:37 2020
+++ src/usr.bin/make/unit-tests/export.mk	Tue Jul 28 18:53:07 2020
@@ -1,4 +1,4 @@
-# $Id: export.mk,v 1.3 2020/07/27 19:53:37 rillig Exp $
+# $Id: export.mk,v 1.4 2020/07/28 18:53:07 sjg Exp $
 
 UT_TEST=export
 UT_FOO=foo${BAR}
@@ -37,7 +37,7 @@ BAR=bar is ${UT_FU}
 
 .MAKE.EXPORTED+= UT_ZOO UT_TEST
 
-FILTER_CMD?=	grep -v -E '^(MAKEFLAGS|PATH|PWD)='
+FILTER_CMD?=	egrep -v '^(MAKEFLAGS|PATH|PWD|SHLVL|_)='
 
 all:
 	@env | ${FILTER_CMD} | sort



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Tue Jul 28 18:39:56 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
Use cat if no POSTPROC.${.TARGET:R}

On Linux sed with no flags throws an error.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/make/unit-tests/Makefile

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/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.73 src/usr.bin/make/unit-tests/Makefile:1.74
--- src/usr.bin/make/unit-tests/Makefile:1.73	Tue Jul 28 16:26:37 2020
+++ src/usr.bin/make/unit-tests/Makefile	Tue Jul 28 18:39:56 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.73 2020/07/28 16:26:37 sjg Exp $
+# $NetBSD: Makefile,v 1.74 2020/07/28 18:39:56 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -158,7 +158,7 @@ _SED_CMDS+=	-e 's,${UNIT_TESTS:S,.,\\.,g
 	@echo postprocess ${.TARGET}
 	@${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.TARGET:R}} \
 	  < ${.IMPSRC} > ${.TARGET}.tmp1
-	@${POSTPROC.${.TARGET:R}:U${TOOL_SED}} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
+	@${POSTPROC.${.TARGET:R}:Ucat} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
 	@rm ${.TARGET}.tmp1
 	@echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp2
 	@mv ${.TARGET}.tmp2 ${.TARGET}



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Tue Jul 28 18:39:56 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
Use cat if no POSTPROC.${.TARGET:R}

On Linux sed with no flags throws an error.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/make/unit-tests/Makefile

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



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 18:31:16 UTC 2020

Modified Files:
src/usr.bin/make: parse.c

Log Message:
make(1): remove dead code in parse error handling


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/make/parse.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.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.240 src/usr.bin/make/parse.c:1.241
--- src/usr.bin/make/parse.c:1.240	Tue Jul 28 18:15:11 2020
+++ src/usr.bin/make/parse.c	Tue Jul 28 18:31:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.241 2020/07/28 18:31:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.241 2020/07/28 18:31:16 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.241 2020/07/28 18:31:16 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1299,8 +1299,7 @@ ParseDoDependency(char *line)
 		Parse_Error(PARSE_FATAL, "Unknown directive \"%.*s\"",
 			(int)(dirend - dirstart), dirstart);
 	} else
-		Parse_Error(PARSE_FATAL, lstart[0] == '.' ? "Unknown directive"
- : "Need an operator");
+		Parse_Error(PARSE_FATAL, "Need an operator");
 	goto out;
 	}
 



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 18:31:16 UTC 2020

Modified Files:
src/usr.bin/make: parse.c

Log Message:
make(1): remove dead code in parse error handling


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/make/parse.c

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 18:25:33 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.exp directives.mk

Log Message:
make(1): add tests for unknown indented directives

It's quite expected that the .${:Uinfo} is not yet expanded when the
directive is parsed, otherwise the directive would have been accepted.
The surprising thing is that it is expanded at the point where the error
message is generated.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directives.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directives.mk

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/make/unit-tests/directives.exp
diff -u src/usr.bin/make/unit-tests/directives.exp:1.3 src/usr.bin/make/unit-tests/directives.exp:1.4
--- src/usr.bin/make/unit-tests/directives.exp:1.3	Tue Jul 28 18:15:11 2020
+++ src/usr.bin/make/unit-tests/directives.exp	Tue Jul 28 18:25:33 2020
@@ -31,7 +31,11 @@ make: "directives.mk" line 132: Unknown 
 make: "directives.mk" line 133: 1 taken
 make: "directives.mk" line 134: Unknown directive "elsif"
 make: "directives.mk" line 135: 2 taken
-make: "directives.mk" line 140: end of the tests
+make: "directives.mk" line 140: Unknown directive "indented"
+make: "directives.mk" line 141: Unknown directive "indented"
+make: "directives.mk" line 142: Unknown directive "indented"
+make: "directives.mk" line 143: Unknown directive "info"
+make: "directives.mk" line 150: end of the tests
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/directives.mk
diff -u src/usr.bin/make/unit-tests/directives.mk:1.2 src/usr.bin/make/unit-tests/directives.mk:1.3
--- src/usr.bin/make/unit-tests/directives.mk:1.2	Tue Jul 28 17:47:57 2020
+++ src/usr.bin/make/unit-tests/directives.mk	Tue Jul 28 18:25:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directives.mk,v 1.2 2020/07/28 17:47:57 rillig Exp $
+# $NetBSD: directives.mk,v 1.3 2020/07/28 18:25:33 rillig Exp $
 #
 # Tests for parsing directives, in the same order as in the manual page.
 #
@@ -137,6 +137,16 @@
 .info else taken
 .endif
 
+.indented none
+.  indented 2 spaces
+.	indented tab
+.${:Uinfo} directives cannot be indirect
+
+
+
+
+
+
 .info end of the tests
 
 all:



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 18:25:33 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.exp directives.mk

Log Message:
make(1): add tests for unknown indented directives

It's quite expected that the .${:Uinfo} is not yet expanded when the
directive is parsed, otherwise the directive would have been accepted.
The surprising thing is that it is expanded at the point where the error
message is generated.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directives.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directives.mk

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



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 18:15:11 UTC 2020

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directives.exp

Log Message:
make(1): when parsing an unknown directive, print the directive name


To generate a diff of this commit:
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directives.exp

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



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 18:15:11 UTC 2020

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directives.exp

Log Message:
make(1): when parsing an unknown directive, print the directive name


To generate a diff of this commit:
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directives.exp

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/make/parse.c
diff -u src/usr.bin/make/parse.c:1.239 src/usr.bin/make/parse.c:1.240
--- src/usr.bin/make/parse.c:1.239	Tue Jul 28 16:42:22 2020
+++ src/usr.bin/make/parse.c	Tue Jul 28 18:15:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.239 2020/07/28 16:42:22 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.239 2020/07/28 16:42:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.239 2020/07/28 16:42:22 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1289,7 +1289,16 @@ ParseDoDependency(char *line)
 		(strncmp(line, ">>", 6) == 0))
 		Parse_Error(PARSE_FATAL,
 		"Makefile appears to contain unresolved cvs/rcs/??? merge conflicts");
-	else
+	else if (lstart[0] == '.') {
+		const char *dirstart = lstart + 1;
+		while (isspace((unsigned char)*dirstart))
+		dirstart++;
+		const char *dirend = dirstart;
+		while (isalnum((unsigned char)*dirend) || *dirend == '-')
+		dirend++;
+		Parse_Error(PARSE_FATAL, "Unknown directive \"%.*s\"",
+			(int)(dirend - dirstart), dirstart);
+	} else
 		Parse_Error(PARSE_FATAL, lstart[0] == '.' ? "Unknown directive"
  : "Need an operator");
 	goto out;

Index: src/usr.bin/make/unit-tests/directives.exp
diff -u src/usr.bin/make/unit-tests/directives.exp:1.2 src/usr.bin/make/unit-tests/directives.exp:1.3
--- src/usr.bin/make/unit-tests/directives.exp:1.2	Tue Jul 28 17:47:57 2020
+++ src/usr.bin/make/unit-tests/directives.exp	Tue Jul 28 18:15:11 2020
@@ -1,25 +1,25 @@
 make: "directives.mk" line 10: begin .export tests
-make: "directives.mk" line 11: Unknown directive
+make: "directives.mk" line 11: Unknown directive "expor"
 make: "directives.mk" line 20: begin .export-env tests
 make: "directives.mk" line 30: begin .export-literal tests
 make: "directives.mk" line 40: begin .info tests
-make: "directives.mk" line 41: Unknown directive
-make: "directives.mk" line 42: Unknown directive
+make: "directives.mk" line 41: Unknown directive "inf"
+make: "directives.mk" line 42: Unknown directive "info"
 make: "directives.mk" line 43: message
 make: "directives.mk" line 44: indented message
-make: "directives.mk" line 45: Unknown directive
+make: "directives.mk" line 45: Unknown directive "information"
 make: "directives.mk" line 46: message
 make: "directives.mk" line 50: begin .undef tests
-make: "directives.mk" line 51: Unknown directive
+make: "directives.mk" line 51: Unknown directive "unde"
 make: "directives.mk" line 60: begin .unexport tests
-make: "directives.mk" line 61: Unknown directive
+make: "directives.mk" line 61: Unknown directive "unexpor"
 make: "directives.mk" line 70: begin .unexport-env tests
 make: "directives.mk" line 80: begin .warning tests
-make: "directives.mk" line 81: Unknown directive
-make: "directives.mk" line 82: Unknown directive
-make: "directives.mk" line 83: Unknown directive
+make: "directives.mk" line 81: Unknown directive "warn"
+make: "directives.mk" line 82: Unknown directive "warnin"
+make: "directives.mk" line 83: Unknown directive "warning"
 make: "directives.mk" line 84: warning: message
-make: "directives.mk" line 85: Unknown directive
+make: "directives.mk" line 85: Unknown directive "warnings"
 make: "directives.mk" line 86: warning: messages
 make: "directives.mk" line 90: begin .elif misspellings tests, part 1
 make: "directives.mk" line 100: begin .elif misspellings tests, part 2
@@ -27,9 +27,9 @@ make: "directives.mk" line 110: begin .e
 make: "directives.mk" line 120: which branch is taken on misspelling after false?
 make: "directives.mk" line 127: else taken
 make: "directives.mk" line 130: which branch is taken on misspelling after true?
-make: "directives.mk" line 132: Unknown directive
+make: "directives.mk" line 132: Unknown directive "elsif"
 make: "directives.mk" line 133: 1 taken
-make: "directives.mk" line 134: Unknown directive
+make: "directives.mk" line 134: Unknown directive "elsif"
 make: "directives.mk" line 135: 2 taken
 make: "directives.mk" line 140: end of the tests

CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 17:47:57 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.exp directives.mk

Log Message:
make(1): refine test for detecting misspellings in directives

The names of directives are only checked if the lines are actually
relevant.  In all other cases, the amount of work is reduced to the bare
minimum, which is just to scan for line continuations.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directives.exp \
src/usr.bin/make/unit-tests/directives.mk

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 17:47:57 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directives.exp directives.mk

Log Message:
make(1): refine test for detecting misspellings in directives

The names of directives are only checked if the lines are actually
relevant.  In all other cases, the amount of work is reduced to the bare
minimum, which is just to scan for line continuations.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directives.exp \
src/usr.bin/make/unit-tests/directives.mk

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/make/unit-tests/directives.exp
diff -u src/usr.bin/make/unit-tests/directives.exp:1.1 src/usr.bin/make/unit-tests/directives.exp:1.2
--- src/usr.bin/make/unit-tests/directives.exp:1.1	Mon Jul 27 20:46:17 2020
+++ src/usr.bin/make/unit-tests/directives.exp	Tue Jul 28 17:47:57 2020
@@ -24,7 +24,14 @@ make: "directives.mk" line 86: warning: 
 make: "directives.mk" line 90: begin .elif misspellings tests, part 1
 make: "directives.mk" line 100: begin .elif misspellings tests, part 2
 make: "directives.mk" line 110: begin .elif misspellings tests, part 3
-make: "directives.mk" line 120: end of the tests
+make: "directives.mk" line 120: which branch is taken on misspelling after false?
+make: "directives.mk" line 127: else taken
+make: "directives.mk" line 130: which branch is taken on misspelling after true?
+make: "directives.mk" line 132: Unknown directive
+make: "directives.mk" line 133: 1 taken
+make: "directives.mk" line 134: Unknown directive
+make: "directives.mk" line 135: 2 taken
+make: "directives.mk" line 140: end of the tests
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
Index: src/usr.bin/make/unit-tests/directives.mk
diff -u src/usr.bin/make/unit-tests/directives.mk:1.1 src/usr.bin/make/unit-tests/directives.mk:1.2
--- src/usr.bin/make/unit-tests/directives.mk:1.1	Mon Jul 27 20:46:17 2020
+++ src/usr.bin/make/unit-tests/directives.mk	Tue Jul 28 17:47:57 2020
@@ -1,12 +1,12 @@
-# $NetBSD: directives.mk,v 1.1 2020/07/27 20:46:17 rillig Exp $
+# $NetBSD: directives.mk,v 1.2 2020/07/28 17:47:57 rillig Exp $
 #
 # Tests for parsing directives, in the same order as in the manual page.
 #
-# Each test group has 10 lines, to keep the expected file stable.
+# Each test group has 10 lines, to keep the line numbers in directives.exp
+# stable.
 #
 # no tests for .error since it exits immediately, see ParseMessage.
 
-
 .info begin .export tests
 .expor# misspelled
 .export# oops: missing argument
@@ -117,6 +117,26 @@
 
 
 
+.info which branch is taken on misspelling after false?
+.if 0
+.elsif 1
+.info 1 taken
+.elsif 2
+.info 2 taken
+.else
+.info else taken
+.endif
+
+.info which branch is taken on misspelling after true?
+.if 1
+.elsif 1
+.info 1 taken
+.elsif 2
+.info 2 taken
+.else
+.info else taken
+.endif
+
 .info end of the tests
 
 all:



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 17:18:40 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: varmisc.exp varmisc.mk

Log Message:
make(1): issue a parse error on unclosed variables

These errors had not been detected before by make.
In pkgsrc, this task as been done by pkglint since 2019-04-07.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/usr.bin/make/var.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmisc.mk

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/make/var.c
diff -u src/usr.bin/make/var.c:1.352 src/usr.bin/make/var.c:1.353
--- src/usr.bin/make/var.c:1.352	Tue Jul 28 16:42:22 2020
+++ src/usr.bin/make/var.c	Tue Jul 28 17:18:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.352 2020/07/28 16:42:22 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.353 2020/07/28 17:18:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.352 2020/07/28 16:42:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.353 2020/07/28 17:18:40 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.352 2020/07/28 16:42:22 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.353 2020/07/28 17:18:40 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3506,6 +3506,8 @@ Var_Parse(const char * const str, GNode 
 	} else if (*tstr == endc) {
 	haveModifier = FALSE;
 	} else {
+	Parse_Error(PARSE_FATAL, "Unclosed variable \"%s\"",
+			Buf_GetAll(, NULL));
 	/*
 	 * If we never did find the end character, return NULL
 	 * right now, setting the length to be the distance to

Index: src/usr.bin/make/unit-tests/varmisc.exp
diff -u src/usr.bin/make/unit-tests/varmisc.exp:1.13 src/usr.bin/make/unit-tests/varmisc.exp:1.14
--- src/usr.bin/make/unit-tests/varmisc.exp:1.13	Sun Jul 26 21:46:10 2020
+++ src/usr.bin/make/unit-tests/varmisc.exp	Tue Jul 28 17:18:40 2020
@@ -47,9 +47,24 @@ parse-dynamic: parse-dynamic parse-dynam
 parse-dynamic: parse-dynamic parse-dynamic after
 parse-dynamic: parse-dynamic parse-dynamic after
 varerror-unclosed:begin
+make: Unclosed variable ""
 
+make: Unclosed variable "UNCLOSED"
+
+make: Unclosed variable "UNCLOSED"
+
+make: Unclosed variable "PATTERN"
 make: Unclosed variable specification (expecting '}') for "UNCLOSED" (value "") modifier M
 
+make: Unclosed variable "param"
+make: Unclosed variable "UNCLOSED."
+
+
+make: Unclosed variable "UNCLOSED.1"
+
+make: Unclosed variable "UNCLOSED.2"
+
+make: Unclosed variable "UNCLOSED.3"
 
 varerror-unclosed:end
 exit status 0

Index: src/usr.bin/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.17 src/usr.bin/make/unit-tests/varmisc.mk:1.18
--- src/usr.bin/make/unit-tests/varmisc.mk:1.17	Sun Jul 26 21:46:10 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Tue Jul 28 17:18:40 2020
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.17 2020/07/26 21:46:10 rillig Exp $
+# $Id: varmisc.mk,v 1.18 2020/07/28 17:18:40 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -191,11 +191,18 @@ parse-dynamic:
 	@echo $@: ${GB_TARGET} ${GB_MEMBER} ${GB_PREFIX} ${GB_ARCHIVE} ${GB_ALLSRC}
 	@echo $@: ${GL_TARGET} ${GL_MEMBER} ${GL_PREFIX} ${GL_ARCHIVE} ${GL_ALLSRC}
 
-# As of 2020-07-26, make does not complain about unclosed variables.
-# It does complain about unclosed variables when parsing modifiers though.
+# Since 2020-07-28, make complains about unclosed variables.
+# Before that, it had not complained about unclosed variables only when
+# parsing the modifiers, but not when parsing the variable name.
 varerror-unclosed:
 	@echo $@:begin
+	@echo $(
+	@echo $(UNCLOSED
 	@echo ${UNCLOSED
 	@echo ${UNCLOSED:M${PATTERN
 	@echo ${UNCLOSED.${param
+	@echo $
+.for i in 1 2 3
+	@echo ${UNCLOSED.${i}
+.endfor
 	@echo $@:end



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 17:18:40 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: varmisc.exp varmisc.mk

Log Message:
make(1): issue a parse error on unclosed variables

These errors had not been detected before by make.
In pkgsrc, this task as been done by pkglint since 2019-04-07.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/usr.bin/make/var.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmisc.mk

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



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 16:45:56 UTC 2020

Modified Files:
src/usr.bin/make: for.c

Log Message:
make(1): remove unnecessary struct tag

Identifiers starting with an underscore and an uppercase letter are
reserved for the C implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/make/for.c

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



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 16:45:56 UTC 2020

Modified Files:
src/usr.bin/make: for.c

Log Message:
make(1): remove unnecessary struct tag

Identifiers starting with an underscore and an uppercase letter are
reserved for the C implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/make/for.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.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.56 src/usr.bin/make/for.c:1.57
--- src/usr.bin/make/for.c:1.56	Tue Jul 28 16:42:22 2020
+++ src/usr.bin/make/for.c	Tue Jul 28 16:45:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.56 2020/07/28 16:42:22 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.57 2020/07/28 16:45:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.56 2020/07/28 16:42:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.57 2020/07/28 16:45:56 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.56 2020/07/28 16:42:22 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.57 2020/07/28 16:45:56 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -88,7 +88,7 @@ static int  	  forLevel = 0;  	/* Nestin
 /*
  * State of a for loop.
  */
-typedef struct _For {
+typedef struct {
 Buffer	  buf;			/* Body of loop		*/
 strlist_t vars;			/* Iteration variables	*/
 strlist_t items;		/* Substitution items */



CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 16:42:22 UTC 2020

Modified Files:
src/usr.bin/make: arch.c compat.c for.c job.c main.c make.c meta.c
nonints.h parse.c suff.c var.c

Log Message:
make(1): remove dead code from Var_Subst

The first parameter from Var_Subst had been a literal NULL in all cases.
These have been fixed using this command:

sed -i 's|Var_Subst(NULL, |Var_Subst(|' *.c

The one remaining case was not found because the "NULL," was followed by
a line break instead of a space.

The removed code probably wouldn't have worked as expected anyway.
Expanding a single variable to a literal string would have led to
unexpected behavior for cases like ${VAR:M${pattern}}, in case pattern
would contain an unescaped ':' itself.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/make/arch.c
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/make/compat.c
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/make/for.c
cvs rdiff -u -r1.202 -r1.203 src/usr.bin/make/job.c
cvs rdiff -u -r1.283 -r1.284 src/usr.bin/make/main.c
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/make/make.c
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/make/meta.c
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.238 -r1.239 src/usr.bin/make/parse.c
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/make/suff.c
cvs rdiff -u -r1.351 -r1.352 src/usr.bin/make/var.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.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.76 src/usr.bin/make/arch.c:1.77
--- src/usr.bin/make/arch.c:1.76	Mon Jul 27 19:06:45 2020
+++ src/usr.bin/make/arch.c	Tue Jul 28 16:42:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.76 2020/07/27 19:06:45 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.77 2020/07/28 16:42:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.76 2020/07/27 19:06:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.77 2020/07/28 16:42:22 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.76 2020/07/27 19:06:45 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.77 2020/07/28 16:42:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -276,7 +276,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 
 *cp++ = '\0';
 if (subLibName) {
-	libName = Var_Subst(NULL, libName, ctxt, VARE_UNDEFERR|VARE_WANTRES);
+	libName = Var_Subst(libName, ctxt, VARE_UNDEFERR|VARE_WANTRES);
 }
 
 
@@ -356,8 +356,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 	char*oldMemName = memName;
 	size_t   sz;
 
-	memName = Var_Subst(NULL, memName, ctxt,
-VARE_UNDEFERR|VARE_WANTRES);
+	memName = Var_Subst(memName, ctxt, VARE_UNDEFERR | VARE_WANTRES);
 
 	/*
 	 * Now form an archive spec and recurse to deal with nested

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.114 src/usr.bin/make/compat.c:1.115
--- src/usr.bin/make/compat.c:1.114	Sun Jul 19 12:26:17 2020
+++ src/usr.bin/make/compat.c	Tue Jul 28 16:42:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.114 2020/07/19 12:26:17 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.115 2020/07/28 16:42:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.114 2020/07/19 12:26:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.115 2020/07/28 16:42:22 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.114 2020/07/19 12:26:17 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.115 2020/07/28 16:42:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -235,7 +235,7 @@ CompatRunCommand(void *cmdp, void *gnp)
 doIt = FALSE;
 
 cmdNode = Lst_Member(gn->commands, cmd);
-cmdStart = Var_Subst(NULL, cmd, gn, VARE_WANTRES);
+cmdStart = Var_Subst(cmd, gn, VARE_WANTRES);
 
 /*
  * brk_string will return an argv with a NULL in av[0], thus causing

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.55 src/usr.bin/make/for.c:1.56
--- src/usr.bin/make/for.c:1.55	Sun Jul 19 12:26:17 2020
+++ src/usr.bin/make/for.c	Tue Jul 28 16:42:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.55 2020/07/19 12:26:17 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.56 2020/07/28 16:42:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.55 2020/07/19 12:26:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.56 2020/07/28 16:42:22 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char 

CVS commit: src/usr.bin/make

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 16:42:22 UTC 2020

Modified Files:
src/usr.bin/make: arch.c compat.c for.c job.c main.c make.c meta.c
nonints.h parse.c suff.c var.c

Log Message:
make(1): remove dead code from Var_Subst

The first parameter from Var_Subst had been a literal NULL in all cases.
These have been fixed using this command:

sed -i 's|Var_Subst(NULL, |Var_Subst(|' *.c

The one remaining case was not found because the "NULL," was followed by
a line break instead of a space.

The removed code probably wouldn't have worked as expected anyway.
Expanding a single variable to a literal string would have led to
unexpected behavior for cases like ${VAR:M${pattern}}, in case pattern
would contain an unescaped ':' itself.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/make/arch.c
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/make/compat.c
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/make/for.c
cvs rdiff -u -r1.202 -r1.203 src/usr.bin/make/job.c
cvs rdiff -u -r1.283 -r1.284 src/usr.bin/make/main.c
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/make/make.c
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/make/meta.c
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.238 -r1.239 src/usr.bin/make/parse.c
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/make/suff.c
cvs rdiff -u -r1.351 -r1.352 src/usr.bin/make/var.c

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Tue Jul 28 16:26:37 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
Ensure .CURDIR is correct for tests that run sub-makes


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/make/unit-tests/Makefile

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/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.72 src/usr.bin/make/unit-tests/Makefile:1.73
--- src/usr.bin/make/unit-tests/Makefile:1.72	Tue Jul 28 16:11:55 2020
+++ src/usr.bin/make/unit-tests/Makefile	Tue Jul 28 16:26:37 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.72 2020/07/28 16:11:55 rillig Exp $
+# $NetBSD: Makefile,v 1.73 2020/07/28 16:26:37 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -136,7 +136,7 @@ LANG=		C
 	@echo testing ${.IMPSRC}
 	@set -eu; \
 	cd ${.OBJDIR}; \
-	env ${ENV.${.TARGET:R}} ${TEST_MAKE} \
+	env ${ENV.${.TARGET:R}} ${TEST_MAKE} -C ${.CURDIR} \
 	  ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC} \
 	  > ${.TARGET}.tmp 2>&1 \
 	&& status=$$? || status=$$?; \



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Tue Jul 28 16:26:37 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
Ensure .CURDIR is correct for tests that run sub-makes


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/make/unit-tests/Makefile

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



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 16:11:55 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
make(1): disable archive test

On FreeBSD, running the archive.mk test results in "create-archive is up
to date" and similar messages.  The situation is unclear, and the
archive code seems to be practically unused.  Furthermore the archive
test doesn't ensure that it is run in ${.PARSEDIR}, so it needs a bit
more work.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/make/unit-tests/Makefile

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/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.71 src/usr.bin/make/unit-tests/Makefile:1.72
--- src/usr.bin/make/unit-tests/Makefile:1.71	Tue Jul 28 00:48:00 2020
+++ src/usr.bin/make/unit-tests/Makefile	Tue Jul 28 16:11:55 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.71 2020/07/28 00:48:00 sjg Exp $
+# $NetBSD: Makefile,v 1.72 2020/07/28 16:11:55 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -30,7 +30,7 @@
 
 # Each test is in a sub-makefile.
 # Keep the list sorted.
-TESTS+=		archive
+TESTS+=		# archive	# broken on FreeBSD
 TESTS+=		comment
 TESTS+=		cond-late
 TESTS+=		cond-short



CVS commit: src/usr.bin/make/unit-tests

2020-07-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jul 28 16:11:55 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
make(1): disable archive test

On FreeBSD, running the archive.mk test results in "create-archive is up
to date" and similar messages.  The situation is unclear, and the
archive code seems to be practically unused.  Furthermore the archive
test doesn't ensure that it is run in ${.PARSEDIR}, so it needs a bit
more work.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/make/unit-tests/Makefile

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



CVS commit: src/sys/dev/ic

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 15:59:19 UTC 2020

Modified Files:
src/sys/dev/ic: nvme.c

Log Message:
say what is not configured in nvme_print()


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/nvme.c

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



CVS commit: src/sys/dev/ic

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 15:59:19 UTC 2020

Modified Files:
src/sys/dev/ic: nvme.c

Log Message:
say what is not configured in nvme_print()


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/nvme.c

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

Modified files:

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.48 src/sys/dev/ic/nvme.c:1.49
--- src/sys/dev/ic/nvme.c:1.48	Tue Apr  7 07:25:41 2020
+++ src/sys/dev/ic/nvme.c	Tue Jul 28 15:59:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.48 2020/04/07 07:25:41 ryo Exp $	*/
+/*	$NetBSD: nvme.c,v 1.49 2020/07/28 15:59:19 jdolecek Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.48 2020/04/07 07:25:41 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.49 2020/07/28 15:59:19 jdolecek Exp $");
 
 #include 
 #include 
@@ -499,7 +499,7 @@ nvme_print(void *aux, const char *pnp)
 	struct nvme_attach_args *naa = aux;
 
 	if (pnp)
-		aprint_normal("at %s", pnp);
+		aprint_normal("ld at %s", pnp);
 
 	if (naa->naa_nsid > 0)
 		aprint_normal(" nsid %d", naa->naa_nsid);



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

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 15:42:41 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon_64.S

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/crypto/chacha/arch/arm/chacha_neon_64.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/crypto/chacha/arch/arm/chacha_neon_64.S
diff -u src/sys/crypto/chacha/arch/arm/chacha_neon_64.S:1.4 src/sys/crypto/chacha/arch/arm/chacha_neon_64.S:1.5
--- src/sys/crypto/chacha/arch/arm/chacha_neon_64.S:1.4	Mon Jul 27 20:57:23 2020
+++ src/sys/crypto/chacha/arch/arm/chacha_neon_64.S	Tue Jul 28 15:42:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: chacha_neon_64.S,v 1.4 2020/07/27 20:57:23 riastradh Exp $	*/
+/*	$NetBSD: chacha_neon_64.S,v 1.5 2020/07/28 15:42:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: chacha_neon_64.S,v 1.4 2020/07/27 20:57:23 riastradh Exp $")
+RCSID("$NetBSD: chacha_neon_64.S,v 1.5 2020/07/28 15:42:41 riastradh Exp $")
 
 #define	ROUND(a0,b0,c0,d0,a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,t0,t1,t2,t3, r) \
 STEP(STEP0,a0,b0,c0,d0,a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,t0,t1,t2,t3, r);   \
@@ -142,7 +142,7 @@ STEP(STEP19,a0,b0,c0,d0,a1,b1,c1,d1,a2,b
  * chacha_stream256_neon(uint8_t s[256]@x0,
  * uint32_t blkno@w1,
  * const uint8_t nonce[12]@x2,
- * const uint8_t key[12]@x3,
+ * const uint8_t key[32]@x3,
  * const uint8_t const[16]@x4,
  * unsigned nr@w5)
  */



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

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 15:42:41 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon_64.S

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/crypto/chacha/arch/arm/chacha_neon_64.S

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



CVS commit: src/sys/net80211

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 15:41:26 UTC 2020

Modified Files:
src/sys/net80211: ieee80211_crypto_ccmp.c

Log Message:
Omit now-unused function.

Ceased to be needed with the AES CCM changes.

For some reason gcc didn't complain about this, but clang did.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/net80211/ieee80211_crypto_ccmp.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/net80211/ieee80211_crypto_ccmp.c
diff -u src/sys/net80211/ieee80211_crypto_ccmp.c:1.17 src/sys/net80211/ieee80211_crypto_ccmp.c:1.18
--- src/sys/net80211/ieee80211_crypto_ccmp.c:1.17	Sat Jul 25 22:27:05 2020
+++ src/sys/net80211/ieee80211_crypto_ccmp.c	Tue Jul 28 15:41:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_crypto_ccmp.c,v 1.17 2020/07/25 22:27:05 riastradh Exp $	*/
+/*	$NetBSD: ieee80211_crypto_ccmp.c,v 1.18 2020/07/28 15:41:26 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_ccmp.c,v 1.7 2005/07/11 03:06:23 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.17 2020/07/25 22:27:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.18 2020/07/28 15:41:26 riastradh Exp $");
 #endif
 
 /*
@@ -266,14 +266,6 @@ ccmp_demic(struct ieee80211_key *k, stru
 	return 1;
 }
 
-static __inline void
-xor_block(uint8_t *b, const uint8_t *a, size_t len)
-{
-	int i;
-	for (i = 0; i < len; i++)
-		b[i] ^= a[i];
-}
-
 /*
  * Host AP crypt: host-based CCMP encryption implementation for Host AP driver
  *



CVS commit: src/sys/net80211

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 15:41:26 UTC 2020

Modified Files:
src/sys/net80211: ieee80211_crypto_ccmp.c

Log Message:
Omit now-unused function.

Ceased to be needed with the AES CCM changes.

For some reason gcc didn't complain about this, but clang did.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/net80211/ieee80211_crypto_ccmp.c

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



CVS commit: src/sys/arch/x86/x86

2020-07-28 Thread Frederic Cambus
Module Name:src
Committed By:   fcambus
Date:   Tue Jul 28 14:49:55 UTC 2020

Modified Files:
src/sys/arch/x86/x86: cpu.c

Log Message:
Use CPU_IS_PRIMARY macro in cpu_stop(), cpu_resume(), and cpu_get_tsc_freq()
on x86.

OK kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/x86/x86/cpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.195 src/sys/arch/x86/x86/cpu.c:1.196
--- src/sys/arch/x86/x86/cpu.c:1.195	Tue Jul 14 00:45:53 2020
+++ src/sys/arch/x86/x86/cpu.c	Tue Jul 28 14:49:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.195 2020/07/14 00:45:53 yamaguchi Exp $	*/
+/*	$NetBSD: cpu.c,v 1.196 2020/07/28 14:49:55 fcambus Exp $	*/
 
 /*
  * Copyright (c) 2000-2020 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.195 2020/07/14 00:45:53 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.196 2020/07/28 14:49:55 fcambus Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -1224,7 +1224,7 @@ cpu_stop(device_t dv)
 
 	KASSERT((ci->ci_flags & CPUF_PRESENT) != 0);
 
-	if ((ci->ci_flags & CPUF_PRIMARY) != 0)
+	if (CPU_IS_PRIMARY(ci))
 		return true;
 
 	if (ci->ci_data.cpu_idlelwp == NULL)
@@ -1269,7 +1269,7 @@ cpu_resume(device_t dv, const pmf_qual_t
 	if ((ci->ci_flags & CPUF_PRESENT) == 0)
 		return true;
 
-	if ((ci->ci_flags & CPUF_PRIMARY) != 0)
+	if (CPU_IS_PRIMARY(ci))
 		goto out;
 
 	if (ci->ci_data.cpu_idlelwp == NULL)
@@ -1312,7 +1312,7 @@ cpu_get_tsc_freq(struct cpu_info *ci)
 	uint64_t freq = 0, freq_from_cpuid, t0, t1;
 	int64_t overhead;
 
-	if ((ci->ci_flags & CPUF_PRIMARY) != 0 && cpu_hascounter()) {
+	if (CPU_IS_PRIMARY(ci) && cpu_hascounter()) {
 		/*
 		 * If it's the first call of this function, try to get TSC
 		 * freq from CPUID by calling cpu_tsc_freq_cpuid().



CVS commit: src/sys/arch/x86/x86

2020-07-28 Thread Frederic Cambus
Module Name:src
Committed By:   fcambus
Date:   Tue Jul 28 14:49:55 UTC 2020

Modified Files:
src/sys/arch/x86/x86: cpu.c

Log Message:
Use CPU_IS_PRIMARY macro in cpu_stop(), cpu_resume(), and cpu_get_tsc_freq()
on x86.

OK kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/x86/x86/cpu.c

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



CVS commit: src/share/misc

2020-07-28 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Tue Jul 28 14:35:34 UTC 2020

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add TSV


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.308 src/share/misc/acronyms.comp:1.309
--- src/share/misc/acronyms.comp:1.308	Sat Jul 11 13:04:29 2020
+++ src/share/misc/acronyms.comp	Tue Jul 28 14:35:34 2020
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.308 2020/07/11 13:04:29 nia Exp $
+$NetBSD: acronyms.comp,v 1.309 2020/07/28 14:35:34 leot Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -1646,6 +1646,7 @@ TSP	Tunnel Setup Protocol
 TSP	time synchronization protocol
 TSP	traveling salesman problem
 TSS	task state segment
+TSV	tab-separated values
 TTL	time to live
 TTL	transistor-transistor logic
 TTM	translation table maps



CVS commit: src/share/misc

2020-07-28 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Tue Jul 28 14:35:34 UTC 2020

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add TSV


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/share/misc/acronyms.comp

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



CVS commit: src/sys/crypto/aes/arch/x86

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 14:01:35 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
Initialize authctr in both branches.

I guess I didn't test the unaligned case, weird.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/crypto/aes/arch/x86/aes_via.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/crypto/aes/arch/x86/aes_via.c
diff -u src/sys/crypto/aes/arch/x86/aes_via.c:1.5 src/sys/crypto/aes/arch/x86/aes_via.c:1.6
--- src/sys/crypto/aes/arch/x86/aes_via.c:1.5	Sat Jul 25 22:31:32 2020
+++ src/sys/crypto/aes/arch/x86/aes_via.c	Tue Jul 28 14:01:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_via.c,v 1.5 2020/07/25 22:31:32 riastradh Exp $	*/
+/*	$NetBSD: aes_via.c,v 1.6 2020/07/28 14:01:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.5 2020/07/25 22:31:32 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_via.c,v 1.6 2020/07/28 14:01:35 riastradh Exp $");
 
 #ifdef _KERNEL
 #include 
@@ -739,6 +739,7 @@ aesvia_ccm_enc1(const struct aesenc *enc
 		authctr = authctrbuf;
 		ccmenc_unaligned_evcnt.ev_count++;
 	} else {
+		authctr = authctr0;
 		ccmenc_aligned_evcnt.ev_count++;
 	}
 	c0 = le32dec(authctr0 + 16 + 4*0);
@@ -812,6 +813,7 @@ aesvia_ccm_dec1(const struct aesenc *enc
 		le32enc(authctr + 16 + 4*2, c2);
 		ccmdec_unaligned_evcnt.ev_count++;
 	} else {
+		authctr = authctr0;
 		ccmdec_aligned_evcnt.ev_count++;
 	}
 



CVS commit: src/sys/crypto/aes/arch/x86

2020-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 28 14:01:35 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/x86: aes_via.c

Log Message:
Initialize authctr in both branches.

I guess I didn't test the unaligned case, weird.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/crypto/aes/arch/x86/aes_via.c

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



CVS commit: src/doc

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 10:29:30 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
note that MSI was enabled by default for Xen


To generate a diff of this commit:
cvs rdiff -u -r1.2720 -r1.2721 src/doc/CHANGES

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



CVS commit: src/doc

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 10:29:30 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
note that MSI was enabled by default for Xen


To generate a diff of this commit:
cvs rdiff -u -r1.2720 -r1.2721 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2720 src/doc/CHANGES:1.2721
--- src/doc/CHANGES:1.2720	Sun Jul 26 15:14:23 2020
+++ src/doc/CHANGES	Tue Jul 28 10:29:30 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2720 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2721 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -261,3 +261,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	sun3: Add Xorg-Server-1.20'fied ancient monolithc Xsun servers.
 		[tsutsui 20200722]
 	wwanc(4): Add driver for Intel XMM7360 LTE modem [jdolecek 20200726]
+	xen: MSI enabled by default [jdolecek 20200728]



CVS commit: src/sys/arch

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 09:38:06 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
remove NO_PCI_MSI_MSIX again, enabling MSI for Xen Dom0 by default


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/conf/XEN3PAE_DOM0

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



CVS commit: src/sys/arch

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 09:38:06 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
remove NO_PCI_MSI_MSIX again, enabling MSI for Xen Dom0 by default


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/conf/XEN3PAE_DOM0

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.181 src/sys/arch/amd64/conf/XEN3_DOM0:1.182
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.181	Tue May 26 14:03:21 2020
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Tue Jul 28 09:38:06 2020
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.181 2020/05/26 14:03:21 jdolecek Exp $
+# $NetBSD: XEN3_DOM0,v 1.182 2020/07/28 09:38:06 jdolecek Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -12,7 +12,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.181 $"
+#ident		"XEN3_DOM0-$Revision: 1.182 $"
 
 maxusers	32		# estimated number of users
 
@@ -224,7 +224,6 @@ pci*		at hypervisor? bus ?
 pci*		at pchb? bus ?
 ppb*		at pci? dev ? function ?	# PCI-PCI bridges
 pci*		at ppb? bus ?
-options 	NO_PCI_MSI_MSIX
 
 # pci backend devices, used for PCI pass-through. To export a PCI device
 # to a domU, the device has to be attached to the pciback driver in the dom0.

Index: src/sys/arch/i386/conf/XEN3PAE_DOM0
diff -u src/sys/arch/i386/conf/XEN3PAE_DOM0:1.29 src/sys/arch/i386/conf/XEN3PAE_DOM0:1.30
--- src/sys/arch/i386/conf/XEN3PAE_DOM0:1.29	Tue May 26 14:03:21 2020
+++ src/sys/arch/i386/conf/XEN3PAE_DOM0	Tue Jul 28 09:38:06 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3PAE_DOM0,v 1.29 2020/05/26 14:03:21 jdolecek Exp $
+#	$NetBSD: XEN3PAE_DOM0,v 1.30 2020/07/28 09:38:06 jdolecek Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -212,7 +212,6 @@ balloon*	at xenbus?		# Xen balloon devic
 # PCI bus support
 pci*		at hypervisor? bus ?
 pci*		at pchb? bus ?
-options 	NO_PCI_MSI_MSIX
 
 # PCI bridges
 ichlpcib* at pci? dev ? function ?	# Intel ICH PCI-ISA w/ timecounter,



CVS commit: src/sys/dev

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 09:36:05 UTC 2020

Modified Files:
src/sys/dev/ic: nvmevar.h
src/sys/dev/pci: nvme_pci.c

Log Message:
add a quirk to disable MSI, and enable it for Intel SSD DC P4500

this device seems to cause serious system responsiveness issues when configured
to use MSI, while it works fine when configured for either INTx or MSI-X

this is important so this works well under Xen Dom0, which doesn't
support MSI-X yet

fixes another issue reported as feedback for PR port-xen/55285 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/nvmevar.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/nvme_pci.c

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

Modified files:

Index: src/sys/dev/ic/nvmevar.h
diff -u src/sys/dev/ic/nvmevar.h:1.20 src/sys/dev/ic/nvmevar.h:1.21
--- src/sys/dev/ic/nvmevar.h:1.20	Fri Jun 28 15:08:47 2019
+++ src/sys/dev/ic/nvmevar.h	Tue Jul 28 09:36:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmevar.h,v 1.20 2019/06/28 15:08:47 jmcneill Exp $	*/
+/*	$NetBSD: nvmevar.h,v 1.21 2020/07/28 09:36:05 jdolecek Exp $	*/
 /*	$OpenBSD: nvmevar.h,v 1.8 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -140,6 +140,7 @@ struct nvme_softc {
 
 	uint32_t		sc_quirks;
 #define	NVME_QUIRK_DELAY_B4_CHK_RDY	__BIT(0)
+#define	NVME_QUIRK_NOMSI		__BIT(1)
 
 	char			sc_modelname[81];
 };

Index: src/sys/dev/pci/nvme_pci.c
diff -u src/sys/dev/pci/nvme_pci.c:1.27 src/sys/dev/pci/nvme_pci.c:1.28
--- src/sys/dev/pci/nvme_pci.c:1.27	Mon Dec  2 03:06:51 2019
+++ src/sys/dev/pci/nvme_pci.c	Tue Jul 28 09:36:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme_pci.c,v 1.27 2019/12/02 03:06:51 msaitoh Exp $	*/
+/*	$NetBSD: nvme_pci.c,v 1.28 2020/07/28 09:36:05 jdolecek Exp $	*/
 /*	$OpenBSD: nvme_pci.c,v 1.3 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.27 2019/12/02 03:06:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.28 2020/07/28 09:36:05 jdolecek Exp $");
 
 #include 
 #include 
@@ -108,6 +108,8 @@ static const struct nvme_pci_quirk {
 	NVME_QUIRK_DELAY_B4_CHK_RDY },
 	{ PCI_VENDOR_SAMSUNGELEC3, PCI_PRODUCT_SAMSUNGELEC3_172XAB,
 	NVME_QUIRK_DELAY_B4_CHK_RDY },
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DC_P4500_SSD,
+	NVME_QUIRK_NOMSI },
 };
 
 static const struct nvme_pci_quirk *
@@ -158,6 +160,10 @@ nvme_pci_attach(device_t parent, device_
 	else
 		sc->sc_dmat = pa->pa_dmat;
 
+	quirk = nvme_pci_lookup_quirk(pa);
+	if (quirk != NULL)
+		sc->sc_quirks = quirk->quirks;
+
 	pci_aprint_devinfo(pa, NULL);
 
 	/* Map registers */
@@ -221,10 +227,6 @@ nvme_pci_attach(device_t parent, device_
 	sc->sc_softih = kmem_zalloc(
 	sizeof(*sc->sc_softih) * psc->psc_nintrs, KM_SLEEP);
 
-	quirk = nvme_pci_lookup_quirk(pa);
-	if (quirk != NULL)
-		sc->sc_quirks = quirk->quirks;
-
 	if (nvme_attach(sc) != 0) {
 		/* error printed by nvme_attach() */
 		goto softintr_free;
@@ -412,6 +414,8 @@ nvme_pci_setup_intr(struct pci_attach_ar
 	}
 
 	/* MSI */
+	if (sc->sc_quirks & NVME_QUIRK_NOMSI)
+		goto force_intx;
 	counts[PCI_INTR_TYPE_MSI] = pci_msi_count(pa->pa_pc, pa->pa_tag);
 	if (counts[PCI_INTR_TYPE_MSI] > 0) {
 		while (counts[PCI_INTR_TYPE_MSI] > ncpu + 1) {



CVS commit: src/sys/dev

2020-07-28 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 28 09:36:05 UTC 2020

Modified Files:
src/sys/dev/ic: nvmevar.h
src/sys/dev/pci: nvme_pci.c

Log Message:
add a quirk to disable MSI, and enable it for Intel SSD DC P4500

this device seems to cause serious system responsiveness issues when configured
to use MSI, while it works fine when configured for either INTx or MSI-X

this is important so this works well under Xen Dom0, which doesn't
support MSI-X yet

fixes another issue reported as feedback for PR port-xen/55285 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/nvmevar.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/nvme_pci.c

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



Re: CVS commit: src/sys/crypto/aes

2020-07-28 Thread Roy Marples

On 27/07/2020 21:44, Taylor R Campbell wrote:

Module Name:src
Committed By:   riastradh
Date:   Mon Jul 27 20:44:30 UTC 2020

Modified Files:
src/sys/crypto/aes: aes_ccm.c aes_ccm.h

Log Message:
Gather auth[16] and ctr[16] into one authctr[32].

Should appease clang.


clang is still not appeased :/

--- aes_via.o ---
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:807:6: error: variable 
'authctr' is used uninitialized whenever 'if' condition is false 
[-Werror,-Wsometimes-uninitialized]

if ((uintptr_t)authctr0 & 0xf) {
^
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:820:10: note: 
uninitialized use occurs here

be32enc(authctr + 16 + 4*3, ++c3);
^~~
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:807:2: note: remove the 
'if' if its condition is always true

if ((uintptr_t)authctr0 & 0xf) {
^~~
/home/roy/src/hg/src/sys/crypto/aes/arch/x86/aes_via.c:796:18: note: initialize 
the variable 'authctr' to silence this warning

uint8_t *authctr;
^
 = NULL
1 error generated.
*** [aes_via.o] Error code 1