CVS commit: src

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 03:39:00 UTC 2020

Modified Files:
src: UPDATING

Log Message:
mention blacklist -> blocklist rename


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/UPDATING

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



CVS commit: src

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 03:39:00 UTC 2020

Modified Files:
src: UPDATING

Log Message:
mention blacklist -> blocklist rename


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.308 src/UPDATING:1.309
--- src/UPDATING:1.308	Mon Jun  1 10:46:04 2020
+++ src/UPDATING	Sun Jun 14 23:39:00 2020
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.308 2020/06/01 14:46:04 christos Exp $
+$NetBSD: UPDATING,v 1.309 2020/06/15 03:39:00 christos Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,12 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20200614:
+	blacklist* has been renamed to blocklist*. You need to manually:
+	mv /var/db/bl{a,o}cklist.db
+	fix npf rules that mention blacklist
+	fix rc.conf variables
+
 20200601:
 	Due to a mistake in LIBISPRIVATE handling, .so libraries were
 	created in the build directories and need cleaning.



CVS commit: src/external/bsd/blocklist

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 02:29:45 UTC 2020

Modified Files:
src/external/bsd/blocklist: Makefile.inc
src/external/bsd/blocklist/bin: blocklistctl.8 blocklistd.8
blocklistd.conf.5
src/external/bsd/blocklist/diff: ftpd.diff named.diff postfix.diff
proftpd.diff ssh.diff
src/external/bsd/blocklist/include: blocklist.h
src/external/bsd/blocklist/lib: blocklist.c libblocklist.3

Log Message:
missed the capitalized ones.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/Makefile.inc
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/bin/blocklistctl.8 \
src/external/bsd/blocklist/bin/blocklistd.8 \
src/external/bsd/blocklist/bin/blocklistd.conf.5
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/diff/ftpd.diff \
src/external/bsd/blocklist/diff/named.diff \
src/external/bsd/blocklist/diff/postfix.diff \
src/external/bsd/blocklist/diff/proftpd.diff \
src/external/bsd/blocklist/diff/ssh.diff
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/include/blocklist.h
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/lib/blocklist.c \
src/external/bsd/blocklist/lib/libblocklist.3

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

Modified files:

Index: src/external/bsd/blocklist/Makefile.inc
diff -u src/external/bsd/blocklist/Makefile.inc:1.1.1.1 src/external/bsd/blocklist/Makefile.inc:1.2
--- src/external/bsd/blocklist/Makefile.inc:1.1.1.1	Sun Jun 14 21:52:52 2020
+++ src/external/bsd/blocklist/Makefile.inc	Sun Jun 14 22:29:44 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile.inc,v 1.1.1.1 2020/06/15 01:52:52 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2020/06/15 02:29:44 christos Exp $
 
 WARNS=6
 .if !defined(LIB)
 LDADD+=	-lblocklist
-DPADD+= ${LIBBLACKLIST}
+DPADD+= ${LIBBLOCKLIST}
 .endif
 CPPFLAGS+= -I${.CURDIR}/../include
 CPPFLAGS+=-DHAVE_STRUCT_SOCKADDR_SA_LEN -DHAVE_UTIL_H -DHAVE_DB_H

Index: src/external/bsd/blocklist/bin/blocklistctl.8
diff -u src/external/bsd/blocklist/bin/blocklistctl.8:1.1.1.1 src/external/bsd/blocklist/bin/blocklistctl.8:1.2
--- src/external/bsd/blocklist/bin/blocklistctl.8:1.1.1.1	Sun Jun 14 21:52:52 2020
+++ src/external/bsd/blocklist/bin/blocklistctl.8	Sun Jun 14 22:29:44 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: blocklistctl.8,v 1.1.1.1 2020/06/15 01:52:52 christos Exp $
+.\" $NetBSD: blocklistctl.8,v 1.2 2020/06/15 02:29:44 christos Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .Dd June 7, 2016
-.Dt BLACKLISTCTL 8
+.Dt BLOCKLISTCTL 8
 .Os
 .Sh NAME
 .Nm blocklistctl
Index: src/external/bsd/blocklist/bin/blocklistd.8
diff -u src/external/bsd/blocklist/bin/blocklistd.8:1.1.1.1 src/external/bsd/blocklist/bin/blocklistd.8:1.2
--- src/external/bsd/blocklist/bin/blocklistd.8:1.1.1.1	Sun Jun 14 21:52:53 2020
+++ src/external/bsd/blocklist/bin/blocklistd.8	Sun Jun 14 22:29:44 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: blocklistd.8,v 1.1.1.1 2020/06/15 01:52:53 christos Exp $
+.\" $NetBSD: blocklistd.8,v 1.2 2020/06/15 02:29:44 christos Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .Dd April 21, 2020
-.Dt BLACKLISTD 8
+.Dt BLOCKLISTD 8
 .Os
 .Sh NAME
 .Nm blocklistd
Index: src/external/bsd/blocklist/bin/blocklistd.conf.5
diff -u src/external/bsd/blocklist/bin/blocklistd.conf.5:1.1.1.1 src/external/bsd/blocklist/bin/blocklistd.conf.5:1.2
--- src/external/bsd/blocklist/bin/blocklistd.conf.5:1.1.1.1	Sun Jun 14 21:52:53 2020
+++ src/external/bsd/blocklist/bin/blocklistd.conf.5	Sun Jun 14 22:29:44 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: blocklistd.conf.5,v 1.1.1.1 2020/06/15 01:52:53 christos Exp $
+.\" $NetBSD: blocklistd.conf.5,v 1.2 2020/06/15 02:29:44 christos Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .Dd May 18, 2020
-.Dt BLACKLISTD.CONF 5
+.Dt BLOCKLISTD.CONF 5
 .Os
 .Sh NAME
 .Nm blocklistd.conf

Index: src/external/bsd/blocklist/diff/ftpd.diff
diff -u src/external/bsd/blocklist/diff/ftpd.diff:1.1.1.1 src/external/bsd/blocklist/diff/ftpd.diff:1.2
--- src/external/bsd/blocklist/diff/ftpd.diff:1.1.1.1	Sun Jun 14 21:52:53 2020
+++ src/external/bsd/blocklist/diff/ftpd.diff	Sun Jun 14 22:29:45 2020
@@ -43,7 +43,7 @@ diff -u -p -u -r1.63 Makefile
  
 +SRCS+=	pfilter.c
 +LDADD+=	-lblocklist
-+DPADD+=	${LIBBLACKLIST}
++DPADD+=	${LIBBLOCKLIST}
 +
  .if defined(NO_INTERNAL_LS)
  CPPFLAGS+=-DNO_INTERNAL_LS
Index: src/external/bsd/blocklist/diff/named.diff
diff -u src/external/bsd/blocklist/diff/named.diff:1.1.1.1 src/external/bsd/blocklist/diff/named.diff:1.2
--- src/external/bsd/blocklist/diff/named.diff:1.1.1.1	Sun Jun 14 21:52:53 2020
+++ 

CVS commit: src/external/bsd/blocklist

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 02:29:45 UTC 2020

Modified Files:
src/external/bsd/blocklist: Makefile.inc
src/external/bsd/blocklist/bin: blocklistctl.8 blocklistd.8
blocklistd.conf.5
src/external/bsd/blocklist/diff: ftpd.diff named.diff postfix.diff
proftpd.diff ssh.diff
src/external/bsd/blocklist/include: blocklist.h
src/external/bsd/blocklist/lib: blocklist.c libblocklist.3

Log Message:
missed the capitalized ones.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/Makefile.inc
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/bin/blocklistctl.8 \
src/external/bsd/blocklist/bin/blocklistd.8 \
src/external/bsd/blocklist/bin/blocklistd.conf.5
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/diff/ftpd.diff \
src/external/bsd/blocklist/diff/named.diff \
src/external/bsd/blocklist/diff/postfix.diff \
src/external/bsd/blocklist/diff/proftpd.diff \
src/external/bsd/blocklist/diff/ssh.diff
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/include/blocklist.h
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/blocklist/lib/blocklist.c \
src/external/bsd/blocklist/lib/libblocklist.3

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



CVS commit: src

2020-06-14 Thread Christos Zoulas
sr/share/man/cat8/blocklistd.0		man-sysutil-catman	.cat
 ./usr/share/man/cat8/boot.0			man-sysutil-catman	.cat
 ./usr/share/man/cat8/bootparamd.0		man-bootserver-catman	.cat
 ./usr/share/man/cat8/bootpd.0			man-bootserver-catman	.cat
@@ -5237,7 +5240,8 @@
 ./usr/share/man/html5/audit-packages.conf.html	man-obsolete		obsolete
 ./usr/share/man/html5/auto_master.html		man-sysutil-htmlman	html
 ./usr/share/man/html5/autofs.html		man-sysutil-htmlman	html
-./usr/share/man/html5/blacklistd.conf.html	man-sysutil-htmlman	html
+./usr/share/man/html5/blacklistd.conf.html	man-obsolete		obsolete
+./usr/share/man/html5/blocklistd.conf.html	man-sysutil-htmlman	html
 ./usr/share/man/html5/body_checks.html		man-postfix-htmlman	postfix,html
 ./usr/share/man/html5/boot.cfg.html		man-sys-htmlman		html
 ./usr/share/man/html5/bootparams.html		man-bootserver-htmlman	html
@@ -5511,8 +5515,10 @@
 ./usr/share/man/html8/bad144.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/badsect.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/bioctl.html		man-sysutil-htmlman	html
-./usr/share/man/html8/blacklistctl.html		man-sysutil-htmlman	html
-./usr/share/man/html8/blacklistd.html		man-sysutil-htmlman	html
+./usr/share/man/html8/blacklistctl.html		man-obsolete		obsolete
+./usr/share/man/html8/blacklistd.html		man-obsolete		obsolete
+./usr/share/man/html8/blocklistctl.html		man-sysutil-htmlman	html
+./usr/share/man/html8/blocklistd.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/boot.html			man-sysutil-htmlman	html
 ./usr/share/man/html8/bootparamd.html		man-bootserver-htmlman	html
 ./usr/share/man/html8/bootpd.html		man-bootserver-htmlman	html
@@ -8291,7 +8297,8 @@
 ./usr/share/man/man5/audit-packages.conf.5	man-obsolete		obsolete
 ./usr/share/man/man5/auto_master.5		man-sysutil-man		.man
 ./usr/share/man/man5/autofs.5			man-sysutil-man		.man
-./usr/share/man/man5/blacklistd.conf.5		man-sysutil-man		.man
+./usr/share/man/man5/blacklistd.conf.5		man-obsolete		obsolete
+./usr/share/man/man5/blocklistd.conf.5		man-sysutil-man		.man
 ./usr/share/man/man5/bluetooth.conf.5		man-obsolete		obsolete
 ./usr/share/man/man5/body_checks.5		man-postfix-man		postfix,.man
 ./usr/share/man/man5/boot.cfg.5			man-sys-man		.man
@@ -8615,8 +8622,10 @@
 ./usr/share/man/man8/bebox/MAKEDEV.8		man-obsolete		obsolete
 ./usr/share/man/man8/bebox/makedev.8		man-obsolete		obsolete
 ./usr/share/man/man8/bioctl.8			man-sysutil-man		.man
-./usr/share/man/man8/blacklistctl.8		man-sysutil-man		.man
-./usr/share/man/man8/blacklistd.8		man-sysutil-man		.man
+./usr/share/man/man8/blacklistctl.8		man-obsolete		obsolete
+./usr/share/man/man8/blacklistd.8		man-obsolete		obsolete
+./usr/share/man/man8/blocklistctl.8		man-sysutil-man		.man
+./usr/share/man/man8/blocklistd.8		man-sysutil-man		.man
 ./usr/share/man/man8/boot.8			man-sysutil-man		.man
 ./usr/share/man/man8/bootparamd.8		man-bootserver-man	.man
 ./usr/share/man/man8/bootpd.8			man-bootserver-man	.man

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1729 src/doc/3RDPARTY:1.1730
--- src/doc/3RDPARTY:1.1729	Sun Jun 14 20:40:14 2020
+++ src/doc/3RDPARTY	Sun Jun 14 21:57:30 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1729 2020/06/15 00:40:14 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1730 2020/06/15 01:57:30 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -138,6 +138,19 @@ Build bind to generate the include files
 Then binclude4netbsd script to import into src/external/bsd/bind/include.
 The libc and include parts of the resolver are now part of libbind.
 
+Package:	blocklist
+Version:	current-2020-06-14
+Current Vers:	current-2020-06-14
+Maintainer:	Christos Zoulas 
+Archive Site:	https://github.com/zoulasc/blocklist
+Home Page:	https://github.com/zoulasc/blocklist
+Date:		2020-06-13
+Mailing List:	bug...@gnu.org
+Responsible:	christos
+License:	BSD-like (2-clause) 
+Location:	external/bsd/blocklist
+Notes:
+
 Package:	libuv
 Version:	1.38.0
 Current Vers:	1.38.0

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2701 src/doc/CHANGES:1.2702
--- src/doc/CHANGES:1.2701	Sun Jun 14 20:40:14 2020
+++ src/doc/CHANGES	Sun Jun 14 21:57:30 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2701 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2702 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -219,3 +219,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	dhcpcd: Import version 9.1.1 [roy 20200604]
 	inet6: in-kernel Router Advertisment handling removed. [roy 20200612]
 	file(1): Upgraded to 5.39. [christos 20200614]
+	blocklist: import current version [christos 20200614]

Index: src/etc/defaults/rc.conf
diff -u src/etc/defaults/rc.conf:1.157 src/etc/defaults/rc.conf:1.158
--- src/etc/defaults/rc.conf:1.157	Fri Jun  5 13:10:44 2020
+++ src/etc/defaults/rc.conf	Sun Jun 14 21:57:30 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: rc.conf,v 1.157 2

CVS commit: src

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 01:57:33 UTC 2020

Modified Files:
src/crypto/external/bsd/openssh/bin/sshd: Makefile
src/crypto/external/bsd/openssh/dist: pfilter.c
src/distrib/sets/lists/base: mi shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/debug: mi shl.mi
src/distrib/sets/lists/etc: mi
src/distrib/sets/lists/man: mi
src/doc: 3RDPARTY CHANGES
src/etc/defaults: rc.conf
src/etc/mtree: NetBSD.dist.base special
src/external/bsd: Makefile
src/external/ibm-public/postfix/dist/src/smtpd: pfilter.c
src/external/ibm-public/postfix/libexec/smtpd: Makefile
src/external/mpl/bind: Makefile.inc
src/external/mpl/bind/dist/lib/ns: pfilter.c
src/lib: Makefile
src/libexec/ftpd: Makefile pfilter.c
src/share/mk: bsd.README bsd.prog.mk
Removed Files:
src/external/bsd/blacklist: Makefile Makefile.inc README TODO
src/external/bsd/blacklist/bin: Makefile blacklistctl.8 blacklistctl.c
blacklistd.8 blacklistd.c blacklistd.conf.5 conf.c conf.h
internal.c internal.h run.c run.h state.c state.h support.c
support.h
src/external/bsd/blacklist/diff: ftpd.diff named.diff postfix.diff
proftpd.diff ssh.diff
src/external/bsd/blacklist/etc: Makefile blacklistd.conf npf.conf
src/external/bsd/blacklist/etc/rc.d: Makefile blacklistd
src/external/bsd/blacklist/include: Makefile bl.h blacklist.h
src/external/bsd/blacklist/lib: Makefile bl.c blacklist.c
libblacklist.3 shlib_version
src/external/bsd/blacklist/libexec: Makefile blacklistd-helper
src/external/bsd/blacklist/port: Makefile.am _strtoi.h clock_gettime.c
configure.ac fgetln.c fparseln.c getprogname.c pidfile.c popenve.c
port.h sockaddr_snprintf.c strlcat.c strlcpy.c strtoi.c
src/external/bsd/blacklist/port/m4: .cvsignore
src/external/bsd/blacklist/test: Makefile cltest.c srvtest.c

Log Message:
Rename blacklist -> blocklist


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/crypto/external/bsd/openssh/bin/sshd/Makefile
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/openssh/dist/pfilter.c
cvs rdiff -u -r1.1250 -r1.1251 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.892 -r1.893 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2335 -r1.2336 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.334 -r1.335 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.315 -r1.316 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.254 -r1.255 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.259 -r1.260 src/distrib/sets/lists/etc/mi
cvs rdiff -u -r1.1691 -r1.1692 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.1729 -r1.1730 src/doc/3RDPARTY
cvs rdiff -u -r1.2701 -r1.2702 src/doc/CHANGES
cvs rdiff -u -r1.157 -r1.158 src/etc/defaults/rc.conf
cvs rdiff -u -r1.218 -r1.219 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.168 -r1.169 src/etc/mtree/special
cvs rdiff -u -r1.70 -r1.71 src/external/bsd/Makefile
cvs rdiff -u -r1.2 -r0 src/external/bsd/blacklist/Makefile
cvs rdiff -u -r1.3 -r0 src/external/bsd/blacklist/Makefile.inc
cvs rdiff -u -r1.8 -r0 src/external/bsd/blacklist/README
cvs rdiff -u -r1.7 -r0 src/external/bsd/blacklist/TODO
cvs rdiff -u -r1.11 -r0 src/external/bsd/blacklist/bin/Makefile
cvs rdiff -u -r1.9 -r0 src/external/bsd/blacklist/bin/blacklistctl.8
cvs rdiff -u -r1.23 -r0 src/external/bsd/blacklist/bin/blacklistctl.c
cvs rdiff -u -r1.24 -r0 src/external/bsd/blacklist/bin/blacklistd.8
cvs rdiff -u -r1.43 -r0 src/external/bsd/blacklist/bin/blacklistd.c
cvs rdiff -u -r1.10 -r0 src/external/bsd/blacklist/bin/blacklistd.conf.5 \
src/external/bsd/blacklist/bin/support.c
cvs rdiff -u -r1.31 -r0 src/external/bsd/blacklist/bin/conf.c
cvs rdiff -u -r1.6 -r0 src/external/bsd/blacklist/bin/conf.h
cvs rdiff -u -r1.5 -r0 src/external/bsd/blacklist/bin/internal.c \
src/external/bsd/blacklist/bin/run.h \
src/external/bsd/blacklist/bin/state.h
cvs rdiff -u -r1.14 -r0 src/external/bsd/blacklist/bin/internal.h
cvs rdiff -u -r1.15 -r0 src/external/bsd/blacklist/bin/run.c
cvs rdiff -u -r1.19 -r0 src/external/bsd/blacklist/bin/state.c
cvs rdiff -u -r1.7 -r0 src/external/bsd/blacklist/bin/support.h
cvs rdiff -u -r1.1 -r0 src/external/bsd/blacklist/diff/ftpd.diff \
src/external/bsd/blacklist/diff/postfix.diff
cvs rdiff -u -r1.6 -r0 src/external/bsd/blacklist/diff/named.diff
cvs rdiff -u -r1.3 -r0 src/external/bsd/blacklist/diff/proftpd.diff
cvs rdiff -u -r1.10 -r0 src/external/bsd/blacklist/diff/ssh.diff
cvs rdiff -u -r1.3 -r0 src/external/bsd/blacklist/etc/Makefile
cvs rdiff -u -r1.6 -r0 src/external/bsd/blacklist/etc/blacklistd.conf
cvs rdiff -u -r1.1 -r0 src/external/bsd/blacklist/etc/npf.conf
cvs rdiff -u -r1.1 -r0 src/external/bsd/blacklist/etc/rc.d/Makefile
cvs rdiff -u -r1.2 -r0 

CVS import: src/external/bsd/blocklist

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 01:52:54 UTC 2020

Update of /cvsroot/src/external/bsd/blocklist
In directory ivanova.netbsd.org:/tmp/cvs-serv28835

Log Message:
Import blocklist from https://github.com/zoulasc/blocklist.
This is the same code as blacklist from the HEAD of the NetBSD tree.

Status:

Vendor Tag: CHRISTOS
Release Tags:   blocklist-20200614

N src/external/bsd/blocklist/Makefile
N src/external/bsd/blocklist/Makefile.inc
N src/external/bsd/blocklist/README
N src/external/bsd/blocklist/TODO
N src/external/bsd/blocklist/bin/Makefile
N src/external/bsd/blocklist/bin/blocklistctl.8
N src/external/bsd/blocklist/bin/blocklistctl.c
N src/external/bsd/blocklist/bin/blocklistd.8
N src/external/bsd/blocklist/bin/blocklistd.c
N src/external/bsd/blocklist/bin/blocklistd.conf.5
N src/external/bsd/blocklist/bin/conf.c
N src/external/bsd/blocklist/bin/conf.h
N src/external/bsd/blocklist/bin/internal.c
N src/external/bsd/blocklist/bin/internal.h
N src/external/bsd/blocklist/bin/run.c
N src/external/bsd/blocklist/bin/run.h
N src/external/bsd/blocklist/bin/state.c
N src/external/bsd/blocklist/bin/state.h
N src/external/bsd/blocklist/bin/support.c
N src/external/bsd/blocklist/bin/support.h
N src/external/bsd/blocklist/diff/ftpd.diff
N src/external/bsd/blocklist/diff/named.diff
N src/external/bsd/blocklist/diff/postfix.diff
N src/external/bsd/blocklist/diff/proftpd.diff
N src/external/bsd/blocklist/diff/ssh.diff
N src/external/bsd/blocklist/etc/Makefile
N src/external/bsd/blocklist/etc/blocklistd.conf
N src/external/bsd/blocklist/etc/npf.conf
N src/external/bsd/blocklist/etc/rc.d/Makefile
N src/external/bsd/blocklist/etc/rc.d/blocklistd
N src/external/bsd/blocklist/include/Makefile
N src/external/bsd/blocklist/include/bl.h
N src/external/bsd/blocklist/include/blocklist.h
N src/external/bsd/blocklist/lib/Makefile
N src/external/bsd/blocklist/lib/bl.c
N src/external/bsd/blocklist/lib/blocklist.c
N src/external/bsd/blocklist/lib/shlib_version
N src/external/bsd/blocklist/lib/libblocklist.3
N src/external/bsd/blocklist/libexec/Makefile
N src/external/bsd/blocklist/libexec/blocklistd-helper
N src/external/bsd/blocklist/port/Makefile.am
N src/external/bsd/blocklist/port/_strtoi.h
N src/external/bsd/blocklist/port/clock_gettime.c
N src/external/bsd/blocklist/port/configure.ac
N src/external/bsd/blocklist/port/fgetln.c
N src/external/bsd/blocklist/port/fparseln.c
N src/external/bsd/blocklist/port/getprogname.c
N src/external/bsd/blocklist/port/pidfile.c
N src/external/bsd/blocklist/port/popenve.c
N src/external/bsd/blocklist/port/port.h
N src/external/bsd/blocklist/port/sockaddr_snprintf.c
N src/external/bsd/blocklist/port/strlcat.c
N src/external/bsd/blocklist/port/strlcpy.c
N src/external/bsd/blocklist/port/strtoi.c
N src/external/bsd/blocklist/port/m4/.cvsignore
N src/external/bsd/blocklist/test/Makefile
N src/external/bsd/blocklist/test/cltest.c
N src/external/bsd/blocklist/test/srvtest.c

No conflicts created by this import



CVS import: src/external/bsd/blocklist

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 01:52:54 UTC 2020

Update of /cvsroot/src/external/bsd/blocklist
In directory ivanova.netbsd.org:/tmp/cvs-serv28835

Log Message:
Import blocklist from https://github.com/zoulasc/blocklist.
This is the same code as blacklist from the HEAD of the NetBSD tree.

Status:

Vendor Tag: CHRISTOS
Release Tags:   blocklist-20200614

N src/external/bsd/blocklist/Makefile
N src/external/bsd/blocklist/Makefile.inc
N src/external/bsd/blocklist/README
N src/external/bsd/blocklist/TODO
N src/external/bsd/blocklist/bin/Makefile
N src/external/bsd/blocklist/bin/blocklistctl.8
N src/external/bsd/blocklist/bin/blocklistctl.c
N src/external/bsd/blocklist/bin/blocklistd.8
N src/external/bsd/blocklist/bin/blocklistd.c
N src/external/bsd/blocklist/bin/blocklistd.conf.5
N src/external/bsd/blocklist/bin/conf.c
N src/external/bsd/blocklist/bin/conf.h
N src/external/bsd/blocklist/bin/internal.c
N src/external/bsd/blocklist/bin/internal.h
N src/external/bsd/blocklist/bin/run.c
N src/external/bsd/blocklist/bin/run.h
N src/external/bsd/blocklist/bin/state.c
N src/external/bsd/blocklist/bin/state.h
N src/external/bsd/blocklist/bin/support.c
N src/external/bsd/blocklist/bin/support.h
N src/external/bsd/blocklist/diff/ftpd.diff
N src/external/bsd/blocklist/diff/named.diff
N src/external/bsd/blocklist/diff/postfix.diff
N src/external/bsd/blocklist/diff/proftpd.diff
N src/external/bsd/blocklist/diff/ssh.diff
N src/external/bsd/blocklist/etc/Makefile
N src/external/bsd/blocklist/etc/blocklistd.conf
N src/external/bsd/blocklist/etc/npf.conf
N src/external/bsd/blocklist/etc/rc.d/Makefile
N src/external/bsd/blocklist/etc/rc.d/blocklistd
N src/external/bsd/blocklist/include/Makefile
N src/external/bsd/blocklist/include/bl.h
N src/external/bsd/blocklist/include/blocklist.h
N src/external/bsd/blocklist/lib/Makefile
N src/external/bsd/blocklist/lib/bl.c
N src/external/bsd/blocklist/lib/blocklist.c
N src/external/bsd/blocklist/lib/shlib_version
N src/external/bsd/blocklist/lib/libblocklist.3
N src/external/bsd/blocklist/libexec/Makefile
N src/external/bsd/blocklist/libexec/blocklistd-helper
N src/external/bsd/blocklist/port/Makefile.am
N src/external/bsd/blocklist/port/_strtoi.h
N src/external/bsd/blocklist/port/clock_gettime.c
N src/external/bsd/blocklist/port/configure.ac
N src/external/bsd/blocklist/port/fgetln.c
N src/external/bsd/blocklist/port/fparseln.c
N src/external/bsd/blocklist/port/getprogname.c
N src/external/bsd/blocklist/port/pidfile.c
N src/external/bsd/blocklist/port/popenve.c
N src/external/bsd/blocklist/port/port.h
N src/external/bsd/blocklist/port/sockaddr_snprintf.c
N src/external/bsd/blocklist/port/strlcat.c
N src/external/bsd/blocklist/port/strlcpy.c
N src/external/bsd/blocklist/port/strtoi.c
N src/external/bsd/blocklist/port/m4/.cvsignore
N src/external/bsd/blocklist/test/Makefile
N src/external/bsd/blocklist/test/cltest.c
N src/external/bsd/blocklist/test/srvtest.c

No conflicts created by this import



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

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 15 01:24:21 UTC 2020

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

Log Message:
Count down bits of entropy, not bits of data, in x86 cpu_rng.

Fixes logic in this loop for XSTORERNG on VIA CPUs, which are deemed
to have half the entropy per bit of data as RDSEED on Intel CPUs, so
that it gathers enough entropy on the first request, not on the
second request.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/cpu_rng.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_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.16 src/sys/arch/x86/x86/cpu_rng.c:1.17
--- src/sys/arch/x86/x86/cpu_rng.c:1.16	Mon Jun 15 01:23:44 2020
+++ src/sys/arch/x86/x86/cpu_rng.c	Mon Jun 15 01:24:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.16 2020/06/15 01:23:44 riastradh Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.17 2020/06/15 01:24:20 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -254,7 +254,7 @@ cpu_rng_get(size_t nbytes, void *cookie)
 	uint64_t buf[2*N];
 	unsigned i, nbits = 0;
 
-	for (; nbytes; nbytes -= MIN(nbytes, sizeof buf)) {
+	while (nbytes) {
 		/*
 		 * The fraction of outputs this rejects in correct
 		 * operation is 1/2^256, which is close enough to zero
@@ -269,6 +269,7 @@ cpu_rng_get(size_t nbytes, void *cookie)
 			nbits = 0;
 		}
 		rnd_add_data_sync(_rng_source, buf, sizeof buf, nbits);
+		nbytes -= MIN(MIN(nbytes, sizeof buf), MAX(1, 8*nbits));
 	}
 #undef N
 }



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

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 15 01:24:21 UTC 2020

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

Log Message:
Count down bits of entropy, not bits of data, in x86 cpu_rng.

Fixes logic in this loop for XSTORERNG on VIA CPUs, which are deemed
to have half the entropy per bit of data as RDSEED on Intel CPUs, so
that it gathers enough entropy on the first request, not on the
second request.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/cpu_rng.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-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 15 01:23:44 UTC 2020

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

Log Message:
Use x86_read_psl/x86_disable_intr/x86_read_psl to defer interrupts.

Using x86_disable_intr/x86_enable_intr causes a bit of a snag when we
try it early at boot before we're ready to handle interrupts, because
it has the effect of enabling interrupts!

Fixes instant reset at boot on VIA CPUs.  The instant reset on boot
is new since the entropy rework, which initialized the x86 CPU RNG
earlier than before, but in principle this could also cause other
problems while not early at boot too.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/cpu_rng.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-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 15 01:23:44 UTC 2020

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

Log Message:
Use x86_read_psl/x86_disable_intr/x86_read_psl to defer interrupts.

Using x86_disable_intr/x86_enable_intr causes a bit of a snag when we
try it early at boot before we're ready to handle interrupts, because
it has the effect of enabling interrupts!

Fixes instant reset at boot on VIA CPUs.  The instant reset on boot
is new since the entropy rework, which initialized the x86 CPU RNG
earlier than before, but in principle this could also cause other
problems while not early at boot too.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/cpu_rng.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_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.15 src/sys/arch/x86/x86/cpu_rng.c:1.16
--- src/sys/arch/x86/x86/cpu_rng.c:1.15	Fri Jun  5 21:48:03 2020
+++ src/sys/arch/x86/x86/cpu_rng.c	Mon Jun 15 01:23:44 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.15 2020/06/05 21:48:03 kamil Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.16 2020/06/15 01:23:44 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -186,6 +186,7 @@ cpu_rng_rdseed_rdrand(uint64_t *out)
 static size_t
 cpu_rng_via(uint64_t *out)
 {
+	u_long psl;
 	uint32_t creg0, rndsts;
 
 	/*
@@ -199,9 +200,9 @@ cpu_rng_via(uint64_t *out)
 	 * even if such a fault is generated.
 	 *
 	 * XXX can this really happen if we don't use "rep xstorrng"?
-	 *
 	 */
 	kpreempt_disable();
+	psl = x86_read_psl();
 	x86_disable_intr();
 	creg0 = rcr0();
 	lcr0(creg0 & ~(CR0_EM|CR0_TS)); /* Permit access to SIMD/FPU path */
@@ -215,7 +216,7 @@ cpu_rng_via(uint64_t *out)
 	: "=a" (rndsts), "+D" (out) : "d" (0) : "memory");
 	/* Put CR0 back how it was */
 	lcr0(creg0);
-	x86_enable_intr();
+	x86_write_psl(psl);
 	kpreempt_enable();
 
 	/*



CVS commit: src/common/lib/libprop

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:46:00 UTC 2020

Modified Files:
src/common/lib/libprop: prop_dictionary_util.c

Log Message:
remove error(1) comments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libprop/prop_dictionary_util.c

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



CVS commit: src/common/lib/libprop

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:46:00 UTC 2020

Modified Files:
src/common/lib/libprop: prop_dictionary_util.c

Log Message:
remove error(1) comments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libprop/prop_dictionary_util.c

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

Modified files:

Index: src/common/lib/libprop/prop_dictionary_util.c
diff -u src/common/lib/libprop/prop_dictionary_util.c:1.7 src/common/lib/libprop/prop_dictionary_util.c:1.8
--- src/common/lib/libprop/prop_dictionary_util.c:1.7	Sun Jun 14 17:31:01 2020
+++ src/common/lib/libprop/prop_dictionary_util.c	Sun Jun 14 20:46:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_dictionary_util.c,v 1.7 2020/06/14 21:31:01 christos Exp $	*/
+/*	$NetBSD: prop_dictionary_util.c,v 1.8 2020/06/15 00:46:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -154,8 +154,6 @@ UTEMPLATE(uchar, unsigned char)
 UTEMPLATE(ushort,unsigned short)
 UTEMPLATE(uint,  unsigned int)
 UTEMPLATE(ulong, unsigned long)
-/*###155 [lint] warning conversion to 'unsigned long' due to prototype, arg #3 [259]%%%*/
-/*###155 [lint] warning conversion from 'unsigned long long' to 'unsigned long' may lose accuracy, arg #3 [298]%%%*/
 UTEMPLATE(ulonglong, unsigned long long)
 UTEMPLATE(uintptr,   uintptr_t)
 UTEMPLATE(uint8, uint8_t)



CVS commit: src/doc

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:40:14 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new file(1)


To generate a diff of this commit:
cvs rdiff -u -r1.1728 -r1.1729 src/doc/3RDPARTY
cvs rdiff -u -r1.2700 -r1.2701 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-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:40:14 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new file(1)


To generate a diff of this commit:
cvs rdiff -u -r1.1728 -r1.1729 src/doc/3RDPARTY
cvs rdiff -u -r1.2700 -r1.2701 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/3RDPARTY
diff -u src/doc/3RDPARTY:1.1728 src/doc/3RDPARTY:1.1729
--- src/doc/3RDPARTY:1.1728	Sat Jun 13 18:35:23 2020
+++ src/doc/3RDPARTY	Sun Jun 14 20:40:14 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1728 2020/06/13 22:35:23 sevan Exp $
+#	$NetBSD: 3RDPARTY,v 1.1729 2020/06/15 00:40:14 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -409,12 +409,12 @@ Notes:
 Please use "expat" as the vendor tag for CVS imports.
 
 Package:	file
-Version:	5.38
-Current Vers:	5.38
+Version:	5.39
+Current Vers:	5.39
 Maintainer:	Christos Zoulas 
 Archive Site:	ftp://ftp.astron.com/pub/file/
 Home Page:	http://www.darwinsys.com/file/
-Date:		2019-12-16
+Date:		2020-06-14
 Mailing List:	f...@astron.com
 Responsible:	christos, pooka
 License:	BSD (2-clause)

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2700 src/doc/CHANGES:1.2701
--- src/doc/CHANGES:1.2700	Fri Jun 12 07:07:43 2020
+++ src/doc/CHANGES	Sun Jun 14 20:40:14 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2700 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2701 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -218,3 +218,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	evbarm: Add install media for earmv7hf and aarch64. [jmcneill 20200528]
 	dhcpcd: Import version 9.1.1 [roy 20200604]
 	inet6: in-kernel Router Advertisment handling removed. [roy 20200612]
+	file(1): Upgraded to 5.39. [christos 20200614]



CVS commit: src/distrib/sets/lists

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:39:03 UTC 2020

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi

Log Message:
bump libmagic


To generate a diff of this commit:
cvs rdiff -u -r1.891 -r1.892 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.253 -r1.254 src/distrib/sets/lists/debug/shl.mi

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/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.891 src/distrib/sets/lists/base/shl.mi:1.892
--- src/distrib/sets/lists/base/shl.mi:1.891	Sat Jun  6 17:25:59 2020
+++ src/distrib/sets/lists/base/shl.mi	Sun Jun 14 20:39:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.891 2020/06/06 21:25:59 thorpej Exp $
+# $NetBSD: shl.mi,v 1.892 2020/06/15 00:39:03 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -449,8 +449,8 @@
 ./usr/lib/libm.so.0base-sys-shlib		compatfile
 ./usr/lib/libm.so.0.12base-sys-shlib		compatfile
 ./usr/lib/libmagic.sobase-sys-shlib		compatfile
-./usr/lib/libmagic.so.6base-sys-shlib		compatfile
-./usr/lib/libmagic.so.6.0			base-sys-shlib		compatfile
+./usr/lib/libmagic.so.7base-sys-shlib		compatfile
+./usr/lib/libmagic.so.7.0			base-sys-shlib		compatfile
 ./usr/lib/libmenu.sobase-sys-shlib		compatfile
 ./usr/lib/libmenu.so.8base-sys-shlib		compatfile
 ./usr/lib/libmenu.so.8.0			base-sys-shlib		compatfile

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.253 src/distrib/sets/lists/debug/shl.mi:1.254
--- src/distrib/sets/lists/debug/shl.mi:1.253	Mon Jun  8 01:05:43 2020
+++ src/distrib/sets/lists/debug/shl.mi	Sun Jun 14 20:39:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.253 2020/06/08 05:05:43 rin Exp $
+# $NetBSD: shl.mi,v 1.254 2020/06/15 00:39:03 christos Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
@@ -162,7 +162,7 @@
 ./usr/libdata/debug/usr/lib/liblzf.so.1.0.debug			comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/liblzma.so.2.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libm.so.0.12.debug			comp-sys-debug	debug,compatfile
-./usr/libdata/debug/usr/lib/libmagic.so.6.0.debug		comp-sys-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libmagic.so.7.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libmenu.so.6.0.debug		comp-sys-debug	debug,obsolete,compatfile
 ./usr/libdata/debug/usr/lib/libmenu.so.7.0.debug		comp-sys-debug	debug,obsolete,compatfile
 ./usr/libdata/debug/usr/lib/libmenu.so.8.0.debug		comp-sys-debug	debug,compatfile



CVS commit: src/distrib/sets/lists

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:39:03 UTC 2020

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi

Log Message:
bump libmagic


To generate a diff of this commit:
cvs rdiff -u -r1.891 -r1.892 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.253 -r1.254 src/distrib/sets/lists/debug/shl.mi

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



CVS commit: src/external/bsd/file

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:37:25 UTC 2020

Modified Files:
src/external/bsd/file/dist: ChangeLog Makefile.am Makefile.in configure
configure.ac
src/external/bsd/file/dist/doc: file.1 magic.5
src/external/bsd/file/dist/magic: Makefile.am Makefile.in
src/external/bsd/file/dist/magic/magdir: archive elf filesystems parix
pgp
src/external/bsd/file/dist/src: apprentice.c compress.c der.c file.c
file.h funcs.c is_csv.c is_json.c magic.c print.c readelf.c
softmagic.c
src/external/bsd/file/include: config.h
src/external/bsd/file/lib: shlib_version

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/dist/ChangeLog
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/Makefile.am
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/Makefile.in \
src/external/bsd/file/dist/configure.ac
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/file/dist/configure
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/file/dist/doc/file.1
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/file/dist/doc/magic.5
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/magic/Makefile.am
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/file/dist/magic/Makefile.in
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/file/dist/magic/magdir/archive
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/magic/magdir/elf
cvs rdiff -u -r1.16 -r1.17 \
src/external/bsd/file/dist/magic/magdir/filesystems
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/file/dist/magic/magdir/parix
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/file/dist/magic/magdir/pgp
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/file/dist/src/apprentice.c \
src/external/bsd/file/dist/src/file.h
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/file/dist/src/compress.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/file/dist/src/der.c
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/file/dist/src/file.c \
src/external/bsd/file/dist/src/magic.c \
src/external/bsd/file/dist/src/print.c
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/file/dist/src/funcs.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/file/dist/src/is_csv.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/src/is_json.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/file/dist/src/readelf.c
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/file/dist/src/softmagic.c
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/file/include/config.h
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/file/lib/shlib_version

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

Modified files:

Index: src/external/bsd/file/dist/ChangeLog
diff -u src/external/bsd/file/dist/ChangeLog:1.10 src/external/bsd/file/dist/ChangeLog:1.11
--- src/external/bsd/file/dist/ChangeLog:1.10	Mon Dec 16 21:31:05 2019
+++ src/external/bsd/file/dist/ChangeLog	Sun Jun 14 20:37:24 2020
@@ -1,3 +1,83 @@
+2020-06-14  20:02  Christos Zoulas 
+
+	* release 5.39
+
+2020-06-07  20:00  Christos Zoulas 
+
+	* Remove unused subtype_mime (Steve Grubb)
+	* Remove unused check in okstat (Steve Grubb)
+	* Fix mime-type in elf binaries by making sure $x is set
+	* Fix indirect negative offsets broken by OFFNEGATIVE
+	* Fix GUID equality check
+	* PR/165: Handle empty array and strings in JSON
+	* PR/162: Add --exclude-quiet
+
+2020-06-06  15:33  Christos Zoulas 
+
+	* Fix memory leak in ascmagic (Steve Grubb)
+
+2020-06-04  00:21  Christos Zoulas 
+
+	* Fix string comparison length with ignore whitespace
+
+2020-05-31  00:11  Christos Zoulas 
+
+	* Fix mingwin 64 compilation
+
+2020-05-30  23:56  Christos Zoulas 
+
+	* PR/159: whitelist getpid needed for file_pipe2file()
+
+2020-05-09  18:57  Christos Zoulas 
+
+	* Indicate negative offsets with a flag OFFNEGATIVE
+	  so that -0 works.
+	* Introduce "offset" magic type that can be used to
+	  detect the file size, and bail on short files.
+	* document DER better in the magic man page.
+
+2020-03-11  21:53  Christos Zoulas 
+
+	* fix memory leaks (SonarQube)
+
+2020-03-08  21:33  Christos Zoulas 
+
+	* fix memory leaks (SonarQube)
+	* rewrite confusing loops (SonarQube)
+	* fix bogus test (SonarQube)
+	* pass a sized buffer to file_fmttime() (SonarQube)
+
+	* fix memory leaks (SonarQube)
+
+2020-02-20  15:50  Christos Zoulas 
+
+	* Don't allow * in printf formats, or the code itself (Christoph Biedl)
+	* Introduce a printf output size checker to avoid DoS attacks
+
+2020-02-17  17:22  Christos Zoulas 
+
+	* Avoid memory leak on error (oss-fuzz)
+	* Check length of string on DER before derefercing and add new types
+	* Add missing DER string (oss-fuzz)
+
+2020-02-16  20:45  Christos Zoulas 
+
+	* Add missing DER types, and debugging
+
+2020-02-13  13:10  Christos Zoulas 
+
+	* PR/140: Avoid abort with hand-crafted magic file (gockelhahn)
+	* PR/139  Avoid DoS in printf with hand-crafted magic file (gockelhahn)
+	* PR/138: 

CVS commit: src/external/bsd/file

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:37:25 UTC 2020

Modified Files:
src/external/bsd/file/dist: ChangeLog Makefile.am Makefile.in configure
configure.ac
src/external/bsd/file/dist/doc: file.1 magic.5
src/external/bsd/file/dist/magic: Makefile.am Makefile.in
src/external/bsd/file/dist/magic/magdir: archive elf filesystems parix
pgp
src/external/bsd/file/dist/src: apprentice.c compress.c der.c file.c
file.h funcs.c is_csv.c is_json.c magic.c print.c readelf.c
softmagic.c
src/external/bsd/file/include: config.h
src/external/bsd/file/lib: shlib_version

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/dist/ChangeLog
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/Makefile.am
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/Makefile.in \
src/external/bsd/file/dist/configure.ac
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/file/dist/configure
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/file/dist/doc/file.1
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/file/dist/doc/magic.5
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/magic/Makefile.am
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/file/dist/magic/Makefile.in
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/file/dist/magic/magdir/archive
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/magic/magdir/elf
cvs rdiff -u -r1.16 -r1.17 \
src/external/bsd/file/dist/magic/magdir/filesystems
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/file/dist/magic/magdir/parix
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/file/dist/magic/magdir/pgp
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/file/dist/src/apprentice.c \
src/external/bsd/file/dist/src/file.h
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/file/dist/src/compress.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/file/dist/src/der.c
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/file/dist/src/file.c \
src/external/bsd/file/dist/src/magic.c \
src/external/bsd/file/dist/src/print.c
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/file/dist/src/funcs.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/file/dist/src/is_csv.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/src/is_json.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/file/dist/src/readelf.c
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/file/dist/src/softmagic.c
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/file/include/config.h
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/file/lib/shlib_version

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



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Jun 15 00:31:21 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Remove mips32r2 error introduced in previous commit; there no MP support
at all for 32-bit MIPSNN kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/sys/arch/mips/mips/mips_machdep.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/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Jun 15 00:31:21 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Remove mips32r2 error introduced in previous commit; there no MP support
at all for 32-bit MIPSNN kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.290 src/sys/arch/mips/mips/mips_machdep.c:1.291
--- src/sys/arch/mips/mips/mips_machdep.c:1.290	Sun Jun 14 14:45:12 2020
+++ src/sys/arch/mips/mips/mips_machdep.c	Mon Jun 15 00:31:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.290 2020/06/14 14:45:12 simonb Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.291 2020/06/15 00:31:21 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.290 2020/06/14 14:45:12 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.291 2020/06/15 00:31:21 simonb Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -946,7 +946,7 @@ mips32r2_vector_init(const struct splsw 
 	 * If this CPU doesn't have a COP0 USERLOCAL register, at the end
 	 * of cpu_switch resume overwrite the instructions which update it.
 	 */
-	if (!MIPS_HAS_USERLOCAL && cpunum == 0) {
+	if (!MIPS_HAS_USERLOCAL) {
 		extern uint32_t mips32r2_cpu_switch_resume[];
 		for (uint32_t *insnp = mips32r2_cpu_switch_resume;; insnp++) {
 			KASSERT(insnp[0] != JR_RA);
@@ -962,8 +962,7 @@ mips32r2_vector_init(const struct splsw 
 	/*
 	 * Copy locore-function vector.
 	 */
-	if (cpunum == 0)
-		mips_locore_jumpvec = mips32r2_locore_vec;
+	mips_locore_jumpvec = mips32r2_locore_vec;
 
 	mips_icache_sync_all();
 	mips_dcache_wbinv_all();



CVS import: src/external/bsd/file/dist

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:18:51 UTC 2020

Update of /cvsroot/src/external/bsd/file/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv16029

Log Message:
Import 5.39:

   * Remove unused subtype_mime (Steve Grubb)
   * Remove unused check in okstat (Steve Grubb)
   * Fix mime-type in elf binaries by making sure $x is set
   * Fix indirect negative offsets broken by OFFNEGATIVE
   * Fix GUID equality check
   * PR/165: Handle empty array and strings in JSON
   * PR/162: Add --exclude-quiet
   * Fix memory leak in ascmagic (Steve Grubb)
   * Fix string comparison length with ignore whitespace
   * Fix mingwin 64 compilation
   * PR/159: whitelist getpid needed for file_pipe2file()
   * Indicate negative offsets with a flag OFFNEGATIVE
 so that -0 works.
   * Introduce "offset" magic type that can be used to
 detect the file size, and bail on short files.
   * document DER better in the magic man page.
   * fix memory leaks (SonarQube)
   * rewrite confusing loops (SonarQube)
   * fix bogus test (SonarQube)
   * pass a sized buffer to file_fmttime() (SonarQube)
   * Don't allow * in printf formats, or the code itself (Christoph Biedl)
   * Introduce a printf output size checker to avoid DoS attacks
   * Avoid memory leak on error (oss-fuzz)
   * Check length of string on DER before derefercing and add new types
   * Add missing DER string (oss-fuzz)
   * Add missing DER types, and debugging
   * PR/140: Avoid abort with hand-crafted magic file (gockelhahn)
   * PR/139:  Avoid DoS in printf with hand-crafted magic file (gockelhahn)
   * PR/138: Avoid crash with hand-crafted magic file (gockelhahn)
   * PR/136: Fix static build by adding a libmagic.pc (Fabrice Fontaine)
   * add guid support native support via the "guid" type.

Status:

Vendor Tag: CHRISTOS
Release Tags:   FILE5_39

C src/external/bsd/file/dist/Makefile.am
C src/external/bsd/file/dist/configure
U src/external/bsd/file/dist/acinclude.m4
C src/external/bsd/file/dist/configure.ac
U src/external/bsd/file/dist/aclocal.m4
C src/external/bsd/file/dist/Makefile.in
U src/external/bsd/file/dist/config.h.in
N src/external/bsd/file/dist/libmagic.pc.in
U src/external/bsd/file/dist/AUTHORS
U src/external/bsd/file/dist/COPYING
C src/external/bsd/file/dist/ChangeLog
U src/external/bsd/file/dist/INSTALL
U src/external/bsd/file/dist/NEWS
U src/external/bsd/file/dist/README
U src/external/bsd/file/dist/TODO
U src/external/bsd/file/dist/compile
U src/external/bsd/file/dist/config.guess
U src/external/bsd/file/dist/config.sub
U src/external/bsd/file/dist/install-sh
U src/external/bsd/file/dist/ltmain.sh
U src/external/bsd/file/dist/missing
U src/external/bsd/file/dist/MAINT
U src/external/bsd/file/dist/depcomp
U src/external/bsd/file/dist/m4/libtool.m4
U src/external/bsd/file/dist/m4/ltoptions.m4
U src/external/bsd/file/dist/m4/ltsugar.m4
U src/external/bsd/file/dist/m4/ltversion.m4
U src/external/bsd/file/dist/m4/lt~obsolete.m4
U src/external/bsd/file/dist/src/Makefile.am
U src/external/bsd/file/dist/src/Makefile.in
U src/external/bsd/file/dist/src/asctime_r.c
U src/external/bsd/file/dist/src/asprintf.c
U src/external/bsd/file/dist/src/ctime_r.c
U src/external/bsd/file/dist/src/dprintf.c
U src/external/bsd/file/dist/src/fmtcheck.c
U src/external/bsd/file/dist/src/getline.c
U src/external/bsd/file/dist/src/getopt_long.c
U src/external/bsd/file/dist/src/gmtime_r.c
U src/external/bsd/file/dist/src/localtime_r.c
U src/external/bsd/file/dist/src/pread.c
U src/external/bsd/file/dist/src/strcasestr.c
U src/external/bsd/file/dist/src/strlcat.c
U src/external/bsd/file/dist/src/strlcpy.c
U src/external/bsd/file/dist/src/vasprintf.c
U src/external/bsd/file/dist/src/buffer.c
C src/external/bsd/file/dist/src/magic.c
C src/external/bsd/file/dist/src/apprentice.c
C src/external/bsd/file/dist/src/softmagic.c
U src/external/bsd/file/dist/src/ascmagic.c
U src/external/bsd/file/dist/src/encoding.c
C src/external/bsd/file/dist/src/compress.c
U src/external/bsd/file/dist/src/is_csv.c
C src/external/bsd/file/dist/src/is_json.c
U src/external/bsd/file/dist/src/is_tar.c
C src/external/bsd/file/dist/src/readelf.c
C src/external/bsd/file/dist/src/print.c
U src/external/bsd/file/dist/src/fsmagic.c
C src/external/bsd/file/dist/src/funcs.c
C src/external/bsd/file/dist/src/file.h
U src/external/bsd/file/dist/src/readelf.h
U src/external/bsd/file/dist/src/tar.h
U src/external/bsd/file/dist/src/apptype.c
C src/external/bsd/file/dist/src/der.c
U src/external/bsd/file/dist/src/der.h
U src/external/bsd/file/dist/src/file_opts.h
U src/external/bsd/file/dist/src/elfclass.h
U src/external/bsd/file/dist/src/mygetopt.h
U src/external/bsd/file/dist/src/cdf.c
U src/external/bsd/file/dist/src/cdf_time.c
U src/external/bsd/file/dist/src/readcdf.c
U src/external/bsd/file/dist/src/cdf.h
C src/external/bsd/file/dist/src/file.c
U src/external/bsd/file/dist/src/seccomp.c
U src/external/bsd/file/dist/src/magic.h.in
C 

CVS import: src/external/bsd/file/dist

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 15 00:18:51 UTC 2020

Update of /cvsroot/src/external/bsd/file/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv16029

Log Message:
Import 5.39:

   * Remove unused subtype_mime (Steve Grubb)
   * Remove unused check in okstat (Steve Grubb)
   * Fix mime-type in elf binaries by making sure $x is set
   * Fix indirect negative offsets broken by OFFNEGATIVE
   * Fix GUID equality check
   * PR/165: Handle empty array and strings in JSON
   * PR/162: Add --exclude-quiet
   * Fix memory leak in ascmagic (Steve Grubb)
   * Fix string comparison length with ignore whitespace
   * Fix mingwin 64 compilation
   * PR/159: whitelist getpid needed for file_pipe2file()
   * Indicate negative offsets with a flag OFFNEGATIVE
 so that -0 works.
   * Introduce "offset" magic type that can be used to
 detect the file size, and bail on short files.
   * document DER better in the magic man page.
   * fix memory leaks (SonarQube)
   * rewrite confusing loops (SonarQube)
   * fix bogus test (SonarQube)
   * pass a sized buffer to file_fmttime() (SonarQube)
   * Don't allow * in printf formats, or the code itself (Christoph Biedl)
   * Introduce a printf output size checker to avoid DoS attacks
   * Avoid memory leak on error (oss-fuzz)
   * Check length of string on DER before derefercing and add new types
   * Add missing DER string (oss-fuzz)
   * Add missing DER types, and debugging
   * PR/140: Avoid abort with hand-crafted magic file (gockelhahn)
   * PR/139:  Avoid DoS in printf with hand-crafted magic file (gockelhahn)
   * PR/138: Avoid crash with hand-crafted magic file (gockelhahn)
   * PR/136: Fix static build by adding a libmagic.pc (Fabrice Fontaine)
   * add guid support native support via the "guid" type.

Status:

Vendor Tag: CHRISTOS
Release Tags:   FILE5_39

C src/external/bsd/file/dist/Makefile.am
C src/external/bsd/file/dist/configure
U src/external/bsd/file/dist/acinclude.m4
C src/external/bsd/file/dist/configure.ac
U src/external/bsd/file/dist/aclocal.m4
C src/external/bsd/file/dist/Makefile.in
U src/external/bsd/file/dist/config.h.in
N src/external/bsd/file/dist/libmagic.pc.in
U src/external/bsd/file/dist/AUTHORS
U src/external/bsd/file/dist/COPYING
C src/external/bsd/file/dist/ChangeLog
U src/external/bsd/file/dist/INSTALL
U src/external/bsd/file/dist/NEWS
U src/external/bsd/file/dist/README
U src/external/bsd/file/dist/TODO
U src/external/bsd/file/dist/compile
U src/external/bsd/file/dist/config.guess
U src/external/bsd/file/dist/config.sub
U src/external/bsd/file/dist/install-sh
U src/external/bsd/file/dist/ltmain.sh
U src/external/bsd/file/dist/missing
U src/external/bsd/file/dist/MAINT
U src/external/bsd/file/dist/depcomp
U src/external/bsd/file/dist/m4/libtool.m4
U src/external/bsd/file/dist/m4/ltoptions.m4
U src/external/bsd/file/dist/m4/ltsugar.m4
U src/external/bsd/file/dist/m4/ltversion.m4
U src/external/bsd/file/dist/m4/lt~obsolete.m4
U src/external/bsd/file/dist/src/Makefile.am
U src/external/bsd/file/dist/src/Makefile.in
U src/external/bsd/file/dist/src/asctime_r.c
U src/external/bsd/file/dist/src/asprintf.c
U src/external/bsd/file/dist/src/ctime_r.c
U src/external/bsd/file/dist/src/dprintf.c
U src/external/bsd/file/dist/src/fmtcheck.c
U src/external/bsd/file/dist/src/getline.c
U src/external/bsd/file/dist/src/getopt_long.c
U src/external/bsd/file/dist/src/gmtime_r.c
U src/external/bsd/file/dist/src/localtime_r.c
U src/external/bsd/file/dist/src/pread.c
U src/external/bsd/file/dist/src/strcasestr.c
U src/external/bsd/file/dist/src/strlcat.c
U src/external/bsd/file/dist/src/strlcpy.c
U src/external/bsd/file/dist/src/vasprintf.c
U src/external/bsd/file/dist/src/buffer.c
C src/external/bsd/file/dist/src/magic.c
C src/external/bsd/file/dist/src/apprentice.c
C src/external/bsd/file/dist/src/softmagic.c
U src/external/bsd/file/dist/src/ascmagic.c
U src/external/bsd/file/dist/src/encoding.c
C src/external/bsd/file/dist/src/compress.c
U src/external/bsd/file/dist/src/is_csv.c
C src/external/bsd/file/dist/src/is_json.c
U src/external/bsd/file/dist/src/is_tar.c
C src/external/bsd/file/dist/src/readelf.c
C src/external/bsd/file/dist/src/print.c
U src/external/bsd/file/dist/src/fsmagic.c
C src/external/bsd/file/dist/src/funcs.c
C src/external/bsd/file/dist/src/file.h
U src/external/bsd/file/dist/src/readelf.h
U src/external/bsd/file/dist/src/tar.h
U src/external/bsd/file/dist/src/apptype.c
C src/external/bsd/file/dist/src/der.c
U src/external/bsd/file/dist/src/der.h
U src/external/bsd/file/dist/src/file_opts.h
U src/external/bsd/file/dist/src/elfclass.h
U src/external/bsd/file/dist/src/mygetopt.h
U src/external/bsd/file/dist/src/cdf.c
U src/external/bsd/file/dist/src/cdf_time.c
U src/external/bsd/file/dist/src/readcdf.c
U src/external/bsd/file/dist/src/cdf.h
C src/external/bsd/file/dist/src/file.c
U src/external/bsd/file/dist/src/seccomp.c
U src/external/bsd/file/dist/src/magic.h.in
C 

CVS commit: src/sys/rump/include/rump

2020-06-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jun 14 23:38:25 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump.h

Log Message:
Remove old compat include of rump_syscallshotgun.h

It was separated in 2016 and is no longer needed.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/rump/include/rump/rump.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/rump/include/rump/rump.h
diff -u src/sys/rump/include/rump/rump.h:1.71 src/sys/rump/include/rump/rump.h:1.72
--- src/sys/rump/include/rump/rump.h:1.71	Sun Jun 14 22:12:58 2020
+++ src/sys/rump/include/rump/rump.h	Sun Jun 14 23:38:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.h,v 1.71 2020/06/14 22:12:58 kamil Exp $	*/
+/*	$NetBSD: rump.h,v 1.72 2020/06/14 23:38:25 kamil Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -133,11 +133,4 @@ int	rump_daemonize_done(int);
 }
 #endif
 
-/*
- * Include macros prehistorically provided by this header.
- * The inclusion might go away some year.  Include the header directly
- * if you want it to keep working for you.
- */
-#include 
-
 #endif /* _RUMP_RUMP_H_ */



CVS commit: src/sys/rump/include/rump

2020-06-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jun 14 23:38:25 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump.h

Log Message:
Remove old compat include of rump_syscallshotgun.h

It was separated in 2016 and is no longer needed.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/rump/include/rump/rump.h

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



CVS commit: src/sys/dev/marvell

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:29:23 UTC 2020

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvcesa.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/marvell/mvcesa.c
diff -u src/sys/dev/marvell/mvcesa.c:1.2 src/sys/dev/marvell/mvcesa.c:1.3
--- src/sys/dev/marvell/mvcesa.c:1.2	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/marvell/mvcesa.c	Sun Jun 14 23:29:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $");
 
 #include 
 #include 
@@ -56,7 +56,6 @@ struct mvcesa_session {
 	int ses_used;
 
 	int ses_klen;
-	uint32_t ses_iv[4];
 	uint32_t ses_key[8];
 
 	uint32_t ses_hminner[5];	/* HMAC inner state */
@@ -236,9 +235,6 @@ mvcesa_newsession(void *arg, u_int32_t *
 return EINVAL;
 			enc = 1;
 
-			cprng_fast(ses->ses_iv,
-			c->cri_alg == CRYPTO_AES_CBC ? 16 : 8);
-
 			/* Go ahead and compute key in CESA's byte order */
 			ses->ses_klen = c->cri_klen;
 			memcpy(ses->ses_key, c->cri_key, c->cri_klen / 8);
@@ -406,8 +402,10 @@ mvcesa_process(void *arg, struct cryptop
 dir = MVCESA_DESE_C_DIRECTION_ENC;
 if (crd->crd_flags & CRD_F_IV_EXPLICIT)
 	iv = (uint32_t *)crd->crd_iv;
-else
-	iv = ses->ses_iv;
+else {
+	cprng_fast(ivbuf, sizeof(ivbuf));
+	iv = ivbuf;
+}
 if (!(crd->crd_flags & CRD_F_IV_PRESENT)) {
 	if (m != NULL)
 		m_copyback(m, crd->crd_inject,
@@ -760,8 +758,5 @@ mvcesa_des_encdec(struct mvcesa_softc *s
 		}
 	}
 
-	if (dir == MVCESA_DESE_C_DIRECTION_ENC)
-		memcpy(ses->ses_iv, iv, sizeof(ses->ses_iv));
-
 	return 0;
 }



CVS commit: src/sys/dev/marvell

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:29:23 UTC 2020

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvcesa.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-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 23:24:20 UTC 2020

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

Log Message:
tsc_get_timecount(): disable the "clock goes backwards" check on i386 for
the moment since it requires 64-bit store to be atomic because of nesting
via interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x86/x86/tsc.c

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



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

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 23:24:20 UTC 2020

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

Log Message:
tsc_get_timecount(): disable the "clock goes backwards" check on i386 for
the moment since it requires 64-bit store to be atomic because of nesting
via interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x86/x86/tsc.c

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

Modified files:

Index: src/sys/arch/x86/x86/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.49 src/sys/arch/x86/x86/tsc.c:1.50
--- src/sys/arch/x86/x86/tsc.c:1.49	Sat Jun 13 23:58:52 2020
+++ src/sys/arch/x86/x86/tsc.c	Sun Jun 14 23:24:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsc.c,v 1.49 2020/06/13 23:58:52 ad Exp $	*/
+/*	$NetBSD: tsc.c,v 1.50 2020/06/14 23:24:20 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.49 2020/06/13 23:58:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.50 2020/06/14 23:24:20 ad Exp $");
 
 #include 
 #include 
@@ -357,6 +357,7 @@ tsc_delay(unsigned int us)
 static u_int
 tsc_get_timecount(struct timecounter *tc)
 {
+#ifdef _LP64 /* requires atomic 64-bit store */
 	static __cpu_simple_lock_t lock = __SIMPLELOCK_UNLOCKED;
 	static int lastwarn;
 	uint64_t cur, prev;
@@ -385,4 +386,7 @@ tsc_get_timecount(struct timecounter *tc
 	}
 	l->l_md.md_tsc = cur;
 	return (uint32_t)cur;
+#else
+	return cpu_counter32();
+#endif
 }



CVS commit: src/sys/opencrypto

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:23:55 UTC 2020

Modified Files:
src/sys/opencrypto: cryptosoft.c

Log Message:
swcrypto(4): Simplify iv generation logic with cprng_fast.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/opencrypto/cryptosoft.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/opencrypto/cryptosoft.c
diff -u src/sys/opencrypto/cryptosoft.c:1.54 src/sys/opencrypto/cryptosoft.c:1.55
--- src/sys/opencrypto/cryptosoft.c:1.54	Sat Oct 12 00:49:30 2019
+++ src/sys/opencrypto/cryptosoft.c	Sun Jun 14 23:23:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptosoft.c,v 1.54 2019/10/12 00:49:30 christos Exp $ */
+/*	$NetBSD: cryptosoft.c,v 1.55 2020/06/14 23:23:55 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $	*/
 /*	$OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $	*/
 
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.54 2019/10/12 00:49:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.55 2020/06/14 23:23:55 riastradh Exp $");
 
 #include 
 #include 
@@ -112,25 +112,7 @@ swcr_encdec(struct cryptodesc *crd, cons
 		} else if (exf->reinit) {
 			exf->reinit(sw->sw_kschedule, 0, iv);
 		} else {
-			/* Get random IV */
-			for (i = 0;
-			i + sizeof (u_int32_t) <= EALG_MAX_BLOCK_LEN;
-			i += sizeof (u_int32_t)) {
-u_int32_t temp = cprng_fast32();
-
-memcpy(iv + i, , sizeof(u_int32_t));
-			}
-			/*
-			 * What if the block size is not a multiple
-			 * of sizeof (u_int32_t), which is the size of
-			 * what arc4random() returns ?
-			 */
-			if (EALG_MAX_BLOCK_LEN % sizeof (u_int32_t) != 0) {
-u_int32_t temp = cprng_fast32();
-
-bcopy (, iv + i,
-EALG_MAX_BLOCK_LEN - i);
-			}
+			cprng_fast(iv, EALG_MAX_BLOCK_LEN);
 		}
 
 		/* Do we need to write the IV */



CVS commit: src/sys/dev/pci/qat

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:23:12 UTC 2020

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

Log Message:
qat(4): Simplify iv generation logic with cprng_fast.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/qat/qat.c

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

Modified files:

Index: src/sys/dev/pci/qat/qat.c
diff -u src/sys/dev/pci/qat/qat.c:1.5 src/sys/dev/pci/qat/qat.c:1.6
--- src/sys/dev/pci/qat/qat.c:1.5	Thu Mar  5 15:33:13 2020
+++ src/sys/dev/pci/qat/qat.c	Sun Jun 14 23:23:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: qat.c,v 1.5 2020/03/05 15:33:13 msaitoh Exp $	*/
+/*	$NetBSD: qat.c,v 1.6 2020/06/14 23:23:12 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Internet Initiative Japan, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.5 2020/03/05 15:33:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.6 2020/06/14 23:23:12 riastradh Exp $");
 
 #include 
 #include 
@@ -1577,24 +1577,13 @@ int
 qat_crypto_load_iv(struct qat_sym_cookie *qsc, struct cryptop *crp,
 struct cryptodesc *crde, struct qat_crypto_desc const *desc)
 {
-	uint32_t rand;
 	uint32_t ivlen = desc->qcd_cipher_blk_sz;
-	int i;
 
 	if (crde->crd_flags & CRD_F_IV_EXPLICIT) {
 		memcpy(qsc->qsc_iv_buf, crde->crd_iv, ivlen);
 	} else {
 		if (crde->crd_flags & CRD_F_ENCRYPT) {
-			for (i = 0; i + sizeof(rand) <= ivlen;
-			i += sizeof(rand)) {
-rand = cprng_fast32();
-memcpy(qsc->qsc_iv_buf + i, , sizeof(rand));
-			}
-			if (sizeof(qsc->qsc_iv_buf) % sizeof(rand) != 0) {
-rand = cprng_fast32();
-memcpy(qsc->qsc_iv_buf + i, ,
-   sizeof(qsc->qsc_iv_buf) - i);
-			}
+			cprng_fast(qsc->qsc_iv_buf, ivlen);
 		} else if (crp->crp_flags & CRYPTO_F_IMBUF) {
 			/* get iv from buf */
 			m_copydata(qsc->qsc_buf, crde->crd_inject, ivlen,



CVS commit: src/sys/opencrypto

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:23:55 UTC 2020

Modified Files:
src/sys/opencrypto: cryptosoft.c

Log Message:
swcrypto(4): Simplify iv generation logic with cprng_fast.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/opencrypto/cryptosoft.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/pci/qat

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:23:12 UTC 2020

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

Log Message:
qat(4): Simplify iv generation logic with cprng_fast.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/qat/qat.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/pci

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:22:09 UTC 2020

Modified Files:
src/sys/dev/pci: ubsec.c ubsecvar.h

Log Message:
ubsec(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ubsecvar.h

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

Modified files:

Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.51 src/sys/dev/pci/ubsec.c:1.52
--- src/sys/dev/pci/ubsec.c:1.51	Mon May 25 19:13:28 2020
+++ src/sys/dev/pci/ubsec.c	Sun Jun 14 23:22:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.51 2020/05/25 19:13:28 thorpej Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.52 2020/06/14 23:22:09 riastradh Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.51 2020/05/25 19:13:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.52 2020/06/14 23:22:09 riastradh Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -1031,9 +1031,6 @@ ubsec_newsession(void *arg, u_int32_t *s
 	memset(ses, 0, sizeof(struct ubsec_session));
 	ses->ses_used = 1;
 	if (encini) {
-		/* get an IV, network byte order */
-		cprng_fast(ses->ses_iv, sizeof(ses->ses_iv));
-
 		/* Go ahead and compute key in ubsec's byte order */
 		if (encini->cri_alg == CRYPTO_AES_CBC) {
 			memcpy(ses->ses_key, encini->cri_key,
@@ -1294,14 +1291,10 @@ ubsec_process(void *arg, struct cryptop 
 		encoffset = enccrd->crd_skip;
 
 		if (enccrd->crd_flags & CRD_F_ENCRYPT) {
-			q->q_flags |= UBSEC_QFLAGS_COPYOUTIV;
-
 			if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
 memcpy(key.ses_iv, enccrd->crd_iv, ivlen);
-			else {
-for (i = 0; i < (ivlen / 4); i++)
-	key.ses_iv[i] = ses->ses_iv[i];
-			}
+			else
+cprng_fast(key.ses_iv, ivlen);
 
 			if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) {
 if (crp->crp_flags & CRYPTO_F_IMBUF)
@@ -1835,26 +1828,6 @@ ubsec_callback(struct ubsec_softc *sc, s
 		crp->crp_buf = (void *)q->q_dst_m;
 	}
 
-	/* copy out IV for future use */
-	if (q->q_flags & UBSEC_QFLAGS_COPYOUTIV) {
-		for (crd = crp->crp_desc; crd; crd = crd->crd_next) {
-			if (crd->crd_alg != CRYPTO_DES_CBC &&
-			crd->crd_alg != CRYPTO_3DES_CBC &&
-			crd->crd_alg != CRYPTO_AES_CBC)
-continue;
-			if (crp->crp_flags & CRYPTO_F_IMBUF)
-m_copydata((struct mbuf *)crp->crp_buf,
-crd->crd_skip + crd->crd_len - 8, 8,
-(void *)sc->sc_sessions[q->q_sesn].ses_iv);
-			else if (crp->crp_flags & CRYPTO_F_IOV) {
-cuio_copydata((struct uio *)crp->crp_buf,
-crd->crd_skip + crd->crd_len - 8, 8,
-(void *)sc->sc_sessions[q->q_sesn].ses_iv);
-			}
-			break;
-		}
-	}
-
 	for (crd = crp->crp_desc; crd; crd = crd->crd_next) {
 		if (crd->crd_alg != CRYPTO_MD5_HMAC_96 &&
 		crd->crd_alg != CRYPTO_SHA1_HMAC_96)

Index: src/sys/dev/pci/ubsecvar.h
diff -u src/sys/dev/pci/ubsecvar.h:1.10 src/sys/dev/pci/ubsecvar.h:1.11
--- src/sys/dev/pci/ubsecvar.h:1.10	Mon Apr 13 15:43:43 2015
+++ src/sys/dev/pci/ubsecvar.h	Sun Jun 14 23:22:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsecvar.h,v 1.10 2015/04/13 15:43:43 riastradh Exp $	*/
+/*	$NetBSD: ubsecvar.h,v 1.11 2020/06/14 23:22:09 riastradh Exp $	*/
 /*	$OpenBSD: ubsecvar.h,v 1.38 2009/03/27 13:31:30 reyk Exp $	*/
 
 /*
@@ -201,8 +201,6 @@ struct ubsec_softc {
 	bus_size_t		sc_memsize;	/* size mapped by sc_sh */
 };
 
-#define	UBSEC_QFLAGS_COPYOUTIV		0x1
-
 struct ubsec_session {
 	u_int32_t	ses_used;
 	u_int32_t	ses_key[8];		/* 3DES/AES key */



CVS commit: src/sys/dev/pci

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:22:09 UTC 2020

Modified Files:
src/sys/dev/pci: ubsec.c ubsecvar.h

Log Message:
ubsec(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ubsecvar.h

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-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:20:15 UTC 2020

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

Log Message:
padlock(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/via_padlock.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/via_padlock.c
diff -u src/sys/arch/x86/x86/via_padlock.c:1.28 src/sys/arch/x86/x86/via_padlock.c:1.29
--- src/sys/arch/x86/x86/via_padlock.c:1.28	Sat Mar  7 13:28:45 2020
+++ src/sys/arch/x86/x86/via_padlock.c	Sun Jun 14 23:20:15 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: via.c,v 1.8 2006/11/17 07:47:56 tom Exp $	*/
-/*	$NetBSD: via_padlock.c,v 1.28 2020/03/07 13:28:45 maya Exp $ */
+/*	$NetBSD: via_padlock.c,v 1.29 2020/06/14 23:20:15 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2003 Jason Wright
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.28 2020/03/07 13:28:45 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.29 2020/06/14 23:20:15 riastradh Exp $");
 
 #include 
 #include 
@@ -191,7 +191,6 @@ via_padlock_crypto_newsession(void *arg,
 C3_CRYPT_CWLO_KEYGEN_SW |
 C3_CRYPT_CWLO_NORMAL;
 
-			cprng_fast(ses->ses_iv, sizeof(ses->ses_iv));
 			ses->ses_klen = c->cri_klen;
 			ses->ses_cw0 = cw0;
 
@@ -384,7 +383,7 @@ via_padlock_crypto_encdec(struct cryptop
 		if (crd->crd_flags & CRD_F_IV_EXPLICIT)
 			memcpy(sc->op_iv, crd->crd_iv, 16);
 		else
-			memcpy(sc->op_iv, ses->ses_iv, 16);
+			cprng_fast(sc->op_iv, 16);
 
 		if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
 			if (crp->crp_flags & CRYPTO_F_IMBUF)
@@ -439,21 +438,6 @@ via_padlock_crypto_encdec(struct cryptop
 		memcpy((char *)crp->crp_buf + crd->crd_skip, sc->op_buf,
 		crd->crd_len);
 
-	/* copy out last block for use as next session IV */
-	if (crd->crd_flags & CRD_F_ENCRYPT) {
-		if (crp->crp_flags & CRYPTO_F_IMBUF)
-			m_copydata((struct mbuf *)crp->crp_buf,
-			crd->crd_skip + crd->crd_len - 16, 16,
-			ses->ses_iv);
-		else if (crp->crp_flags & CRYPTO_F_IOV)
-			cuio_copydata((struct uio *)crp->crp_buf,
-			crd->crd_skip + crd->crd_len - 16, 16,
-			ses->ses_iv);
-		else
-			memcpy(ses->ses_iv, (char *)crp->crp_buf +
-			crd->crd_skip + crd->crd_len - 16, 16);
-	}
-
 	if (sc->op_buf != NULL) {
 		memset(sc->op_buf, 0, crd->crd_len);
 		free(sc->op_buf, M_DEVBUF);



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

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:20:15 UTC 2020

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

Log Message:
padlock(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/via_padlock.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/i386/pci

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:19:11 UTC 2020

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/glxsb.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/i386/pci

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:19:11 UTC 2020

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/glxsb.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/i386/pci/glxsb.c
diff -u src/sys/arch/i386/pci/glxsb.c:1.14 src/sys/arch/i386/pci/glxsb.c:1.15
--- src/sys/arch/i386/pci/glxsb.c:1.14	Thu Jul 14 10:19:05 2016
+++ src/sys/arch/i386/pci/glxsb.c	Sun Jun 14 23:19:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: glxsb.c,v 1.14 2016/07/14 10:19:05 msaitoh Exp $	*/
+/*	$NetBSD: glxsb.c,v 1.15 2020/06/14 23:19:11 riastradh Exp $	*/
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.14 2016/07/14 10:19:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.15 2020/06/14 23:19:11 riastradh Exp $");
 
 #include 
 #include 
@@ -149,7 +149,6 @@ struct glxsb_dma_map {
 };
 struct glxsb_session {
 	uint32_t	ses_key[4];
-	uint8_t		ses_iv[SB_AES_BLOCK_SIZE];
 	int		ses_klen;
 	int		ses_used;
 };
@@ -346,7 +345,6 @@ glxsb_crypto_newsession(void *aux, uint3
 	memset(ses, 0, sizeof(*ses));
 	ses->ses_used = 1;
 
-	cprng_fast(ses->ses_iv, sizeof(ses->ses_iv));
 	ses->ses_klen = cri->cri_klen;
 
 	/* Copy the key (Geode LX wants the primary key only) */
@@ -450,7 +448,7 @@ glxsb_crypto_process(void *aux, struct c
 	struct cryptodesc *crd;
 	char *op_src, *op_dst;
 	uint32_t op_psrc, op_pdst;
-	uint8_t op_iv[SB_AES_BLOCK_SIZE], *piv;
+	uint8_t op_iv[SB_AES_BLOCK_SIZE];
 	int sesn, err = 0;
 	int len, tlen, xlen;
 	int offset;
@@ -497,7 +495,7 @@ glxsb_crypto_process(void *aux, struct c
 		if (crd->crd_flags & CRD_F_IV_EXPLICIT)
 			memcpy(op_iv, crd->crd_iv, sizeof(op_iv));
 		else
-			memcpy(op_iv, ses->ses_iv, sizeof(op_iv));
+			cprng_fast(op_iv, sizeof(op_iv));
 
 		if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
 			if (crp->crp_flags & CRYPTO_F_IMBUF)
@@ -530,7 +528,6 @@ glxsb_crypto_process(void *aux, struct c
 
 	offset = 0;
 	tlen = crd->crd_len;
-	piv = op_iv;
 
 	/* Process the data in GLXSB_MAX_AES_LEN chunks */
 	while (tlen > 0) {
@@ -566,25 +563,13 @@ glxsb_crypto_process(void *aux, struct c
 		offset += len;
 		tlen -= len;
 
-		if (tlen <= 0) {	/* Ideally, just == 0 */
-			/* Finished - put the IV in session IV */
-			piv = ses->ses_iv;
-		}
-
-		/*
-		 * Copy out last block for use as next iteration/session IV.
-		 *
-		 * piv is set to op_iv[] before the loop starts, but is
-		 * set to ses->ses_iv if we're going to exit the loop this
-		 * time.
-		 */
 		if (crd->crd_flags & CRD_F_ENCRYPT) {
-			memcpy(piv, op_dst + len - sizeof(op_iv),
+			memcpy(op_iv, op_dst + len - sizeof(op_iv),
 			sizeof(op_iv));
 		} else {
 			/* Decryption, only need this if another iteration */
 			if (tlen > 0) {
-memcpy(piv, op_src + len - sizeof(op_iv),
+memcpy(op_iv, op_src + len - sizeof(op_iv),
 sizeof(op_iv));
 			}
 		}



CVS commit: src/sys/kern

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 23:17:01 UTC 2020

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

Log Message:
Arithmetic error in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/sys/kern/subr_pool.c

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

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.271 src/sys/kern/subr_pool.c:1.272
--- src/sys/kern/subr_pool.c:1.271	Sun Jun 14 21:34:25 2020
+++ src/sys/kern/subr_pool.c	Sun Jun 14 23:17:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.271 2020/06/14 21:34:25 ad Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.272 2020/06/14 23:17:01 ad Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.271 2020/06/14 21:34:25 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.272 2020/06/14 23:17:01 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -3353,7 +3353,7 @@ pool_sysctl(SYSCTLFN_ARGS)
 data.pr_cache_nhit_pcpu += cc->cc_hits;
 data.pr_cache_nmiss_global += cc->cc_pcmisses;
 nfull += cc->cc_nfull; /* 32-bit rollover! */
-data.pr_cache_npartial = cc->cc_npart;
+data.pr_cache_npartial += cc->cc_npart;
 			}
 			data.pr_cache_nfull = nfull;
 		} else {



CVS commit: src/sys/kern

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 23:17:01 UTC 2020

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

Log Message:
Arithmetic error in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/sys/kern/subr_pool.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-06-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jun 14 23:13:21 UTC 2020

Modified Files:
src/usr.bin/make: str.c
src/usr.bin/make/unit-tests: modmatch.mk

Log Message:
usr.bin/make: revert performance improvement

That change might be the cause of a build failure for vax.
http://releng.netbsd.org/builds/HEAD/202006131940Z/ builds fine.
http://releng.netbsd.org/builds/HEAD/202006141020Z/ doesn't.

The build fails with:
/home/source/ab/HEAD/src/external/gpl3/gcc/dist/gcc/machmode.h:524:28:
error: 'mode_size_inline' was not declared in this scope


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/make/str.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/modmatch.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/str.c
diff -u src/usr.bin/make/str.c:1.46 src/usr.bin/make/str.c:1.47
--- src/usr.bin/make/str.c:1.46	Sat Jun 13 21:16:27 2020
+++ src/usr.bin/make/str.c	Sun Jun 14 23:13:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.46 2020/06/13 21:16:27 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.47 2020/06/14 23:13:21 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.46 2020/06/13 21:16:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.47 2020/06/14 23:13:21 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)str.c	5.8 (Berkeley) 6/1/90";
 #else
-__RCSID("$NetBSD: str.c,v 1.46 2020/06/13 21:16:27 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.47 2020/06/14 23:13:21 rillig Exp $");
 #endif
 #endif/* not lint */
 #endif
@@ -355,8 +355,6 @@ Str_Match(const char *string, const char
 		 */
 		if (*pattern == '*') {
 			pattern++;
-			while (*pattern == '*')
-pattern++;
 			if (*pattern == 0)
 return 1;
 			while (*string != 0) {

Index: src/usr.bin/make/unit-tests/modmatch.mk
diff -u src/usr.bin/make/unit-tests/modmatch.mk:1.4 src/usr.bin/make/unit-tests/modmatch.mk:1.5
--- src/usr.bin/make/unit-tests/modmatch.mk:1.4	Sat Jun 13 21:16:27 2020
+++ src/usr.bin/make/unit-tests/modmatch.mk	Sun Jun 14 23:13:21 2020
@@ -36,4 +36,4 @@ check-cclass:
 # Before 2020-06-13, this expression took quite a long time in Str_Match,
 # calling itself 601080390 times for 16 asterisks.
 slow: .PHONY
-	@:;: ${:U:Mb:Q}
+#	@:;: ${:U:Mb:Q}



CVS commit: src/usr.bin/make

2020-06-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jun 14 23:13:21 UTC 2020

Modified Files:
src/usr.bin/make: str.c
src/usr.bin/make/unit-tests: modmatch.mk

Log Message:
usr.bin/make: revert performance improvement

That change might be the cause of a build failure for vax.
http://releng.netbsd.org/builds/HEAD/202006131940Z/ builds fine.
http://releng.netbsd.org/builds/HEAD/202006141020Z/ doesn't.

The build fails with:
/home/source/ab/HEAD/src/external/gpl3/gcc/dist/gcc/machmode.h:524:28:
error: 'mode_size_inline' was not declared in this scope


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/make/str.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/modmatch.mk

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



CVS commit: src/share/man/man4

2020-06-14 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sun Jun 14 22:30:44 UTC 2020

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

Log Message:
is -> are


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/mcp980x.4

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

Modified files:

Index: src/share/man/man4/mcp980x.4
diff -u src/share/man/man4/mcp980x.4:1.6 src/share/man/man4/mcp980x.4:1.7
--- src/share/man/man4/mcp980x.4:1.6	Tue Jul 26 08:05:51 2016
+++ src/share/man/man4/mcp980x.4	Sun Jun 14 22:30:44 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: mcp980x.4,v 1.6 2016/07/26 08:05:51 rkujawa Exp $
+.\" $NetBSD: mcp980x.4,v 1.7 2020/06/14 22:30:44 rkujawa Exp $
 .\"
 .\" Copyright (c) 2013 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -71,7 +71,7 @@ The
 driver was written by
 .An Radoslaw Kujawa Aq Mt radoslaw.kuj...@gmail.com .
 .Sh CAVEATS
-MCP9804 and MCP9805 chip are different and is supported by the
+MCP9804 and MCP9805 chip are different and are supported by the
 .Xr sdtemp 4
 driver.
 .Pp



CVS commit: src/share/man/man4

2020-06-14 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sun Jun 14 22:30:44 UTC 2020

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

Log Message:
is -> are


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/mcp980x.4

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



CVS commit: src/sys/uvm

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 22:25:15 UTC 2020

Modified Files:
src/sys/uvm: uvm_extern.h

Log Message:
g/c vm_page_zero_enable


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/uvm/uvm_extern.h

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



CVS commit: src/sys/uvm

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 22:25:15 UTC 2020

Modified Files:
src/sys/uvm: uvm_extern.h

Log Message:
g/c vm_page_zero_enable


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/uvm/uvm_extern.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/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.229 src/sys/uvm/uvm_extern.h:1.230
--- src/sys/uvm/uvm_extern.h:1.229	Sat Jun 13 19:55:58 2020
+++ src/sys/uvm/uvm_extern.h	Sun Jun 14 22:25:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.229 2020/06/13 19:55:58 ad Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.230 2020/06/14 22:25:15 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -515,8 +515,6 @@ struct uvmexp_sysctl {
 #ifdef _KERNEL
 /* we need this before including uvm_page.h on some platforms */
 extern struct uvmexp uvmexp;
-/* MD code needs this without including  */
-extern bool vm_page_zero_enable;
 #endif
 
 /*



CVS commit: src/sys/rump/include/rump

2020-06-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jun 14 22:12:58 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump.h

Log Message:
Fix header compatibility with C++

This file is OS-agnostic and cannot include OS specific headers.

The fallback for NetBSD specific symbol __BEGIN_DECLS didn't work as it was
misspelled as _BEGIN_DECLS.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/rump/include/rump/rump.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/rump/include/rump/rump.h
diff -u src/sys/rump/include/rump/rump.h:1.70 src/sys/rump/include/rump/rump.h:1.71
--- src/sys/rump/include/rump/rump.h:1.70	Thu May 11 18:16:00 2017
+++ src/sys/rump/include/rump/rump.h	Sun Jun 14 22:12:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.h,v 1.70 2017/05/11 18:16:00 christos Exp $	*/
+/*	$NetBSD: rump.h,v 1.71 2020/06/14 22:12:58 kamil Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -86,9 +86,8 @@ enum rump_etfs_type {
 	RUMP_ETFS_DIR_SUBDIRS	/* dir + subdirectories (recursive) */
 };
 
-/* um, what's the point ?-) */
-#ifdef _BEGIN_DECLS
-_BEGIN_DECLS
+#if defined(__cplusplus)
+extern "C" {
 #endif
 
 int	rump_getversion(void);
@@ -130,8 +129,8 @@ int	rump_daemonize_done(int);
 #include 
 #endif
 
-#ifdef _END_DECLS
-_END_DECLS
+#if defined(__cplusplus)
+}
 #endif
 
 /*



CVS commit: src/sys/rump/include/rump

2020-06-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jun 14 22:12:58 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump.h

Log Message:
Fix header compatibility with C++

This file is OS-agnostic and cannot include OS specific headers.

The fallback for NetBSD specific symbol __BEGIN_DECLS didn't work as it was
misspelled as _BEGIN_DECLS.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/rump/include/rump/rump.h

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



CVS commit: src/sys/arch/aarch64

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:47:15 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c
src/sys/arch/aarch64/include: pmap.h

Log Message:
- Fix a lock order reversal in pmap_page_protect().

- Make sure pmap is always locked when updating stats; atomics no longer
  needed to do that.

- Remove unneeded traversal of pv list in pmap_enter_pv().

- Shrink struct vm_page from 136 to 128 bytes (cache line sized) and struct
  pv_entry from 48 to 32 bytes (power of 2 sized).

- Embed a pv_entry in each vm_page.  This means PV entries don't need to
  be allocated for private anonymous memory / COW pages / most UBC mappings.
  Dynamic PV entries are then used only for stuff like shared libraries and
  shared memory.

Proposed on port-arm@.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/aarch64/include/pmap.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.77 src/sys/arch/aarch64/aarch64/pmap.c:1.78
--- src/sys/arch/aarch64/aarch64/pmap.c:1.77	Wed Jun 10 22:24:22 2020
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun Jun 14 21:47:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.77 2020/06/10 22:24:22 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.78 2020/06/14 21:47:14 ad Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2020/06/10 22:24:22 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2020/06/14 21:47:14 ad Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -102,8 +102,9 @@ PMAP_COUNTER(pdp_alloc_boot, "page table
 PMAP_COUNTER(pdp_alloc, "page table page allocate (uvm_pagealloc)");
 PMAP_COUNTER(pdp_free, "page table page free (uvm_pagefree)");
 
-PMAP_COUNTER(pv_enter, "pv_entry allocate and link");
-PMAP_COUNTER(pv_remove, "pv_entry free and unlink");
+PMAP_COUNTER(pv_enter, "pv_entry fill");
+PMAP_COUNTER(pv_remove_dyn, "pv_entry free and unlink dynamic");
+PMAP_COUNTER(pv_remove_emb, "pv_entry clear embedded");
 PMAP_COUNTER(pv_remove_nopv, "no pv_entry found when removing pv");
 
 PMAP_COUNTER(activate, "pmap_activate call");
@@ -184,15 +185,6 @@ PMAP_COUNTER(unwire_failure, "pmap_unwir
 
 #define VM_PAGE_TO_PP(pg)	(&(pg)->mdpage.mdpg_pp)
 
-struct pv_entry {
-	LIST_ENTRY(pv_entry) pv_link;
-	struct pmap *pv_pmap;
-	vaddr_t pv_va;
-	paddr_t pv_pa;		/* debug */
-	pt_entry_t *pv_ptep;	/* for fast pte lookup */
-};
-#define pv_next	pv_link.le_next
-
 #define L3INDEXMASK	(L3_SIZE * Ln_ENTRIES - 1)
 #define PDPSWEEP_TRIGGER	512
 
@@ -204,7 +196,7 @@ static void _pmap_remove(struct pmap *, 
 struct pv_entry **);
 static int _pmap_enter(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int, bool);
 
-static struct pmap kernel_pmap;
+static struct pmap kernel_pmap __cacheline_aligned;
 
 struct pmap * const kernel_pmap_ptr = _pmap;
 static vaddr_t pmap_maxkvaddr;
@@ -223,27 +215,48 @@ static inline void
 pmap_pv_lock(struct pmap_page *pp)
 {
 
-	mutex_enter(>pp_pvlock);
+	mutex_spin_enter(>pp_pvlock);
 }
 
 static inline void
 pmap_pv_unlock(struct pmap_page *pp)
 {
 
-	mutex_exit(>pp_pvlock);
+	mutex_spin_exit(>pp_pvlock);
 }
 
 
 static inline void
 pm_lock(struct pmap *pm)
 {
-	mutex_enter(>pm_lock);
+	mutex_spin_enter(>pm_lock);
 }
 
 static inline void
 pm_unlock(struct pmap *pm)
 {
-	mutex_exit(>pm_lock);
+	mutex_spin_exit(>pm_lock);
+}
+
+static bool
+pm_reverse_lock(struct pmap *pm, struct pmap_page *pp)
+{
+
+	KASSERT(mutex_owned(>pp_pvlock));
+
+	if (__predict_true(mutex_tryenter(>pm_lock)))
+		return true;
+
+	if (pm != pmap_kernel())
+		pmap_reference(pm);
+	mutex_spin_exit(>pp_pvlock);
+	mutex_spin_enter(>pm_lock);
+	/* nothing, just wait for lock */
+	mutex_spin_exit(>pm_lock);
+	if (pm != pmap_kernel())
+		pmap_destroy(pm);
+	mutex_spin_enter(>pp_pvlock);
+	return false;
 }
 
 static inline struct pmap_page *
@@ -466,14 +479,22 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v
 
 	CTASSERT(sizeof(kpm->pm_stats.wired_count) == sizeof(long));
 	CTASSERT(sizeof(kpm->pm_stats.resident_count) == sizeof(long));
-#define PMSTAT_INC_WIRED_COUNT(pm)	\
-	atomic_inc_ulong(&(pm)->pm_stats.wired_count)
-#define PMSTAT_DEC_WIRED_COUNT(pm)	\
-	atomic_dec_ulong(&(pm)->pm_stats.wired_count)
-#define PMSTAT_INC_RESIDENT_COUNT(pm)	\
-	atomic_inc_ulong(&(pm)->pm_stats.resident_count)
-#define PMSTAT_DEC_RESIDENT_COUNT(pm)	\
-	atomic_dec_ulong(&(pm)->pm_stats.resident_count)
+#define PMSTAT_INC_WIRED_COUNT(pm) do { \
+	KASSERT(mutex_owned(&(pm)->pm_lock)); \
+	(pm)->pm_stats.wired_count++; \
+} while (/* CONSTCOND */ 0);
+#define PMSTAT_DEC_WIRED_COUNT(pm) do{ \
+	KASSERT(mutex_owned(&(pm)->pm_lock)); \
+	(pm)->pm_stats.wired_count--; \
+} while (/* CONSTCOND */ 0);
+#define PMSTAT_INC_RESIDENT_COUNT(pm) do { \
+	

CVS commit: src/sys/arch/aarch64

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:47:15 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c
src/sys/arch/aarch64/include: pmap.h

Log Message:
- Fix a lock order reversal in pmap_page_protect().

- Make sure pmap is always locked when updating stats; atomics no longer
  needed to do that.

- Remove unneeded traversal of pv list in pmap_enter_pv().

- Shrink struct vm_page from 136 to 128 bytes (cache line sized) and struct
  pv_entry from 48 to 32 bytes (power of 2 sized).

- Embed a pv_entry in each vm_page.  This means PV entries don't need to
  be allocated for private anonymous memory / COW pages / most UBC mappings.
  Dynamic PV entries are then used only for stuff like shared libraries and
  shared memory.

Proposed on port-arm@.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/aarch64/include/pmap.h

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



CVS commit: src

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:41:42 UTC 2020

Modified Files:
src/sys/arch/x86/x86: pmap.c
src/sys/sys: cpu_data.h
src/sys/uvm: uvm_glue.c uvm_meter.c uvm_page.c uvm_page.h
uvm_pgflcache.c uvm_pglist.c uvm_stat.c
src/usr.bin/vmstat: vmstat.c

Log Message:
Remove PG_ZERO.  It worked brilliantly on x86 machines from the mid-90s but
having spent an age experimenting with it over the last 6 months on various
machines and with different use cases it's always either break-even or a
slight net loss for me.


To generate a diff of this commit:
cvs rdiff -u -r1.398 -r1.399 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/cpu_data.h
cvs rdiff -u -r1.180 -r1.181 src/sys/uvm/uvm_glue.c
cvs rdiff -u -r1.79 -r1.80 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.241 -r1.242 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.104 -r1.105 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.4 -r1.5 src/sys/uvm/uvm_pgflcache.c
cvs rdiff -u -r1.84 -r1.85 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.45 -r1.46 src/sys/uvm/uvm_stat.c
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/vmstat/vmstat.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/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.398 src/sys/arch/x86/x86/pmap.c:1.399
--- src/sys/arch/x86/x86/pmap.c:1.398	Wed Jun  3 00:27:46 2020
+++ src/sys/arch/x86/x86/pmap.c	Sun Jun 14 21:41:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.398 2020/06/03 00:27:46 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.399 2020/06/14 21:41:42 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.398 2020/06/03 00:27:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.399 2020/06/14 21:41:42 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3066,7 +3066,6 @@ pmap_zap_ptp(struct pmap *pmap, struct v
 		if (!pmap_valid_entry(opte)) {
 			continue;
 		}
-		pmap_pte_set(pte, 0);
 
 		/*
 		 * Count the PTE.  If it's not for a managed mapping
@@ -5741,8 +5740,6 @@ pmap_update(struct pmap *pmap)
 		PMAP_DUMMY_LOCK(pmap);
 		uvm_pagerealloc(ptp, NULL, 0);
 		PMAP_DUMMY_UNLOCK(pmap);
-
-		ptp->flags |= PG_ZERO;
 		uvm_pagefree(ptp);
 	}
 	mutex_exit(>pm_lock);

Index: src/sys/sys/cpu_data.h
diff -u src/sys/sys/cpu_data.h:1.51 src/sys/sys/cpu_data.h:1.52
--- src/sys/sys/cpu_data.h:1.51	Thu Jun 11 22:21:05 2020
+++ src/sys/sys/cpu_data.h	Sun Jun 14 21:41:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_data.h,v 1.51 2020/06/11 22:21:05 ad Exp $	*/
+/*	$NetBSD: cpu_data.h,v 1.52 2020/06/14 21:41:42 ad Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -57,12 +57,12 @@ enum cpu_count {
 	CPU_COUNT_FORKS_SHAREVM,
 	CPU_COUNT_COLORHIT,		/* 8 */
 	CPU_COUNT_COLORMISS,
-	CPU_COUNT_PGA_ZEROHIT,
-	CPU_COUNT_PGA_ZEROMISS,
+	CPU_COUNT__UNUSED3,
+	CPU_COUNT__UNUSED4,
 	CPU_COUNT_CPUHIT,
 	CPU_COUNT_CPUMISS,
 	CPU_COUNT_FREEPAGES,
-	CPU_COUNT_ZEROPAGES,
+	CPU_COUNT__UNUSED5,
 	CPU_COUNT_PAGEINS,		/* 16 */
 	CPU_COUNT_FLTUP,
 	CPU_COUNT_FLTNOUP,

Index: src/sys/uvm/uvm_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.180 src/sys/uvm/uvm_glue.c:1.181
--- src/sys/uvm/uvm_glue.c:1.180	Thu Jun 11 19:20:47 2020
+++ src/sys/uvm/uvm_glue.c	Sun Jun 14 21:41:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.180 2020/06/11 19:20:47 ad Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.181 2020/06/14 21:41:42 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.180 2020/06/11 19:20:47 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.181 2020/06/14 21:41:42 ad Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -531,7 +531,4 @@ uvm_idle(void)
 
 	if (!ci->ci_want_resched)
 		uvmpdpol_idle(ucpu);
-	if (!ci->ci_want_resched)
-		uvm_pageidlezero();
-
 }

Index: src/sys/uvm/uvm_meter.c
diff -u src/sys/uvm/uvm_meter.c:1.79 src/sys/uvm/uvm_meter.c:1.80
--- src/sys/uvm/uvm_meter.c:1.79	Thu Jun 11 22:21:05 2020
+++ src/sys/uvm/uvm_meter.c	Sun Jun 14 21:41:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_meter.c,v 1.79 2020/06/11 22:21:05 ad Exp $	*/
+/*	$NetBSD: uvm_meter.c,v 1.80 2020/06/14 21:41:42 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_meter.c,v 1.79 2020/06/11 22:21:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_meter.c,v 1.80 2020/06/14 21:41:42 ad Exp $");
 
 #include 
 #include 
@@ -111,7 +111,6 @@ sysctl_vm_uvmexp2(SYSCTLFN_ARGS)
 	u.inactive = inactive;
 	u.paging = uvmexp.paging;
 	u.wired = uvmexp.wired;
-	u.zeropages = cpu_count_get(CPU_COUNT_ZEROPAGES);
 	u.reserve_pagedaemon = uvmexp.reserve_pagedaemon;
 	u.reserve_kernel = uvmexp.reserve_kernel;
 	u.freemin = 

CVS commit: src

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:41:42 UTC 2020

Modified Files:
src/sys/arch/x86/x86: pmap.c
src/sys/sys: cpu_data.h
src/sys/uvm: uvm_glue.c uvm_meter.c uvm_page.c uvm_page.h
uvm_pgflcache.c uvm_pglist.c uvm_stat.c
src/usr.bin/vmstat: vmstat.c

Log Message:
Remove PG_ZERO.  It worked brilliantly on x86 machines from the mid-90s but
having spent an age experimenting with it over the last 6 months on various
machines and with different use cases it's always either break-even or a
slight net loss for me.


To generate a diff of this commit:
cvs rdiff -u -r1.398 -r1.399 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/cpu_data.h
cvs rdiff -u -r1.180 -r1.181 src/sys/uvm/uvm_glue.c
cvs rdiff -u -r1.79 -r1.80 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.241 -r1.242 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.104 -r1.105 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.4 -r1.5 src/sys/uvm/uvm_pgflcache.c
cvs rdiff -u -r1.84 -r1.85 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.45 -r1.46 src/sys/uvm/uvm_stat.c
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/vmstat/vmstat.c

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



CVS commit: src

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:34:25 UTC 2020

Modified Files:
src/sys/kern: subr_pool.c
src/sys/sys: pool.h
src/usr.bin/vmstat: vmstat.c

Log Message:
pool_cache:

- make all counters per-CPU and make cache layer do its work with atomic ops.
- conserve memory by caching empty groups globally.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.90 -r1.91 src/sys/sys/pool.h
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/vmstat/vmstat.c

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

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.270 src/sys/kern/subr_pool.c:1.271
--- src/sys/kern/subr_pool.c:1.270	Sun Jun  7 09:45:19 2020
+++ src/sys/kern/subr_pool.c	Sun Jun 14 21:34:25 2020
@@ -1,8 +1,8 @@
-/*	$NetBSD: subr_pool.c,v 1.270 2020/06/07 09:45:19 maxv Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.271 2020/06/14 21:34:25 ad Exp $	*/
 
 /*
- * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
- * The NetBSD Foundation, Inc.
+ * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
+ * 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.270 2020/06/07 09:45:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.271 2020/06/14 21:34:25 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_pool.c,
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -337,6 +338,9 @@ static struct pool pcg_large_pool;
 static struct pool cache_pool;
 static struct pool cache_cpu_pool;
 
+static pcg_t *volatile pcg_large_cache __cacheline_aligned;
+static pcg_t *volatile pcg_normal_cache __cacheline_aligned;
+
 /* List of all caches. */
 TAILQ_HEAD(,pool_cache) pool_cache_head =
 TAILQ_HEAD_INITIALIZER(pool_cache_head);
@@ -344,14 +348,17 @@ TAILQ_HEAD(,pool_cache) pool_cache_head 
 int pool_cache_disable;		/* global disable for caching */
 static const pcg_t pcg_dummy;	/* zero sized: always empty, yet always full */
 
-static bool	pool_cache_put_slow(pool_cache_cpu_t *, int,
+static bool	pool_cache_put_slow(pool_cache_t, pool_cache_cpu_t *, int,
 void *);
-static bool	pool_cache_get_slow(pool_cache_cpu_t *, int,
+static bool	pool_cache_get_slow(pool_cache_t, pool_cache_cpu_t *, int,
 void **, paddr_t *, int);
 static void	pool_cache_cpu_init1(struct cpu_info *, pool_cache_t);
-static void	pool_cache_invalidate_groups(pool_cache_t, pcg_t *);
+static int	pool_cache_invalidate_groups(pool_cache_t, pcg_t *);
 static void	pool_cache_invalidate_cpu(pool_cache_t, u_int);
 static void	pool_cache_transfer(pool_cache_t);
+static int	pool_pcg_get(pcg_t *volatile *, pcg_t **);
+static int	pool_pcg_put(pcg_t *volatile *, pcg_t *);
+static pcg_t *	pool_pcg_trunc(pcg_t *volatile *);
 
 static int	pool_catchup(struct pool *);
 static void	pool_prime_page(struct pool *, void *,
@@ -1804,7 +1811,8 @@ pool_print1(struct pool *pp, const char 
 	pool_cache_t pc;
 	pcg_t *pcg;
 	pool_cache_cpu_t *cc;
-	uint64_t cpuhit, cpumiss;
+	uint64_t cpuhit, cpumiss, pchit, pcmiss;
+	uint32_t nfull;
 	int i, print_log = 0, print_pagelist = 0, print_cache = 0;
 	char c;
 
@@ -1881,31 +1889,26 @@ pool_print1(struct pool *pp, const char 
 	if (pc != NULL) {
 		cpuhit = 0;
 		cpumiss = 0;
+		pcmiss = 0;
+		nfull = 0;
 		for (i = 0; i < __arraycount(pc->pc_cpus); i++) {
 			if ((cc = pc->pc_cpus[i]) == NULL)
 continue;
 			cpuhit += cc->cc_hits;
 			cpumiss += cc->cc_misses;
+			pcmiss += cc->cc_pcmisses;
+			nfull += cc->cc_nfull;
 		}
+		pchit = cpumiss - pcmiss;
 		(*pr)("\tcpu layer hits %llu misses %llu\n", cpuhit, cpumiss);
-		(*pr)("\tcache layer hits %llu misses %llu\n",
-		pc->pc_hits, pc->pc_misses);
-		(*pr)("\tcache layer entry uncontended %llu contended %llu\n",
-		pc->pc_hits + pc->pc_misses - pc->pc_contended,
-		pc->pc_contended);
-		(*pr)("\tcache layer empty groups %u full groups %u\n",
-		pc->pc_nempty, pc->pc_nfull);
+		(*pr)("\tcache layer hits %llu misses %llu\n", pchit, pcmiss);
+		(*pr)("\tcache layer full groups %u\n", nfull);
 		if (print_cache) {
 			(*pr)("\tfull cache groups:\n");
 			for (pcg = pc->pc_fullgroups; pcg != NULL;
 			pcg = pcg->pcg_next) {
 PR_GROUPLIST(pcg);
 			}
-			(*pr)("\tempty cache groups:\n");
-			for (pcg = pc->pc_emptygroups; pcg != NULL;
-			pcg = pcg->pcg_next) {
-PR_GROUPLIST(pcg);
-			}
 		}
 	}
 #undef PR_GROUPLIST
@@ -2051,7 +2054,6 @@ pool_cache_bootstrap(pool_cache_t pc, si
 			palloc = _allocator_nointr;
 	}
 	pool_init(pp, size, align, align_offset, flags, wchan, palloc, ipl);
-	mutex_init(>pc_lock, MUTEX_DEFAULT, ipl);
 
 	if (ctor == NULL) {
 		ctor 

CVS commit: src

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:34:25 UTC 2020

Modified Files:
src/sys/kern: subr_pool.c
src/sys/sys: pool.h
src/usr.bin/vmstat: vmstat.c

Log Message:
pool_cache:

- make all counters per-CPU and make cache layer do its work with atomic ops.
- conserve memory by caching empty groups globally.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.90 -r1.91 src/sys/sys/pool.h
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/vmstat/vmstat.c

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



CVS commit: src/lib/libpthread

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:33:28 UTC 2020

Modified Files:
src/lib/libpthread: pthread_cond.c

Log Message:
Another bug.  The CAS loop in pthread_cond_signal() could race against the
thread it is trying to awake.  The thread could exit the condvar and then
reinsert itself at the head of the list with a new waiter behind it.  It's
likely possible to fix this in a way that's wait-free but for now just fix
the bug.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/lib/libpthread/pthread_cond.c

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



CVS commit: src/lib/libpthread

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:33:28 UTC 2020

Modified Files:
src/lib/libpthread: pthread_cond.c

Log Message:
Another bug.  The CAS loop in pthread_cond_signal() could race against the
thread it is trying to awake.  The thread could exit the condvar and then
reinsert itself at the head of the list with a new waiter behind it.  It's
likely possible to fix this in a way that's wait-free but for now just fix
the bug.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/lib/libpthread/pthread_cond.c

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

Modified files:

Index: src/lib/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.75 src/lib/libpthread/pthread_cond.c:1.76
--- src/lib/libpthread/pthread_cond.c:1.75	Sat Jun 13 17:39:42 2020
+++ src/lib/libpthread/pthread_cond.c	Sun Jun 14 21:33:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.75 2020/06/13 17:39:42 riastradh Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.76 2020/06/14 21:33:28 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.75 2020/06/13 17:39:42 riastradh Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.76 2020/06/14 21:33:28 ad Exp $");
 
 #include 
 #include 
@@ -54,6 +54,13 @@ __strong_alias(__libc_cond_wait,pthread_
 __strong_alias(__libc_cond_timedwait,pthread_cond_timedwait)
 __strong_alias(__libc_cond_destroy,pthread_cond_destroy)
 
+/*
+ * A dummy waiter that's used to flag that pthread_cond_signal() is in
+ * progress and nobody else should try to modify the waiter list until
+ * it completes.
+ */
+static struct pthread__waiter pthread__cond_dummy;
+
 static clockid_t
 pthread_cond_getclock(const pthread_cond_t *cond)
 {
@@ -111,7 +118,7 @@ int
 pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 		   const struct timespec *abstime)
 {
-	struct pthread__waiter waiter, *next, *waiters;
+	struct pthread__waiter waiter, *next, *head;
 	pthread_t self;
 	int error, cancel;
 	clockid_t clkid = pthread_cond_getclock(cond);
@@ -135,33 +142,39 @@ pthread_cond_timedwait(pthread_cond_t *c
 
 	/* Note this thread as waiting on the CV. */
 	cond->ptc_mutex = mutex;
-	for (waiters = cond->ptc_waiters;; waiters = next) {
+	for (head = cond->ptc_waiters;; head = next) {
+		/* Wait while pthread_cond_signal() in progress. */
+		if (__predict_false(head == __cond_dummy)) {
+			sched_yield();
+			next = cond->ptc_waiters;
+			continue;
+		}
 		waiter.lid = self->pt_lid;
-		waiter.next = waiters;
+		waiter.next = head;
 #ifndef PTHREAD__ATOMIC_IS_MEMBAR
 		membar_producer();
 #endif
-		next = atomic_cas_ptr(>ptc_waiters, waiters, );
-		if (__predict_true(next == waiters)) {
+		next = atomic_cas_ptr(>ptc_waiters, head, );
+		if (__predict_true(next == head)) {
 			break;
 		}
 	}
 
-	/* Drop the interlock */
-	pthread_mutex_unlock(mutex);
+	/* Drop the interlock and wait. */
 	error = 0;
-
+	pthread_mutex_unlock(mutex);
 	while (waiter.lid && !(cancel = self->pt_cancel)) {
 		int rv = _lwp_park(clkid, TIMER_ABSTIME, __UNCONST(abstime),
 		0, NULL, NULL);
 		if (rv == 0) {
 			continue;
 		}
-		if (errno != EINTR && errno != EALREADY && errno != ESRCH) {
+		if (errno != EINTR && errno != EALREADY) {
 			error = errno;
 			break;
 		}
 	}
+	pthread_mutex_lock(mutex);
 
 	/*
 	 * If this thread absorbed a wakeup from pthread_cond_signal() and
@@ -169,11 +182,6 @@ pthread_cond_timedwait(pthread_cond_t *c
 	 *
 	 * And if awoken early, we may still be on the waiter list and must
 	 * remove self.
-	 *
-	 * In all cases do the wakeup without the mutex held otherwise:
-	 *
-	 * - wakeup could be deferred until mutex release
-	 * - it would be mixing up two sets of waitpoints
 	 */
 	if (__predict_false(cancel | error)) {
 		pthread_cond_broadcast(cond);
@@ -183,10 +191,12 @@ pthread_cond_timedwait(pthread_cond_t *c
 		 * Wait until released, otherwise "waiter" is still globally
 		 * visible.
 		 */
+		pthread_mutex_unlock(mutex);
 		while (__predict_false(waiter.lid)) {
 			(void)_lwp_park(CLOCK_MONOTONIC, 0, NULL, 0, NULL,
 			NULL);
 		}
+		pthread_mutex_lock(mutex);
 	} else {
 		pthread__assert(!waiter.lid);
 	}
@@ -195,7 +205,6 @@ pthread_cond_timedwait(pthread_cond_t *c
 	 * If cancelled then exit.  POSIX dictates that the mutex must be
 	 * held if this happens.
 	 */
-	pthread_mutex_lock(mutex);
 	if (cancel) {
 		pthread__cancelled();
 	}
@@ -215,7 +224,7 @@ pthread_cond_wait(pthread_cond_t *cond, 
 int
 pthread_cond_signal(pthread_cond_t *cond)
 {
-	struct pthread__waiter *waiter, *next;
+	struct pthread__waiter *head, *next;
 	pthread_mutex_t *mutex;
 	pthread_t self;
 
@@ -228,28 +237,39 @@ pthread_cond_signal(pthread_cond_t *cond
 	/* Take ownership of one waiter. */
 	self = pthread_self();
 	mutex = cond->ptc_mutex;
-	for (waiter = cond->ptc_waiters;; 

CVS commit: src/lib/libpthread

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:31:11 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Don't need to ignore ESRCH from _lwp_park() any more.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/lib/libpthread/pthread.c

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



CVS commit: src/lib/libpthread

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 21:31:11 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Don't need to ignore ESRCH from _lwp_park() any more.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.176 src/lib/libpthread/pthread.c:1.177
--- src/lib/libpthread/pthread.c:1.176	Thu Jun 11 18:42:02 2020
+++ src/lib/libpthread/pthread.c	Sun Jun 14 21:31:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.176 2020/06/11 18:42:02 ad Exp $	*/
+/*	$NetBSD: pthread.c,v 1.177 2020/06/14 21:31:11 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.176 2020/06/11 18:42:02 ad Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.177 2020/06/14 21:31:11 ad Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -1145,7 +1145,6 @@ pthread__park(pthread_t self, pthread_mu
 			switch (rv = errno) {
 			case EINTR:
 			case EALREADY:
-			case ESRCH:
 rv = 0;
 break;
 			case ETIMEDOUT:



CVS commit: src/common/lib/libprop

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 14 21:31:01 UTC 2020

Modified Files:
src/common/lib/libprop: prop_array_util.c prop_dictionary_util.c

Log Message:
add/fix linted comments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libprop/prop_array_util.c
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libprop/prop_dictionary_util.c

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

Modified files:

Index: src/common/lib/libprop/prop_array_util.c
diff -u src/common/lib/libprop/prop_array_util.c:1.7 src/common/lib/libprop/prop_array_util.c:1.8
--- src/common/lib/libprop/prop_array_util.c:1.7	Sun Jun 14 17:28:58 2020
+++ src/common/lib/libprop/prop_array_util.c	Sun Jun 14 17:31:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_array_util.c,v 1.7 2020/06/14 21:28:58 christos Exp $	*/
+/*	$NetBSD: prop_array_util.c,v 1.8 2020/06/14 21:31:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -136,7 +136,7 @@ prop_array_set_ ## name (prop_array_t ar
 			 unsigned int indx,\
 			 typ val)	\
 {	\
-	/*LINTED: for conversion from long long to 'long'*/		\
+	/*LINTED: for conversion from 'long long' to 'long'*/		\
 	return prop_array_set_ ## which ## _number(array, indx, val);	\
 }	\
 	\
@@ -144,7 +144,7 @@ bool	\
 prop_array_add_ ## name (prop_array_t array,\
 			 typ val)	\
 {	\
-	/*LINTED: for conversion from long long to 'long'*/		\
+	/*LINTED: for conversion from 'long long' to 'long'*/		\
 	return prop_array_add_ ## which ## _number(array, val);		\
 }
 

Index: src/common/lib/libprop/prop_dictionary_util.c
diff -u src/common/lib/libprop/prop_dictionary_util.c:1.6 src/common/lib/libprop/prop_dictionary_util.c:1.7
--- src/common/lib/libprop/prop_dictionary_util.c:1.6	Sat Jun  6 17:25:59 2020
+++ src/common/lib/libprop/prop_dictionary_util.c	Sun Jun 14 17:31:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_dictionary_util.c,v 1.6 2020/06/06 21:25:59 thorpej Exp $	*/
+/*	$NetBSD: prop_dictionary_util.c,v 1.7 2020/06/14 21:31:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -121,6 +121,7 @@ static bool
 prop_dictionary_set_unsigned_number(prop_dictionary_t dict, const char *key,
 uintmax_t val)
 {
+	/*LINTED: for conversion from 'long long' to 'long'*/		\
 	return prop_dictionary_set_and_rel(dict, key,
 	   prop_number_create_unsigned(val));
 }
@@ -131,6 +132,7 @@ prop_dictionary_set_ ## name (prop_dicti
 			  const char *key,\
 			  typ val)	\
 {	\
+	/*LINTED: for conversion from long long to 'long'*/		\
 	return prop_dictionary_set_ ## which ## _number(dict, key, val);\
 }
 
@@ -152,6 +154,8 @@ UTEMPLATE(uchar, unsigned char)
 UTEMPLATE(ushort,unsigned short)
 UTEMPLATE(uint,  unsigned int)
 UTEMPLATE(ulong, unsigned long)
+/*###155 [lint] warning conversion to 'unsigned long' due to prototype, arg #3 [259]%%%*/
+/*###155 [lint] warning conversion from 'unsigned long long' to 'unsigned long' may lose accuracy, arg #3 [298]%%%*/
 UTEMPLATE(ulonglong, unsigned long long)
 UTEMPLATE(uintptr,   uintptr_t)
 UTEMPLATE(uint8, uint8_t)



CVS commit: src/common/lib/libprop

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 14 21:31:01 UTC 2020

Modified Files:
src/common/lib/libprop: prop_array_util.c prop_dictionary_util.c

Log Message:
add/fix linted comments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libprop/prop_array_util.c
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libprop/prop_dictionary_util.c

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



CVS commit: src/common/lib/libprop

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 14 21:28:58 UTC 2020

Modified Files:
src/common/lib/libprop: prop_array_util.c

Log Message:
Fix incorrect type (found by lint), and add linted comments for the
long long -> long (uintmax_t on LP64)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libprop/prop_array_util.c

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

Modified files:

Index: src/common/lib/libprop/prop_array_util.c
diff -u src/common/lib/libprop/prop_array_util.c:1.6 src/common/lib/libprop/prop_array_util.c:1.7
--- src/common/lib/libprop/prop_array_util.c:1.6	Sat Jun  6 17:25:59 2020
+++ src/common/lib/libprop/prop_array_util.c	Sun Jun 14 17:28:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_array_util.c,v 1.6 2020/06/06 21:25:59 thorpej Exp $	*/
+/*	$NetBSD: prop_array_util.c,v 1.7 2020/06/14 21:28:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@ prop_array_set_unsigned_number(prop_arra
 }
 
 static bool
-prop_array_add_unsigned_number(prop_array_t array, intmax_t val)
+prop_array_add_unsigned_number(prop_array_t array, uintmax_t val)
 {
 	return prop_array_add_and_rel(array, prop_number_create_unsigned(val));
 }
@@ -136,6 +136,7 @@ prop_array_set_ ## name (prop_array_t ar
 			 unsigned int indx,\
 			 typ val)	\
 {	\
+	/*LINTED: for conversion from long long to 'long'*/		\
 	return prop_array_set_ ## which ## _number(array, indx, val);	\
 }	\
 	\
@@ -143,6 +144,7 @@ bool	\
 prop_array_add_ ## name (prop_array_t array,\
 			 typ val)	\
 {	\
+	/*LINTED: for conversion from long long to 'long'*/		\
 	return prop_array_add_ ## which ## _number(array, val);		\
 }
 



CVS commit: src/common/lib/libprop

2020-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 14 21:28:58 UTC 2020

Modified Files:
src/common/lib/libprop: prop_array_util.c

Log Message:
Fix incorrect type (found by lint), and add linted comments for the
long long -> long (uintmax_t on LP64)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libprop/prop_array_util.c

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



CVS commit: src/usr.sbin/mdsetimage

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 18:24:21 UTC 2020

Modified Files:
src/usr.sbin/mdsetimage: mdsetimage.c

Log Message:
Explicitly print a fs image filename on "fs image is too big" errors.

This will help future analysis of build errors caused by bloated
embedded ramdisk images and possible but unexpected other binaries.

Proposed on port-mips@ in discusson about ews4800mips daily build errors:
 https://mail-index.netbsd.org/port-mips/2020/06/14/msg000950.html
and "Yes please!" from martin@.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/mdsetimage/mdsetimage.c

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

Modified files:

Index: src/usr.sbin/mdsetimage/mdsetimage.c
diff -u src/usr.sbin/mdsetimage/mdsetimage.c:1.24 src/usr.sbin/mdsetimage/mdsetimage.c:1.25
--- src/usr.sbin/mdsetimage/mdsetimage.c:1.24	Sun Dec 18 18:32:24 2016
+++ src/usr.sbin/mdsetimage/mdsetimage.c	Sun Jun 14 18:24:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdsetimage.c,v 1.24 2016/12/18 18:32:24 riastradh Exp $	*/
+/*	$NetBSD: mdsetimage.c,v 1.25 2020/06/14 18:24:21 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996, 2002 Christopher G. Demetriou
@@ -37,7 +37,7 @@
 #if !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1996\
  Christopher G. Demetriou.  All rights reserved.");
-__RCSID("$NetBSD: mdsetimage.c,v 1.24 2016/12/18 18:32:24 riastradh Exp $");
+__RCSID("$NetBSD: mdsetimage.c,v 1.25 2020/06/14 18:24:21 tsutsui Exp $");
 #endif /* not lint */
 
 #include 
@@ -166,10 +166,10 @@ main(int argc, char *argv[])
 		if (fstat(fsfd, ) == -1)
 			err(1, "fstat %s", fsfile);
 		if ((uintmax_t)fssb.st_size != (size_t)fssb.st_size)
-			errx(1, "fs image is too big");
+			errx(1, "fs image %s is too big", fsfile);
 		if (fssb.st_size > md_root_size_value)
-			errx(1, "fs image (%jd bytes) too big for buffer"
-			" (%u bytes)", (intmax_t) fssb.st_size,
+			errx(1, "fs image %s (%jd bytes) too big for buffer"
+			" (%u bytes)", fsfile, (intmax_t) fssb.st_size,
 			md_root_size_value);
 		left_to_copy = fssb.st_size;
 	}



CVS commit: src/usr.sbin/mdsetimage

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 18:24:21 UTC 2020

Modified Files:
src/usr.sbin/mdsetimage: mdsetimage.c

Log Message:
Explicitly print a fs image filename on "fs image is too big" errors.

This will help future analysis of build errors caused by bloated
embedded ramdisk images and possible but unexpected other binaries.

Proposed on port-mips@ in discusson about ews4800mips daily build errors:
 https://mail-index.netbsd.org/port-mips/2020/06/14/msg000950.html
and "Yes please!" from martin@.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/mdsetimage/mdsetimage.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/arm/sunxi

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 16:29:47 UTC 2020

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

Log Message:
Fix !DIAGNOSTIC compile.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/sunxi/sun8i_crypto.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun8i_crypto.c
diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.17 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.18
--- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.17	Sat Jun 13 18:58:26 2020
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c	Sun Jun 14 16:29:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sun8i_crypto.c,v 1.17 2020/06/13 18:58:26 riastradh Exp $	*/
+/*	$NetBSD: sun8i_crypto.c,v 1.18 2020/06/14 16:29:47 ad Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.17 2020/06/13 18:58:26 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.18 2020/06/14 16:29:47 ad Exp $");
 
 #include 
 #include 
@@ -2393,7 +2393,7 @@ sun8i_crypto_callback(struct sun8i_crypt
 struct sun8i_crypto_task *task, void *cookie, int error)
 {
 	struct cryptop *crp = cookie;
-	struct cryptodesc *crd = crp->crp_desc;
+	struct cryptodesc *crd __diagused = crp->crp_desc;
 
 	KASSERT(error != ERESTART);
 	KASSERT(crd != NULL);



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

2020-06-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jun 14 16:29:47 UTC 2020

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

Log Message:
Fix !DIAGNOSTIC compile.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/sunxi/sun8i_crypto.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

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 16:12:05 UTC 2020

Modified Files:
src/sys/arch/x86/include: cpufunc.h fpu.h
src/sys/arch/x86/x86: fpu.c

Log Message:
Use static constant rather than stack memset buffer for zero fpregs.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/include/cpufunc.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/fpu.c

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

Modified files:

Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.39 src/sys/arch/x86/include/cpufunc.h:1.40
--- src/sys/arch/x86/include/cpufunc.h:1.39	Sat May  2 11:37:17 2020
+++ src/sys/arch/x86/include/cpufunc.h	Sun Jun 14 16:12:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.39 2020/05/02 11:37:17 maxv Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.40 2020/06/14 16:12:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2019 The NetBSD Foundation, Inc.
@@ -381,7 +381,7 @@ fnsave(void *addr)
 }
 
 static inline void
-frstor(void *addr)
+frstor(const void *addr)
 {
 	const uint8_t *area = addr;
 
@@ -407,7 +407,7 @@ fxsave(void *addr)
 }
 
 static inline void
-fxrstor(void *addr)
+fxrstor(const void *addr)
 {
 	const uint8_t *area = addr;
 
@@ -452,7 +452,7 @@ xsaveopt(void *addr, uint64_t mask)
 }
 
 static inline void
-xrstor(void *addr, uint64_t mask)
+xrstor(const void *addr, uint64_t mask)
 {
 	const uint8_t *area = addr;
 	uint32_t low, high;

Index: src/sys/arch/x86/include/fpu.h
diff -u src/sys/arch/x86/include/fpu.h:1.20 src/sys/arch/x86/include/fpu.h:1.21
--- src/sys/arch/x86/include/fpu.h:1.20	Wed Nov 27 06:24:33 2019
+++ src/sys/arch/x86/include/fpu.h	Sun Jun 14 16:12:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.20 2019/11/27 06:24:33 maxv Exp $	*/
+/*	$NetBSD: fpu.h,v 1.21 2020/06/14 16:12:05 riastradh Exp $	*/
 
 #ifndef	_X86_FPU_H_
 #define	_X86_FPU_H_
@@ -15,7 +15,7 @@ void fpuinit(struct cpu_info *);
 void fpuinit_mxcsr_mask(void);
 
 void fpu_area_save(void *, uint64_t);
-void fpu_area_restore(void *, uint64_t);
+void fpu_area_restore(const void *, uint64_t);
 
 void fpu_save(void);
 

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.64 src/sys/arch/x86/x86/fpu.c:1.65
--- src/sys/arch/x86/x86/fpu.c:1.64	Sat Jun 13 19:01:11 2020
+++ src/sys/arch/x86/x86/fpu.c	Sun Jun 14 16:12:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.64 2020/06/13 19:01:11 riastradh Exp $	*/
+/*	$NetBSD: fpu.c,v 1.65 2020/06/14 16:12:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.64 2020/06/13 19:01:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.65 2020/06/14 16:12:05 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -267,7 +267,7 @@ fpu_area_save(void *area, uint64_t xsave
 }
 
 void
-fpu_area_restore(void *area, uint64_t xsave_features)
+fpu_area_restore(const void *area, uint64_t xsave_features)
 {
 	clts();
 
@@ -392,7 +392,7 @@ fpu_kern_enter(void)
 void
 fpu_kern_leave(void)
 {
-	union savefpu zero_fpu __aligned(64);
+	static const union savefpu zero_fpu __aligned(64);
 	struct cpu_info *ci = curcpu();
 	int s;
 
@@ -404,7 +404,6 @@ fpu_kern_leave(void)
 	 * through Spectre-class attacks to userland, even if there are
 	 * no bugs in fpu state management.
 	 */
-	memset(_fpu, 0, sizeof(zero_fpu));
 	fpu_area_restore(_fpu, x86_xsave_features);
 
 	/*



CVS commit: src/sys/arch/x86

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 16:12:05 UTC 2020

Modified Files:
src/sys/arch/x86/include: cpufunc.h fpu.h
src/sys/arch/x86/x86: fpu.c

Log Message:
Use static constant rather than stack memset buffer for zero fpregs.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/include/cpufunc.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/fpu.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/aarch64

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 16:10:18 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c
src/sys/arch/aarch64/include: armreg.h

Log Message:
Add some more id_aa64pfr0_el1 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/aarch64/include/armreg.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.46 src/sys/arch/aarch64/aarch64/cpu.c:1.47
--- src/sys/arch/aarch64/aarch64/cpu.c:1.46	Sat May 30 17:50:39 2020
+++ src/sys/arch/aarch64/aarch64/cpu.c	Sun Jun 14 16:10:18 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.46 2020/05/30 17:50:39 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.47 2020/06/14 16:10:18 riastradh Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.46 2020/05/30 17:50:39 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.47 2020/06/14 16:10:18 riastradh Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -343,6 +343,16 @@ cpu_identify2(device_t self, struct cpu_
 	aprint_verbose_dev(self, "auxID=0x%" PRIx64, ci->ci_id.ac_aa64isar0);
 
 	/* PFR0 */
+	switch (__SHIFTOUT(id->ac_aa64pfr0, ID_AA64PFR0_EL1_CSV3)) {
+	case ID_AA64PFR0_EL1_CSV3_IMPL:
+		aprint_verbose(", CSV3");
+		break;
+	}
+	switch (__SHIFTOUT(id->ac_aa64pfr0, ID_AA64PFR0_EL1_CSV2)) {
+	case ID_AA64PFR0_EL1_CSV2_IMPL:
+		aprint_verbose(", CSV2");
+		break;
+	}
 	switch (__SHIFTOUT(id->ac_aa64pfr0, ID_AA64PFR0_EL1_GIC)) {
 	case ID_AA64PFR0_EL1_GIC_CPUIF_EN:
 		aprint_verbose(", GICv3");
@@ -384,6 +394,12 @@ cpu_identify2(device_t self, struct cpu_
 		break;
 	}
 
+	/* PFR0:DIT -- data-independent timing support */
+	switch (__SHIFTOUT(id->ac_aa64pfr0, ID_AA64PFR0_EL1_DIT)) {
+	case ID_AA64PFR0_EL1_DIT_IMPL:
+		aprint_verbose(", DIT");
+		break;
+	}
 
 	/* PFR0:AdvSIMD */
 	switch (__SHIFTOUT(id->ac_aa64pfr0, ID_AA64PFR0_EL1_ADVSIMD)) {

Index: src/sys/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.48 src/sys/arch/aarch64/include/armreg.h:1.49
--- src/sys/arch/aarch64/include/armreg.h:1.48	Thu May 28 12:41:15 2020
+++ src/sys/arch/aarch64/include/armreg.h	Sun Jun 14 16:10:18 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.48 2020/05/28 12:41:15 skrll Exp $ */
+/* $NetBSD: armreg.h,v 1.49 2020/06/14 16:10:18 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -1305,6 +1305,26 @@ AARCH64REG_WRITE_INLINE(cntvct_el0)
 #define	CNTCTL_ENABLE		__BIT(0)	// Timer Enabled
 
 // ID_AA64PFR0_EL1: AArch64 Processor Feature Register 0
+#define	ID_AA64PFR0_EL1_CSV3		__BITS(63,60) // Speculative fault data
+#define	 ID_AA64PFR0_EL1_CSV3_NONE	0
+#define	 ID_AA64PFR0_EL1_CSV3_IMPL	1
+#define	ID_AA64PFR0_EL1_CSV2		__BITS(59,56) // Speculative branches
+#define	 ID_AA64PFR0_EL1_CSV2_NONE	0
+#define	 ID_AA64PFR0_EL1_CSV2_IMPL	1
+// reserved [55:52]
+#define	ID_AA64PFR0_EL1_DIT		__BITS(51,48) // Data-indep. timing
+#define	 ID_AA64PFR0_EL1_DIT_NONE	0
+#define	 ID_AA64PFR0_EL1_DIT_IMPL	1
+#define	ID_AA64PFR0_EL1_AMU		__BITS(47,44) // Activity monitors ext.
+#define	 ID_AA64PFR0_EL1_AMU_NONE	0
+#define	 ID_AA64PFR0_EL1_AMU_IMPLv8_4	1
+#define	 ID_AA64PFR0_EL1_AMU_IMPLv8_6	2
+#define	ID_AA64PFR0_EL1_MPAM		__BITS(43,40) // MPAM Extension
+#define	 ID_AA64PFR0_EL1_MPAM_NONE	0
+#define	 ID_AA64PFR0_EL1_MPAM_IMPL	1
+#define	ID_AA64PFR0_EL1_SEL2		__BITS(43,40) // Secure EL2
+#define	 ID_AA64PFR0_EL1_SEL2_NONE	0
+#define	 ID_AA64PFR0_EL1_SEL2_IMPL	1
 #define	ID_AA64PFR0_EL1_SVE		__BITS(35,32) // Scalable Vector
 #define	 ID_AA64PFR0_EL1_SVE_NONE	 0
 #define	 ID_AA64PFR0_EL1_SVE_IMPL	 1



CVS commit: src/sys/arch/aarch64

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 16:10:18 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c
src/sys/arch/aarch64/include: armreg.h

Log Message:
Add some more id_aa64pfr0_el1 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/aarch64/include/armreg.h

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



CVS commit: src/sys/arch/mips

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 15:12:56 UTC 2020

Modified Files:
src/sys/arch/mips/include: cache_r5k.h
src/sys/arch/mips/mips: cache_r5k.c cache_r5k_subr.S

Log Message:
Use proper "page" alignments for R5k Page Invalidate(S) op.  PR/55139

According to NEC "User's Manual VR5000, VR1000 64-BIT MICROPROCESSOR
INSTRUCTION" (U12754EJ1V0UMJ1), R5000 Page Invalidate (S) op does
"a page invalidate by doing a burst of 128 line invalidates to
the secondary cache at the page specified by the effective address
generated by the CACHE instruction, which must be page aligned."

This description looks a bit confusing, but "page" used here
implies fixed 32 byte cacheline * 128 lines == 4096 bytes,
not our variable "PAGE_SIZE" used in VM paging ops.  Note
the current default PAGE_SIZE for MIPS3 has been changed to 8192.

While here, also define and use proper macro for the "page" and CACHEOP
arg for the R5k Page_Invalidate_S op, as the manual also describes
the cache op field 10111 as "Page Invalidate" for the secondary cache.

No visible regression on Cobalt Qube 2700 (Rm5230) through
whole installation using netbsd-9 based Cobalt RestoreCD/USB.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/include/cache_r5k.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/mips/cache_r5k.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/mips/cache_r5k_subr.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/mips/include/cache_r5k.h
diff -u src/sys/arch/mips/include/cache_r5k.h:1.4 src/sys/arch/mips/include/cache_r5k.h:1.5
--- src/sys/arch/mips/include/cache_r5k.h:1.4	Mon Jul 11 16:15:35 2016
+++ src/sys/arch/mips/include/cache_r5k.h	Sun Jun 14 15:12:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache_r5k.h,v 1.4 2016/07/11 16:15:35 matt Exp $	*/
+/*	$NetBSD: cache_r5k.h,v 1.5 2020/06/14 15:12:56 tsutsui Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -61,3 +61,13 @@ void	r5k_sdcache_inv_range(register_t, v
 void	r5k_sdcache_wb_range(register_t, vsize_t);
 
 #endif /* _KERNEL && !_LOCORE */
+
+#define CACHEOP_R5K_Page_Invalidate_S   0x17
+
+#define R5K_SC_LINESIZE		32
+#define R5K_SC_PAGESIZE		(R5K_SC_LINESIZE * 128)
+#define R5K_SC_PAGEMASK		(R5K_SC_PAGESIZE - 1)
+
+#define mips_r5k_round_page(x)	(((x) + (register_t)R5K_SC_PAGEMASK) \
+& (register_t)R5K_SC_PAGEMASK)
+#define mips_r5k_trunc_page(x)	((x) & (register_t)R5K_SC_PAGEMASK)

Index: src/sys/arch/mips/mips/cache_r5k.c
diff -u src/sys/arch/mips/mips/cache_r5k.c:1.20 src/sys/arch/mips/mips/cache_r5k.c:1.21
--- src/sys/arch/mips/mips/cache_r5k.c:1.20	Thu Apr 27 20:05:09 2017
+++ src/sys/arch/mips/mips/cache_r5k.c	Sun Jun 14 15:12:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache_r5k.c,v 1.20 2017/04/27 20:05:09 skrll Exp $	*/
+/*	$NetBSD: cache_r5k.c,v 1.21 2020/06/14 15:12:56 tsutsui Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache_r5k.c,v 1.20 2017/04/27 20:05:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache_r5k.c,v 1.21 2020/06/14 15:12:56 tsutsui Exp $");
 
 #include 
 
@@ -407,9 +407,6 @@ r4600v2_pdcache_wb_range_32(register_t v
 
 __asm(".set mips3");
 
-#define R5K_Page_Invalidate_S   0x17
-CTASSERT(R5K_Page_Invalidate_S == (CACHEOP_R4K_HIT_WB_INV|CACHE_R4K_SD));
-
 void
 r5k_sdcache_wbinv_all(void)
 {
@@ -431,9 +428,6 @@ r5k_sdcache_wbinv_range_index(vaddr_t va
 	r5k_sdcache_wbinv_range((intptr_t)va, size);
 }
 
-#define	mips_r5k_round_page(x)	round_line(x, PAGE_SIZE)
-#define	mips_r5k_trunc_page(x)	trunc_line(x, PAGE_SIZE)
-
 void
 r5k_sdcache_wbinv_range(register_t va, vsize_t size)
 {
@@ -448,8 +442,8 @@ r5k_sdcache_wbinv_range(register_t va, v
 	__asm volatile("mfc0 %0, $28" : "=r"(taglo));
 	__asm volatile("mtc0 $0, $28");
 
-	for (; va < eva; va += (128 * 32)) {
-		cache_op_r4k_line(va, CACHEOP_R4K_HIT_WB_INV|CACHE_R4K_SD);
+	for (; va < eva; va += R5K_SC_PAGESIZE) {
+		cache_op_r4k_line(va, CACHEOP_R5K_Page_Invalidate_S);
 	}
 
 	mips_cp0_status_write(ostatus);

Index: src/sys/arch/mips/mips/cache_r5k_subr.S
diff -u src/sys/arch/mips/mips/cache_r5k_subr.S:1.3 src/sys/arch/mips/mips/cache_r5k_subr.S:1.4
--- src/sys/arch/mips/mips/cache_r5k_subr.S:1.3	Sun Feb 20 07:45:47 2011
+++ src/sys/arch/mips/mips/cache_r5k_subr.S	Sun Jun 14 15:12:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache_r5k_subr.S,v 1.3 2011/02/20 07:45:47 matt Exp $ 	*/
+/*	$NetBSD: cache_r5k_subr.S,v 1.4 2020/06/14 15:12:56 tsutsui Exp $ 	*/
 
 /*
  * Redistribution and use in source and binary forms, with or without
@@ -65,8 +65,8 @@ LEAF_NOPROFILE(r5k_enable_sdcache)
 	nop
 
 2:
-	cache	0x17, 0(t1)		# 0x17 == Page_Invalidate_SD
-	PTR_ADDU t1, t1, 4096
+	cache	CACHEOP_R5K_Page_Invalidate_S, 0(t1)
+	PTR_ADDU t1, t1, R5K_SC_PAGESIZE
 
 	sltu	v0, t1, t2
 	bne	v0, zero, 2b



CVS commit: src/sys/arch/mips

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 15:12:56 UTC 2020

Modified Files:
src/sys/arch/mips/include: cache_r5k.h
src/sys/arch/mips/mips: cache_r5k.c cache_r5k_subr.S

Log Message:
Use proper "page" alignments for R5k Page Invalidate(S) op.  PR/55139

According to NEC "User's Manual VR5000, VR1000 64-BIT MICROPROCESSOR
INSTRUCTION" (U12754EJ1V0UMJ1), R5000 Page Invalidate (S) op does
"a page invalidate by doing a burst of 128 line invalidates to
the secondary cache at the page specified by the effective address
generated by the CACHE instruction, which must be page aligned."

This description looks a bit confusing, but "page" used here
implies fixed 32 byte cacheline * 128 lines == 4096 bytes,
not our variable "PAGE_SIZE" used in VM paging ops.  Note
the current default PAGE_SIZE for MIPS3 has been changed to 8192.

While here, also define and use proper macro for the "page" and CACHEOP
arg for the R5k Page_Invalidate_S op, as the manual also describes
the cache op field 10111 as "Page Invalidate" for the secondary cache.

No visible regression on Cobalt Qube 2700 (Rm5230) through
whole installation using netbsd-9 based Cobalt RestoreCD/USB.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/include/cache_r5k.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/mips/cache_r5k.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/mips/cache_r5k_subr.S

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



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 14:45:12 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Revert thinko in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.289 src/sys/arch/mips/mips/mips_machdep.c:1.290
--- src/sys/arch/mips/mips/mips_machdep.c:1.289	Sun Jun 14 14:40:24 2020
+++ src/sys/arch/mips/mips/mips_machdep.c	Sun Jun 14 14:45:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.289 2020/06/14 14:40:24 simonb Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.290 2020/06/14 14:45:12 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.289 2020/06/14 14:40:24 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.290 2020/06/14 14:45:12 simonb Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -1444,7 +1444,7 @@ mips3_tlb_probe(void)
 static const char *
 wayname(int ways)
 {
-	static char buf[sizeof("xxx-way set-associative") + 1];
+	static char buf[sizeof("xxx-way set-associative")];
 
 #ifdef DIAGNOSTIC
 	if (ways > 999)



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 14:45:12 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Revert thinko in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/arch/mips/mips/mips_machdep.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/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 14:40:24 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Include room for the trailing NUL in the way name string.


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.288 src/sys/arch/mips/mips/mips_machdep.c:1.289
--- src/sys/arch/mips/mips/mips_machdep.c:1.288	Sun Jun 14 06:50:31 2020
+++ src/sys/arch/mips/mips/mips_machdep.c	Sun Jun 14 14:40:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.288 2020/06/14 06:50:31 simonb Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.289 2020/06/14 14:40:24 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.288 2020/06/14 06:50:31 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.289 2020/06/14 14:40:24 simonb Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -1444,7 +1444,7 @@ mips3_tlb_probe(void)
 static const char *
 wayname(int ways)
 {
-	static char buf[sizeof("xxx-way set-associative")];
+	static char buf[sizeof("xxx-way set-associative") + 1];
 
 #ifdef DIAGNOSTIC
 	if (ways > 999)



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 14:40:24 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Include room for the trailing NUL in the way name string.


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/arch/mips/mips/mips_machdep.c

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



CVS commit: src/sys/netinet6

2020-06-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Jun 14 14:26:18 UTC 2020

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

Log Message:
inet6: Allow addresses to be marked AUTOCONF from userland


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/sys/netinet6/in6.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.c
diff -u src/sys/netinet6/in6.c:1.279 src/sys/netinet6/in6.c:1.280
--- src/sys/netinet6/in6.c:1.279	Sat Jun 13 06:05:08 2020
+++ src/sys/netinet6/in6.c	Sun Jun 14 14:26:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.279 2020/06/13 06:05:08 mlelstv Exp $	*/
+/*	$NetBSD: in6.c,v 1.280 2020/06/14 14:26:17 roy Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.279 2020/06/13 06:05:08 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.280 2020/06/14 14:26:17 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -682,8 +682,7 @@ in6_control1(struct socket *so, u_long c
 		if ((ifra->ifra_flags & IN6_IFF_DUPLICATED) != 0 ||
 		(ifra->ifra_flags & IN6_IFF_DETACHED) != 0 ||
 		(ifra->ifra_flags & IN6_IFF_TENTATIVE) != 0 ||
-		(ifra->ifra_flags & IN6_IFF_NODAD) != 0 ||
-		(ifra->ifra_flags & IN6_IFF_AUTOCONF) != 0) {
+		(ifra->ifra_flags & IN6_IFF_NODAD) != 0) {
 			error = EINVAL;
 			break;
 		}



CVS commit: src/sys/netinet6

2020-06-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Jun 14 14:26:18 UTC 2020

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

Log Message:
inet6: Allow addresses to be marked AUTOCONF from userland


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/sys/netinet6/in6.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/mips/mips

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 14:16:49 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Use 32 byte cacheline ops (not 16 byte ones) for R5000 picache.  PR/55138

Commented "I think this is bad copy" from skrll@.
No visible regression on Cobalt Qube 2700 (Rm5230) through
whole installation using netbsd-9 based Cobalt RestoreCD/USB.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.66 src/sys/arch/mips/mips/cache.c:1.67
--- src/sys/arch/mips/mips/cache.c:1.66	Sun Jun 14 12:58:01 2020
+++ src/sys/arch/mips/mips/cache.c	Sun Jun 14 14:16:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.66 2020/06/14 12:58:01 simonb Exp $	*/
+/*	$NetBSD: cache.c,v 1.67 2020/06/14 14:16:49 tsutsui Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.66 2020/06/14 12:58:01 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.67 2020/06/14 14:16:49 tsutsui Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -495,11 +495,11 @@ primary_cache_is_2way:
 		case 32:
 			/* used internally by mipsNN_picache_sync_range */
 			mco->mco_intern_icache_sync_range =
-			cache_r4k_icache_hit_inv_16;
+			cache_r4k_icache_hit_inv_32;
 
 			/* used internally by mipsNN_picache_sync_range_index */
 			mco->mco_intern_icache_sync_range_index =
-			cache_r4k_icache_index_inv_16;
+			cache_r4k_icache_index_inv_32;
 			break;
 
 		default:



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 14:16:49 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Use 32 byte cacheline ops (not 16 byte ones) for R5000 picache.  PR/55138

Commented "I think this is bad copy" from skrll@.
No visible regression on Cobalt Qube 2700 (Rm5230) through
whole installation using netbsd-9 based Cobalt RestoreCD/USB.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mips/mips/cache.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/mips/mips

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 14:02:39 UTC 2020

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
Fix inconsistent mips_o32, _mips_o32, and __mips_o32 macro.  PR/54216

Not sure what the original intention was, but no responce for a year,
and no visible regression on Cobalt Qube 2700 (Rm5230) through
whole installation using netbsd-9 based Cobalt RestoreCD/USB.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/mips/mips/bus_dma.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/mips/mips

2020-06-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun 14 14:02:39 UTC 2020

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
Fix inconsistent mips_o32, _mips_o32, and __mips_o32 macro.  PR/54216

Not sure what the original intention was, but no responce for a year,
and no visible regression on Cobalt Qube 2700 (Rm5230) through
whole installation using netbsd-9 based Cobalt RestoreCD/USB.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/mips/mips/bus_dma.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/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.40 src/sys/arch/mips/mips/bus_dma.c:1.41
--- src/sys/arch/mips/mips/bus_dma.c:1.40	Sat Mar 14 18:08:38 2020
+++ src/sys/arch/mips/mips/bus_dma.c	Sun Jun 14 14:02:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.40 2020/03/14 18:08:38 ad Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.41 2020/06/14 14:02:39 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001, 2020 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.40 2020/03/14 18:08:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.41 2020/06/14 14:02:39 tsutsui Exp $");
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -829,7 +829,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	|| (ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) == 0)
 		goto bounce_it;
 
-#ifdef _mips_o32
+#ifdef __mips_o32
 	/*
 	 * If the mapping belongs to the kernel, or it belongs
 	 * to the currently-running process (XXX actually, vmspace),
@@ -871,7 +871,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		 * If we are forced to use Index ops, it's always a
 		 * Write-back,Invalidate, so just do one test.
 		 */
-#ifdef mips_o32
+#ifdef __mips_o32
 		if (__predict_false(useindex || vaddr == 0)) {
 			mips_dcache_wbinv_range_index(vaddr, minlen);
 #ifdef BUS_DMA_DEBUG



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 12:58:01 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Support Octeon Cavium cnMIPS I, II and III cores that have various
non-standard cache configurations (in terms of following MIPS spec
for defining cache configurations).

Move (most) Octeon support into a single place.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/mips/mips/cache.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/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 12:58:01 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Support Octeon Cavium cnMIPS I, II and III cores that have various
non-standard cache configurations (in terms of following MIPS spec
for defining cache configurations).

Move (most) Octeon support into a single place.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.65 src/sys/arch/mips/mips/cache.c:1.66
--- src/sys/arch/mips/mips/cache.c:1.65	Sun Jun 14 12:07:44 2020
+++ src/sys/arch/mips/mips/cache.c	Sun Jun 14 12:58:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.65 2020/06/14 12:07:44 simonb Exp $	*/
+/*	$NetBSD: cache.c,v 1.66 2020/06/14 12:58:01 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.65 2020/06/14 12:07:44 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.66 2020/06/14 12:58:01 simonb Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -1078,20 +1078,17 @@ mips_config_cache_modern(uint32_t cpu_id
 	/* figure out Dcache params. */
 	switch (MIPSNN_GET(CFG1_DL, cfg1)) {
 	case MIPSNN_CFG1_DL_NONE:
-#ifdef MIPS64_OCTEON
-		mci->mci_pdcache_line_size = 128;
-		mci->mci_pdcache_way_size = 256;
-		mci->mci_pdcache_ways = 64;
-		mci->mci_pdcache_write_through = true;
-
-		mci->mci_pdcache_size =
-		mci->mci_pdcache_way_size * mci->mci_pdcache_ways;
-		mci->mci_pdcache_way_mask = mci->mci_pdcache_way_size - 1;
-		uvmexp.ncolors = atop(mci->mci_pdcache_size) / mci->mci_pdcache_ways;
-#else
 		mci->mci_pdcache_line_size = mci->mci_pdcache_way_size =
 		mci->mci_pdcache_ways = 0;
-#endif
+#ifdef MIPS64_OCTEON
+		if (MIPS_PRID_CID(cpu_id) == MIPS_PRID_CID_CAVIUM) {
+			/*
+			 * Set the cache line size here, remaining Octeon
+			 * cache configuration will be done below.
+			 */
+			mci->mci_pdcache_line_size = OCTEON_CACHELINE_SIZE;
+		}
+#endif /* MIPS64_OCTEON */
 		break;
 	case MIPSNN_CFG1_DL_RSVD:
 		panic("reserved MIPS32/64 Dcache line size");
@@ -1187,11 +1184,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		cache_r4k_icache_index_inv_64;
 		break;
 	case 128:
-#ifdef MIPS64_OCTEON
-		mco->mco_icache_sync_all = octeon_icache_sync_all;
-		mco->mco_icache_sync_range = octeon_icache_sync_range;
-		mco->mco_icache_sync_range_index = octeon_icache_sync_range_index;
-#else
 		/* used internally by mipsNN_picache_sync_range */
 		mco->mco_intern_icache_sync_range =
 		cache_r4k_icache_hit_inv_128;
@@ -1199,7 +1191,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		/* used internally by mipsNN_picache_sync_range_index */
 		mco->mco_intern_icache_sync_range_index =
 		cache_r4k_icache_index_inv_128;
-#endif
 		break;
 	default:
 		panic("no Icache ops for %dB lines",
@@ -1255,13 +1246,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		mco->mco_intern_pdcache_wbinv_range_index =
 		cache_r4k_pdcache_index_wb_inv_64;
 	case 128:
-#ifdef MIPS64_OCTEON
-		mco->mco_pdcache_wbinv_all = octeon_pdcache_inv_all;
-		mco->mco_pdcache_wbinv_range = octeon_pdcache_inv_range;
-		mco->mco_pdcache_wbinv_range_index = octeon_pdcache_inv_range_index;
-		mco->mco_pdcache_inv_range = octeon_pdcache_inv_range;
-		mco->mco_pdcache_wb_range = no_cache_op_range;
-#else
 		mco->mco_pdcache_wbinv_range =
 		cache_r4k_pdcache_hit_wb_inv_128;
 		mco->mco_pdcache_inv_range =
@@ -1272,7 +1256,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		/* used internally by mipsNN_pdcache_wbinv_range_index */
 		mco->mco_intern_pdcache_wbinv_range_index =
 		cache_r4k_pdcache_index_wb_inv_128;
-#endif
 		break;
 	default:
 		panic("no Dcache ops for %dB lines",
@@ -1358,26 +1341,6 @@ mips_config_cache_modern(uint32_t cpu_id
 	 * Core specific overrides
 	 */
 	switch (MIPS_PRID_CID(cpu_id)) {
-	case MIPS_PRID_CID_RMI:
-		/*
-		 * RMI (NetLogic/Broadcom) don't support WB (op 6)
-		 * so we have to make do with WBINV (op 5).  This is
-		 * merely for correctness since because the caches are
-		 * coherent, these routines will become noops in a bit.
-		 */
-		mco->mco_pdcache_wb_range = mco->mco_pdcache_wbinv_range;
-		mco->mco_intern_pdcache_sync_range =
-		mco->mco_pdcache_wbinv_range;
-		if (MIPSNN_GET(CFG_AR, cfg) == MIPSNN_CFG_AR_REV2) {
-			mci->mci_pdcache_write_through = true;
-			mci->mci_sdcache_write_through = false;
-			KASSERT(PAGE_SIZE >= mci->mci_picache_way_size
-			|| MIPS_ICACHE_VIRTUAL_ALIAS);
-		} else {
-			KASSERT(MIPS_CACHE_VIRTUAL_ALIAS == 0);
-			KASSERT(MIPS_ICACHE_VIRTUAL_ALIAS == 0);
-		}
-		break;
 	case MIPS_PRID_CID_MTI:
 		/*
 		 * All MTI cores share a (mostly) common config7 definition.
@@ -1402,6 +1365,129 @@ mips_config_cache_modern(uint32_t cpu_id

CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 12:07:44 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Move some "case 0" statements to be first in their switch statements.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.64 src/sys/arch/mips/mips/cache.c:1.65
--- src/sys/arch/mips/mips/cache.c:1.64	Sun Jun 14 12:02:07 2020
+++ src/sys/arch/mips/mips/cache.c	Sun Jun 14 12:07:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.64 2020/06/14 12:02:07 simonb Exp $	*/
+/*	$NetBSD: cache.c,v 1.65 2020/06/14 12:07:44 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.64 2020/06/14 12:02:07 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.65 2020/06/14 12:07:44 simonb Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -1152,6 +1152,13 @@ mips_config_cache_modern(uint32_t cpu_id
 	mco->mco_icache_sync_range_index = mipsNN_picache_sync_range_index;
 
 	switch (mci->mci_picache_line_size) {
+#ifdef MIPS_DISABLE_L1_CACHE
+	case 0:
+		mco->mco_icache_sync_all = no_cache_op;
+		mco->mco_icache_sync_range = no_cache_op_range;
+		mco->mco_icache_sync_range_index = no_cache_op_range_index;
+		break;
+#endif
 	case 16:
 		/* used internally by mipsNN_picache_sync_range */
 		mco->mco_intern_icache_sync_range =
@@ -1170,13 +1177,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		mco->mco_intern_icache_sync_range_index =
 		cache_r4k_icache_index_inv_32;
 		break;
-#ifdef MIPS_DISABLE_L1_CACHE
-	case 0:
-		mco->mco_icache_sync_all = no_cache_op;
-		mco->mco_icache_sync_range = no_cache_op_range;
-		mco->mco_icache_sync_range_index = no_cache_op_range_index;
-		break;
-#endif
 	case 64:
 		/* used internally by mipsNN_picache_sync_range */
 		mco->mco_intern_icache_sync_range =
@@ -1210,6 +1210,15 @@ mips_config_cache_modern(uint32_t cpu_id
 	mco->mco_pdcache_wbinv_range_index = mipsNN_pdcache_wbinv_range_index;
 
 	switch (mci->mci_pdcache_line_size) {
+#ifdef MIPS_DISABLE_L1_CACHE
+	case 0:
+		mco->mco_pdcache_wbinv_all = no_cache_op;
+		mco->mco_pdcache_wbinv_range = no_cache_op_range;
+		mco->mco_pdcache_wbinv_range_index = no_cache_op_index;
+		mco->mco_pdcache_inv_range = no_cache_op_range;
+		mco->mco_pdcache_wb_range = no_cache_op_range;
+		break;
+#endif
 	case 16:
 		mco->mco_pdcache_wbinv_range =
 		cache_r4k_pdcache_hit_wb_inv_16;
@@ -1265,15 +1274,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		cache_r4k_pdcache_index_wb_inv_128;
 #endif
 		break;
-#ifdef MIPS_DISABLE_L1_CACHE
-	case 0:
-		mco->mco_pdcache_wbinv_all = no_cache_op;
-		mco->mco_pdcache_wbinv_range = no_cache_op_range;
-		mco->mco_pdcache_wbinv_range_index = no_cache_op_index;
-		mco->mco_pdcache_inv_range = no_cache_op_range;
-		mco->mco_pdcache_wb_range = no_cache_op_range;
-		break;
-#endif
 	default:
 		panic("no Dcache ops for %dB lines",
 		mci->mci_pdcache_line_size);



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 12:07:44 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Move some "case 0" statements to be first in their switch statements.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/mips/mips/cache.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/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 12:02:07 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Adjust previous - move consolidated debug printfs _after_ core specific
overrides, not before them.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.63 src/sys/arch/mips/mips/cache.c:1.64
--- src/sys/arch/mips/mips/cache.c:1.63	Sun Jun 14 09:55:37 2020
+++ src/sys/arch/mips/mips/cache.c	Sun Jun 14 12:02:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.63 2020/06/14 09:55:37 simonb Exp $	*/
+/*	$NetBSD: cache.c,v 1.64 2020/06/14 12:02:07 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.63 2020/06/14 09:55:37 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.64 2020/06/14 12:02:07 simonb Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -1345,44 +1345,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		}
 	}
 
-#define CACHE_DEBUG
-#ifdef CACHE_DEBUG
-	printf("MIPS32/64 params: cpu arch: %d\n", opts->mips_cpu_arch);
-	printf("MIPS32/64 params: TLB entries: %d\n", opts->mips_num_tlb_entries);
-	if (mci->mci_picache_line_size == 0) {
-		printf("MIPS32/64 params: no Icache\n");
-	} else {
-		printf("MIPS32/64 params: %s: line=%d, total=%d, "
-		"ways=%d, sets=%d, colors=%d\n", "Icache",
-		mci->mci_picache_line_size,
-		mci->mci_picache_way_size * mci->mci_picache_ways,
-		mci->mci_picache_ways,
-		mci->mci_picache_way_size / mci->mci_picache_line_size,
-		mci->mci_picache_way_size >> PAGE_SHIFT);
-	}
-	if (mci->mci_pdcache_line_size == 0) {
-		printf("MIPS32/64 params: no Dcache\n");
-	} else {
-		printf("MIPS32/64 params: %s: line=%d, total=%d, "
-		"ways=%d, sets=%d, colors=%d\n", "Dcache",
-		mci->mci_pdcache_line_size,
-		mci->mci_pdcache_way_size * mci->mci_pdcache_ways,
-		mci->mci_pdcache_ways,
-		mci->mci_pdcache_way_size / mci->mci_pdcache_line_size,
-		mci->mci_pdcache_way_size >> PAGE_SHIFT);
-	}
-	if (mci->mci_sdcache_line_size != 0) {
-		printf("MIPS32/64 params: %s: line=%d, total=%d, "
-		"ways=%d, sets=%d, colors=%d\n", "SDcache",
-		mci->mci_sdcache_line_size,
-		mci->mci_sdcache_way_size * mci->mci_sdcache_ways,
-		mci->mci_sdcache_ways,
-		mci->mci_sdcache_way_size / mci->mci_sdcache_line_size,
-		mci->mci_sdcache_way_size >> PAGE_SHIFT);
-	}
-#endif
-
-
 /*
  * calculate the alias masks and from them set to virtual alias flags.
  */
@@ -1442,6 +1404,43 @@ mips_config_cache_modern(uint32_t cpu_id
 		break;
 	}
 
+#define CACHE_DEBUG
+#ifdef CACHE_DEBUG
+	printf("MIPS32/64 params: cpu arch: %d\n", opts->mips_cpu_arch);
+	printf("MIPS32/64 params: TLB entries: %d\n", opts->mips_num_tlb_entries);
+	if (mci->mci_picache_line_size == 0) {
+		printf("MIPS32/64 params: no Icache\n");
+	} else {
+		printf("MIPS32/64 params: %s: line=%d, total=%d, "
+		"ways=%d, sets=%d, colors=%d\n", "Icache",
+		mci->mci_picache_line_size,
+		mci->mci_picache_way_size * mci->mci_picache_ways,
+		mci->mci_picache_ways,
+		mci->mci_picache_way_size / mci->mci_picache_line_size,
+		mci->mci_picache_way_size >> PAGE_SHIFT);
+	}
+	if (mci->mci_pdcache_line_size == 0) {
+		printf("MIPS32/64 params: no Dcache\n");
+	} else {
+		printf("MIPS32/64 params: %s: line=%d, total=%d, "
+		"ways=%d, sets=%d, colors=%d\n", "Dcache",
+		mci->mci_pdcache_line_size,
+		mci->mci_pdcache_way_size * mci->mci_pdcache_ways,
+		mci->mci_pdcache_ways,
+		mci->mci_pdcache_way_size / mci->mci_pdcache_line_size,
+		mci->mci_pdcache_way_size >> PAGE_SHIFT);
+	}
+	if (mci->mci_sdcache_line_size != 0) {
+		printf("MIPS32/64 params: %s: line=%d, total=%d, "
+		"ways=%d, sets=%d, colors=%d\n", "SDcache",
+		mci->mci_sdcache_line_size,
+		mci->mci_sdcache_way_size * mci->mci_sdcache_ways,
+		mci->mci_sdcache_ways,
+		mci->mci_sdcache_way_size / mci->mci_sdcache_line_size,
+		mci->mci_sdcache_way_size >> PAGE_SHIFT);
+	}
+#endif
+
 	mipsNN_cache_init(cfg, cfg1);
 
 	if (opts->mips_cpu_flags &



CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 12:02:07 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Adjust previous - move consolidated debug printfs _after_ core specific
overrides, not before them.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/mips/mips/cache.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/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 09:55:37 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Make core specific overrides a bit more readable / scalable (switch
instead of if / else / ...).
Move debug printfs to after core specific overrides in case any config
is updated.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mips/mips/cache.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/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 09:55:37 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Make core specific overrides a bit more readable / scalable (switch
instead of if / else / ...).
Move debug printfs to after core specific overrides in case any config
is updated.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.62 src/sys/arch/mips/mips/cache.c:1.63
--- src/sys/arch/mips/mips/cache.c:1.62	Sun Jun 14 09:41:17 2020
+++ src/sys/arch/mips/mips/cache.c	Sun Jun 14 09:55:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.62 2020/06/14 09:41:17 simonb Exp $	*/
+/*	$NetBSD: cache.c,v 1.63 2020/06/14 09:55:37 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.62 2020/06/14 09:41:17 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.63 2020/06/14 09:55:37 simonb Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -1147,34 +1147,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		break;
 	}
 
-#define CACHE_DEBUG
-#ifdef CACHE_DEBUG
-	printf("MIPS32/64 params: cpu arch: %d\n", opts->mips_cpu_arch);
-	printf("MIPS32/64 params: TLB entries: %d\n", opts->mips_num_tlb_entries);
-	if (mci->mci_picache_line_size == 0) {
-		printf("MIPS32/64 params: no Icache\n");
-	} else {
-		printf("MIPS32/64 params: %s: line=%d, total=%d, "
-		"ways=%d, sets=%d, colors=%d\n", "Icache",
-		mci->mci_picache_line_size,
-		mci->mci_picache_way_size * mci->mci_picache_ways,
-		mci->mci_picache_ways,
-		mci->mci_picache_way_size / mci->mci_picache_line_size,
-		mci->mci_picache_way_size >> PAGE_SHIFT);
-	}
-	if (mci->mci_pdcache_line_size == 0) {
-		printf("MIPS32/64 params: no Dcache\n");
-	} else {
-		printf("MIPS32/64 params: %s: line=%d, total=%d, "
-		"ways=%d, sets=%d, colors=%d\n", "Dcache",
-		mci->mci_pdcache_line_size,
-		mci->mci_pdcache_way_size * mci->mci_pdcache_ways,
-		mci->mci_pdcache_ways,
-		mci->mci_pdcache_way_size / mci->mci_pdcache_line_size,
-		mci->mci_pdcache_way_size >> PAGE_SHIFT);
-	}
-#endif /* CACHE_DEBUG */
-
 	mco->mco_icache_sync_all = mipsNN_picache_sync_all;
 	mco->mco_icache_sync_range = mipsNN_picache_sync_range;
 	mco->mco_icache_sync_range_index = mipsNN_picache_sync_range_index;
@@ -1352,20 +1324,6 @@ mips_config_cache_modern(uint32_t cpu_id
 		 * the coherence checks below will overwrite them with no ops.
 		 */
 
-#ifdef CACHE_DEBUG
-		if (mci->mci_sdcache_line_size != 0) {
-			printf("MIPS32/64 params: %s: line=%d, total=%d, "
-			"ways=%d, sets=%d, colors=%d\n",
-			"SDcache",
-			mci->mci_sdcache_line_size,
-			mci->mci_sdcache_way_size * mci->mci_sdcache_ways,
-			mci->mci_sdcache_ways,
-			mci->mci_sdcache_way_size
-			/ mci->mci_sdcache_line_size,
-			mci->mci_sdcache_way_size >> PAGE_SHIFT);
-		}
-#endif
-
 		switch (MIPSNN_GET(CFG2_TL, cfg2)) {
 		case MIPSNN_CFG2_TL_NONE:
 			break;
@@ -1387,6 +1345,44 @@ mips_config_cache_modern(uint32_t cpu_id
 		}
 	}
 
+#define CACHE_DEBUG
+#ifdef CACHE_DEBUG
+	printf("MIPS32/64 params: cpu arch: %d\n", opts->mips_cpu_arch);
+	printf("MIPS32/64 params: TLB entries: %d\n", opts->mips_num_tlb_entries);
+	if (mci->mci_picache_line_size == 0) {
+		printf("MIPS32/64 params: no Icache\n");
+	} else {
+		printf("MIPS32/64 params: %s: line=%d, total=%d, "
+		"ways=%d, sets=%d, colors=%d\n", "Icache",
+		mci->mci_picache_line_size,
+		mci->mci_picache_way_size * mci->mci_picache_ways,
+		mci->mci_picache_ways,
+		mci->mci_picache_way_size / mci->mci_picache_line_size,
+		mci->mci_picache_way_size >> PAGE_SHIFT);
+	}
+	if (mci->mci_pdcache_line_size == 0) {
+		printf("MIPS32/64 params: no Dcache\n");
+	} else {
+		printf("MIPS32/64 params: %s: line=%d, total=%d, "
+		"ways=%d, sets=%d, colors=%d\n", "Dcache",
+		mci->mci_pdcache_line_size,
+		mci->mci_pdcache_way_size * mci->mci_pdcache_ways,
+		mci->mci_pdcache_ways,
+		mci->mci_pdcache_way_size / mci->mci_pdcache_line_size,
+		mci->mci_pdcache_way_size >> PAGE_SHIFT);
+	}
+	if (mci->mci_sdcache_line_size != 0) {
+		printf("MIPS32/64 params: %s: line=%d, total=%d, "
+		"ways=%d, sets=%d, colors=%d\n", "SDcache",
+		mci->mci_sdcache_line_size,
+		mci->mci_sdcache_way_size * mci->mci_sdcache_ways,
+		mci->mci_sdcache_ways,
+		mci->mci_sdcache_way_size / mci->mci_sdcache_line_size,
+		mci->mci_sdcache_way_size >> PAGE_SHIFT);
+	}
+#endif
+
+
 /*
  * calculate the alias masks and from them set to virtual alias flags.
  */
@@ -1397,13 +1393,19 @@ mips_config_cache_modern(uint32_t cpu_id
 	

CVS commit: src/sys/arch/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 09:41:18 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
KNF police - long lines and comments.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mips/mips/cache.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/mips/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 09:41:18 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
KNF police - long lines and comments.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.61 src/sys/arch/mips/mips/cache.c:1.62
--- src/sys/arch/mips/mips/cache.c:1.61	Fri Dec 27 09:47:18 2019
+++ src/sys/arch/mips/mips/cache.c	Sun Jun 14 09:41:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.61 2019/12/27 09:47:18 msaitoh Exp $	*/
+/*	$NetBSD: cache.c,v 1.62 2020/06/14 09:41:17 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.61 2019/12/27 09:47:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.62 2020/06/14 09:41:17 simonb Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -205,7 +205,7 @@ mips_config_cache(void)
 
 #ifdef DIAGNOSTIC
 	/* Check that all cache ops are set up. */
-	if (mci->mci_picache_size || 1) {	/* XXX- must have primary Icache */
+	if (mci->mci_picache_size || 1) { /* XXX- must have primary Icache */
 		if (!mco->mco_icache_sync_all)
 			panic("no icache_sync_all cache op");
 		if (!mco->mco_icache_sync_range)
@@ -213,7 +213,7 @@ mips_config_cache(void)
 		if (!mco->mco_icache_sync_range_index)
 			panic("no icache_sync_range_index cache op");
 	}
-	if (mci->mci_pdcache_size || 1) {	/* XXX- must have primary Dcache */
+	if (mci->mci_pdcache_size || 1) { /* XXX- must have primary Dcache */
 		if (!mco->mco_pdcache_wbinv_all)
 			panic("no pdcache_wbinv_all");
 		if (!mco->mco_pdcache_wbinv_range)
@@ -375,7 +375,8 @@ mips_config_cache_prehistoric(void)
 		/* change to write-through mode */
 		tx39_cache_config_write_through();
 
-		uvmexp.ncolors = atop(mci->mci_pdcache_size) / mci->mci_pdcache_ways;
+		uvmexp.ncolors =
+		atop(mci->mci_pdcache_size) / mci->mci_pdcache_ways;
 		break;
 #endif /* ENABLE_MIPS_TX3900 */
 #endif /* MIPS1 */
@@ -617,7 +618,7 @@ primary_cache_is_2way:
 
 		mips3_get_cache_config(csizebase);
 
-		mci->mci_sdcache_line_size = 32;	/* don't trust config reg */
+		mci->mci_sdcache_line_size = 32; /* don't trust config reg */
 
 		if (mci->mci_picache_size / mci->mci_picache_ways > PAGE_SIZE)
 			mci->mci_icache_virtual_alias = true;
@@ -660,7 +661,8 @@ primary_cache_is_2way:
 	 */
 	if (mci->mci_picache_size) {
 		KASSERT(mci->mci_picache_ways != 0);
-		mci->mci_picache_way_size = mci->mci_picache_size / mci->mci_picache_ways;
+		mci->mci_picache_way_size =
+		mci->mci_picache_size / mci->mci_picache_ways;
 		mci->mci_picache_way_mask = mci->mci_picache_way_size - 1;
 #if (MIPS2 + MIPS3 + MIPS4) > 0
 		if (mci->mci_icache_virtual_alias)
@@ -670,7 +672,8 @@ primary_cache_is_2way:
 	}
 	if (mci->mci_pdcache_size) {
 		KASSERT(mci->mci_pdcache_ways != 0);
-		mci->mci_pdcache_way_size = mci->mci_pdcache_size / mci->mci_pdcache_ways;
+		mci->mci_pdcache_way_size =
+		mci->mci_pdcache_size / mci->mci_pdcache_ways;
 		mci->mci_pdcache_way_mask = mci->mci_pdcache_way_size - 1;
 #if (MIPS2 + MIPS3 + MIPS4) > 0
 		if (mci->mci_cache_virtual_alias)
@@ -777,7 +780,8 @@ primary_cache_is_2way:
 
 			default:
 panic("r4k sdcache %d way line size %d",
-mci->mci_sdcache_ways, mci->mci_sdcache_line_size);
+mci->mci_sdcache_ways,
+mci->mci_sdcache_line_size);
 			}
 			break;
 
@@ -851,7 +855,8 @@ primary_cache_is_2way:
 	 */
 	if (mci->mci_sdcache_size) {
 		KASSERT(mci->mci_sdcache_ways != 0);
-		mci->mci_sdcache_way_size = mci->mci_sdcache_size / mci->mci_sdcache_ways;
+		mci->mci_sdcache_way_size =
+		mci->mci_sdcache_size / mci->mci_sdcache_ways;
 		mci->mci_sdcache_way_mask = mci->mci_sdcache_way_size - 1;
 	}
 
@@ -1019,7 +1024,8 @@ mips3_get_cache_config(int csizebase)
 mci->mci_scache_unified = true;
 		} else {
 #ifdef CACHE_DEBUG
-			printf("External cache detected, but is disabled -- WILL NOT ENABLE!\n");
+			printf("External cache detected, but is disabled -- "
+			"WILL NOT ENABLE!\n");
 #endif	/* CACHE_DEBUG */
 		}
 	}
@@ -1302,7 +1308,8 @@ mips_config_cache_modern(uint32_t cpu_id
 	}
 
 	mco->mco_intern_pdcache_sync_all = mco->mco_pdcache_wbinv_all;
-	mco->mco_intern_pdcache_sync_range_index = mco->mco_intern_pdcache_wbinv_range_index;
+	mco->mco_intern_pdcache_sync_range_index =
+	mco->mco_intern_pdcache_wbinv_range_index;
 	mco->mco_intern_pdcache_sync_range = mco->mco_pdcache_wb_range;
 
 	if (MIPSNN_CFG1_M & cfg1) {
@@ -1340,8 +1347,10 @@ mips_config_cache_modern(uint32_t cpu_id
 			break;
 		}
 
-		// Note we don't set up any sd cache ops because we expect that
-		// the coherence checks below will overwrite them with no ops.
+		/*
+		 * Note we don't set up any sd cache ops 

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

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 08:43:08 UTC 2020

Modified Files:
src/sys/arch/mips/include: cache_octeon.h

Log Message:
Define Octeon Cavium cache layouts for various cnMIPS cores.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/include/cache_octeon.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/mips/include/cache_octeon.h
diff -u src/sys/arch/mips/include/cache_octeon.h:1.3 src/sys/arch/mips/include/cache_octeon.h:1.4
--- src/sys/arch/mips/include/cache_octeon.h:1.3	Thu Apr 11 09:18:55 2019
+++ src/sys/arch/mips/include/cache_octeon.h	Sun Jun 14 08:43:07 2020
@@ -1,4 +1,7 @@
-/*	$NetBSD: cache_octeon.h,v 1.3 2019/04/11 09:18:55 simonb Exp $	*/
+/*	$NetBSD: cache_octeon.h,v 1.4 2020/06/14 08:43:07 simonb Exp $	*/
+
+#ifndef _MIPS_CACHE_OCTEON_H_
+#define _MIPS_CACHE_OCTEON_H_
 
 #define	CACHE_OCTEON_I			0
 #define	CACHE_OCTEON_D			1
@@ -8,6 +11,31 @@
 #define	CACHEOP_OCTEON_BITMAP_STORE		(3 << 2)	/* I */
 #define	CACHEOP_OCTEON_VIRTUAL_TAG_INV		(4 << 2)	/* D */
 
+#define	OCTEON_CACHELINE_SIZE			128
+
+/*
+ * Note that for the Dcache the 50XX manual says 1 set per way (Config1
+ * register - DS=0 ("... actual is 1"), p173) as does U-boot sources,
+ * however this only adds up to an 8kB Dcache.  The 50XX manual
+ * elsewhere references a 16kB Dcache as does the CN50XX product brief.
+ * The original NetBSD code, current OpenBSD and Linux code all use 2
+ * sets per way. lmbench's "cache" program also detects a 16kB Dcache.
+ * So we assume that all Octeon 1 and Octeon Plus cores have a 16kB
+ * Dcache.
+ */
+#define	OCTEON_I_DCACHE_WAYS			64
+#define	OCTEON_I_DCACHE_SETS			2
+
+#define	OCTEON_II_DCACHE_SETS			8
+#define	OCTEON_II_DCACHE_WAYS			32
+#define	OCTEON_II_ICACHE_SETS			8
+#define	OCTEON_II_ICACHE_WAYS			37
+
+#define	OCTEON_III_DCACHE_SETS			8
+#define	OCTEON_III_DCACHE_WAYS			32
+#define	OCTEON_III_ICACHE_SETS			16
+#define	OCTEON_III_ICACHE_WAYS			39
+
 #if !defined(_LOCORE)
 
 /*
@@ -54,3 +82,4 @@ void octeon_pdcache_inv_range_index(vadd
 void octeon_pdcache_wb_range(register_t va, vsize_t size);
 
 #endif /* !_LOCORE */
+#endif /* _MIPS_CACHE_OCTEON_H_ */



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

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 08:43:08 UTC 2020

Modified Files:
src/sys/arch/mips/include: cache_octeon.h

Log Message:
Define Octeon Cavium cache layouts for various cnMIPS cores.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/include/cache_octeon.h

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



CVS commit: src/sys/arch/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 06:50:31 UTC 2020

Modified Files:
src/sys/arch/mips/include: locore.h
src/sys/arch/mips/mips: cpu_subr.c db_interface.c mips_machdep.c

Log Message:
Retire MIPS_CP0FL_USERLOCAL and MIPS_CP0FL_HWRENA and the flawed
logic that tried to deal with a MIPS processor that supports the ULR
CP0 register.  Probe correctly and save probed info somewhere we can
actually use it.  Avoids problems where libc expects ULR set to a
value but the CPU definition in the CPU table didn't have the right
combination of magic flags and thus never set ULR in the first place.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/mips/mips/db_interface.c
cvs rdiff -u -r1.287 -r1.288 src/sys/arch/mips/mips/mips_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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.106 src/sys/arch/mips/include/locore.h:1.107
--- src/sys/arch/mips/include/locore.h:1.106	Sat Jun 13 14:26:33 2020
+++ src/sys/arch/mips/include/locore.h	Sun Jun 14 06:50:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.106 2020/06/13 14:26:33 simonb Exp $ */
+/* $NetBSD: locore.h,v 1.107 2020/06/14 06:50:31 simonb Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -146,22 +146,23 @@ struct mips_options {
 #define	CPU_ARCH_MIPS32R2	(1 << 7)
 #define	CPU_ARCH_MIPS64R2	(1 << 8)
 
-#define	CPU_MIPS_R4K_MMU		0x0001
-#define	CPU_MIPS_NO_LLSC		0x0002
-#define	CPU_MIPS_CAUSE_IV		0x0004
-#define	CPU_MIPS_HAVE_SPECIAL_CCA	0x0008	/* Defaults to '3' if not set. */
-#define	CPU_MIPS_CACHED_CCA_MASK	0x0070
+#define	CPU_MIPS_R4K_MMU		0x1
+#define	CPU_MIPS_NO_LLSC		0x2
+#define	CPU_MIPS_CAUSE_IV		0x4
+#define	CPU_MIPS_HAVE_SPECIAL_CCA	0x8	/* Defaults to '3' if not set. */
+#define	CPU_MIPS_CACHED_CCA_MASK	0x00070
 #define	CPU_MIPS_CACHED_CCA_SHIFT	 4
-#define	CPU_MIPS_DOUBLE_COUNT		0x0080	/* 1 cp0 count == 2 clock cycles */
-#define	CPU_MIPS_USE_WAIT		0x0100	/* Use "wait"-based cpu_idle() */
-#define	CPU_MIPS_NO_WAIT		0x0200	/* Inverse of previous, for mips32/64 */
-#define	CPU_MIPS_D_CACHE_COHERENT	0x0400	/* D-cache is fully coherent */
-#define	CPU_MIPS_I_D_CACHE_COHERENT	0x0800	/* I-cache funcs don't need to flush the D-cache */
-#define	CPU_MIPS_NO_LLADDR		0x1000
-#define	CPU_MIPS_HAVE_MxCR		0x2000	/* have mfcr, mtcr insns */
-#define	CPU_MIPS_LOONGSON2		0x4000
-#define	MIPS_NOT_SUPP			0x8000
+#define	CPU_MIPS_DOUBLE_COUNT		0x00080	/* 1 cp0 count == 2 clock cycles */
+#define	CPU_MIPS_USE_WAIT		0x00100	/* Use "wait"-based cpu_idle() */
+#define	CPU_MIPS_NO_WAIT		0x00200	/* Inverse of previous, for mips32/64 */
+#define	CPU_MIPS_D_CACHE_COHERENT	0x00400	/* D-cache is fully coherent */
+#define	CPU_MIPS_I_D_CACHE_COHERENT	0x00800	/* I-cache funcs don't need to flush the D-cache */
+#define	CPU_MIPS_NO_LLADDR		0x01000
+#define	CPU_MIPS_HAVE_MxCR		0x02000	/* have mfcr, mtcr insns */
+#define	CPU_MIPS_LOONGSON2		0x04000
+#define	MIPS_NOT_SUPP			0x08000
 #define	CPU_MIPS_HAVE_DSP		0x1
+#define	CPU_MIPS_HAVE_USERLOCAL		0x2
 
 #endif	/* !_LOCORE */
 
@@ -181,8 +182,9 @@ struct mips_options {
 # define MIPS_HAS_CLOCK		0
 # define MIPS_HAS_LLSC		0
 # define MIPS_HAS_LLADDR	0
-# define MIPS_HAS_DSP		0
 # define MIPS_HAS_LMMI		0
+# define MIPS_HAS_DSP		0
+# define MIPS_HAS_USERLOCAL	0
 
 #elif defined(MIPS3) || defined(MIPS4)
 
@@ -206,12 +208,14 @@ struct mips_options {
 #  define MIPS_HAS_LLSC		(mips_options.mips_has_llsc)
 # endif	/* _LOCORE */
 # define MIPS_HAS_LLADDR	((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
-# define MIPS_HAS_DSP		0
 # if defined(MIPS3_LOONGSON2)
 #  define MIPS_HAS_LMMI		((mips_options.mips_cpu_flags & CPU_MIPS_LOONGSON2) != 0)
 # else
 #  define MIPS_HAS_LMMI		0
 # endif
+# define MIPS_HAS_DSP		0
+# define MIPS_HAS_USERLOCAL	0
+
 #elif defined(MIPS32)
 
 # define CPUISMIPS3		1
@@ -226,8 +230,9 @@ struct mips_options {
 # define MIPS_HAS_CLOCK		1
 # define MIPS_HAS_LLSC		1
 # define MIPS_HAS_LLADDR	((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
-# define MIPS_HAS_DSP		0
 # define MIPS_HAS_LMMI		0
+# define MIPS_HAS_DSP		0
+# define MIPS_HAS_USERLOCAL	0
 
 #elif defined(MIPS32R2)
 
@@ -243,8 +248,9 @@ struct mips_options {
 # define MIPS_HAS_CLOCK		1
 # define MIPS_HAS_LLSC		1
 # define MIPS_HAS_LLADDR	((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
-# define MIPS_HAS_DSP		(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_DSP)
 # define MIPS_HAS_LMMI		0
+# define MIPS_HAS_DSP		(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_DSP)
+# define MIPS_HAS_USERLOCAL	(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_USERLOCAL)
 
 #elif defined(MIPS64)
 
@@ -260,8 +266,9 @@ struct mips_options {
 # define 

CVS commit: src/sys/arch/mips

2020-06-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 14 06:50:31 UTC 2020

Modified Files:
src/sys/arch/mips/include: locore.h
src/sys/arch/mips/mips: cpu_subr.c db_interface.c mips_machdep.c

Log Message:
Retire MIPS_CP0FL_USERLOCAL and MIPS_CP0FL_HWRENA and the flawed
logic that tried to deal with a MIPS processor that supports the ULR
CP0 register.  Probe correctly and save probed info somewhere we can
actually use it.  Avoids problems where libc expects ULR set to a
value but the CPU definition in the CPU table didn't have the right
combination of magic flags and thus never set ULR in the first place.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/mips/mips/db_interface.c
cvs rdiff -u -r1.287 -r1.288 src/sys/arch/mips/mips/mips_machdep.c

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