CVS commit: src/usr.bin/xlint/lint2

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Aug 11 05:37:45 UTC 2021

Modified Files:
src/usr.bin/xlint/lint2: main2.c

Log Message:
lint: add reminder to sort the output of lint2


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/lint2/main2.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/xlint/lint2/main2.c
diff -u src/usr.bin/xlint/lint2/main2.c:1.17 src/usr.bin/xlint/lint2/main2.c:1.18
--- src/usr.bin/xlint/lint2/main2.c:1.17	Sun Apr 18 22:51:24 2021
+++ src/usr.bin/xlint/lint2/main2.c	Wed Aug 11 05:37:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main2.c,v 1.17 2021/04/18 22:51:24 rillig Exp $	*/
+/*	$NetBSD: main2.c,v 1.18 2021/08/11 05:37:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main2.c,v 1.17 2021/04/18 22:51:24 rillig Exp $");
+__RCSID("$NetBSD: main2.c,v 1.18 2021/08/11 05:37:45 rillig Exp $");
 #endif
 
 #include 
@@ -181,6 +181,7 @@ main(int argc, char *argv[])
 	mainused();
 
 	/* perform all tests */
+	/* TODO: sort the names; hashcode order looks chaotic. */
 	forall(chkname);
 
 	exit(0);



CVS commit: src/lib/libpam/libpam

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Aug 11 05:23:05 UTC 2021

Modified Files:
src/lib/libpam/libpam: Makefile

Log Message:
libpam: clean up LINTFLAGS

Warning 346 is new, the other suppressions are not needed anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libpam/libpam/Makefile

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

Modified files:

Index: src/lib/libpam/libpam/Makefile
diff -u src/lib/libpam/libpam/Makefile:1.26 src/lib/libpam/libpam/Makefile:1.27
--- src/lib/libpam/libpam/Makefile:1.26	Sat May 23 00:43:33 2020
+++ src/lib/libpam/libpam/Makefile	Wed Aug 11 05:23:05 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.26 2020/05/23 00:43:33 rin Exp $
+# $NetBSD: Makefile,v 1.27 2021/08/11 05:23:05 rillig Exp $
 #-
 # Copyright (c) 1998 Juniper Networks, Inc.
 # All rights reserved.
@@ -51,12 +51,11 @@ MKPICLIB=yes
 DIST=   ${NETBSDSRCDIR}/external/bsd/openpam/dist
 LIB=	pam
 NOPROFILE=
-# XXX: returns no value
-#LINTFLAGS+= -X 217 -X 284
 
-WARNS=	6
-# 233: Struct/union never defined
-LINTFLAGS+= -Sw -X 233
+WARNS=		6
+LINTFLAGS+=	-w
+# warning: call to 'strchr' effectively discards 'const' from argument
+LINTFLAGS.pam_putenv.c+= -X 346
 
 CPPFLAGS+= -DLIB_MAJ=${SHLIB_MAJOR} -DHAVE_CONFIG_H -I${.CURDIR}
 #CPPFLAGS+= -DOPENPAM_DEBUG



CVS commit: src

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Aug 11 05:19:33 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute_var.c
gcc_attribute_var.exp
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: allow GCC __attribute__ after array brackets

GCC accepts this, so should lint.  Seen in pam_lastlog.c:115.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c \
src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp
cvs rdiff -u -r1.354 -r1.355 src/usr.bin/xlint/lint1/cgram.y

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.4 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.5
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.4	Wed Aug 11 05:08:35 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c	Wed Aug 11 05:19:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcc_attribute_var.c,v 1.4 2021/08/11 05:08:35 rillig Exp $	*/
+/*	$NetBSD: gcc_attribute_var.c,v 1.5 2021/08/11 05:19:33 rillig Exp $	*/
 # 3 "gcc_attribute_var.c"
 
 /*
@@ -65,8 +65,6 @@ ambiguity_for_attribute(void)
 
 void
 attribute_after_array_brackets(
-/* FIXME: GCC accepts this */
-/* expect+1: error: syntax error '__attribute__' [249] */
 const char *argv[] __attribute__((__unused__))
 )
 {
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp:1.4 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp:1.5
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp:1.4	Wed Aug 11 05:08:35 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp	Wed Aug 11 05:19:33 2021
@@ -1,3 +1,2 @@
 gcc_attribute_var.c(59): warning: 'var2' unused in function 'ambiguity_for_attribute' [192]
-gcc_attribute_var.c(70): error: syntax error '__attribute__' [249]
-gcc_attribute_var.c(77): error: syntax error 'syntax_error' [249]
+gcc_attribute_var.c(75): error: syntax error 'syntax_error' [249]

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.354 src/usr.bin/xlint/lint1/cgram.y:1.355
--- src/usr.bin/xlint/lint1/cgram.y:1.354	Sun Aug  1 19:18:10 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Aug 11 05:19:32 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.354 2021/08/01 19:18:10 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.355 2021/08/11 05:19:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.354 2021/08/01 19:18:10 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.355 2021/08/11 05:19:32 rillig Exp $");
 #endif
 
 #include 
@@ -1292,10 +1292,11 @@ direct_param_declarator:
 	| T_LPAREN notype_param_declarator T_RPAREN {
 		$$ = $2;
 	  }
-	| direct_param_declarator T_LBRACK T_RBRACK {
+	| direct_param_declarator T_LBRACK T_RBRACK gcc_attribute_list_opt {
 		$$ = add_array($1, false, 0);
 	  }
-	| direct_param_declarator T_LBRACK array_size T_RBRACK {
+	| direct_param_declarator T_LBRACK array_size T_RBRACK
+	gcc_attribute_list_opt {
 		$$ = add_array($1, true, to_int_constant($3, false));
 	  }
 	| direct_param_declarator param_list asm_or_symbolrename_opt {



CVS commit: src/sys/ufs/chfs

2021-08-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Aug 11 05:17:48 UTC 2021

Modified Files:
src/sys/ufs/chfs: media.h

Log Message:
s/enrty/entry/


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/chfs/media.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/ufs/chfs/media.h
diff -u src/sys/ufs/chfs/media.h:1.2 src/sys/ufs/chfs/media.h:1.3
--- src/sys/ufs/chfs/media.h:1.2	Fri Oct 19 12:44:39 2012
+++ src/sys/ufs/chfs/media.h	Wed Aug 11 05:17:48 2021
@@ -46,7 +46,7 @@ typedef uint64_t le64;
 enum {
 	CHFS_NODETYPE_VNODE = 1,	/* vnode information */
 	CHFS_NODETYPE_DATA,			/* data node */
-	CHFS_NODETYPE_DIRENT,		/* directory enrty */
+	CHFS_NODETYPE_DIRENT,		/* directory entry */
 	CHFS_NODETYPE_PADDING,		/* padding node */
 };
 



CVS commit: src/tests/usr.bin/xlint/lint1

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Aug 11 05:08:35 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute_var.c
gcc_attribute_var.exp

Log Message:
tests/lint: demonstrate wrong 'syntax error' for unused argument

Seen in pam_chroot.c:60.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c \
src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.3 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.4
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.3	Sun Jul 11 15:07:39 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c	Wed Aug 11 05:08:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcc_attribute_var.c,v 1.3 2021/07/11 15:07:39 rillig Exp $	*/
+/*	$NetBSD: gcc_attribute_var.c,v 1.4 2021/08/11 05:08:35 rillig Exp $	*/
 # 3 "gcc_attribute_var.c"
 
 /*
@@ -63,6 +63,15 @@ ambiguity_for_attribute(void)
 	}
 }
 
+void
+attribute_after_array_brackets(
+/* FIXME: GCC accepts this */
+/* expect+1: error: syntax error '__attribute__' [249] */
+const char *argv[] __attribute__((__unused__))
+)
+{
+}
+
 /* just to trigger _some_ error, to keep the .exp file */
 /* expect+1: error: syntax error 'syntax_error' [249] */
 __attribute__((syntax_error));
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp:1.3 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp:1.4
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp:1.3	Sun Jul 11 15:07:39 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp	Wed Aug 11 05:08:35 2021
@@ -1,2 +1,3 @@
 gcc_attribute_var.c(59): warning: 'var2' unused in function 'ambiguity_for_attribute' [192]
-gcc_attribute_var.c(68): error: syntax error 'syntax_error' [249]
+gcc_attribute_var.c(70): error: syntax error '__attribute__' [249]
+gcc_attribute_var.c(77): error: syntax error 'syntax_error' [249]



CVS commit: src

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 10 20:43:13 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_115.c msg_115.exp
src/usr.bin/xlint/lint1: decl.c init.c tree.c

Log Message:
lint: fix 3 of the 4 wrong messages about lvalue in initial assignment


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_115.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_115.exp
cvs rdiff -u -r1.220 -r1.221 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.206 -r1.207 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.331 -r1.332 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_115.c
diff -u src/tests/usr.bin/xlint/lint1/msg_115.c:1.6 src/tests/usr.bin/xlint/lint1/msg_115.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_115.c:1.6	Sat Jul 31 10:09:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_115.c	Tue Aug 10 20:43:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_115.c,v 1.6 2021/07/31 10:09:03 rillig Exp $	*/
+/*	$NetBSD: msg_115.c,v 1.7 2021/08/10 20:43:13 rillig Exp $	*/
 # 3 "msg_115.c"
 
 // Test for message: %soperand of '%s' must be modifiable lvalue [115]
@@ -30,21 +30,18 @@ initialize_const_struct_member(void)
 	/* expect+1: warning: left operand of '=' must be modifiable lvalue [115] */
 	const_member cm1 = (const_member) { 12345 };
 	if (cm1.member != 0)
-		/* FIXME: In a function call, const members can be assigned. */
-		/* expect+1: warning: left operand of 'farg' must be modifiable lvalue [115] */
+		/* In a function call, const members can be assigned. */
 		take_const_member(cm1);
 
 	struct {
 		const_member member;
 	} cm2 = {
-	/* FIXME: In an initialization, const members can be assigned. */
-	/* expect+1: warning: left operand of 'init' must be modifiable lvalue [115] */
+	/* In an initialization, const members can be assigned. */
 	cm1,
 	};
 	if (cm2.member.member != 0) {
 	}
 
-	/* FIXME: In a return statement, const members can be assigned. */
-	/* expect+1: warning: left operand of 'return' must be modifiable lvalue [115] */
+	/* In a return statement, const members can be assigned. */
 	return cm1;
 }

Index: src/tests/usr.bin/xlint/lint1/msg_115.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_115.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_115.exp:1.6
--- src/tests/usr.bin/xlint/lint1/msg_115.exp:1.5	Sat Jul 31 10:09:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_115.exp	Tue Aug 10 20:43:13 2021
@@ -6,6 +6,3 @@ msg_115.c(14): warning: left operand of 
 msg_115.c(15): warning: left operand of '%=' must be modifiable lvalue [115]
 msg_115.c(16): warning: operand of 'x++' must be modifiable lvalue [115]
 msg_115.c(31): warning: left operand of '=' must be modifiable lvalue [115]
-msg_115.c(35): warning: left operand of 'farg' must be modifiable lvalue [115]
-msg_115.c(42): warning: left operand of 'init' must be modifiable lvalue [115]
-msg_115.c(49): warning: left operand of 'return' must be modifiable lvalue [115]

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.220 src/usr.bin/xlint/lint1/decl.c:1.221
--- src/usr.bin/xlint/lint1/decl.c:1.220	Tue Aug 10 19:52:14 2021
+++ src/usr.bin/xlint/lint1/decl.c	Tue Aug 10 20:43:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.220 2021/08/10 19:52:14 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.221 2021/08/10 20:43:12 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.220 2021/08/10 19:52:14 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.221 2021/08/10 20:43:12 rillig Exp $");
 #endif
 
 #include 
@@ -209,7 +209,13 @@ expr_unqualified_type(const type_t *tp)
 	ntp->t_const = false;
 	ntp->t_volatile = false;
 
-	/* TODO: deep-copy struct/union members; see msg_115.c */
+	/*
+	 * In case of a struct or union type, the members should lose their
+	 * qualifiers as well, but that would require a deep copy of the
+	 * struct or union type.  This in turn would defeat the type
+	 * comparison in eqtype, which simply tests whether tp1->t_str ==
+	 * tp2->t_str.
+	 */
 
 	return ntp;
 }

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.206 src/usr.bin/xlint/lint1/init.c:1.207
--- src/usr.bin/xlint/lint1/init.c:1.206	Sat Jul 31 19:07:52 2021
+++ src/usr.bin/xlint/lint1/init.c	Tue Aug 10 20:43:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.206 2021/07/31 19:07:52 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.207 2021/08/10 20:43:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.206 2021/07/31 19:07:52 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.207 2021/08/10 20:43:12 rillig Exp $");
 #endif
 
 #include 
@@ 

CVS commit: src/usr.bin/xlint/lint1

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 10 19:52:14 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: remove redundant test for negative bit-field size

A bit-field can never have negative size.  Its type is an unsigned
integer.

Strangely, GCC 10.3.0 only complains about this if the extra struct
level lint1_type.t_b is removed.  Clang 12.0.1 does not complain at all.


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/xlint/lint1/decl.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/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.219 src/usr.bin/xlint/lint1/decl.c:1.220
--- src/usr.bin/xlint/lint1/decl.c:1.219	Tue Aug  3 21:18:24 2021
+++ src/usr.bin/xlint/lint1/decl.c	Tue Aug 10 19:52:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.219 2021/08/03 21:18:24 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.220 2021/08/10 19:52:14 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.219 2021/08/03 21:18:24 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.220 2021/08/10 19:52:14 rillig Exp $");
 #endif
 
 #include 
@@ -1151,7 +1151,7 @@ declare_bit_field(sym_t *dsym, tspec_t *
 
 	type_t *const tp = *inout_tp;
 	tspec_t const t = *inout_t;
-	if (tp->t_flen < 0 || tp->t_flen > (ssize_t)size_in_bits(t)) {
+	if (tp->t_flen > size_in_bits(t)) {
 		/* illegal bit-field size: %d */
 		error(36, tp->t_flen);
 		tp->t_flen = size_in_bits(t);



CVS commit: src/usr.bin/xlint/lint1

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 10 17:57:16 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: mem1.c

Log Message:
lint: remove redundant function prototypes


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint1/mem1.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/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.48 src/usr.bin/xlint/lint1/mem1.c:1.49
--- src/usr.bin/xlint/lint1/mem1.c:1.48	Tue Aug 10 17:31:44 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Tue Aug 10 17:57:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.48 2021/08/10 17:31:44 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.49 2021/08/10 17:57:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.48 2021/08/10 17:31:44 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.49 2021/08/10 17:57:16 rillig Exp $");
 #endif
 
 #include 
@@ -205,9 +205,6 @@ static	memory_block	*frmblks;
 /* length of new allocated memory blocks */
 static	size_t	mblklen;
 
-static	void	*xgetblk(memory_block **, size_t);
-static	void	xfreeblk(memory_block **);
-static	memory_block *xnewblk(void);
 
 static memory_block *
 xnewblk(void)



CVS commit: src/usr.bin/xlint

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 10 17:31:44 UTC 2021

Modified Files:
src/usr.bin/xlint/common: lint.h
src/usr.bin/xlint/lint1: mem1.c
src/usr.bin/xlint/lint2: externs2.h

Log Message:
lint: clean up comments


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/lint2/externs2.h

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/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.27 src/usr.bin/xlint/common/lint.h:1.28
--- src/usr.bin/xlint/common/lint.h:1.27	Sat Apr 10 18:36:27 2021
+++ src/usr.bin/xlint/common/lint.h	Tue Aug 10 17:31:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.27 2021/04/10 18:36:27 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.28 2021/08/10 17:31:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -80,7 +80,7 @@ typedef enum {
 	PTR,		/* pointer */
 	ARRAY,		/* array */
 	FUNC,		/* function */
-	COMPLEX,	/* _Complex */
+	COMPLEX,	/* keyword "_Complex", only used in the parser */
 	FCOMPLEX,	/* float _Complex */
 	DCOMPLEX,	/* double _Complex */
 	LCOMPLEX	/* long double _Complex */

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.47 src/usr.bin/xlint/lint1/mem1.c:1.48
--- src/usr.bin/xlint/lint1/mem1.c:1.47	Sun Aug  1 18:07:35 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Tue Aug 10 17:31:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.47 2021/08/01 18:07:35 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.48 2021/08/10 17:31:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.47 2021/08/01 18:07:35 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.48 2021/08/10 17:31:44 rillig Exp $");
 #endif
 
 #include 
@@ -297,7 +297,7 @@ initmem(void)
 }
 
 
-/* Allocate memory associated with level l. */
+/* Allocate memory associated with level l, initialized with zero. */
 void *
 getlblk(size_t l, size_t s)
 {
@@ -310,6 +310,10 @@ getlblk(size_t l, size_t s)
 	return xgetblk([l], s);
 }
 
+/*
+ * Return allocated memory for the current mem_block_level, initialized with
+ * zero.
+ */
 void *
 getblk(size_t s)
 {

Index: src/usr.bin/xlint/lint2/externs2.h
diff -u src/usr.bin/xlint/lint2/externs2.h:1.9 src/usr.bin/xlint/lint2/externs2.h:1.10
--- src/usr.bin/xlint/lint2/externs2.h:1.9	Sat Jan 16 02:40:02 2021
+++ src/usr.bin/xlint/lint2/externs2.h	Tue Aug 10 17:31:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: externs2.h,v 1.9 2021/01/16 02:40:02 rillig Exp $ */
+/* $NetBSD: externs2.h,v 1.10 2021/08/10 17:31:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -33,7 +33,7 @@
  */
 
 /*
- * main.c
+ * main2.c
  */
 extern	bool	xflag;
 extern	bool	uflag;



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 17:12:31 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: files.cortex gic.c gicv3.c

Log Message:
Make gic_splfuncs optional and disable it by default until it has had
more testing.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arm/cortex/gic.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/arm/cortex/gicv3.c

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

Modified files:

Index: src/sys/arch/arm/cortex/files.cortex
diff -u src/sys/arch/arm/cortex/files.cortex:1.15 src/sys/arch/arm/cortex/files.cortex:1.16
--- src/sys/arch/arm/cortex/files.cortex:1.15	Tue Aug 10 15:33:09 2021
+++ src/sys/arch/arm/cortex/files.cortex	Tue Aug 10 17:12:31 2021
@@ -1,4 +1,4 @@
-# $NetBSD: files.cortex,v 1.15 2021/08/10 15:33:09 jmcneill Exp $
+# $NetBSD: files.cortex,v 1.16 2021/08/10 17:12:31 jmcneill Exp $
 
 defflag opt_cpu_in_cksum.h			NEON_IN_CKSUM
 
@@ -11,16 +11,16 @@ device	armperiph: mpcorebus
 attach	armperiph at mainbus
 file	arch/arm/cortex/armperiph.c		armperiph
 
-define	gic_splfuncs
+defflag	opt_gic.hGIC_SPLFUNCS
 file	arch/arm/cortex/gic_splfuncs.c		gic_splfuncs
 
 # ARM Generic Interrupt Controller (initially on Cortex-A9)
-device	armgic: pic, pic_splfuncs, gic_splfuncs
+device	armgic: pic, pic_splfuncs
 attach	armgic at mpcorebus
 file	arch/arm/cortex/gic.c			armgic
 
 # ARM Generic Interrupt Controller v3+
-device	gicvthree: pic, pic_splfuncs, gic_splfuncs
+device	gicvthree: pic, pic_splfuncs
 file	arch/arm/cortex/gicv3.c			gicvthree
 file	arch/arm/cortex/gicv3_its.c		gicvthree & pci & __have_pci_msi_msix
 

Index: src/sys/arch/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.48 src/sys/arch/arm/cortex/gic.c:1.49
--- src/sys/arch/arm/cortex/gic.c:1.48	Tue Aug 10 15:33:09 2021
+++ src/sys/arch/arm/cortex/gic.c	Tue Aug 10 17:12:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $	*/
+/*	$NetBSD: gic.c,v 1.49 2021/08/10 17:12:31 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,11 +30,12 @@
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
+#include "opt_gic.h"
 
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.49 2021/08/10 17:12:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,9 +51,12 @@ __KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.48
 #include 
 
 #include 
-#include 
 #include 
 
+#ifdef GIC_SPLFUNCS
+#include 
+#endif
+
 void armgic_irq_handler(void *);
 
 #define	ARMGIC_SGI_IPIBASE	0
@@ -730,7 +734,9 @@ armgic_attach(device_t parent, device_t 
 	"%u SGIs\n",  priorities, sc->sc_gic_lines - ppis - sgis, ppis,
 	sgis);
 
+#ifdef GIC_SPLFUNCS
 	gic_spl_init();
+#endif
 }
 
 CFATTACH_DECL_NEW(armgic, 0,

Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.45 src/sys/arch/arm/cortex/gicv3.c:1.46
--- src/sys/arch/arm/cortex/gicv3.c:1.45	Tue Aug 10 15:33:09 2021
+++ src/sys/arch/arm/cortex/gicv3.c	Tue Aug 10 17:12:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.46 2021/08/10 17:12:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include "opt_multiprocessor.h"
+#include "opt_gic.h"
 
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.46 2021/08/10 17:12:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -51,7 +52,10 @@ __KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.
 
 #include 
 #include 
+
+#ifdef GIC_SPLFUNCS
 #include 
+#endif
 
 #define	PICTOSOFTC(pic)	\
 	((void *)((uintptr_t)(pic) - offsetof(struct gicv3_softc, sc_pic)))
@@ -952,7 +956,9 @@ gicv3_init(struct gicv3_softc *sc)
 #endif
 #endif
 
+#ifdef GIC_SPLFUNCS
 	gic_spl_init();
+#endif
 
 	return 0;
 }



CVS commit: src/usr.bin/xlint/lint1

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 10 16:59:28 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: ops.def

Log Message:
lint: fix documentation of FARG and PUSH


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/lint1/ops.def

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/xlint/lint1/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.22 src/usr.bin/xlint/lint1/ops.def:1.23
--- src/usr.bin/xlint/lint1/ops.def:1.22	Tue Aug 10 07:02:00 2021
+++ src/usr.bin/xlint/lint1/ops.def	Tue Aug 10 16:59:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ops.def,v 1.22 2021/08/10 07:02:00 rillig Exp $ */
+/*	$NetBSD: ops.def,v 1.23 2021/08/10 16:59:28 rillig Exp $ */
 
 begin_ops()
 
@@ -93,6 +93,12 @@ op(	COMMA,	",",		1,-,1,-,-,-,-,-,-,-,-,-
 op(	CVT,	"convert",	-,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
 op(	ICALL,	"icall",	1,-,-,-,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-)
 op(	LOAD,	"load",		-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
+/*
+ * PUSH is a virtual node that is used to concatenate arguments in a function
+ * call expression.  The PUSH nodes are ordered from right to left.  For
+ * example, the function call f(17, 23) is represented as
+ * CALL(f, PUSH(23, PUSH(17, NULL))).
+ */
 op(	PUSH,	"push",		-,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
 op(	RETURN,	"return",	1,-,1,-,-,-,-,-,-,-,-,-,1,-,-,-,-,1,-,-)
 op(	REAL,	"real",		-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
@@ -102,17 +108,11 @@ op(	IMAG,	"imag",		-,-,-,-,-,-,-,-,-,-,-
 /*	name	repr		b l b B i c a s f v t b s l r p c e e = */
 op(	INIT,	"init",		1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,1,-,-)
 op(	CASE,	"case",		-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
-op(	FARG,	"farg",		1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,1,-,-)
-
 /*
- * Both FARG and PUSH represent function arguments.  FARG is used in the
- * early phase of analysis, when the node is not yet part of a function call
- * expression (CALL or ICALL).  Later, build_function_argument builds a
- * function call expression out of the FARG nodes, where they become PUSH.
- * In a function call expression, the PUSH nodes are ordered from right to
- * left, that is, the function call f(17, 23) is represented as
- * CALL(f, PUSH(23, PUSH(17, NULL))).
+ * FARG is only used temporarily in check_prototype_argument to check type
+ * compatibility and conversion for function arguments.
  */
+op(	FARG,	"farg",		1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,1,-,-)
 
 end_ops()
 



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 16:52:43 UTC 2021

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

Log Message:
Enable DVFS


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts

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

Modified files:

Index: src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.4 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.5
--- src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.4	Wed Jun 30 06:24:02 2021
+++ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts	Tue Aug 10 16:52:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.4 2021/06/30 06:24:02 skrll Exp $ */
+/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.5 2021/08/10 16:52:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -37,3 +37,15 @@
 	status = "okay";
 };
 
+ {
+cpu-supply = <_dcdc2>;
+operating-points = <
+/* kHzuV */
+1152000 130
+1104000 126
+1008000 120
+816000  108
+648000  104
+408000  100
+>;
+};



CVS commit: src/doc

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 16:45:35 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
evbarm: Improvements in interrupt handling on Arm GIC v2 and v3 systems
resulting in better network and storage performance.


To generate a diff of this commit:
cvs rdiff -u -r1.2818 -r1.2819 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.2818 src/doc/CHANGES:1.2819
--- src/doc/CHANGES:1.2818	Sun Aug  8 12:35:43 2021
+++ src/doc/CHANGES	Tue Aug 10 16:45:35 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2818 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2819 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -396,3 +396,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		on the Raspberry Pi 4. [jmcneill 20210808]
 	evbarm: Add support for shared ACPI platform interrupts.
 		[jmcneill 20210808]
+	evbarm: Improvements in interrupt handling on Arm GIC v2 and v3 systems
+		resulting in better network and storage performance.
+		[jmcneill 20210810]



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:33:09 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: files.cortex gic.c gicv3.c
Added Files:
src/sys/arch/arm/cortex: gic_splfuncs.c gic_splfuncs.h

Log Message:
Use custom spl funcs for GIC and avoid unnecessary pmr register accesses
in splx.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/arm/cortex/gic.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/cortex/gic_splfuncs.c \
src/sys/arch/arm/cortex/gic_splfuncs.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/arm/cortex/gicv3.c

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

Modified files:

Index: src/sys/arch/arm/cortex/files.cortex
diff -u src/sys/arch/arm/cortex/files.cortex:1.14 src/sys/arch/arm/cortex/files.cortex:1.15
--- src/sys/arch/arm/cortex/files.cortex:1.14	Tue Sep 29 19:58:50 2020
+++ src/sys/arch/arm/cortex/files.cortex	Tue Aug 10 15:33:09 2021
@@ -1,4 +1,4 @@
-# $NetBSD: files.cortex,v 1.14 2020/09/29 19:58:50 jmcneill Exp $
+# $NetBSD: files.cortex,v 1.15 2021/08/10 15:33:09 jmcneill Exp $
 
 defflag opt_cpu_in_cksum.h			NEON_IN_CKSUM
 
@@ -11,13 +11,16 @@ device	armperiph: mpcorebus
 attach	armperiph at mainbus
 file	arch/arm/cortex/armperiph.c		armperiph
 
+define	gic_splfuncs
+file	arch/arm/cortex/gic_splfuncs.c		gic_splfuncs
+
 # ARM Generic Interrupt Controller (initially on Cortex-A9)
-device	armgic: pic, pic_splfuncs
+device	armgic: pic, pic_splfuncs, gic_splfuncs
 attach	armgic at mpcorebus
 file	arch/arm/cortex/gic.c			armgic
 
 # ARM Generic Interrupt Controller v3+
-device	gicvthree: pic, pic_splfuncs
+device	gicvthree: pic, pic_splfuncs, gic_splfuncs
 file	arch/arm/cortex/gicv3.c			gicvthree
 file	arch/arm/cortex/gicv3_its.c		gicvthree & pci & __have_pci_msi_msix
 

Index: src/sys/arch/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.47 src/sys/arch/arm/cortex/gic.c:1.48
--- src/sys/arch/arm/cortex/gic.c:1.47	Sun Mar 28 09:11:38 2021
+++ src/sys/arch/arm/cortex/gic.c	Tue Aug 10 15:33:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.47 2021/03/28 09:11:38 skrll Exp $	*/
+/*	$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.47 2021/03/28 09:11:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.47
 #include 
 
 #include 
+#include 
 #include 
 
 void armgic_irq_handler(void *);
@@ -224,11 +225,10 @@ armgic_set_priority(struct pic_softc *pi
 	struct armgic_softc * const sc = PICTOSOFTC(pic);
 	struct cpu_info * const ci = curcpu();
 
-	const uint32_t priority = armgic_ipl_to_priority(ipl);
-	if (priority > ci->ci_hwpl) {
+	if (ipl < ci->ci_hwpl) {
 		/* Lowering priority mask */
-		ci->ci_hwpl = priority;
-		gicc_write(sc, GICC_PMR, priority);
+		ci->ci_hwpl = ipl;
+		gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(ipl));
 	}
 }
 
@@ -327,10 +327,9 @@ armgic_irq_handler(void *tf)
 
 	ci->ci_data.cpu_nintr++;
 
-	const uint32_t priority = armgic_ipl_to_priority(old_ipl);
-	if (ci->ci_hwpl != priority) {
-		ci->ci_hwpl = priority;
-		gicc_write(sc, GICC_PMR, priority);
+	if (ci->ci_hwpl != old_ipl) {
+		ci->ci_hwpl = old_ipl;
+		gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(old_ipl));
 		if (old_ipl == IPL_HIGH) {
 			return;
 		}
@@ -545,7 +544,7 @@ armgic_cpu_init(struct pic_softc *pic, s
 			sc->sc_enabled_local);
 		}
 	}
-	ci->ci_hwpl = armgic_ipl_to_priority(ci->ci_cpl);
+	ci->ci_hwpl = ci->ci_cpl;
 	gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(ci->ci_cpl));	// set PMR
 	gicc_write(sc, GICC_CTRL, GICC_CTRL_V1_Enable);	// enable interrupt
 	ENABLE_INTERRUPT();// allow IRQ exceptions
@@ -730,6 +729,8 @@ armgic_attach(device_t parent, device_t 
 	aprint_normal_dev(sc->sc_dev, "%u Priorities, %zu SPIs, %u PPIs, "
 	"%u SGIs\n",  priorities, sc->sc_gic_lines - ppis - sgis, ppis,
 	sgis);
+
+	gic_spl_init();
 }
 
 CFATTACH_DECL_NEW(armgic, 0,

Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.44 src/sys/arch/arm/cortex/gicv3.c:1.45
--- src/sys/arch/arm/cortex/gicv3.c:1.44	Sun Mar 28 11:13:24 2021
+++ src/sys/arch/arm/cortex/gicv3.c	Tue Aug 10 15:33:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.44 2021/03/28 11:13:24 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.44 2021/03/28 11:13:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: 

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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:31:55 UTC 2021

Modified Files:
src/sys/arch/arm/pic: pic_splfuncs.c picvar.h

Log Message:
arm: pic: allow overriding _splraise/_spllower/splx


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/pic/pic_splfuncs.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/pic/picvar.h

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

Modified files:

Index: src/sys/arch/arm/pic/pic_splfuncs.c
diff -u src/sys/arch/arm/pic/pic_splfuncs.c:1.20 src/sys/arch/arm/pic/pic_splfuncs.c:1.21
--- src/sys/arch/arm/pic/pic_splfuncs.c:1.20	Sat Mar 27 12:15:09 2021
+++ src/sys/arch/arm/pic/pic_splfuncs.c	Tue Aug 10 15:31:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic_splfuncs.c,v 1.20 2021/03/27 12:15:09 jmcneill Exp $	*/
+/*	$NetBSD: pic_splfuncs.c,v 1.21 2021/08/10 15:31:55 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.20 2021/03/27 12:15:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.21 2021/08/10 15:31:55 jmcneill Exp $");
 
 #define _INTR_PRIVATE
 #include 
@@ -46,9 +46,16 @@ __KERNEL_RCSID(0, "$NetBSD: pic_splfuncs
 
 #include 
 
+static int	pic_default_splraise(int);
+static int	pic_default_spllower(int);
+static void	pic_default_splx(int);
+
+int (*_splraise)(int) = pic_default_splraise;
+int (*_spllower)(int) = pic_default_spllower;
+void (*splx)(int) = pic_default_splx;
 
-int
-_splraise(int newipl)
+static int
+pic_default_splraise(int newipl)
 {
 	struct cpu_info * const ci = curcpu();
 	const int oldipl = ci->ci_cpl;
@@ -58,8 +65,9 @@ _splraise(int newipl)
 	}
 	return oldipl;
 }
-int
-_spllower(int newipl)
+
+static int
+pic_default_spllower(int newipl)
 {
 	struct cpu_info * const ci = curcpu();
 	const int oldipl = ci->ci_cpl;
@@ -76,8 +84,8 @@ _spllower(int newipl)
 	return oldipl;
 }
 
-void
-splx(int savedipl)
+static void
+pic_default_splx(int savedipl)
 {
 	struct cpu_info * const ci = curcpu();
 	KASSERT(savedipl < NIPL);

Index: src/sys/arch/arm/pic/picvar.h
diff -u src/sys/arch/arm/pic/picvar.h:1.34 src/sys/arch/arm/pic/picvar.h:1.35
--- src/sys/arch/arm/pic/picvar.h:1.34	Sat Mar 27 12:15:09 2021
+++ src/sys/arch/arm/pic/picvar.h	Tue Aug 10 15:31:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: picvar.h,v 1.34 2021/03/27 12:15:09 jmcneill Exp $	*/
+/*	$NetBSD: picvar.h,v 1.35 2021/08/10 15:31:55 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,9 +40,10 @@
 
 typedef uint32_t	intr_handle_t;		/* for ACPI */
 
-int	_splraise(int);
-int	_spllower(int);
-void	splx(int);
+extern int	(*_splraise)(int);
+extern int	(*_spllower)(int);
+extern void	(*splx)(int);
+
 const char *
 	intr_typename(int);
 



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:31:38 UTC 2021

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
Disable MSI if the linux,pcie-nomsi flag is present


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/acpi/acpipchb.c

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

Modified files:

Index: src/sys/arch/arm/acpi/acpipchb.c
diff -u src/sys/arch/arm/acpi/acpipchb.c:1.27 src/sys/arch/arm/acpi/acpipchb.c:1.28
--- src/sys/arch/arm/acpi/acpipchb.c:1.27	Sat Aug  7 21:27:53 2021
+++ src/sys/arch/arm/acpi/acpipchb.c	Tue Aug 10 15:31:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.27 2021/08/07 21:27:53 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.28 2021/08/10 15:31:38 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.27 2021/08/07 21:27:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.28 2021/08/10 15:31:38 jmcneill Exp $");
 
 #include 
 #include 
@@ -123,7 +123,7 @@ acpipchb_attach(device_t parent, device_
 	struct acpipchb_softc * const sc = device_private(self);
 	struct acpi_attach_args *aa = aux;
 	struct pcibus_attach_args pba;
-	ACPI_INTEGER seg;
+	ACPI_INTEGER seg, nomsi;
 	ACPI_STATUS rv;
 	uint16_t bus_start;
 
@@ -148,6 +148,11 @@ acpipchb_attach(device_t parent, device_
 		seg = 0;
 	}
 
+	if (ACPI_FAILURE(acpi_dsd_integer(sc->sc_handle, "linux,pcie-nomsi",
+	))) {
+		nomsi = 0;
+	}
+
 	aprint_naive("\n");
 	aprint_normal(": PCI Express Host Bridge\n");
 
@@ -156,6 +161,9 @@ acpipchb_attach(device_t parent, device_
 	memset(, 0, sizeof(pba));
 	pba.pba_flags = aa->aa_pciflags &
 			~(PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY);
+	if (nomsi) {
+		pba.pba_flags &= ~(PCI_FLAGS_MSI_OKAY | PCI_FLAGS_MSIX_OKAY);
+	}
 	pba.pba_memt = 0;
 	pba.pba_iot = 0;
 	pba.pba_dmat = aa->aa_dmat;



CVS commit: src/sys/dev/ic

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:28:44 UTC 2021

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

Log Message:
Clear IFF_OACTIVE in genet_txintr (bug introduced in r1.8) and don't
sync DMA maps with size 0.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/bcmgenet.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/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.9 src/sys/dev/ic/bcmgenet.c:1.10
--- src/sys/dev/ic/bcmgenet.c:1.9	Mon May  3 10:28:26 2021
+++ src/sys/dev/ic/bcmgenet.c	Tue Aug 10 15:28:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $");
 
 #include 
 #include 
@@ -726,9 +726,11 @@ genet_rxintr(struct genet_softc *sc, int
 		}
 
 		/* unload map before it gets loaded in setup_rxbuf */
-		bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
-		0, sc->sc_rx.buf_map[index].map->dm_mapsize,
-		BUS_DMASYNC_POSTREAD);
+		if (sc->sc_rx.buf_map[index].map->dm_mapsize > 0) {
+			bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
+			0, sc->sc_rx.buf_map[index].map->dm_mapsize,
+			BUS_DMASYNC_POSTREAD);
+		}
 		bus_dmamap_unload(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map);
 		sc->sc_rx.buf_map[index].mbuf = NULL;
 
@@ -778,15 +780,18 @@ genet_txintr(struct genet_softc *sc, int
 		bmap = >sc_tx.buf_map[i];
 		if (bmap->mbuf != NULL) {
 			/* XXX first segment already unloads */
-			bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
-			0, bmap->map->dm_mapsize,
-			BUS_DMASYNC_POSTWRITE);
+			if (bmap->map->dm_mapsize > 0) {
+bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
+0, bmap->map->dm_mapsize,
+BUS_DMASYNC_POSTWRITE);
+			}
 			bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
 			m_freem(bmap->mbuf);
 			bmap->mbuf = NULL;
 			++pkts;
 		}
 
+		ifp->if_flags &= ~IFF_OACTIVE;
 		i = TX_NEXT(i);
 		sc->sc_tx.cidx = (sc->sc_tx.cidx + 1) & 0x;
 	}



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips

2021-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 10 10:43:42 UTC 2021

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: bn.inc

Log Message:
PR/56318: Izumi Tsutsui: Don't include mips.S for 32 bit mips because it
does not work for mips1


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.7 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.8
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.7	Mon Apr 26 14:06:09 2021
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc	Tue Aug 10 06:43:42 2021
@@ -1,6 +1,7 @@
 .include "mips.inc"
 
-.if ${MIPS_LE}
+# Don't include mips.S for 32 bit mips because it does not work for mips1
+.if ${MIPS_LE} && ${MIPS_64} == "64"
 .PATH.S: ${.PARSEDIR}
 
 BN_SRCS = mips${MIPS_64}.S



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc

2021-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 10 10:38:42 UTC 2021

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc: bn.inc

Log Message:
PR/56318: Izumi Tsutsui: Limit bn-sparcv8.S to sparc64; breaks
on sparcstation 2 (sun4c)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc:1.2	Sun Jun 21 18:16:08 2020
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc	Tue Aug 10 06:38:42 2021
@@ -1,5 +1,8 @@
 .PATH.S: ${.PARSEDIR}
+# Limit bn-sparcv8.S to sparc64; breaks on sparcstation 2 (sun4c)
+.if ${MACHINE} == "sparc64"
 # XXX bn-sparcv8plus.S doesn't work well. why?
 BN_SRCS = bn-sparcv8.S
 AFLAGS.bn-sparcv8.S+= -Wa,-Av9
+.endif
 .include "../../bn.inc"



CVS commit: src/usr.bin/xlint/lint1

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 10 07:02:00 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: ops.def

Log Message:
lint: document the difference between FARG and PUSH


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint1/ops.def

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/xlint/lint1/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.21 src/usr.bin/xlint/lint1/ops.def:1.22
--- src/usr.bin/xlint/lint1/ops.def:1.21	Tue Aug 10 06:31:16 2021
+++ src/usr.bin/xlint/lint1/ops.def	Tue Aug 10 07:02:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ops.def,v 1.21 2021/08/10 06:31:16 rillig Exp $ */
+/*	$NetBSD: ops.def,v 1.22 2021/08/10 07:02:00 rillig Exp $ */
 
 begin_ops()
 
@@ -104,6 +104,16 @@ op(	INIT,	"init",		1,-,1,-,-,-,-,-,-,-,-
 op(	CASE,	"case",		-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
 op(	FARG,	"farg",		1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,1,-,-)
 
+/*
+ * Both FARG and PUSH represent function arguments.  FARG is used in the
+ * early phase of analysis, when the node is not yet part of a function call
+ * expression (CALL or ICALL).  Later, build_function_argument builds a
+ * function call expression out of the FARG nodes, where they become PUSH.
+ * In a function call expression, the PUSH nodes are ordered from right to
+ * left, that is, the function call f(17, 23) is represented as
+ * CALL(f, PUSH(23, PUSH(17, NULL))).
+ */
+
 end_ops()
 
 #ifndef NOPS



CVS commit: src/sys/arch/evbarm

2021-08-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 10 06:47:49 UTC 2021

Modified Files:
src/sys/arch/evbarm/imx23_olinuxino: imx23_olinuxino_machdep.c
src/sys/arch/evbarm/include: bootconfig.h
src/sys/arch/evbarm/integrator: integrator_machdep.c

Log Message:
G/C unused flag


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/include/bootconfig.h
cvs rdiff -u -r1.79 -r1.80 \
src/sys/arch/evbarm/integrator/integrator_machdep.c

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

Modified files:

Index: src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
diff -u src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c:1.11 src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c:1.12
--- src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c:1.11	Sat Nov 28 14:02:30 2020
+++ src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c	Tue Aug 10 06:47:48 2021
@@ -1,4 +1,4 @@
-/* $Id: imx23_olinuxino_machdep.c,v 1.11 2020/11/28 14:02:30 skrll Exp $ */
+/* $Id: imx23_olinuxino_machdep.c,v 1.12 2021/08/10 06:47:48 skrll Exp $ */
 
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -178,7 +178,7 @@ initarm(void *arg)
 	bootconfig.dramblocks = 1;
 	bootconfig.dram[0].address = DRAM_BASE;
 	bootconfig.dram[0].pages = ram_size / PAGE_SIZE;
-	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA | BOOT_DRAM_PREFER;
+	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA;
 
 arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
 ((vsize_t)_BASE_phys));

Index: src/sys/arch/evbarm/include/bootconfig.h
diff -u src/sys/arch/evbarm/include/bootconfig.h:1.10 src/sys/arch/evbarm/include/bootconfig.h:1.11
--- src/sys/arch/evbarm/include/bootconfig.h:1.10	Mon Jun 18 13:05:20 2018
+++ src/sys/arch/evbarm/include/bootconfig.h	Tue Aug 10 06:47:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootconfig.h,v 1.10 2018/06/18 13:05:20 jmcneill Exp $	*/
+/*	$NetBSD: bootconfig.h,v 1.11 2021/08/10 06:47:48 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994 Mark Brinicombe.
@@ -51,7 +51,6 @@ typedef struct _PhysMem {
 	u_int pages;
 	u_int flags;
 #define BOOT_DRAM_CAN_DMA 1	/* Can DMA direct to this memory.  */
-#define BOOT_DRAM_PREFER  2	/* UVM should prefer this memory.  */
 } PhysMem;
 
 #ifndef	DRAM_BLOCKS

Index: src/sys/arch/evbarm/integrator/integrator_machdep.c
diff -u src/sys/arch/evbarm/integrator/integrator_machdep.c:1.79 src/sys/arch/evbarm/integrator/integrator_machdep.c:1.80
--- src/sys/arch/evbarm/integrator/integrator_machdep.c:1.79	Sat Apr 18 11:00:39 2020
+++ src/sys/arch/evbarm/integrator/integrator_machdep.c	Tue Aug 10 06:47:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: integrator_machdep.c,v 1.79 2020/04/18 11:00:39 skrll Exp $	*/
+/*	$NetBSD: integrator_machdep.c,v 1.80 2021/08/10 06:47:49 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001,2002 ARM Ltd
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: integrator_machdep.c,v 1.79 2020/04/18 11:00:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: integrator_machdep.c,v 1.80 2021/08/10 06:47:49 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -371,7 +371,7 @@ initarm(void *arg)
 	bootconfig.dramblocks = 1;
 	bootconfig.dram[0].address = memstart;
 	bootconfig.dram[0].pages = memsize / PAGE_SIZE;
-	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA | BOOT_DRAM_PREFER;
+	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA;
 
 	arm32_bootmem_init(bootconfig.dram[0].address,
 		bootconfig.dram[0].pages * PAGE_SIZE, (unsigned int) KERNEL_BASE_phys);



CVS commit: src/usr.bin/xlint/lint1

2021-08-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 10 06:31:16 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: ops.def

Log Message:
lint: document operator properties directly at the definition


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint1/ops.def

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/xlint/lint1/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.20 src/usr.bin/xlint/lint1/ops.def:1.21
--- src/usr.bin/xlint/lint1/ops.def:1.20	Thu Apr  1 14:59:21 2021
+++ src/usr.bin/xlint/lint1/ops.def	Tue Aug 10 06:31:16 2021
@@ -1,9 +1,31 @@
-/*	$NetBSD: ops.def,v 1.20 2021/04/01 14:59:21 rillig Exp $ */
+/*	$NetBSD: ops.def,v 1.21 2021/08/10 06:31:16 rillig Exp $ */
 
 begin_ops()
 
-/* See mod_t in op.h for the definition of the table columns. */
-
+/*
+ * Operator properties; see mod_t in op.h.
+ *
+ * 	warn if operand '='	  x
+ *	bad on enum		x
+ *	valid on enum		  x
+ *	comparison		- - - - - - - - - - - - - - - - x
+ *	possible precedence confusion			  x	|
+ *	warn if right operand unsigned			x	|
+ *	warn if left operand unsigned			  x	|
+ *	has side effects	- - - - - - - - - - - - x	|
+ *	balance operands			  x	|	|
+ *	left test context			x	|	|
+ *	left value context			  x	|	|
+ *	fold constant operands	- - - - - - - - x	|	|
+ *	requires scalar			  x	|	|	|
+ *	requires arithmetic		x	|	|	|
+ *	requires integer or complex	  x	|	|	|
+ *	requires integer	- - - - x	|	|	|
+ *	requires _Bool		  x	|	|	|	|
+ *	takes _Bool		x	|	|	|	|
+ *	logical			  x	|	|	|	|
+ *	binary			x	|	|	|	|
+ */
 /*	name	repr		b l b B i c a s f v t b s l r p c e e =	*/
 op(	NOOP,	"no-op",	-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
 op(	ARROW,	"->",		1,-,1,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)



CVS commit: src/sys/netinet6

2021-08-10 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Aug 10 06:29:56 UTC 2021

Modified Files:
src/sys/netinet6: in6_src.c

Log Message:
PR kern/56348
MTU discovery fails with IPv6 sockets bound to IPv4 mapped address

pick up the IPv4 route for IPv4 mapped IPv6 address to get the correct
MTU and not any unrelated/inappropriate MTU from IPv6 routes. IPv4 mapped
IPv6 addresses are always handled by the IPv4 stack and MTU discovery
is solely handled with the IPv4 routing table.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/netinet6/in6_src.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/netinet6/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.87 src/sys/netinet6/in6_src.c:1.88
--- src/sys/netinet6/in6_src.c:1.87	Fri Aug 28 06:32:24 2020
+++ src/sys/netinet6/in6_src.c	Tue Aug 10 06:29:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.87 2020/08/28 06:32:24 ozaki-r Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.88 2021/08/10 06:29:56 kardel Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.87 2020/08/28 06:32:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.88 2021/08/10 06:29:56 kardel Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -612,6 +612,7 @@ in6_selectroute(struct sockaddr_in6 *dst
 	struct rtentry *rt = NULL;
 	union {
 		struct sockaddr		dst;
+		struct sockaddr_in	dst4;
 		struct sockaddr_in6	dst6;
 	} u;
 
@@ -679,9 +680,17 @@ in6_selectroute(struct sockaddr_in6 *dst
 	 * Use a cached route if it exists and is valid, else try to allocate
 	 * a new one.  Note that we should check the address family of the
 	 * cached destination, in case of sharing the cache with IPv4.
+	 *
+	 * for V4 mapped addresses we want to pick up the v4 route
+	 * see PR kern/56348
 	 */
-	u.dst6 = *dstsock;
-	u.dst6.sin6_scope_id = 0;
+	if (IN6_IS_ADDR_V4MAPPED(>sin6_addr)) {
+		in6_sin6_2_sin(, dstsock);
+	} else {
+		u.dst6 = *dstsock;
+		u.dst6.sin6_scope_id = 0;
+	}
+
 	rt = rtcache_lookup1(*ro, , 1);
 
 	if (rt == NULL)