CVS commit: xsrc/external/mit/xinit/dist/man

2019-03-10 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Mon Mar 11 05:08:42 UTC 2019

Modified Files:
xsrc/external/mit/xinit/dist/man: startx.man

Log Message:
remove reference to non existance sys.startxrc.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 xsrc/external/mit/xinit/dist/man/startx.man

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

Modified files:

Index: xsrc/external/mit/xinit/dist/man/startx.man
diff -u xsrc/external/mit/xinit/dist/man/startx.man:1.1.1.3 xsrc/external/mit/xinit/dist/man/startx.man:1.2
--- xsrc/external/mit/xinit/dist/man/startx.man:1.1.1.3	Sun Mar  3 21:36:26 2019
+++ xsrc/external/mit/xinit/dist/man/startx.man	Mon Mar 11 05:08:42 2019
@@ -76,8 +76,6 @@ looks for the following files, in order:
 .PP
 .I $(HOME)/.startxrc
 .PP
-.I __libdir__/sys.startxrc
-.PP
 .I $(HOME)/.xinitrc
 .PP
 .I __xinitdir__/xinitrc



CVS commit: src

2019-03-10 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Mon Mar 11 05:05:32 UTC 2019

Modified Files:
src/distrib/sets/lists/xetc: mi
src/external/mit/xorg/lib/fontconfig/etc/conf.avail: Makefile

Log Message:
Install new files also to etc/fonts/conf.avail.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/distrib/sets/lists/xetc/mi
cvs rdiff -u -r1.6 -r1.7 \
src/external/mit/xorg/lib/fontconfig/etc/conf.avail/Makefile

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/xetc/mi
diff -u src/distrib/sets/lists/xetc/mi:1.33 src/distrib/sets/lists/xetc/mi:1.34
--- src/distrib/sets/lists/xetc/mi:1.33	Fri Mar  8 12:21:03 2019
+++ src/distrib/sets/lists/xetc/mi	Mon Mar 11 05:05:31 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.33 2019/03/08 12:21:03 mrg Exp $
+# $NetBSD: mi,v 1.34 2019/03/11 05:05:31 nakayama Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -46,10 +46,12 @@
 ./etc/fonts/conf.avail/30-metric-aliases.conf		-unknown-	xorg
 ./etc/fonts/conf.avail/30-urw-aliases.conf		-unknown-	obsolete
 ./etc/fonts/conf.avail/40-nonlatin.conf			-unknown-	xorg
+./etc/fonts/conf.avail/45-generic.conf			-unknown-	xorg
 ./etc/fonts/conf.avail/45-latin.conf			-unknown-	xorg
 ./etc/fonts/conf.avail/49-sansserif.conf		-unknown-	xorg
 ./etc/fonts/conf.avail/50-user.conf			-unknown-	xorg
 ./etc/fonts/conf.avail/51-local.conf			-unknown-	xorg
+./etc/fonts/conf.avail/60-generic.conf			-unknown-	xorg
 ./etc/fonts/conf.avail/60-latin.conf			-unknown-	xorg
 ./etc/fonts/conf.avail/65-fonts-persian.conf		-unknown-	xorg
 ./etc/fonts/conf.avail/65-khmer.conf			-unknown-	xorg

Index: src/external/mit/xorg/lib/fontconfig/etc/conf.avail/Makefile
diff -u src/external/mit/xorg/lib/fontconfig/etc/conf.avail/Makefile:1.6 src/external/mit/xorg/lib/fontconfig/etc/conf.avail/Makefile:1.7
--- src/external/mit/xorg/lib/fontconfig/etc/conf.avail/Makefile:1.6	Sat Mar  9 02:56:44 2019
+++ src/external/mit/xorg/lib/fontconfig/etc/conf.avail/Makefile	Mon Mar 11 05:05:32 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2019/03/09 02:56:44 mrg Exp $
+#	$NetBSD: Makefile,v 1.7 2019/03/11 05:05:32 nakayama Exp $
 
 .include 
 
@@ -23,10 +23,12 @@ CONFIGFILES= \
 	25-unhint-nonlatin.conf \
 	30-metric-aliases.conf \
 	40-nonlatin.conf \
+	45-generic.conf \
 	45-latin.conf \
 	49-sansserif.conf \
 	50-user.conf \
 	51-local.conf \
+	60-generic.conf \
 	60-latin.conf \
 	65-fonts-persian.conf \
 	65-khmer.conf \



CVS commit: src/external/bsd/mdocml/dist

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 03:56:30 UTC 2019

Modified Files:
src/external/bsd/mdocml/dist: man_validate.c mdoc_validate.c

Log Message:
add __dead for clang.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.19 -r1.2 src/external/bsd/mdocml/dist/man_validate.c
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/mdocml/dist/mdoc_validate.c

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

Modified files:

Index: src/external/bsd/mdocml/dist/man_validate.c
diff -u src/external/bsd/mdocml/dist/man_validate.c:1.1.1.19 src/external/bsd/mdocml/dist/man_validate.c:1.2
--- src/external/bsd/mdocml/dist/man_validate.c:1.1.1.19	Sun Mar 10 18:28:59 2019
+++ src/external/bsd/mdocml/dist/man_validate.c	Sun Mar 10 23:56:30 2019
@@ -41,7 +41,7 @@
 
 typedef	void	(*v_check)(CHKARGS);
 
-static	void	  check_abort(CHKARGS);
+static	void	  check_abort(CHKARGS) __dead;
 static	void	  check_par(CHKARGS);
 static	void	  check_part(CHKARGS);
 static	void	  check_root(CHKARGS);

Index: src/external/bsd/mdocml/dist/mdoc_validate.c
diff -u src/external/bsd/mdocml/dist/mdoc_validate.c:1.15 src/external/bsd/mdocml/dist/mdoc_validate.c:1.16
--- src/external/bsd/mdocml/dist/mdoc_validate.c:1.15	Sun Mar 10 20:15:38 2019
+++ src/external/bsd/mdocml/dist/mdoc_validate.c	Sun Mar 10 23:56:30 2019
@@ -64,7 +64,7 @@ static	size_t		macro2len(enum roff_tok);
 static	void	 rewrite_macro2len(struct roff_man *, char **);
 static	int	 similar(const char *, const char *);
 
-static	void	 post_abort(POST_ARGS);
+static	void	 post_abort(POST_ARGS) __dead;
 static	void	 post_an(POST_ARGS);
 static	void	 post_an_norm(POST_ARGS);
 static	void	 post_at(POST_ARGS);



CVS commit: src/sys/net

2019-03-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Mar 11 03:00:41 UTC 2019

Modified Files:
src/sys/net: route.c

Log Message:
Add missing ifa_release on error paths


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/net/route.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/net/route.c
diff -u src/sys/net/route.c:1.216 src/sys/net/route.c:1.217
--- src/sys/net/route.c:1.216	Tue Oct 30 05:56:02 2018
+++ src/sys/net/route.c	Mon Mar 11 03:00:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.216 2018/10/30 05:56:02 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.217 2019/03/11 03:00:41 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.216 2018/10/30 05:56:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.217 2019/03/11 03:00:41 ozaki-r Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -1504,6 +1504,8 @@ rt_update(struct rtentry *rt, struct rt_
 		}
 		if (new_ifa == NULL)
 			ifa_release(ifa, _ifa);
+		/* To avoid ifa_release below */
+		ifa = NULL;
 	}
 	ifa_release(new_ifa, _new_ifa);
 	if (new_ifp && rt->rt_ifp != new_ifp && !if_is_deactivated(new_ifp)) {
@@ -1525,6 +1527,7 @@ rt_update(struct rtentry *rt, struct rt_
 	(void)ifp_changed; /* XXX gcc */
 #endif
 out:
+	ifa_release(ifa, _ifa);
 	if_put(new_ifp, _new_ifp);
 	if_put(ifp, _ifp);
 



CVS commit: src/external/mit/xorg/lib/fontconfig/src

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Mar 11 01:40:05 UTC 2019

Modified Files:
src/external/mit/xorg/lib/fontconfig/src: Makefile

Log Message:
handle @PKG_EXPAT_LIBS@ and @PKG_EXPAT_CFLAGS@.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/mit/xorg/lib/fontconfig/src/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/fontconfig/src/Makefile
diff -u src/external/mit/xorg/lib/fontconfig/src/Makefile:1.23 src/external/mit/xorg/lib/fontconfig/src/Makefile:1.24
--- src/external/mit/xorg/lib/fontconfig/src/Makefile:1.23	Fri Mar  8 09:58:24 2019
+++ src/external/mit/xorg/lib/fontconfig/src/Makefile	Mon Mar 11 01:40:05 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2019/03/08 09:58:24 mrg Exp $
+#	$NetBSD: Makefile,v 1.24 2019/03/11 01:40:05 mrg Exp $
 
 .include 
 
@@ -297,6 +297,8 @@ PKGCONFIG_SED_FLAGS= \
 	-e "s,@sysconfdir@,${X11ETCDIR},; \
 	s,@localstatedir@,/var,; \
 	s,@BASECONFIGDIR@,${FONTCONFIG_PATH},; \
+	s,@PKG_EXPAT_LIBS@,-lexpat,; \
+	s,@PKG_EXPAT_CFLAGS@,,; \
 	s,@TEMPLATEDIR@,${TEMPLATEDIR},; \
 	s,@fc_cachedir@,${FONTCONFIG_PATH},"
 



CVS commit: xsrc/external/mit/xdm/dist/config

2019-03-10 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Mon Mar 11 01:32:06 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/config: Xservers.ws.in

Log Message:
restore change lost in Xservers.ws.cpp -> Xservers.ws.in rename:

http://mail-index.netbsd.org/source-changes/2012/02/18/msg031930.html

Add -noretro as default server arg in configuration files where we are
sure the user will get a visible window "soon".
The sole reason we backed out the "retro" change from upstream
was to avoid an empty black screen after manualy starting just "X". With
these preconfigured startup mehtods, this confusion can not happen.

pointed out by jmcneill.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/xdm/dist/config/Xservers.ws.in

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

Modified files:

Index: xsrc/external/mit/xdm/dist/config/Xservers.ws.in
diff -u xsrc/external/mit/xdm/dist/config/Xservers.ws.in:1.1.1.1 xsrc/external/mit/xdm/dist/config/Xservers.ws.in:1.2
--- xsrc/external/mit/xdm/dist/config/Xservers.ws.in:1.1.1.1	Tue Mar  5 08:26:49 2019
+++ xsrc/external/mit/xdm/dist/config/Xservers.ws.in	Mon Mar 11 01:32:06 2019
@@ -9,4 +9,4 @@ XCOMM you can add them here as well.  Ea
 XCOMM look like:
 XCOMM	XTerminalName:0 foreign
 XCOMM
-:0 local BINDIR/X :0 DEFAULTVT
+:0 local BINDIR/X :0 -noretro DEFAULTVT



CVS commit: src/usr.sbin/makemandb

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 00:31:36 UTC 2019

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

Log Message:
remove unneeded header.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/makemandb/makemandb.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/makemandb/makemandb.c
diff -u src/usr.sbin/makemandb/makemandb.c:1.58 src/usr.sbin/makemandb/makemandb.c:1.59
--- src/usr.sbin/makemandb/makemandb.c:1.58	Sun Mar 10 20:14:44 2019
+++ src/usr.sbin/makemandb/makemandb.c	Sun Mar 10 20:31:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: makemandb.c,v 1.58 2019/03/11 00:14:44 christos Exp $	*/
+/*	$NetBSD: makemandb.c,v 1.59 2019/03/11 00:31:36 christos Exp $	*/
 /*
  * Copyright (c) 2011 Abhinav Upadhyay 
  * Copyright (c) 2011 Kristaps Dzonsons 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: makemandb.c,v 1.58 2019/03/11 00:14:44 christos Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.59 2019/03/11 00:31:36 christos Exp $");
 
 #include 
 #include 
@@ -39,7 +39,6 @@ __RCSID("$NetBSD: makemandb.c,v 1.58 201
 #include "dist/mandoc.h"
 #include "dist/mdoc.h"
 #include "dist/roff.h"
-#include "dist/roff_int.h"
 #include "dist/mandoc_parse.h"
 
 #define BUFLEN 1024



CVS commit: src/doc

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 00:17:16 UTC 2019

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new mdocml


To generate a diff of this commit:
cvs rdiff -u -r1.1601 -r1.1602 src/doc/3RDPARTY
cvs rdiff -u -r1.2508 -r1.2509 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.1601 src/doc/3RDPARTY:1.1602
--- src/doc/3RDPARTY:1.1601	Sun Mar 10 07:53:35 2019
+++ src/doc/3RDPARTY	Sun Mar 10 20:17:16 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1601 2019/03/10 11:53:35 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1602 2019/03/11 00:17:16 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -875,7 +875,7 @@ Location:	external/apache2/mDNSResponder
 Notes:
 
 Package:	mandoc
-Version:	1.14.4
+Version:	1.14.5
 Current Vers:	1.14.5
 Maintainer:	Kristaps Džonsons/Ingo Schwarze
 Archive Site:	http://mandoc.bsd.lv/snapshots/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2508 src/doc/CHANGES:1.2509
--- src/doc/CHANGES:1.2508	Sun Mar 10 17:25:09 2019
+++ src/doc/CHANGES	Sun Mar 10 20:17:16 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2508 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2509 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -344,3 +344,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	arm: Add support for Amlogic S905 SoC. [jmcneill 20190225]
 	jemalloc: Import 5.1.0 [christos 20190304]
 	kcov(4): Added driver for kernel coverage tracing [kamil 20190310]
+	mdocml: Import 1.14.5. [christos 20190310]



CVS commit: src/usr.sbin/makemandb

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 00:14:44 UTC 2019

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

Log Message:
adjust to the new mandoc api


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makemandb/makemandb.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/makemandb/makemandb.c
diff -u src/usr.sbin/makemandb/makemandb.c:1.57 src/usr.sbin/makemandb/makemandb.c:1.58
--- src/usr.sbin/makemandb/makemandb.c:1.57	Fri Aug 24 12:01:57 2018
+++ src/usr.sbin/makemandb/makemandb.c	Sun Mar 10 20:14:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: makemandb.c,v 1.57 2018/08/24 16:01:57 abhinav Exp $	*/
+/*	$NetBSD: makemandb.c,v 1.58 2019/03/11 00:14:44 christos Exp $	*/
 /*
  * Copyright (c) 2011 Abhinav Upadhyay 
  * Copyright (c) 2011 Kristaps Dzonsons 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: makemandb.c,v 1.57 2018/08/24 16:01:57 abhinav Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.58 2019/03/11 00:14:44 christos Exp $");
 
 #include 
 #include 
@@ -39,6 +39,8 @@ __RCSID("$NetBSD: makemandb.c,v 1.57 201
 #include "dist/mandoc.h"
 #include "dist/mdoc.h"
 #include "dist/roff.h"
+#include "dist/roff_int.h"
+#include "dist/mandoc_parse.h"
 
 #define BUFLEN 1024
 #define MDOC 0	//If the page is of mdoc(7) type
@@ -98,13 +100,12 @@ static void init_secbuffs(mandb_rec *);
 static void free_secbuffs(mandb_rec *);
 static int check_md5(const char *, sqlite3 *, char **, void *, size_t);
 static void cleanup(mandb_rec *);
-static void set_section(const struct roff_man *, mandb_rec *);
-static void set_machine(const struct roff_man *, mandb_rec *);
+static void set_section(const struct roff_meta *, mandb_rec *);
+static void set_machine(const struct roff_meta *, mandb_rec *);
 static int insert_into_db(sqlite3 *, mandb_rec *);
-static	void begin_parse(const char *, struct mparse *, mandb_rec *,
-			 const void *, size_t len);
-static void proff_node(const struct roff_node *, mandb_rec *, struct roff_man *,
-		 const proff_nf *);
+static	void begin_parse(const char *, struct mparse *, mandb_rec *, int);
+static void proff_node(const struct roff_node *, mandb_rec *,
+		   struct roff_meta *, const proff_nf *);
 static void pmdoc_Nm(const struct roff_node *, mandb_rec *);
 static void pmdoc_Nd(const struct roff_node *, mandb_rec *);
 static void pmdoc_Sh(const struct roff_node *, mandb_rec *);
@@ -336,7 +337,8 @@ main(int argc, char *argv[])
 
 	init_secbuffs();
 	mchars_alloc();
-	mp = mparse_alloc(0, MANDOCERR_MAX, NULL, MANDOC_OS_OTHER, NULL);
+	mp = mparse_alloc(MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1 |
+	MPARSE_VALIDATE, MANDOC_OS_OTHER, NULL);
 
 	if (manconf) {
 		char *arg;
@@ -579,62 +581,6 @@ build_file_cache(sqlite3 *db, const char
 	sqlite3_finalize(stmt);
 }
 
-static void
-update_existing_entry(sqlite3 *db, const char *file, const char *hash,
-mandb_rec *rec, int *new_count, int *link_count, int *err_count)
-{
-	int update_count, rc, idx;
-	const char *inner_sqlstr;
-	sqlite3_stmt *inner_stmt;
-
-	update_count = sqlite3_total_changes(db);
-	inner_sqlstr = "UPDATE mandb_meta SET device = :device,"
-		   " inode = :inode, mtime = :mtime WHERE"
-		   " md5_hash = :md5 AND file = :file AND"
-		   " (device <> :device2 OR inode <> "
-		   "  :inode2 OR mtime <> :mtime2)";
-	rc = sqlite3_prepare_v2(db, inner_sqlstr, -1, _stmt, NULL);
-	if (rc != SQLITE_OK) {
-		if (mflags.verbosity)
-			warnx("%s", sqlite3_errmsg(db));
-		return;
-	}
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":device");
-	sqlite3_bind_int64(inner_stmt, idx, rec->device);
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":inode");
-	sqlite3_bind_int64(inner_stmt, idx, rec->inode);
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":mtime");
-	sqlite3_bind_int64(inner_stmt, idx, rec->mtime);
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":md5");
-	sqlite3_bind_text(inner_stmt, idx, hash, -1, NULL);
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":file");
-	sqlite3_bind_text(inner_stmt, idx, file, -1, NULL);
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":device2");
-	sqlite3_bind_int64(inner_stmt, idx, rec->device);
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":inode2");
-	sqlite3_bind_int64(inner_stmt, idx, rec->inode);
-	idx = sqlite3_bind_parameter_index(inner_stmt, ":mtime2");
-	sqlite3_bind_int64(inner_stmt, idx, rec->mtime);
-
-	rc = sqlite3_step(inner_stmt);
-	if (rc == SQLITE_DONE) {
-		/* Check if an update has been performed. */
-		if (update_count != sqlite3_total_changes(db)) {
-			if (mflags.verbosity == 2)
-printf("Updated %s\n", file);
-			(*new_count)++;
-		} else {
-			/* Otherwise it was a hardlink. */
-			(*link_count)++;
-		}
-	} else {
-		if (mflags.verbosity == 2)
-			warnx("Could not update the meta data for %s", file);
-		(*err_count)++;
-	}
-	sqlite3_finalize(inner_stmt);
-}
-
 /* 

CVS commit: src

2019-03-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 10 22:34:14 UTC 2019

Modified Files:
src/sys/kern: subr_kcov.c
src/tests/modules: t_kcov.c

Log Message:
Introduce enhancements to the kcov(4) code

Add new tests verifying dup2(2) scenarios:
 - kcov_dup2
 - kcov_basic_dup2_pc
 - kcov_basic_dup2_cmp

The dup2(2) trick is used by syzkaller and assert that it works.
All new tests pass.

While there add minor non-functional cleanup changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/subr_kcov.c
cvs rdiff -u -r1.7 -r1.8 src/tests/modules/t_kcov.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_kcov.c
diff -u src/sys/kern/subr_kcov.c:1.5 src/sys/kern/subr_kcov.c:1.6
--- src/sys/kern/subr_kcov.c:1.5	Sun Mar 10 17:51:00 2019
+++ src/sys/kern/subr_kcov.c	Sun Mar 10 22:34:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kcov.c,v 1.5 2019/03/10 17:51:00 kamil Exp $	*/
+/*	$NetBSD: subr_kcov.c,v 1.6 2019/03/10 22:34:14 kamil Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -417,7 +417,7 @@ trace_cmp(uint64_t type, uint64_t arg1, 
 	}
 
 	if (kd->mode != KCOV_MODE_TRACE_CMP) {
-		/* PC tracing mode not enabled */
+		/* CMP tracing mode not enabled */
 		return;
 	}
 

Index: src/tests/modules/t_kcov.c
diff -u src/tests/modules/t_kcov.c:1.7 src/tests/modules/t_kcov.c:1.8
--- src/tests/modules/t_kcov.c:1.7	Sun Mar 10 17:51:00 2019
+++ src/tests/modules/t_kcov.c	Sun Mar 10 22:34:14 2019
@@ -57,6 +57,34 @@ open_kcov(void)
 	return fd;
 }
 
+static int
+pick_unassigned_fd(int greater_than_fd)
+{
+	int fd2;
+
+	fd2 = greater_than_fd;
+	do {
+		++fd2;
+	} while (fcntl(fd2, F_GETFL) != -1 || errno != EBADF);
+
+	return fd2;
+}
+
+ATF_TC_WITHOUT_HEAD(kcov_dup2);
+ATF_TC_BODY(kcov_dup2, tc)
+{
+	int fd1, fd2;
+	fd1 = open_kcov();
+
+	fd2 = pick_unassigned_fd(fd1);
+
+	/* Test the dup2(2) trick used by syzkaller */
+	ATF_REQUIRE_EQ(dup2(fd1, fd2), fd2);
+
+	close(fd1);
+	close(fd2);
+}
+
 ATF_TC_WITHOUT_HEAD(kcov_multiopen);
 ATF_TC_BODY(kcov_multiopen, tc)
 {
@@ -216,11 +244,7 @@ ATF_TC_BODY(kcov_enable, tc)
 	ATF_CHECK(ioctl(fd, KCOV_IOC_DISABLE) == 0);
 	ATF_CHECK(ioctl(fd, KCOV_IOC_DISABLE) == -1);
 
-	/* Re-enabling should also work */
-	ATF_CHECK(ioctl(fd, KCOV_IOC_ENABLE, ) == 0);
-	ATF_CHECK(ioctl(fd, KCOV_IOC_DISABLE) == 0);
-
-	/* Re-enablibling and changing mode should also work */
+	/* Re-enabling and changing mode should also work */
 	mode = KCOV_MODE_NONE;
 	ATF_CHECK(ioctl(fd, KCOV_IOC_ENABLE, ) == 0);
 	ATF_CHECK(ioctl(fd, KCOV_IOC_DISABLE) == 0);
@@ -262,14 +286,22 @@ ATF_TC_BODY(kcov_enable_no_disable_no_cl
 }
 
 static void *
-common_head(int *fdp)
+common_head_raw(bool fd_dup, int *fdp)
 {
 	void *data;
-	int fd;
+	int fd, fd2;
 	uint64_t size = PAGE_SIZE / KCOV_ENTRY_SIZE;
 
 	fd = open_kcov();
 
+	/* Test the dup2(2) trick used by syzkaller */
+	if (fd_dup) {
+		fd2 = pick_unassigned_fd(fd);
+		ATF_REQUIRE_EQ(dup2(fd, fd2), fd2);
+		close(fd);
+		fd = fd2;
+	}
+
 	ATF_REQUIRE_MSG(ioctl(fd, KCOV_IOC_SETBUFSIZE, ) == 0,
 	"Unable to set the kcov buffer size");
 
@@ -280,6 +312,13 @@ common_head(int *fdp)
 	return data;
 }
 
+static void *
+common_head(int *fdp)
+{
+
+	return common_head_raw(false, fdp);
+}
+
 static void
 common_tail(int fd, kcov_int_t *data)
 {
@@ -291,12 +330,12 @@ common_tail(int fd, kcov_int_t *data)
 }
 
 static void
-kcov_basic(int mode)
+kcov_basic(bool fd_dup, int mode)
 {
 	kcov_int_t *buf;
 	int fd;
 
-	buf = common_head();
+	buf = common_head_raw(fd_dup, );
 	ATF_REQUIRE_MSG(ioctl(fd, KCOV_IOC_ENABLE, ) == 0,
 	"Unable to enable kcov ");
 
@@ -315,7 +354,7 @@ ATF_TC_WITHOUT_HEAD(kcov_basic_pc);
 ATF_TC_BODY(kcov_basic_pc, tc)
 {
 
-	kcov_basic(KCOV_MODE_TRACE_PC);
+	kcov_basic(false, KCOV_MODE_TRACE_PC);
 }
 
 ATF_TC_WITHOUT_HEAD(kcov_basic_cmp);
@@ -324,7 +363,23 @@ ATF_TC_BODY(kcov_basic_cmp, tc)
 
 	atf_tc_skip("XXX: GCC8 needed");
 
-	kcov_basic(KCOV_MODE_TRACE_CMP);
+	kcov_basic(false, KCOV_MODE_TRACE_CMP);
+}
+
+ATF_TC_WITHOUT_HEAD(kcov_basic_dup2_pc);
+ATF_TC_BODY(kcov_basic_dup2_pc, tc)
+{
+
+	kcov_basic(true, KCOV_MODE_TRACE_PC);
+}
+
+ATF_TC_WITHOUT_HEAD(kcov_basic_dup2_cmp);
+ATF_TC_BODY(kcov_basic_dup2_cmp, tc)
+{
+
+	atf_tc_skip("XXX: GCC8 needed");
+
+	kcov_basic(true, KCOV_MODE_TRACE_CMP);
 }
 
 ATF_TC_WITHOUT_HEAD(kcov_multienable_on_the_same_thread);
@@ -486,6 +541,7 @@ KCOV_MULTIPLE_THREADS(32)
 ATF_TP_ADD_TCS(tp)
 {
 
+	ATF_TP_ADD_TC(tp, kcov_dup2);
 	ATF_TP_ADD_TC(tp, kcov_multiopen);
 	ATF_TP_ADD_TC(tp, kcov_open_close_open);
 	ATF_TP_ADD_TC(tp, kcov_bufsize);
@@ -498,6 +554,8 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, kcov_mmap_enable_thread_close);
 	ATF_TP_ADD_TC(tp, kcov_basic_pc);
 	ATF_TP_ADD_TC(tp, kcov_basic_cmp);
+	ATF_TP_ADD_TC(tp, kcov_basic_dup2_pc);
+	ATF_TP_ADD_TC(tp, kcov_basic_dup2_cmp);
 	ATF_TP_ADD_TC(tp, kcov_multienable_on_the_same_thread);
 	

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

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 22:29:02 UTC 2019

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

Log Message:
Changes in version 1.14.5, released on March 10, 2019

--- MAJOR NEW FEATURES ---
 * apropos(1): improve POSIX compliance by accepting case-insensitive
   extended regular expressions by default
 * new -O tag[=term] output option (open a page at the definition of a term)
 * tbl(7) -T html: spanning and horizontal and vertical alignment of cells
 * tbl(7) -T html: draw lines on the edges of table cells
 * tbl(7) -T utf8: render lines with the Unicode box drawing characters
 * mandoc is now able to handle the manual pages of the groff package.
--- MINOR NEW FEATURES ---
 * -T html: new option -O toc (table of contents)
 * -T html: second argument to -O man to support local and remote links
 * mdoc(7) .Bd -centered now fills the text contained in it
 * man-ext .SY and .YS macros (synopsis block)
 * man-ext .TQ macro (tagged paragraph without vertical space before it)
 * tbl(7) \& explicit alignment indicator
 * roff(7) .shift, .while, and .return requests
 * roff(7) .char request (output glyph definition)
 * roff(7) .nop request (no operation)
 * roff(7) .ft request: handle the CB, CI, and CR fonts
 * roff(7) .if c conditional (character available)
 * roff(7) \\$@ escape sequence (insert all macro arguments, quoted)
 * roff(7) \*(.T predefined string (interpolate output device name)
 * roff(7) \[charNNN] escape sequence (for printable ASCII characters)
 * roff(7) \# escape sequence (line continuation with comment)
--- HTML OUTPUT SYNTAX CORRECTIONS ---
 * Render .br and \p as , not as an empty .
 * Render .Pp and .PP as  and automatically close it when needed.
 * Stop writing empty list elements for non-compact .Bl -tag lists.
 * Do not put  inside  if .UR or .MT contain .PP.
 * Implement tooltips purely in CSS rather than abusing title= attributes.
--- MINOR FUNCTIONAL IMPROVEMENTS ---
 * many improvements to the handling of fill and no-fill mode
 * tbl(7): better column widths in the presence of horizontal spans
 * several minor improvements to escape sequence handling
 * several minor improvements to manual font handling
 * portability: autodetect need for _GNU_SOURCE or _OPENBSD_SOURCE
 * portability: autodetect whether less(1) supports the -T option
 * large numbers of bugfixes of diverse kinds
--- STRUCTURAL IMPROVEMENTS ---
 * Disentangle eqn(7) and tbl(7) from other parser header files,
   and clean up some parser data structures.
 * Substantially simplify error and warning message infrastructure.
--- THANKS TO ---
 * John Gardner for crucial help implementing tooltips in CSS.
 * Alexander Bluhm, Raphael Graf, Ted Unangst (OpenBSD)
   and Daniel Sabogal (Alpine Linux) for patches.
 * Anthony Bentley and Jason McIntyre (OpenBSD) for documentation patches,
   suggesting new features, bug reports, and useful discussions.
 * Kyle Evans and Baptiste Daroussin (FreeBSD) for minor patches.
 * Pali Rohar for suggesting multiple new features and for reporting
   several bugs and missing features.
 * Klemens Nanni (OpenBSD) for suggesting multiple new features.
 * Kristaps Dzonsons (bsd.lv), Marc Espie (OpenBSD), Adam Kalisz,
   and Laura Morales for suggesting new features.
 * Wolfram Schneider and Yuri Pankov (FreeBSD) for reporting missing features.
 * Edward Tomasz Napierala (FreeBSD) for suggesting a feature improvement.
 * Thomas Klausner (NetBSD) and Sevan Janiyan (SmartOS)
   for bug reports and release testing.
 * Bryan Steele, Janne Johansson, Kurt Mosiejczuk, Mike Belopuhov, Theo
   Buehler, Todd Miller (OpenBSD), Andreas Gustafsson, Christos Zoulas,
   Robert Elz (NetBSD), Kurt Jaeger (FreeBSD), Fabio Scotoni, Kelvin
   Sherlock, Mark Harris, Orestis Ioannou, Raf Czlonka, and Sean Farrell
   for bug reports.
 * Ulrich Spoerlein (FreeBSD), Leah Neukirchen (Void Linux),
   Matej Cepl (openSUSE), and Jan Stary (MacOS X) for release testing.
 * Brian Callahan and Stuart Henderson (OpenBSD) for help
   with the OpenBSD groff port.
 * Bertrand Garrigues, Branden Robinson, Ralph Corderoy, and Werner
   Lemberg (GNU troff) for checking groff patches.
 * Scott Cheloha, Theo de Raadt (OpenBSD)
   and Natanael Copa (Alpine Linux) for useful discussions.

Status:

Vendor Tag: KRISTAPS
Release Tags:   mdocml-1-14-5

U src/external/bsd/mdocml/dist/Makefile.depend
U src/external/bsd/mdocml/dist/INSTALL
U src/external/bsd/mdocml/dist/LICENSE
C src/external/bsd/mdocml/dist/Makefile
U src/external/bsd/mdocml/dist/apropos.1
U src/external/bsd/mdocml/dist/NEWS
U src/external/bsd/mdocml/dist/TODO
U src/external/bsd/mdocml/dist/cgi.h.example
U src/external/bsd/mdocml/dist/catman.8
U src/external/bsd/mdocml/dist/compat_ohash.h
U src/external/bsd/mdocml/dist/compat_fts.h
U src/external/bsd/mdocml/dist/configure.local.example
U src/external/bsd/mdocml/dist/compat_stringlist.h
C 

CVS commit: src/distrib/sets/lists/xbase

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 22:00:37 UTC 2019

Modified Files:
src/distrib/sets/lists/xbase: md.evbarm

Log Message:
add vdpau to evbarm


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/xbase/md.evbarm

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/xbase/md.evbarm
diff -u src/distrib/sets/lists/xbase/md.evbarm:1.2 src/distrib/sets/lists/xbase/md.evbarm:1.3
--- src/distrib/sets/lists/xbase/md.evbarm:1.2	Thu Aug 18 15:27:33 2016
+++ src/distrib/sets/lists/xbase/md.evbarm	Sun Mar 10 18:00:37 2019
@@ -1,4 +1,7 @@
-# $NetBSD: md.evbarm,v 1.2 2016/08/18 19:27:33 skrll Exp $
+# $NetBSD: md.evbarm,v 1.3 2019/03/10 22:00:37 christos Exp $
 ./usr/X11R7/lib/libdrm_nouveau.so		-unknown-		xorg
 ./usr/X11R7/lib/libdrm_nouveau.so.3		-unknown-		xorg
 ./usr/X11R7/lib/libdrm_nouveau.so.3.0		-unknown-		xorg
+./usr/X11R7/lib/libvdpau.so			-unknown-		xorg,compatx11file
+./usr/X11R7/lib/libvdpau.so.1			-unknown-		xorg,compatx11file
+./usr/X11R7/lib/libvdpau.so.1.0			-unknown-		xorg,compatx11file



CVS commit: src/external/bsd/jemalloc/include/jemalloc/internal

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 21:52:00 UTC 2019

Modified Files:
src/external/bsd/jemalloc/include/jemalloc/internal: prof_inlines_a.h

Log Message:
one more noreturn


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/bsd/jemalloc/include/jemalloc/internal/prof_inlines_a.h

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/jemalloc/include/jemalloc/internal/prof_inlines_a.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/prof_inlines_a.h:1.1 src/external/bsd/jemalloc/include/jemalloc/internal/prof_inlines_a.h:1.2
--- src/external/bsd/jemalloc/include/jemalloc/internal/prof_inlines_a.h:1.1	Mon Mar  4 12:25:09 2019
+++ src/external/bsd/jemalloc/include/jemalloc/internal/prof_inlines_a.h	Sun Mar 10 17:52:00 2019
@@ -41,7 +41,7 @@ prof_accum_add(tsdn_t *tsdn, prof_accum_
 	return overflow;
 }
 
-static inline void
+static JEMALLOC_NORETURN inline void
 prof_accum_cancel(tsdn_t *tsdn, prof_accum_t *prof_accum, size_t usize) {
 	cassert(config_prof);
 



CVS commit: src/doc

2019-03-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 10 21:25:09 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
Register kcov(4) in CHANGES

kcov(4): Added driver for kernel coverage tracing

Register the entry with the current date as the driver has been just
finished.

Primary author of the port: Siddharth Muralee.
Review and major code improvements by .
Various contributions by myself.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2507 src/doc/CHANGES:1.2508
--- src/doc/CHANGES:1.2507	Mon Mar  4 17:36:35 2019
+++ src/doc/CHANGES	Sun Mar 10 21:25:09 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2507 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2508 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -343,3 +343,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	bind: Import version 9.13.7. [christos 20190224]
 	arm: Add support for Amlogic S905 SoC. [jmcneill 20190225]
 	jemalloc: Import 5.1.0 [christos 20190304]
+	kcov(4): Added driver for kernel coverage tracing [kamil 20190310]



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

2019-03-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Mar 10 19:47:03 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip: rk_emmcphy.c

Log Message:
Use syscon instead of bus_space_map


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_emmcphy.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_emmcphy.c
diff -u src/sys/arch/arm/rockchip/rk_emmcphy.c:1.1 src/sys/arch/arm/rockchip/rk_emmcphy.c:1.2
--- src/sys/arch/arm/rockchip/rk_emmcphy.c:1.1	Sun Mar 10 11:10:21 2019
+++ src/sys/arch/arm/rockchip/rk_emmcphy.c	Sun Mar 10 19:47:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_emmcphy.c,v 1.1 2019/03/10 11:10:21 jmcneill Exp $ */
+/* $NetBSD: rk_emmcphy.c,v 1.2 2019/03/10 19:47:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_emmcphy.c,v 1.1 2019/03/10 11:10:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_emmcphy.c,v 1.2 2019/03/10 19:47:03 jmcneill Exp $");
 
 #include 
 #include 
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: rk_emmcphy.c
 #include 
 
 #include 
+#include 
 
 #define	GRF_EMMCPHY_CON0	0x00
 #define	 PHYCTRL_FRQSEL			__BITS(13,12)
@@ -93,15 +94,16 @@ static const char * const compatible[] =
 
 struct rk_emmcphy_softc {
 	device_t		sc_dev;
-	bus_space_tag_t		sc_bst;
-	bus_space_handle_t	sc_bsh;
+	struct syscon		*sc_syscon;
+	bus_addr_t		sc_regbase;
 	int			sc_phandle;
+	struct clk		*sc_clk;
 };
 
 #define RD4(sc, reg) 		\
-bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
+	syscon_read_4((sc)->sc_syscon, (sc)->sc_regbase + (reg))
 #define WR4(sc, reg, val) 	\
-bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
+	syscon_write_4((sc)->sc_syscon, (sc)->sc_regbase + (reg), (val))
 
 static int	rk_emmcphy_match(device_t, cfdata_t, void *);
 static void	rk_emmcphy_attach(device_t, device_t, void *);
@@ -112,10 +114,15 @@ CFATTACH_DECL_NEW(rkemmcphy, sizeof(stru
 static void *
 rk_emmcphy_acquire(device_t dev, const void *data, size_t len)
 {
+	struct rk_emmcphy_softc * const sc = device_private(dev);
+
 	if (len != 0)
 		return NULL;
 
-	return device_private(dev);
+	if (sc->sc_clk == NULL)
+		sc->sc_clk = fdtbus_clock_get(sc->sc_phandle, "emmcclk");
+
+	return sc;
 }
 
 static void
@@ -126,22 +133,23 @@ rk_emmcphy_release(device_t dev, void *p
 static int
 rk_emmcphy_enable(device_t dev, void *priv, bool enable)
 {
-	struct rk_emmcphy_softc * const sc = priv;
-	const int phandle = sc->sc_phandle;
-	struct clk *clk;
+	struct rk_emmcphy_softc * const sc = device_private(dev);
 	uint32_t mask, val;
 	u_int rate, frqsel;
 
+	syscon_lock(sc->sc_syscon);
+
 	/* Power down PHY and disable DLL before making changes */
 	mask = PHYCTRL_ENDLL | PHYCTRL_PDB;
 	val = 0;
 	WR4(sc, GRF_EMMCPHY_CON6, (mask << 16) | val);
 
-	if (enable == false)
+	if (enable == false) {
+		syscon_unlock(sc->sc_syscon);
 		return 0;
+	}
 
-	clk = fdtbus_clock_get(phandle, "emmcclk");
-	rate = clk ? clk_get_rate(clk) : 0;
+	rate = sc->sc_clk ? clk_get_rate(sc->sc_clk) : 0;
 
 	if (rate != 0) {
 		if (rate < 7500)
@@ -168,6 +176,7 @@ rk_emmcphy_enable(device_t dev, void *pr
 	val = RD4(sc, GRF_EMMCPHY_STATUS);
 	if ((val & PHYCTRL_CALDONE) == 0) {
 		device_printf(dev, "PHY calibration did not complete\n");
+		syscon_unlock(sc->sc_syscon);
 		return EIO;
 	}
 
@@ -187,10 +196,13 @@ rk_emmcphy_enable(device_t dev, void *pr
 		val = RD4(sc, GRF_EMMCPHY_STATUS);
 		if ((val & PHYCTRL_DLLRDY) == 0) {
 			device_printf(dev, "DLL loop failed to lock\n");
+			syscon_unlock(sc->sc_syscon);
 			return EIO;
 		}
 	}
 
+	syscon_unlock(sc->sc_syscon);
+
 	return 0;
 }
 
@@ -224,11 +236,12 @@ rk_emmcphy_attach(device_t parent, devic
 
 	sc->sc_dev = self;
 	sc->sc_phandle = phandle;
-	sc->sc_bst = faa->faa_bst;
-	if (bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh) != 0) {
-		aprint_error(": couldn't map registers\n");
+	sc->sc_syscon = fdtbus_syscon_lookup(OF_parent(phandle));
+	if (sc->sc_syscon == NULL) {
+		aprint_error(": couldn't get syscon\n");
 		return;
 	}
+	sc->sc_regbase = addr;
 
 	aprint_naive("\n");
 	aprint_normal(": eMMC PHY\n");



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 19:34:30 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: extent.c jemalloc.c prof.c rtree.c
witness.c

Log Message:
Add noreturn where needed. In the prof case because of cassert() and return
in some functions we disable the cassert() for clang. We should really have
a JEMALLOC_PROF_NORETURN and a way to mark the remaining of the function
unreachable.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/extent.c \
src/external/bsd/jemalloc/dist/src/prof.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/jemalloc/dist/src/jemalloc.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/rtree.c \
src/external/bsd/jemalloc/dist/src/witness.c

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

Modified files:

Index: src/external/bsd/jemalloc/dist/src/extent.c
diff -u src/external/bsd/jemalloc/dist/src/extent.c:1.2 src/external/bsd/jemalloc/dist/src/extent.c:1.3
--- src/external/bsd/jemalloc/dist/src/extent.c:1.2	Mon Mar  4 12:20:07 2019
+++ src/external/bsd/jemalloc/dist/src/extent.c	Sun Mar 10 15:34:30 2019
@@ -697,7 +697,7 @@ extent_interior_register(tsdn_t *tsdn, r
 	}
 }
 
-static void
+static JEMALLOC_NORETURN void
 extent_gdump_add(tsdn_t *tsdn, const extent_t *extent) {
 	cassert(config_prof);
 	/* prof_gdump() requirement. */
@@ -723,7 +723,7 @@ extent_gdump_add(tsdn_t *tsdn, const ext
 	}
 }
 
-static void
+static JEMALLOC_NORETURN void
 extent_gdump_sub(tsdn_t *tsdn, const extent_t *extent) {
 	cassert(config_prof);
 
Index: src/external/bsd/jemalloc/dist/src/prof.c
diff -u src/external/bsd/jemalloc/dist/src/prof.c:1.2 src/external/bsd/jemalloc/dist/src/prof.c:1.3
--- src/external/bsd/jemalloc/dist/src/prof.c:1.2	Mon Mar  4 12:18:53 2019
+++ src/external/bsd/jemalloc/dist/src/prof.c	Sun Mar 10 15:34:30 2019
@@ -207,7 +207,7 @@ rb_gen(static UNUSED, tdata_tree_, prof_
 
 /**/
 
-void
+JEMALLOC_NORETURN void
 prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) {
 	prof_tdata_t *tdata;
 
@@ -237,7 +237,7 @@ prof_alloc_rollback(tsd_t *tsd, prof_tct
 	}
 }
 
-void
+JEMALLOC_NORETURN void
 prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize,
 prof_tctx_t *tctx) {
 	prof_tctx_set(tsdn, ptr, usize, NULL, tctx);
@@ -268,7 +268,7 @@ prof_free_sampled_object(tsd_t *tsd, siz
 	}
 }
 
-void
+JEMALLOC_NORETURN void
 bt_init(prof_bt_t *bt, void **vec) {
 	cassert(config_prof);
 
@@ -276,7 +276,7 @@ bt_init(prof_bt_t *bt, void **vec) {
 	bt->len = 0;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_enter(tsd_t *tsd, prof_tdata_t *tdata) {
 	cassert(config_prof);
 	assert(tdata == prof_tdata_get(tsd, false));
@@ -289,7 +289,7 @@ prof_enter(tsd_t *tsd, prof_tdata_t *tda
 	malloc_mutex_lock(tsd_tsdn(tsd), _mtx);
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_leave(tsd_t *tsd, prof_tdata_t *tdata) {
 	cassert(config_prof);
 	assert(tdata == prof_tdata_get(tsd, false));
@@ -530,7 +530,7 @@ prof_backtrace(prof_bt_t *bt) {
 #undef BT_FRAME
 }
 #else
-void
+JEMALLOC_NORETURN void
 prof_backtrace(prof_bt_t *bt) {
 	cassert(config_prof);
 	not_reached();
@@ -575,7 +575,7 @@ prof_gctx_create(tsdn_t *tsdn, prof_bt_t
 	return gctx;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx,
 prof_tdata_t *tdata) {
 	cassert(config_prof);
@@ -1175,7 +1175,7 @@ label_return:
 	return ret;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_dump_gctx_prep(tsdn_t *tsdn, prof_gctx_t *gctx, prof_gctx_tree_t *gctxs) {
 	cassert(config_prof);
 
@@ -1548,7 +1548,7 @@ label_return:
 	return ret;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_dump_prep(tsd_t *tsd, prof_tdata_t *tdata,
 struct prof_tdata_merge_iter_arg_s *prof_tdata_merge_iter_arg,
 struct prof_gctx_merge_iter_arg_s *prof_gctx_merge_iter_arg,
@@ -1719,7 +1719,7 @@ prof_cnt_all(uint64_t *curobjs, uint64_t
 
 #define DUMP_FILENAME_BUFSIZE	(PATH_MAX + 1)
 #define VSEQ_INVALID		UINT64_C(0x)
-static void
+static JEMALLOC_NORETURN void
 prof_dump_filename(char *filename, char v, uint64_t vseq) {
 	cassert(config_prof);
 
@@ -1741,8 +1741,9 @@ static void
 prof_fdump(void) {
 	tsd_t *tsd;
 	char filename[DUMP_FILENAME_BUFSIZE];
-
+#ifndef __clang__
 	cassert(config_prof);
+#endif
 	assert(opt_prof_final);
 	assert(opt_prof_prefix[0] != '\0');
 
@@ -1778,8 +1779,9 @@ void
 prof_idump(tsdn_t *tsdn) {
 	tsd_t *tsd;
 	prof_tdata_t *tdata;
-
+#ifndef __clang__
 	cassert(config_prof);
+#endif
 
 	if (!prof_booted || tsdn_null(tsdn) || !prof_active_get_unlocked()) {
 		return;
@@ -1835,8 +1837,9 @@ void
 prof_gdump(tsdn_t *tsdn) {
 	tsd_t *tsd;
 	prof_tdata_t *tdata;
-
+#ifndef __clang__
 	cassert(config_prof);
+#endif
 
 	if (!prof_booted 

CVS commit: src/external/bsd/jemalloc/include/jemalloc

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 19:32:56 UTC 2019

Modified Files:
src/external/bsd/jemalloc/include/jemalloc: jemalloc.h
src/external/bsd/jemalloc/include/jemalloc/internal: arena_externs.h
arena_inlines_a.h arena_inlines_b.h atomic_gcc_atomic.h
prof_inlines_b.h

Log Message:
Add noreturn for the benefit of clang


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/bsd/jemalloc/include/jemalloc/jemalloc.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/bsd/jemalloc/include/jemalloc/internal/arena_externs.h \
src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_a.h \
src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_b.h \
src/external/bsd/jemalloc/include/jemalloc/internal/atomic_gcc_atomic.h \
src/external/bsd/jemalloc/include/jemalloc/internal/prof_inlines_b.h

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/jemalloc/include/jemalloc/jemalloc.h
diff -u src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.4 src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.5
--- src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.4	Sun Mar 10 11:45:26 2019
+++ src/external/bsd/jemalloc/include/jemalloc/jemalloc.h	Sun Mar 10 15:32:56 2019
@@ -169,6 +169,7 @@ extern "C" {
 #if defined(_MSC_VER)
 #  define JEMALLOC_ATTR(s)
 #  define JEMALLOC_ALIGNED(s) __declspec(align(s))
+#  define JEMALLOC_NORETURN
 #  define JEMALLOC_ALLOC_SIZE(s)
 #  define JEMALLOC_ALLOC_SIZE2(s1, s2)
 #  ifndef JEMALLOC_EXPORT
@@ -195,6 +196,7 @@ extern "C" {
 #elif defined(JEMALLOC_HAVE_ATTR)
 #  define JEMALLOC_ATTR(s) __attribute__((s))
 #  define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
+#  define JEMALLOC_NORETURN JEMALLOC_ATTR(__noreturn__)
 #  ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
 #define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s))
 #define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2))

Index: src/external/bsd/jemalloc/include/jemalloc/internal/arena_externs.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/arena_externs.h:1.1 src/external/bsd/jemalloc/include/jemalloc/internal/arena_externs.h:1.2
--- src/external/bsd/jemalloc/include/jemalloc/internal/arena_externs.h:1.1	Mon Mar  4 12:25:09 2019
+++ src/external/bsd/jemalloc/include/jemalloc/internal/arena_externs.h	Sun Mar 10 15:32:56 2019
@@ -56,8 +56,8 @@ void *arena_malloc_hard(tsdn_t *tsdn, ar
 szind_t ind, bool zero);
 void *arena_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize,
 size_t alignment, bool zero, tcache_t *tcache);
-void arena_prof_promote(tsdn_t *tsdn, const void *ptr, size_t usize);
-void arena_dalloc_promoted(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
+JEMALLOC_NORETURN void arena_prof_promote(tsdn_t *tsdn, const void *ptr, size_t usize);
+JEMALLOC_NORETURN void arena_dalloc_promoted(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
 bool slow_path);
 void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena,
 extent_t *extent, void *ptr);
Index: src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_a.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_a.h:1.1 src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_a.h:1.2
--- src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_a.h:1.1	Mon Mar  4 12:25:09 2019
+++ src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_a.h	Sun Mar 10 15:32:56 2019
@@ -32,7 +32,7 @@ arena_prof_accum(tsdn_t *tsdn, arena_t *
 	return prof_accum_add(tsdn, >prof_accum, accumbytes);
 }
 
-static inline void
+static JEMALLOC_NORETURN inline void
 percpu_arena_update(tsd_t *tsd, unsigned cpu) {
 	assert(have_percpu_arena);
 	arena_t *oldarena = tsd_arena_get(tsd);
Index: src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_b.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_b.h:1.1 src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_b.h:1.2
--- src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_b.h:1.1	Mon Mar  4 12:25:09 2019
+++ src/external/bsd/jemalloc/include/jemalloc/internal/arena_inlines_b.h	Sun Mar 10 15:32:56 2019
@@ -27,7 +27,7 @@ arena_prof_tctx_get(tsdn_t *tsdn, const 
 	return (prof_tctx_t *)(uintptr_t)1U;
 }
 
-JEMALLOC_ALWAYS_INLINE void
+JEMALLOC_NORETURN JEMALLOC_ALWAYS_INLINE void
 arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, UNUSED size_t usize,
 alloc_ctx_t *alloc_ctx, prof_tctx_t *tctx) {
 	cassert(config_prof);
@@ -46,7 +46,7 @@ arena_prof_tctx_set(tsdn_t *tsdn, const 
 	}
 }
 
-static inline void
+static JEMALLOC_NORETURN inline void
 arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, UNUSED prof_tctx_t *tctx) {
 	cassert(config_prof);
 	assert(ptr != NULL);
Index: src/external/bsd/jemalloc/include/jemalloc/internal/atomic_gcc_atomic.h
diff -u 

CVS commit: src/external/mpl/bind/dist/lib/isc/unix

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 18:03:40 UTC 2019

Modified Files:
src/external/mpl/bind/dist/lib/isc/unix: socket.c

Log Message:
shorten name, use snprintf


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mpl/bind/dist/lib/isc/unix/socket.c

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

Modified files:

Index: src/external/mpl/bind/dist/lib/isc/unix/socket.c
diff -u src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.8 src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.9
--- src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.8	Sun Feb 24 15:01:32 2019
+++ src/external/mpl/bind/dist/lib/isc/unix/socket.c	Sun Mar 10 14:03:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.c,v 1.8 2019/02/24 20:01:32 christos Exp $	*/
+/*	$NetBSD: socket.c,v 1.9 2019/03/10 18:03:40 christos Exp $	*/
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -3956,8 +3956,8 @@ isc_socketmgr_create2(isc_mem_t *mctx, i
 		>threads[i],
 		>threads[i].thread)
 			  == ISC_R_SUCCESS);
-		char tname[1024];
-		sprintf(tname, "isc-socket-%d", i);
+		char tname[128];
+		snprintf(tname, sizeof(tname), "sock-%d", i);
 		isc_thread_setname(manager->threads[i].thread, tname);
 	}
 



CVS commit: src

2019-03-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 10 17:51:00 UTC 2019

Modified Files:
src/share/man/man4: kcov.4
src/sys/kern: subr_kcov.c
src/sys/sys: kcov.h
src/tests/modules: t_kcov.c

Log Message:
Add support for trace type selection in kcov(4)

Allow to specify mode in KCOV_IOC_ENABLE synchronizing the functionality
with Linux, FreeBSD and OpenBSD. As a NetBSD (and OpenBSD) specific of
the ioctl(2) interface, the mode argument has to be specified as 
rather than value.

There are 3 modes available:
 1. KCOV_MODE_NONE   -- no trace specified, useful for testing purposes
 2. KCOV_MODE_TRACE_PC   -- trace the kernel program counter
 3. KCOV_MODE_TRACE_CMP  -- trace comparison instructions and switch statements

Adapt the ATF tests and documentation for new API.

The KCOV_MODE_TRACE_CMP mode is implemented but still awaits for the
GCC 8.x upgrade or selection of Clang/LLVM as the kernel compiler.

Obtained from OpenBSD and adapted for NetBSD by myself.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/kcov.4
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_kcov.c
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/kcov.h
cvs rdiff -u -r1.6 -r1.7 src/tests/modules/t_kcov.c

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/kcov.4
diff -u src/share/man/man4/kcov.4:1.3 src/share/man/man4/kcov.4:1.4
--- src/share/man/man4/kcov.4:1.3	Sun Mar 10 12:54:39 2019
+++ src/share/man/man4/kcov.4	Sun Mar 10 17:51:00 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kcov.4,v 1.3 2019/03/10 12:54:39 kamil Exp $
+.\"	$NetBSD: kcov.4,v 1.4 2019/03/10 17:51:00 kamil Exp $
 .\"
 .\" Copyright (c) 2018 Anton Lindqvist 
 .\"
@@ -82,8 +82,46 @@ entries.
 Note that kcov_int_t is volatile.
 The first entry contains the number of entries in the array,
 excluding the first entry.
-.It Dv KCOV_IOC_ENABLE Fa void
+.It Dv KCOV_IOC_ENABLE Fa int *mode
 Enable code coverage tracing for the current thread.
+The
+.Fa mode
+must be one of the following:
+.Bl -ohang
+.It Dv KCOV_MODE_NONE
+No trace selected.
+This option is useful for testing the
+.Nm
+device.
+.It Dv KCOV_MODE_TRACE_PC
+Trace the kernel program counter.
+.It Dv KCOV_MODE_TRACE_CMP
+Trace comparison instructions and switch statements.
+For switch statements, the number of traced comparison instructions is equal to
+the number of switch cases.
+Each traced comparison instruction is represented by 4 entries in the coverage
+buffer:
+.Bl -enum
+.It
+A mask where the least significant bit is set if one of the comparison operands
+is a compile-time constant, which is always true for switch statements.
+The remaining bits represents the log2 size of the operands, ranging from 0 to
+3.
+.It
+First comparison operand.
+For switch statements, this operand corresponds to the case value.
+.It
+Second comparison operand.
+For switch statements, this operand corresponds to the value passed to switch.
+.It
+Kernel program counter where the comparison instruction took place.
+.El
+.Pp
+In this mode, the first entry in the coverage buffer reflects the number of
+traced comparison instructions.
+Thus, the effective number of entries in the coverage buffer is given by
+multiplying the first entry by 4.
+.El
 .It Dv KCOV_IOC_DISABLE Fa void
 Disable code coverage tracing for the current thread.
 .El
@@ -119,6 +157,7 @@ main(void)
 	kcov_int_t *cover, i, n;
 	uint64_t size = 1024 * 100;
 	int fd;
+	int mode;
 
 	fd = open("/dev/kcov", O_RDWR);
 	if (fd == -1)
@@ -129,7 +168,8 @@ main(void)
 	PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
 	if (cover == MAP_FAILED)
 		err(1, "mmap");
-	if (ioctl(fd, KCOV_IOC_ENABLE) == -1)
+	mode = KCOV_MODE_TRACE_PC;
+	if (ioctl(fd, KCOV_IOC_ENABLE, ) == -1)
 		err(1, "ioctl: KCOV_IOC_ENABLE");
 	KCOV_STORE(cover[0], 0);
 	read(-1, NULL, 0); /* syscall paths to be traced */

Index: src/sys/kern/subr_kcov.c
diff -u src/sys/kern/subr_kcov.c:1.4 src/sys/kern/subr_kcov.c:1.5
--- src/sys/kern/subr_kcov.c:1.4	Sun Mar 10 12:54:39 2019
+++ src/sys/kern/subr_kcov.c	Sun Mar 10 17:51:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kcov.c,v 1.4 2019/03/10 12:54:39 kamil Exp $	*/
+/*	$NetBSD: subr_kcov.c,v 1.5 2019/03/10 17:51:00 kamil Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -50,6 +50,9 @@
 
 #define KCOV_BUF_MAX_ENTRIES	(256 << 10)
 
+#define KCOV_CMP_CONST		1
+#define KCOV_CMP_SIZE(x)	((x) << 1)
+
 static dev_type_open(kcov_open);
 
 const struct cdevsw kcov_cdevsw = {
@@ -107,6 +110,7 @@ typedef struct kcov_desc {
 	struct uvm_object *uobj;
 	size_t bufnent;
 	size_t bufsize;
+	int mode;
 	bool enabled;
 	bool lwpfree;
 } kcov_t;
@@ -231,6 +235,7 @@ static int
 kcov_fops_ioctl(file_t *fp, u_long cmd, void *addr)
 {
 	int error = 0;
+	int mode;
 	kcov_t *kd;
 
 	kd = fp->f_data;
@@ -259,6 +264,20 @@ kcov_fops_ioctl(file_t *fp, u_long cmd, 
 			error = ENOBUFS;
 			break;
 		}
+
+		mode = *((int 

CVS commit: src/sys/arch

2019-03-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Mar 10 16:30:01 UTC 2019

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

Log Message:
Two changes:

 * Allow large pages to be passed in pmap_pdes_valid, this happens under
   DDB when it reads RIP (.text), called via pmap_extract.

 * Invert a branch in pmap_extract, so that 'l_cpu' is not touched if we're
   dealing with the kernel pmap.

This fixes 'boot -d'.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.329 -r1.330 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/xen/x86/xen_pmap.c

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

Modified files:

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.99 src/sys/arch/x86/include/pmap.h:1.100
--- src/sys/arch/x86/include/pmap.h:1.99	Sat Mar  9 08:42:26 2019
+++ src/sys/arch/x86/include/pmap.h	Sun Mar 10 16:30:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.99 2019/03/09 08:42:26 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.100 2019/03/10 16:30:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -372,7 +372,8 @@ void		pmap_map_ptes(struct pmap *, struc
 		pd_entry_t * const **);
 void		pmap_unmap_ptes(struct pmap *, struct pmap *);
 
-int		pmap_pdes_invalid(vaddr_t, pd_entry_t * const *, pd_entry_t *);
+bool		pmap_pdes_valid(vaddr_t, pd_entry_t * const *, pd_entry_t *,
+		int *lastlvl);
 
 u_int		x86_mmap_flags(paddr_t);
 
@@ -424,12 +425,6 @@ bool	pmap_pageidlezero(paddr_t);
  * inline functions
  */
 
-__inline static bool __unused
-pmap_pdes_valid(vaddr_t va, pd_entry_t * const *pdes, pd_entry_t *lastpde)
-{
-	return pmap_pdes_invalid(va, pdes, lastpde) == 0;
-}
-
 /*
  * pmap_update_pg: flush one page from the TLB (or flush the whole thing
  *	if hardware doesn't support one-page flushing)

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.329 src/sys/arch/x86/x86/pmap.c:1.330
--- src/sys/arch/x86/x86/pmap.c:1.329	Sat Mar  9 08:42:26 2019
+++ src/sys/arch/x86/x86/pmap.c	Sun Mar 10 16:30:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.329 2019/03/09 08:42:26 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.330 2019/03/10 16:30:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.329 2019/03/09 08:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.330 2019/03/10 16:30:01 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3031,22 +3031,28 @@ pmap_deactivate(struct lwp *l)
  * some misc. functions
  */
 
-int
-pmap_pdes_invalid(vaddr_t va, pd_entry_t * const *pdes, pd_entry_t *lastpde)
+bool
+pmap_pdes_valid(vaddr_t va, pd_entry_t * const *pdes, pd_entry_t *lastpde,
+int *lastlvl)
 {
-	int i;
 	unsigned long index;
 	pd_entry_t pde;
+	int i;
 
 	for (i = PTP_LEVELS; i > 1; i--) {
 		index = pl_i(va, i);
 		pde = pdes[i - 2][index];
-		if ((pde & PTE_P) == 0)
-			return i;
+		if ((pde & PTE_P) == 0) {
+			*lastlvl = i;
+			return false;
+		}
+		if (pde & PTE_PS)
+			break;
 	}
 	if (lastpde != NULL)
 		*lastpde = pde;
-	return 0;
+	*lastlvl = i;
+	return true;
 }
 
 /*
@@ -3063,6 +3069,7 @@ pmap_extract(struct pmap *pmap, vaddr_t 
 	paddr_t pa;
 	lwp_t *l;
 	bool hard, rv;
+	int lvl;
 
 	if (__predict_false(pmap->pm_extract != NULL)) {
 		return (*pmap->pm_extract)(pmap, va, pap);
@@ -3083,8 +3090,8 @@ pmap_extract(struct pmap *pmap, vaddr_t 
 
 	kpreempt_disable();
 	ci = l->l_cpu;
-	if (__predict_true(!ci->ci_want_pmapload && ci->ci_pmap == pmap) ||
-	pmap == pmap_kernel()) {
+	if (pmap == pmap_kernel() ||
+	__predict_true(!ci->ci_want_pmapload && ci->ci_pmap == pmap)) {
 		/*
 		 * no need to lock, because it's pmap_kernel() or our
 		 * own pmap and is active.  if a user pmap, the caller
@@ -3101,14 +3108,17 @@ pmap_extract(struct pmap *pmap, vaddr_t 
 		hard = true;
 		pmap_map_ptes(pmap, , , );
 	}
-	if (pmap_pdes_valid(va, pdes, )) {
-		pte = ptes[pl1_i(va)];
-		if (pde & PTE_PS) {
+	if (pmap_pdes_valid(va, pdes, , )) {
+		if (lvl == 2) {
 			pa = (pde & PTE_LGFRAME) | (va & (NBPD_L2 - 1));
 			rv = true;
-		} else if (__predict_true((pte & PTE_P) != 0)) {
-			pa = pmap_pte2pa(pte) | (va & (NBPD_L1 - 1));
-			rv = true;
+		} else {
+			KASSERT(lvl == 1);
+			pte = ptes[pl1_i(va)];
+			if (__predict_true((pte & PTE_P) != 0)) {
+pa = pmap_pte2pa(pte) | (va & (NBPD_L1 - 1));
+rv = true;
+			}
 		}
 	}
 	if (__predict_false(hard)) {
@@ -3531,6 +3541,7 @@ pmap_remove(struct pmap *pmap, vaddr_t s
 	vaddr_t blkendva, va = sva;
 	struct vm_page *ptp;
 	struct pmap *pmap2;
+	int lvl;
 
 	if (__predict_false(pmap->pm_remove != NULL)) {
 		(*pmap->pm_remove)(pmap, sva, eva);
@@ -3545,7 +3556,8 @@ pmap_remove(struct 

CVS commit: src/external/bsd/jemalloc/include/jemalloc

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 15:45:26 UTC 2019

Modified Files:
src/external/bsd/jemalloc/include/jemalloc: jemalloc.h jemalloc_defs.h

Log Message:
clang does not have the gnu_printf attribute


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/jemalloc/include/jemalloc/jemalloc.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/bsd/jemalloc/include/jemalloc/jemalloc_defs.h

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/jemalloc/include/jemalloc/jemalloc.h
diff -u src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.3 src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.4
--- src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.3	Sun Mar 10 06:00:29 2019
+++ src/external/bsd/jemalloc/include/jemalloc/jemalloc.h	Sun Mar 10 11:45:26 2019
@@ -11,7 +11,9 @@ extern "C" {
 #define JEMALLOC_HAVE_ATTR_ALLOC_SIZE
 
 /* Defined if format(gnu_printf, ...) attribute is supported. */
+#ifndef __clang__
 #define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
+#endif
 
 /* Defined if format(printf, ...) attribute is supported. */
 #define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF

Index: src/external/bsd/jemalloc/include/jemalloc/jemalloc_defs.h
diff -u src/external/bsd/jemalloc/include/jemalloc/jemalloc_defs.h:1.1 src/external/bsd/jemalloc/include/jemalloc/jemalloc_defs.h:1.2
--- src/external/bsd/jemalloc/include/jemalloc/jemalloc_defs.h:1.1	Mon Mar  4 12:25:09 2019
+++ src/external/bsd/jemalloc/include/jemalloc/jemalloc_defs.h	Sun Mar 10 11:45:26 2019
@@ -5,8 +5,10 @@
 /* Defined if alloc_size attribute is supported. */
 #define JEMALLOC_HAVE_ATTR_ALLOC_SIZE 
 
+#ifndef __clang__
 /* Defined if format(gnu_printf, ...) attribute is supported. */
 #define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF 
+#endif
 
 /* Defined if format(printf, ...) attribute is supported. */
 #define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF 



CVS commit: src/external/bsd/jemalloc/lib

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 15:32:42 UTC 2019

Modified Files:
src/external/bsd/jemalloc/lib: Makefile.inc

Log Message:
turn on debugging to help find problems.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/jemalloc/lib/Makefile.inc

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/jemalloc/lib/Makefile.inc
diff -u src/external/bsd/jemalloc/lib/Makefile.inc:1.4 src/external/bsd/jemalloc/lib/Makefile.inc:1.5
--- src/external/bsd/jemalloc/lib/Makefile.inc:1.4	Sat Mar  9 21:49:52 2019
+++ src/external/bsd/jemalloc/lib/Makefile.inc	Sun Mar 10 11:32:42 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.4 2019/03/10 02:49:52 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.5 2019/03/10 15:32:42 christos Exp $
 
 JEMALLOC:=${.PARSEDIR}/..
 
@@ -39,7 +39,7 @@ witness.c
 .PATH.3: ${JEMALLOC}/dist/doc
 .for i in ${JEMALLOC_SRCS}
 CPPFLAGS.${i}+=-I${JEMALLOC}/include -DJEMALLOC_NO_PRIVATE_NAMESPACE \
--DJEMALLOC_WEAK_NOSTD
+-DJEMALLOC_WEAK_NOSTD -DJEMALLOC_DEBUG
 COPTS.${i}+= -fvisibility=hidden -funroll-loops 
 .endfor
 



CVS commit: src/include

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 15:31:02 UTC 2019

Modified Files:
src/include: malloc.h

Log Message:
catch up with name change.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/include/malloc.h

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

Modified files:

Index: src/include/malloc.h
diff -u src/include/malloc.h:1.6 src/include/malloc.h:1.7
--- src/include/malloc.h:1.6	Sat Mar  9 22:54:08 2019
+++ src/include/malloc.h	Sun Mar 10 11:31:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: malloc.h,v 1.6 2019/03/10 03:54:08 christos Exp $	*/
+/*	$NetBSD: malloc.h,v 1.7 2019/03/10 15:31:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@ void sdallocx(void *, size_t, int);
 size_t nallocx(size_t, int);
 
 int mallctl(const char *, void *, size_t *, void *, size_t);
-int mallctltomib(const char *, size_t *, size_t *);
+int mallctlnametomib(const char *, size_t *, size_t *);
 int mallctlbymib(const size_t *, size_t, void *, size_t *, void *, size_t);
 
 void malloc_stats_print(void (*)(void *, const char *), void *, const char *);



CVS commit: src/bin/sleep

2019-03-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Mar 10 15:18:45 UTC 2019

Modified Files:
src/bin/sleep: sleep.c

Log Message:
Deal with overflow when the sleep duration given is a simple
integer (previously it was just clamped at the max possible value).
This would have caused
sleep 1000
(or anything bigger) to have only actually slept for 9223372036854775807
secs.   Someone would have noticed that happen, one day, in some other
universe.

This is now an error, as it was previously if this had been entered as
sleep 1e19

Also detect an attempt to sleep for so long that a time_t will no longer
be able to represent the current time when the sleep is done.

Undo the attempts to work around a broken kernel nanosleep()
implementation (by only ever issuing shortish sleep requests,
and looping).   That code was broken (idiot botch of mine) though
you would have had to wait a month to observe it happen.  I was going
to just fix it, but sanity prevailed, and the kernel got fixed instead.

That allows this to be much simplified, only looping as needed to
handle dealing with SIGINFO.   Switch to using clock_nanosleep()
to implement the delay, as while our nanosleep() uses CLOCK_MONOTONIC
the standards say it should use CLOCK_REALTIME, and if that we
ever changed that, the old way would alter "sleep 5" from
"sleep for 5 seconds" to "sleep until now + 5 secs", which is
subtly different.

Always use %g format to print the original sleep duration in reports of how
much time remains - this works best for both long and short durations.
A couple of other minor (frill) mods to the SIGINFO report message as well.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/sleep/sleep.c

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

Modified files:

Index: src/bin/sleep/sleep.c
diff -u src/bin/sleep/sleep.c:1.29 src/bin/sleep/sleep.c:1.30
--- src/bin/sleep/sleep.c:1.29	Sun Jan 27 02:00:45 2019
+++ src/bin/sleep/sleep.c	Sun Mar 10 15:18:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sleep.c,v 1.29 2019/01/27 02:00:45 christos Exp $ */
+/* $NetBSD: sleep.c,v 1.30 2019/03/10 15:18:45 kre Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -39,17 +39,19 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)sleep.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: sleep.c,v 1.29 2019/01/27 02:00:45 christos Exp $");
+__RCSID("$NetBSD: sleep.c,v 1.30 2019/03/10 15:18:45 kre Exp $");
 #endif
 #endif /* not lint */
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -73,9 +75,10 @@ main(int argc, char *argv[])
 	const char *msg;
 	double fval, ival, val;
 	struct timespec ntime;
+	struct timespec endtime;
+	struct timespec now;
 	time_t original;
 	int ch, fracflag;
-	unsigned delay;
 
 	setprogname(argv[0]);
 	(void)setlocale(LC_ALL, "");
@@ -145,9 +148,15 @@ main(int argc, char *argv[])
 		if (ntime.tv_sec == 0 && ntime.tv_nsec == 0)
 			return EXIT_SUCCESS;	/* was 0.0 or underflowed */
 	} else {
+		errno = 0;
 		ntime.tv_sec = strtol(arg, , 10);
 		if (ntime.tv_sec < 0 || temp == arg || *temp != '\0')
 			usage();
+		if (errno == ERANGE)
+			errx(EXIT_FAILURE, "Requested delay (%s) out of range",
+			arg);
+		else if (errno != 0)
+			err(EXIT_FAILURE, "Requested delay (%s)", arg);
 
 		if (ntime.tv_sec == 0)
 			return EXIT_SUCCESS;
@@ -155,40 +164,45 @@ main(int argc, char *argv[])
 	}
 
 	original = ntime.tv_sec;
-	if (ntime.tv_nsec != 0)
-		msg = " and a bit";
-	else
+	if (original < 86400) {
+		if (ntime.tv_nsec > 10 * 2 / 3) {
+			original++;
+			msg = " less a bit";
+		} else if (ntime.tv_nsec != 0)
+			msg = " and a bit";
+		else
+			msg = "";
+	} else
 		msg = "";
 
+	if (clock_gettime(CLOCK_MONOTONIC, ) != 0)
+		err(EXIT_FAILURE, "clock_gettime");
+	timespecadd(, , );
+
+	if (endtime.tv_sec < now.tv_sec || (endtime.tv_sec == now.tv_sec &&
+	endtime.tv_nsec <= now.tv_nsec))
+		errx(EXIT_FAILURE, "cannot sleep beyond the end of time");
+
 	signal(SIGINFO, report_request);
+	for (;;) {
+		int e;
+
+		if ((e = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME,
+		 , NULL)) == 0)
+			return EXIT_SUCCESS;
 
-	if (ntime.tv_sec <= 1) {			/* arbitrary */
-		while (nanosleep(, ) != 0) {
-			if (report_requested) {
-report(ntime.tv_sec, original, msg);
-report_requested = 0;
-			} else
-err(EXIT_FAILURE, "nanosleep failed");
+		if (!report_requested || e != EINTR) {
+			errno = e;
+			err(EXIT_FAILURE, "clock_nanotime");
 		}
-	} else while (ntime.tv_sec > 0) {
-		delay = (unsigned int)ntime.tv_sec;
 
-		if ((time_t)delay != ntime.tv_sec || delay > 30 * 86400)
-			delay = 30 * 86400;
+		report_requested = 0;
+		if (clock_gettime(CLOCK_MONOTONIC, ) != 0) /* Huh? */
+			continue;
 
-		ntime.tv_sec -= delay;
-		delay = sleep(delay);
-		ntime.tv_sec += delay;
-
-		if (delay != 0 && 

CVS commit: src/sys/kern

2019-03-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Mar 10 14:45:53 UTC 2019

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

Log Message:
Fix the code that deals with very long sleeps (> 248 days) which
go beyond the maximum that the callout mechanism can handle.
[See the comments in tvtohz() in subr_sleep.c for the details.]

When that happens the timeout is clamped to MAX_INT (ticks), and the
code in nanosleep1() looped (or tried to) repeating the sleep (aka
kpause()) until the requested end time for the sleep was reached.

Unfortunately, the code assumed that kpause() would return 0 when
it returned after the timeout expired.   But it doesn't, it returns
EWOULDBLOCK instead (why is incomprehensible to me, but I assume
there is a reason.)   [That comes from sleepq_block() which returns
EWOULDBLOCK when callout_halt() indicates that the callout had fired,
which is exactly what has happened when the time has elapsed.]

There was already code to deal with that EWOULDBLOCK and return 0
instead of an error in that case - but it was placed after the
error code was tested against 0 for the purposes of the loop.

Simply move the EWOULDBLOCK->0 mapping earlier, so the code which
is expecting "error == 0" to mean "nothing went wrong" actually
gets to see that happen, and the loop can actually loop.

(Someday the loop should probably be rewritten as a loop, instead of
as a bunch of code followed by a "goto again"!)


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/kern/kern_time.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/kern_time.c
diff -u src/sys/kern/kern_time.c:1.196 src/sys/kern/kern_time.c:1.197
--- src/sys/kern/kern_time.c:1.196	Sun Feb 24 07:23:11 2019
+++ src/sys/kern/kern_time.c	Sun Mar 10 14:45:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.196 2019/02/24 07:23:11 mlelstv Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.197 2019/03/10 14:45:53 kre Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.196 2019/02/24 07:23:11 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.197 2019/03/10 14:45:53 kre Exp $");
 
 #include 
 #include 
@@ -350,6 +350,8 @@ nanosleep1(struct lwp *l, clockid_t cloc
 		timo = 1;
 again:
 	error = kpause("nanoslp", true, timo, NULL);
+	if (error == EWOULDBLOCK)
+		error = 0;
 	if (rmt != NULL || error == 0) {
 		struct timespec rmtend;
 		struct timespec t0;
@@ -374,8 +376,6 @@ again:
 
 	if (error == ERESTART)
 		error = EINTR;
-	if (error == EWOULDBLOCK)
-		error = 0;
 
 	return error;
 }



CVS commit: src/external/mit/xorg/include

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 13:52:11 UTC 2019

Modified Files:
src/external/mit/xorg/include: Makefile

Log Message:
only do vdpau headers on vdpau systems.

XXX: make this a common define in the few places


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/xorg/include/Makefile

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

Modified files:

Index: src/external/mit/xorg/include/Makefile
diff -u src/external/mit/xorg/include/Makefile:1.8 src/external/mit/xorg/include/Makefile:1.9
--- src/external/mit/xorg/include/Makefile:1.8	Sun Mar 10 11:18:02 2019
+++ src/external/mit/xorg/include/Makefile	Sun Mar 10 13:52:11 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2019/03/10 11:18:02 mrg Exp $
+#	$NetBSD: Makefile,v 1.9 2019/03/10 13:52:11 mrg Exp $
 
 # *proto packages for xorg
 
@@ -7,7 +7,10 @@
 .if ${HAVE_MESA_VER} == 18
 SUBDIR=		KHR 
 .endif
-SUBDIR+=	libvdpau xorgproto xbitmaps xcb-proto
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "evbarm"
+SUBDIR+=	libvdpau
+.endif
+SUBDIR+=	xorgproto xbitmaps xcb-proto
 SUBDIR+=	.WAIT xtrans
 
 .include 



CVS commit: src/sys/kern

2019-03-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Mar 10 13:44:49 UTC 2019

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

Log Message:
Undo previous, in the name of "defined" behaviour, it breaks things.

This is all explained in the comment at the head of the file:

 * Some of the "math" in here is a bit tricky.  We have to beware of
 * wrapping ints.
 *
 * [...] but c->c_time can
 * be positive or negative so comparing it with anything is dangerous.

In particular, "if (c->c_time > ticks)" is simply wrong.

 * The only way we can use the c->c_time value in any predictable way is
 * when we calculate how far in the future `to' will timeout - "c->c_time
 * - c->c_cpu->cc_ticks".  The result will always be positive for future
 * timeouts and 0 or negative for due timeouts.

Go back to the old way.   But write the calculation of delta slightly
differently which will hopefully appease KUBsan.   Perhaps.  In any
case, this code works on any system that NetBSD has any hope of ever
running on, whatever the C standards say is "defined" behaviour.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/kern_timeout.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/kern_timeout.c
diff -u src/sys/kern/kern_timeout.c:1.55 src/sys/kern/kern_timeout.c:1.56
--- src/sys/kern/kern_timeout.c:1.55	Sun Jul  8 14:42:52 2018
+++ src/sys/kern/kern_timeout.c	Sun Mar 10 13:44:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_timeout.c,v 1.55 2018/07/08 14:42:52 kamil Exp $	*/
+/*	$NetBSD: kern_timeout.c,v 1.56 2019/03/10 13:44:49 kre Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.55 2018/07/08 14:42:52 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.56 2019/03/10 13:44:49 kre Exp $");
 
 /*
  * Timeouts are kept in a hierarchical timing wheel.  The c_time is the
@@ -717,12 +717,12 @@ callout_softclock(void *v)
 
 		/* If due run it, otherwise insert it into the right bucket. */
 		ticks = cc->cc_ticks;
-		if (c->c_time > ticks) {
-			delta = c->c_time - ticks;
+		delta = (int)((unsigned)c->c_time - (unsigned)ticks);
+		if (delta > 0) {
 			CIRCQ_INSERT(>c_list, BUCKET(cc, delta, c->c_time));
 			continue;
 		}
-		if (c->c_time < ticks)
+		if (delta < 0)
 			cc->cc_ev_late.ev_count++;
 
 		c->c_flags = (c->c_flags & ~CALLOUT_PENDING) |



CVS commit: src/tests/modules

2019-03-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 10 13:24:51 UTC 2019

Modified Files:
src/tests/modules: t_kcov.c

Log Message:
Fix bug in kcov_multiple_threads in t_kcov

Spawn the expected number of threads rather than hardcoding one value for
all tests.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/modules/t_kcov.c

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

Modified files:

Index: src/tests/modules/t_kcov.c
diff -u src/tests/modules/t_kcov.c:1.5 src/tests/modules/t_kcov.c:1.6
--- src/tests/modules/t_kcov.c:1.5	Sun Mar 10 12:54:39 2019
+++ src/tests/modules/t_kcov.c	Sun Mar 10 13:24:50 2019
@@ -418,10 +418,10 @@ kcov_multiple_threads(size_t N)
 
 	ATF_REQUIRE(__arraycount(thread) >= N);
 
-	for (i = 0; i < __arraycount(thread); i++)
+	for (i = 0; i < N; i++)
 		pthread_create([i], NULL, multiple_threads_helper, NULL);
 
-	for (i = 0; i < __arraycount(thread); i++)
+	for (i = 0; i < N; i++)
 		pthread_join(thread[i], NULL);
 }
 



CVS commit: src/doc

2019-03-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 10 12:59:03 UTC 2019

Modified Files:
src/doc: TODO.sanitizers

Log Message:
Sync TODO.sanitizers with reality

Mark compiler-rt sanitizers as imported into src/, but still not
integrated (waiting for Clang/LLVM upgrade to 8.0 or newer).

ESan has been discontinued upstream, drop from plans.

lld ported to NetBSD by , but we need to keep local patches.

Mark kernel-msan as finished for Linux

Mark syzkaller and KCOV as finished projects.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/doc/TODO.sanitizers

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

Modified files:

Index: src/doc/TODO.sanitizers
diff -u src/doc/TODO.sanitizers:1.10 src/doc/TODO.sanitizers:1.11
--- src/doc/TODO.sanitizers:1.10	Thu Dec 27 21:20:40 2018
+++ src/doc/TODO.sanitizers	Sun Mar 10 12:59:03 2019
@@ -1,7 +1,7 @@
 Sanitizer and related tasks.
 
 Short term:
- - compiler-rt import and integration with base
+ - compiler-rt sanitizers integration with base
  - merge TSan, MSan and libFuzzer ATF tests
  - prepare MKSANITIZER readme
 
@@ -12,7 +12,6 @@ Long term:
  - improve the framework for ioctl(2) database and handle special cases when a
part of a struct can be uninitialized and passed to the kernel (MSan)
  - port or finish the port of:
-   * ESan,
* LSan,
* shadowcallstack,
* cfi,
@@ -29,7 +28,6 @@ Long term:
  - attach a NetBSD buildbot testing build of compiler-rt and executing tests
  - make compiler-rt buildable with GCC
  - finish the support of float128 for Clang/LLVM/libstdc++/libgcc
- - lld port to NetBSD (GNU ld(1) is too slow for serious LLVM development)
  - merge of the libFuzzer integration with the basesystem
  - oom-killer ATF tests and fixes
  - utime(3) allow changing actime regardless of noatime mount property
@@ -38,10 +36,7 @@ Long term:
 
 
 Unspecified:
+ - kernel-msan https://github.com/google/kmsan
  - kernel-tsan? upstream development is stalled with patches for Linux 4.2
https://github.com/google/ktsan
- - kernek-msan? in development for Linux
-   https://github.com/google/kmsan
  - kernel-safestack? implemented in Fuchsia/Magenta
- - kernel coverage (KCOV?)
- - syzkaller port



CVS commit: src

2019-03-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 10 12:54:39 UTC 2019

Modified Files:
src/share/man/man4: kcov.4
src/sys/kern: subr_kcov.c
src/tests/modules: t_kcov.c

Log Message:
Add support for multiple threads in kcov(4)

Reuse the fd_clone() API to associate kcov descriptors (KD) with a file
descriptor. Each fd (/dev/kcov) can be reused for a single LWP.

Add new ATF regression tests and cleanup existing code there. All tests
pass.

Refresh the kcov(4) man page documentation.

Developed with help from .


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/kcov.4
cvs rdiff -u -r1.3 -r1.4 src/sys/kern/subr_kcov.c
cvs rdiff -u -r1.4 -r1.5 src/tests/modules/t_kcov.c

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/kcov.4
diff -u src/share/man/man4/kcov.4:1.2 src/share/man/man4/kcov.4:1.3
--- src/share/man/man4/kcov.4:1.2	Sat Feb 23 17:33:01 2019
+++ src/share/man/man4/kcov.4	Sun Mar 10 12:54:39 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kcov.4,v 1.2 2019/02/23 17:33:01 wiz Exp $
+.\"	$NetBSD: kcov.4,v 1.3 2019/03/10 12:54:39 kamil Exp $
 .\"
 .\" Copyright (c) 2018 Anton Lindqvist 
 .\"
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd November 16, 2018
+.Dd March 10, 2019
 .Dt KCOV 4
 .Os
 .Sh NAME
@@ -28,12 +28,35 @@
 The
 .Nm
 driver implements collection of code coverage inside the kernel.
-It can be enabled on a per process basis from userland,
+It can be enabled on a per thread basis from userland,
 allowing the kernel program counter to be collected during syscalls triggered by
-the same process.
+the same thread.
+.Pp
+The
+.Nm
+descriptors (KD) are allocated during
+.Xr open 2 ,
+and are associated with a file descriptor.
+A thread can enable the
+.Nm
+device.
+When this happens,
+this thread becomes the owner of the
+.Nm
+descriptors (KD),
+and no thread can disable this KD except the owner.
+.Pp
+A
+.Nm
+descriptor (KD)
+is freed when its file descriptor is closed iff the KD is not active on a thread.
+If it is,
+we ask the thread to free it when it exits.
+.Pp
 The collected coverage can be accessed by mapping the device
 using
 .Xr mmap 2 .
+The buffers are mapped without risk that the kernel frees a buffer still mapped in a process.
 .Pp
 By default,
 .Nm
@@ -94,7 +117,7 @@ int
 main(void)
 {
 	kcov_int_t *cover, i, n;
-	kcov_int_t size = 1024 * 100;
+	uint64_t size = 1024 * 100;
 	int fd;
 
 	fd = open("/dev/kcov", O_RDWR);
@@ -108,9 +131,9 @@ main(void)
 		err(1, "mmap");
 	if (ioctl(fd, KCOV_IOC_ENABLE) == -1)
 		err(1, "ioctl: KCOV_IOC_ENABLE");
-	__atomic_store_n([0], 0, __ATOMIC_RELAXED);
+	KCOV_STORE(cover[0], 0);
 	read(-1, NULL, 0); /* syscall paths to be traced */
-	n = __atomic_load_n([0], __ATOMIC_RELAXED);
+	n = KCOV_LOAD(cover[0]);
 	if (ioctl(fd, KCOV_IOC_DISABLE) == -1)
 		err(1, "ioctl: KCOV_IOC_DISABLE");
 	for (i = 0; i < cover[0]; i++)

Index: src/sys/kern/subr_kcov.c
diff -u src/sys/kern/subr_kcov.c:1.3 src/sys/kern/subr_kcov.c:1.4
--- src/sys/kern/subr_kcov.c:1.3	Sat Feb 23 12:07:40 2019
+++ src/sys/kern/subr_kcov.c	Sun Mar 10 12:54:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kcov.c,v 1.3 2019/02/23 12:07:40 kamil Exp $	*/
+/*	$NetBSD: subr_kcov.c,v 1.4 2019/03/10 12:54:39 kamil Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -38,7 +38,10 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 
@@ -47,28 +50,67 @@
 
 #define KCOV_BUF_MAX_ENTRIES	(256 << 10)
 
+static dev_type_open(kcov_open);
+
+const struct cdevsw kcov_cdevsw = {
+	.d_open = kcov_open,
+	.d_close = noclose,
+	.d_read = noread,
+	.d_write = nowrite,
+	.d_ioctl = noioctl,
+	.d_stop = nostop,
+	.d_tty = notty,
+	.d_poll = nopoll,
+	.d_mmap = nommap,
+	.d_kqfilter = nokqfilter,
+	.d_discard = nodiscard,
+	.d_flag = D_OTHER | D_MPSAFE
+};
+
+static int kcov_fops_ioctl(file_t *, u_long, void *);
+static int kcov_fops_close(file_t *);
+static int kcov_fops_mmap(file_t *, off_t *, size_t, int, int *, int *,
+struct uvm_object **, int *);
+
+const struct fileops kcov_fileops = {
+	.fo_read = fbadop_read,
+	.fo_write = fbadop_write,
+	.fo_ioctl = kcov_fops_ioctl,
+	.fo_fcntl = fnullop_fcntl,
+	.fo_poll = fnullop_poll,
+	.fo_stat = fbadop_stat,
+	.fo_close = kcov_fops_close,
+	.fo_kqfilter = fnullop_kqfilter,
+	.fo_restart = fnullop_restart,
+	.fo_mmap = kcov_fops_mmap,
+};
+
 /*
- * The KCOV descriptors are allocated during open(), and are associated with
- * the calling proc. They are freed lazily when their refcount reaches zero,
- * only when the process exits; this guarantees that kd->buf is not mmapped
- * in a currently running LWP. A KCOV descriptor is active on only one LWP
- * at the same time within the proc.
+ * The KCOV descriptors (KD) are allocated 

CVS commit: src/sys/kern

2019-03-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar 10 12:49:48 UTC 2019

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

Log Message:
Fix two oddities...

- remove extraneous semi-colons from do { } while (0) macro definitions
- actually wrap MUTEX_INITIALIZE_ADAPTIVE contents in do { }

Spotted by kre@


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/kern_mutex.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/kern_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.75 src/sys/kern/kern_mutex.c:1.76
--- src/sys/kern/kern_mutex.c:1.75	Fri Aug 31 01:23:57 2018
+++ src/sys/kern/kern_mutex.c	Sun Mar 10 12:49:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.75 2018/08/31 01:23:57 ozaki-r Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.76 2019/03/10 12:49:48 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.75 2018/08/31 01:23:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.76 2019/03/10 12:49:48 skrll Exp $");
 
 #include 
 #include 
@@ -98,7 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_mutex.c
 do {\
 	if (__predict_false(!(cond)))\
 		MUTEX_ABORT(mtx, "assertion failed: " #cond);	\
-} while (/* CONSTCOND */ 0);
+} while (/* CONSTCOND */ 0)
 
 #else	/* LOCKDEBUG */
 
@@ -182,10 +182,10 @@ do {	\
 	(((int)(mtx)->mtx_owner & MUTEX_BIT_WAITERS) != 0)
 
 #define	MUTEX_INITIALIZE_ADAPTIVE(mtx, dodebug)\
+do {	\
 	if (!dodebug)			\
 		(mtx)->mtx_owner |= MUTEX_BIT_NODEBUG;			\
-do {	\
-} while (/* CONSTCOND */ 0);
+} while (/* CONSTCOND */ 0)
 
 #define	MUTEX_INITIALIZE_SPIN(mtx, dodebug, ipl)			\
 do {	\
@@ -199,7 +199,7 @@ do {	\
 #define	MUTEX_DESTROY(mtx)		\
 do {	\
 	(mtx)->mtx_owner = MUTEX_THREAD;\
-} while (/* CONSTCOND */ 0);
+} while (/* CONSTCOND */ 0)
 
 #define	MUTEX_SPIN_P(mtx)		\
 (((mtx)->mtx_owner & MUTEX_BIT_SPIN) != 0)



CVS commit: src

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 12:44:58 UTC 2019

Modified Files:
src/distrib/sets/lists/xcomp: md.amd64 md.evbarm md.i386
src/external/mit/xorg/lib/libvdpau: Makefile

Log Message:
libvdpau pkg-config file is called vdpau.pc.

this does not need a special rule, just to be named correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/distrib/sets/lists/xcomp/md.amd64
cvs rdiff -u -r1.9 -r1.10 src/distrib/sets/lists/xcomp/md.evbarm
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/xcomp/md.i386
cvs rdiff -u -r1.1 -r1.2 src/external/mit/xorg/lib/libvdpau/Makefile

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/xcomp/md.amd64
diff -u src/distrib/sets/lists/xcomp/md.amd64:1.51 src/distrib/sets/lists/xcomp/md.amd64:1.52
--- src/distrib/sets/lists/xcomp/md.amd64:1.51	Sun Mar 10 11:18:02 2019
+++ src/distrib/sets/lists/xcomp/md.amd64	Sun Mar 10 12:44:58 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.51 2019/03/10 11:18:02 mrg Exp $
+# $NetBSD: md.amd64,v 1.52 2019/03/10 12:44:58 mrg Exp $
 ./usr/X11R7/include/intel_bufmgr.h			-unknown-	obsolete
 ./usr/X11R7/include/libdrm/nouveau/nvif/cl0080.h	-unknown-	xorg
 ./usr/X11R7/include/libdrm/nouveau/nvif/cl9097.h	-unknown-	xorg
@@ -34,7 +34,7 @@
 ./usr/X11R7/lib/libvdpau.a-unknown-	xorg,compatx11file
 ./usr/X11R7/lib/libvdpau_p.a-unknown-	profile,xorg,compatx11file
 ./usr/X11R7/lib/libvdpau_pic.a-unknown-	xorg,picinstall,compatx11file
-#./usr/X11R7/lib/pkgconfig/libvdpau.pc			-unknown-	xorg
+./usr/X11R7/lib/pkgconfig/vdpau.pc			-unknown-	xorg
 ./usr/X11R7/lib/pkgconfig/libdrm_amdgpu.pc		-unknown-	xorg
 ./usr/X11R7/lib/pkgconfig/libdrm_intel.pc		-unknown-	xorg
 ./usr/X11R7/lib/pkgconfig/libdrm_nouveau.pc		-unknown-	xorg

Index: src/distrib/sets/lists/xcomp/md.evbarm
diff -u src/distrib/sets/lists/xcomp/md.evbarm:1.9 src/distrib/sets/lists/xcomp/md.evbarm:1.10
--- src/distrib/sets/lists/xcomp/md.evbarm:1.9	Sun Mar 10 11:18:02 2019
+++ src/distrib/sets/lists/xcomp/md.evbarm	Sun Mar 10 12:44:58 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbarm,v 1.9 2019/03/10 11:18:02 mrg Exp $
+# $NetBSD: md.evbarm,v 1.10 2019/03/10 12:44:58 mrg Exp $
 ./usr/X11R7/include/libdrm/nouveau/nvif/cl0080.h	-unknown-	xorg
 ./usr/X11R7/include/libdrm/nouveau/nvif/cl9097.h	-unknown-	xorg
 ./usr/X11R7/include/libdrm/nouveau/nvif/class.h		-unknown-	xorg
@@ -15,6 +15,6 @@
 ./usr/X11R7/lib/libvdpau.a-unknown-	xorg,compatx11file
 ./usr/X11R7/lib/libvdpau_p.a-unknown-	profile,xorg,compatx11file
 ./usr/X11R7/lib/libvdpau_pic.a-unknown-	xorg,picinstall,compatx11file
-#./usr/X11R7/lib/pkgconfig/libvdpau.pc			-unknown-	xorg
+./usr/X11R7/lib/pkgconfig/vdpau.pc			-unknown-	xorg
 ./usr/X11R7/lib/pkgconfig/libdrm_nouveau.pc		-unknown-	xorg
 ./usr/libdata/lint/llib-ldrm_nouveau.ln			-unknown-	lint,xorg

Index: src/distrib/sets/lists/xcomp/md.i386
diff -u src/distrib/sets/lists/xcomp/md.i386:1.56 src/distrib/sets/lists/xcomp/md.i386:1.57
--- src/distrib/sets/lists/xcomp/md.i386:1.56	Sun Mar 10 11:18:02 2019
+++ src/distrib/sets/lists/xcomp/md.i386	Sun Mar 10 12:44:58 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.56 2019/03/10 11:18:02 mrg Exp $
+# $NetBSD: md.i386,v 1.57 2019/03/10 12:44:58 mrg Exp $
 #./usr/libdata/lint/llib-lIntelXvMC.ln			-unknown-	lint,xorg
 ./usr/X11R7/include/intel_bufmgr.h			-unknown-	obsolete
 ./usr/X11R7/include/libdrm/nouveau/nvif/cl0080.h	-unknown-	xorg
@@ -35,7 +35,7 @@
 ./usr/X11R7/lib/libvdpau.a-unknown-	xorg,compatx11file
 ./usr/X11R7/lib/libvdpau_p.a-unknown-	profile,xorg,compatx11file
 ./usr/X11R7/lib/libvdpau_pic.a-unknown-	xorg,picinstall,compatx11file
-#./usr/X11R7/lib/pkgconfig/libvdpau.pc			-unknown-	xorg
+./usr/X11R7/lib/pkgconfig/vdpau.pc			-unknown-	xorg
 ./usr/X11R7/lib/pkgconfig/libdrm_amdgpu.pc		-unknown-	xorg
 ./usr/X11R7/lib/pkgconfig/libdrm_intel.pc		-unknown-	xorg
 ./usr/X11R7/lib/pkgconfig/libdrm_nouveau.pc		-unknown-	xorg

Index: src/external/mit/xorg/lib/libvdpau/Makefile
diff -u src/external/mit/xorg/lib/libvdpau/Makefile:1.1 src/external/mit/xorg/lib/libvdpau/Makefile:1.2
--- src/external/mit/xorg/lib/libvdpau/Makefile:1.1	Sun Mar 10 11:18:02 2019
+++ src/external/mit/xorg/lib/libvdpau/Makefile	Sun Mar 10 12:44:58 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2019/03/10 11:18:02 mrg Exp $
+#	$NetBSD: Makefile,v 1.2 2019/03/10 12:44:58 mrg Exp $
 
 .include 
 
@@ -18,8 +18,7 @@ CFLAGS+=	-DVDPAU_SYSCONFDIR=\"${VDPAU_SY
 SHLIB_MAJOR=	1
 SHLIB_MINOR=	0
 
-# XXX todo
-#PKGDIST=	libvdpau
+PKGDIST=	vdpau
 
 .include 
 .include 



CVS commit: src

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 12:14:07 UTC 2019

Modified Files:
src/external/bsd/llvm/lib/libLLVMExecutionEngine: Makefile
src/external/bsd/llvm/lib/libLLVMIR: Makefile
src/external/bsd/llvm/lib/libLLVMInstCombine: Makefile
src/external/bsd/llvm/lib/libLLVMMCJIT: Makefile
src/external/bsd/llvm/lib/libLLVMRuntimeDyld: Makefile
Added Files:
src/external/bsd/llvm/lib/libLLVMAMDGPUAsmParser: Makefile
src/external/bsd/llvm/lib/libLLVMAMDGPUAsmPrinter: Makefile
src/external/bsd/llvm/lib/libLLVMAMDGPUCodeGen: Makefile
src/external/bsd/llvm/lib/libLLVMAMDGPUDisassembler: Makefile
src/external/bsd/llvm/lib/libLLVMAMDGPUMCTargetDesc: Makefile
src/external/bsd/llvm/lib/libLLVMAMDGPUTargetInfo: Makefile
src/external/bsd/llvm/lib/libLLVMAMDGPUUtils: Makefile
src/tools/llvm-lib/libLLVMAMDGPUAsmParser: Makefile
src/tools/llvm-lib/libLLVMAMDGPUAsmPrinter: Makefile
src/tools/llvm-lib/libLLVMAMDGPUCodeGen: Makefile
src/tools/llvm-lib/libLLVMAMDGPUDisassembler: Makefile
src/tools/llvm-lib/libLLVMAMDGPUMCTargetDesc: Makefile
src/tools/llvm-lib/libLLVMAMDGPUTargetInfo: Makefile
src/tools/llvm-lib/libLLVMAMDGPUUtils: Makefile
src/tools/llvm-lib/libLLVMExecutionEngine: Makefile
src/tools/llvm-lib/libLLVMMCJIT: Makefile

Log Message:
add most of the AMDGPU target makefiles and stuff that don't
touch the build.  this comes from:

commit f90685c11d4460d3098fa35f48b58d1893e974e0
Author: Maya Rashish 
Date:   Sat Feb 23 09:46:14 2019 +0200

Separate MKCLANG from MKLLVM.

build LLVM libraries as PIC.
Add AMDGPU target, and adjust tools accordingly.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/llvm/lib/libLLVMAMDGPUAsmParser/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/llvm/lib/libLLVMAMDGPUAsmPrinter/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/llvm/lib/libLLVMAMDGPUCodeGen/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/llvm/lib/libLLVMAMDGPUDisassembler/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/llvm/lib/libLLVMAMDGPUMCTargetDesc/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/llvm/lib/libLLVMAMDGPUTargetInfo/Makefile
cvs rdiff -u -r0 -r1.1 src/external/bsd/llvm/lib/libLLVMAMDGPUUtils/Makefile
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/llvm/lib/libLLVMExecutionEngine/Makefile
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/llvm/lib/libLLVMIR/Makefile
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/llvm/lib/libLLVMInstCombine/Makefile
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/llvm/lib/libLLVMMCJIT/Makefile
cvs rdiff -u -r1.9 -r1.10 \
src/external/bsd/llvm/lib/libLLVMRuntimeDyld/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMAMDGPUAsmParser/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMAMDGPUAsmPrinter/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMAMDGPUCodeGen/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMAMDGPUDisassembler/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMAMDGPUMCTargetDesc/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMAMDGPUTargetInfo/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMAMDGPUUtils/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMExecutionEngine/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/llvm-lib/libLLVMMCJIT/Makefile

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/llvm/lib/libLLVMExecutionEngine/Makefile
diff -u src/external/bsd/llvm/lib/libLLVMExecutionEngine/Makefile:1.6 src/external/bsd/llvm/lib/libLLVMExecutionEngine/Makefile:1.7
--- src/external/bsd/llvm/lib/libLLVMExecutionEngine/Makefile:1.6	Sat Feb 27 21:47:33 2016
+++ src/external/bsd/llvm/lib/libLLVMExecutionEngine/Makefile	Sun Mar 10 12:14:06 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2016/02/27 21:47:33 joerg Exp $
+#	$NetBSD: Makefile,v 1.7 2019/03/10 12:14:06 mrg Exp $
 
 LIB=	LLVMExecutionEngine
 
@@ -12,4 +12,8 @@ SRCS+=	GDBRegistrationListener.cpp \
 	SectionMemoryManager.cpp \
 	TargetSelect.cpp
 
+.if defined(HOSTLIB)
+.include 
+.else
 .include 
+.endif

Index: src/external/bsd/llvm/lib/libLLVMIR/Makefile
diff -u src/external/bsd/llvm/lib/libLLVMIR/Makefile:1.13 src/external/bsd/llvm/lib/libLLVMIR/Makefile:1.14
--- src/external/bsd/llvm/lib/libLLVMIR/Makefile:1.13	Tue Jul 17 18:55:28 2018
+++ src/external/bsd/llvm/lib/libLLVMIR/Makefile	Sun Mar 10 12:14:06 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2018/07/17 18:55:28 joerg Exp $
+#	$NetBSD: Makefile,v 1.14 2019/03/10 12:14:06 mrg Exp $
 
 LIB=	LLVMIR
 
@@ -10,6 +10,8 @@ TABLEGEN_SRC=		AttributesCompatFunc.td
 TABLEGEN_OUTPUT= \
 	AttributesCompatFunc.inc|-gen-attrs
 
+.include "${.PARSEDIR}/../../tablegen.mk"
+
 SRCS+=	AsmWriter.cpp \
 	Attributes.cpp \
 	AutoUpgrade.cpp \
@@ -62,8 

CVS commit: src/doc

2019-03-10 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Mar 10 11:53:35 UTC 2019

Modified Files:
src/doc: 3RDPARTY

Log Message:
Update mandoc entry, and note new 1.14.5 release.


To generate a diff of this commit:
cvs rdiff -u -r1.1600 -r1.1601 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1600 src/doc/3RDPARTY:1.1601
--- src/doc/3RDPARTY:1.1600	Mon Mar  4 17:36:35 2019
+++ src/doc/3RDPARTY	Sun Mar 10 11:53:35 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1600 2019/03/04 17:36:35 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1601 2019/03/10 11:53:35 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -876,11 +876,11 @@ Notes:
 
 Package:	mandoc
 Version:	1.14.4
-Current Vers:	1.14.4
-Maintainer:	Kristaps Džonsons
-Archive Site:	http://mdocml.bsd.lv/snapshots/
-Home Page:	http://mdocml.bsd.lv/
-Date:		2019-01-09
+Current Vers:	1.14.5
+Maintainer:	Kristaps Džonsons/Ingo Schwarze
+Archive Site:	http://mandoc.bsd.lv/snapshots/
+Home Page:	http://mandoc.bsd.lv/
+Date:		2019-03-10
 Mailing List:
 Responsible:	joerg
 License:	BSD (2-clause)



CVS commit: src

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 11:18:03 UTC 2019

Modified Files:
src/distrib/sets/lists/xbase: md.amd64 md.i386 mi
src/distrib/sets/lists/xcomp: md.amd64 md.evbarm md.i386 mi
src/distrib/sets/lists/xdebug: md.amd64 md.evbarm md.evbarm.armeb
md.i386
src/etc/mtree: NetBSD.dist.Xorg
src/external/mit/xorg/include: Makefile
src/external/mit/xorg/lib: Makefile
Added Files:
src/external/mit/xorg/include/libvdpau: Makefile
src/external/mit/xorg/lib/libvdpau: Makefile

Log Message:
- build and install libvdpau and x86 and evbarm.
- add khrplatform.h for mesa_ver=18 platforms.

need to enable libvdpau.pc generation (needs special rules)

this mostly comes from maya in the first one, and a small part
of the second:

commit 48eb746983a5a7967fba221e7b167808af36f44a
Author: Maya Rashish 
Date:   Sun Feb 24 09:31:22 2019 +0200

More of vdpau. Cogs spin.

commit d9fbba8f61a43648d32f160c5fa62626788566ff
Author: Maya Rashish 
Date:   Sat Feb 23 22:36:37 2019 +0200

Adjust for MesaLib 18.

Build llvmpipe driver on x86 (the driver itself is x86-only).
build llvm on all x86, even on GCC builds.
galahad driver removed (upstream).
Don't build mesa 7 at all.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/lists/xbase/md.amd64
cvs rdiff -u -r1.30 -r1.31 src/distrib/sets/lists/xbase/md.i386
cvs rdiff -u -r1.148 -r1.149 src/distrib/sets/lists/xbase/mi
cvs rdiff -u -r1.50 -r1.51 src/distrib/sets/lists/xcomp/md.amd64
cvs rdiff -u -r1.8 -r1.9 src/distrib/sets/lists/xcomp/md.evbarm
cvs rdiff -u -r1.55 -r1.56 src/distrib/sets/lists/xcomp/md.i386
cvs rdiff -u -r1.205 -r1.206 src/distrib/sets/lists/xcomp/mi
cvs rdiff -u -r1.43 -r1.44 src/distrib/sets/lists/xdebug/md.amd64
cvs rdiff -u -r1.18 -r1.19 src/distrib/sets/lists/xdebug/md.evbarm
cvs rdiff -u -r1.10 -r1.11 src/distrib/sets/lists/xdebug/md.evbarm.armeb
cvs rdiff -u -r1.40 -r1.41 src/distrib/sets/lists/xdebug/md.i386
cvs rdiff -u -r1.23 -r1.24 src/etc/mtree/NetBSD.dist.Xorg
cvs rdiff -u -r1.7 -r1.8 src/external/mit/xorg/include/Makefile
cvs rdiff -u -r0 -r1.1 src/external/mit/xorg/include/libvdpau/Makefile
cvs rdiff -u -r1.46 -r1.47 src/external/mit/xorg/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/external/mit/xorg/lib/libvdpau/Makefile

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/xbase/md.amd64
diff -u src/distrib/sets/lists/xbase/md.amd64:1.16 src/distrib/sets/lists/xbase/md.amd64:1.17
--- src/distrib/sets/lists/xbase/md.amd64:1.16	Wed Aug 17 03:10:22 2016
+++ src/distrib/sets/lists/xbase/md.amd64	Sun Mar 10 11:18:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.16 2016/08/17 03:10:22 mrg Exp $
+# $NetBSD: md.amd64,v 1.17 2019/03/10 11:18:02 mrg Exp $
 ./usr/X11R7/lib/libI810XvMC.so			-unknown-		xorg,compatx11file
 ./usr/X11R7/lib/libI810XvMC.so.1		-unknown-		xorg,compatx11file
 ./usr/X11R7/lib/libI810XvMC.so.1.0		-unknown-		xorg,compatx11file
@@ -20,4 +20,7 @@
 ./usr/X11R7/lib/libdrm_nouveau.so		-unknown-		xorg,compatx11file
 ./usr/X11R7/lib/libdrm_nouveau.so.3		-unknown-		xorg,compatx11file
 ./usr/X11R7/lib/libdrm_nouveau.so.3.0		-unknown-		xorg,compatx11file
+./usr/X11R7/lib/libvdpau.so			-unknown-		xorg,compatx11file
+./usr/X11R7/lib/libvdpau.so.1			-unknown-		xorg,compatx11file
+./usr/X11R7/lib/libvdpau.so.1.0			-unknown-		xorg,compatx11file
 ./usr/X11R7/share/pciids/pci.ids		-unknown-		obsolete

Index: src/distrib/sets/lists/xbase/md.i386
diff -u src/distrib/sets/lists/xbase/md.i386:1.30 src/distrib/sets/lists/xbase/md.i386:1.31
--- src/distrib/sets/lists/xbase/md.i386:1.30	Wed Aug 17 03:10:22 2016
+++ src/distrib/sets/lists/xbase/md.i386	Sun Mar 10 11:18:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.30 2016/08/17 03:10:22 mrg Exp $
+# $NetBSD: md.i386,v 1.31 2019/03/10 11:18:02 mrg Exp $
 ./usr/X11R7/lib/libI810XvMC.so			-unknown-		xorg
 ./usr/X11R7/lib/libI810XvMC.so.1		-unknown-		xorg
 ./usr/X11R7/lib/libI810XvMC.so.1.0		-unknown-		xorg
@@ -20,4 +20,7 @@
 ./usr/X11R7/lib/libdrm_nouveau.so		-unknown-		xorg
 ./usr/X11R7/lib/libdrm_nouveau.so.3		-unknown-		xorg
 ./usr/X11R7/lib/libdrm_nouveau.so.3.0		-unknown-		xorg
+./usr/X11R7/lib/libvdpau.so			-unknown-		xorg,compatx11file
+./usr/X11R7/lib/libvdpau.so.1			-unknown-		xorg,compatx11file
+./usr/X11R7/lib/libvdpau.so.1.0			-unknown-		xorg,compatx11file
 ./usr/X11R7/share/pciids/pci.ids		-unknown-		obsolete

Index: src/distrib/sets/lists/xbase/mi
diff -u src/distrib/sets/lists/xbase/mi:1.148 src/distrib/sets/lists/xbase/mi:1.149
--- src/distrib/sets/lists/xbase/mi:1.148	Fri Mar  8 09:58:23 2019
+++ src/distrib/sets/lists/xbase/mi	Sun Mar 10 11:18:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.148 2019/03/08 09:58:23 mrg Exp $
+# $NetBSD: mi,v 1.149 2019/03/10 11:18:02 mrg Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" 

CVS commit: src/sys/arch

2019-03-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Mar 10 11:10:21 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip: files.rockchip
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/rockchip: rk_emmcphy.c

Log Message:
Add support for Rockchip eMMC PHY


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/rockchip/rk_emmcphy.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/arm/rockchip/files.rockchip
diff -u src/sys/arch/arm/rockchip/files.rockchip:1.16 src/sys/arch/arm/rockchip/files.rockchip:1.17
--- src/sys/arch/arm/rockchip/files.rockchip:1.16	Thu Mar  7 00:35:22 2019
+++ src/sys/arch/arm/rockchip/files.rockchip	Sun Mar 10 11:10:21 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.rockchip,v 1.16 2019/03/07 00:35:22 jakllsch Exp $
+#	$NetBSD: files.rockchip,v 1.17 2019/03/10 11:10:21 jmcneill Exp $
 #
 # Configuration info for Rockchip family SoCs
 #
@@ -63,6 +63,11 @@ device	rkpcie: pcibus, pcihost_fdt
 attach	rkpcie at fdt
 file	arch/arm/rockchip/rk3399_pcie.c		rkpcie
 
+# eMMC PHY
+device	rkemmcphy
+attach	rkemmcphy at fdt
+file	arch/arm/rockchip/rk_emmcphy.c		rkemmcphy
+
 # SOC parameters
 defflag	opt_soc.h			SOC_ROCKCHIP
 defflag	opt_soc.h			SOC_RK3328: SOC_ROCKCHIP

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.82 src/sys/arch/evbarm/conf/GENERIC64:1.83
--- src/sys/arch/evbarm/conf/GENERIC64:1.82	Wed Mar  6 19:36:59 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Mar 10 11:10:21 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.82 2019/03/06 19:36:59 jakllsch Exp $
+#	$NetBSD: GENERIC64,v 1.83 2019/03/10 11:10:21 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -338,6 +338,7 @@ tegrartc*	at fdt?			# NVIDIA Tegra RTC
 dwcmmc*		at fdt?			# Designware SD/MMC
 mesongxmmc*	at fdt?			# Amlogic Meson GX eMMC/SD/SDIO controller
 mmcpwrseq*	at fdt?			# Simple MMC power sequence provider
+rkemmcphy*	at fdt?			# Rockchip eMMC PHY
 sdhc*		at fdt?			# SD Host Controller Interface
 sdhost*		at fdt?			# Broadcom BCM283x SD Host Interface
 sunximmc*	at fdt?			# Allwinner SD/MMC

Added files:

Index: src/sys/arch/arm/rockchip/rk_emmcphy.c
diff -u /dev/null src/sys/arch/arm/rockchip/rk_emmcphy.c:1.1
--- /dev/null	Sun Mar 10 11:10:21 2019
+++ src/sys/arch/arm/rockchip/rk_emmcphy.c	Sun Mar 10 11:10:21 2019
@@ -0,0 +1,237 @@
+/* $NetBSD: rk_emmcphy.c,v 1.1 2019/03/10 11:10:21 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2019 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: rk_emmcphy.c,v 1.1 2019/03/10 11:10:21 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define	GRF_EMMCPHY_CON0	0x00
+#define	 PHYCTRL_FRQSEL			__BITS(13,12)
+#define	  PHYCTRL_FRQSEL_200M		0
+#define	  PHYCTRL_FRQSEL_50M		1
+#define	  PHYCTRL_FRQSEL_100M		2
+#define	  PHYCTRL_FRQSEL_150M		3
+#define	 PHYCTRL_OTAPDLYENA		__BIT(11)
+#define	 PHYCTRL_OTAPDLYSEL		__BITS(10,7)
+#define	 PHYCTRL_ITAPCHGWIN		__BIT(6)
+#define	 PHYCTRL_ITAPDLYSEL		__BITS(5,1)
+#define	 PHYCTRL_ITAPDLYENA		__BIT(0)
+#define	GRF_EMMCPHY_CON1	0x04
+#define	 PHYCTRL_CLKBUFSEL		__BITS(8,6)
+#define	 PHYCTRL_SELDLYTXCLK		__BIT(5)
+#define	 PHYCTRL_SELDLYRXCLK		__BIT(4)
+#define	 PHYCTRL_STRBSEL		__BITS(3,0)
+#define	GRF_EMMCPHY_CON2	0x08
+#define	 PHYCTRL_REN_STRB		__BIT(9)
+#define	 PHYCTRL_REN_CMD		__BIT(8)
+#define	 PHYCTRL_REN_DAT		__BITS(7,0)
+#define	GRF_EMMCPHY_CON3	0x0c

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

2019-03-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Mar 10 11:09:35 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip: rk3399_cru.c

Log Message:
Add eMMC clocks


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rk3399_cru.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk3399_cru.c
diff -u src/sys/arch/arm/rockchip/rk3399_cru.c:1.4 src/sys/arch/arm/rockchip/rk3399_cru.c:1.5
--- src/sys/arch/arm/rockchip/rk3399_cru.c:1.4	Sun Nov 11 22:39:25 2018
+++ src/sys/arch/arm/rockchip/rk3399_cru.c	Sun Mar 10 11:09:35 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_cru.c,v 1.4 2018/11/11 22:39:25 jakllsch Exp $ */
+/* $NetBSD: rk3399_cru.c,v 1.5 2019/03/10 11:09:35 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.4 2018/11/11 22:39:25 jakllsch Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.5 2019/03/10 11:09:35 jmcneill Exp $");
 
 #include 
 #include 
@@ -360,6 +360,7 @@ static const char * mux_uart2_parents[] 
 static const char * mux_uart3_parents[] = { "clk_uart3_div", "clk_uart3_frac", "xin24m" };
 static const char * mux_rmii_parents[] = { "clk_gmac", "clkin_gmac" };
 static const char * mux_aclk_gmac_parents[] = { "cpll_aclk_gmac_src", "gpll_aclk_gmac_src" };
+static const char * mux_aclk_emmc_parents[] = { "cpll_aclk_emmc_src", "gpll_aclk_emmc_src" };
 static const char * mux_pll_src_24m_pciephy_parents[] = { "xin24m", "clk_pciephy_ref100m" };
 static const char * mux_pciecore_cru_phy_parents[] = { "clk_pcie_core_cru", "clk_pcie_core_phy" };
 
@@ -612,6 +613,24 @@ static struct rk_cru_clk rk3399_cru_clks
 	RK_GATE(RK3399_HCLK_SDIO, "hclk_sdio", "pclk_perilp1", CLKGATE_CON(34), 4),
 
 	/*
+	 * eMMC
+	 */
+	RK_COMPOSITE(RK3399_SCLK_EMMC, "clk_emmc", mux_pll_src_cpll_gpll_npll_ppll_upll_24m_parents,
+		 CLKSEL_CON(22),	/* muxdiv_reg */
+		 __BITS(10,8),	/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(6),	/* gate_reg */
+		 __BIT(14),		/* gate_mask */
+		 0),
+	RK_GATE(0, "cpll_aclk_emmc_src", "cpll", CLKGATE_CON(6), 13),
+	RK_GATE(0, "gpll_aclk_emmc_src", "gpll", CLKGATE_CON(6), 12),
+	RK_COMPOSITE_NOGATE(RK3399_ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_parents,
+			CLKSEL_CON(22),	/* muxdiv_reg */
+			__BIT(7),		/* mux_mask */
+			__BITS(4,0),	/* div_mask */
+			0),
+
+	/*
 	 * GMAC
 	 */
 	RK_COMPOSITE(RK3399_SCLK_MAC, "clk_gmac", mux_pll_src_cpll_gpll_npll_parents,



CVS commit: src/distrib/sets

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 11:04:08 UTC 2019

Modified Files:
src/distrib/sets: Makefile mkvars.mk sets.subr

Log Message:
convert make's HAVE_MESA_VER into mesa_ver for set lists


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/distrib/sets/Makefile
cvs rdiff -u -r1.35 -r1.36 src/distrib/sets/mkvars.mk
cvs rdiff -u -r1.184 -r1.185 src/distrib/sets/sets.subr

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/Makefile
diff -u src/distrib/sets/Makefile:1.106 src/distrib/sets/Makefile:1.107
--- src/distrib/sets/Makefile:1.106	Mon Oct  1 09:47:34 2018
+++ src/distrib/sets/Makefile	Sun Mar 10 11:04:08 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.106 2018/10/01 09:47:34 martin Exp $
+#	$NetBSD: Makefile,v 1.107 2019/03/10 11:04:08 mrg Exp $
 
 # Experimental RCS METALOG versioning
 # (Needs host's rcs(1) commands)
@@ -74,6 +74,9 @@ MAKETARSETS!= ${SETSCMD} ./makeflist -l 
 print_have_xorg_server_ver: .PHONY
 	@echo ${HAVE_XORG_SERVER_VER}
 
+print_have_mesa_ver: .PHONY
+	@echo ${HAVE_MESA_VER}
+
 print_have_gcc: .PHONY
 	@echo ${HAVE_GCC}
 

Index: src/distrib/sets/mkvars.mk
diff -u src/distrib/sets/mkvars.mk:1.35 src/distrib/sets/mkvars.mk:1.36
--- src/distrib/sets/mkvars.mk:1.35	Thu May 31 05:27:45 2018
+++ src/distrib/sets/mkvars.mk	Sun Mar 10 11:04:08 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mkvars.mk,v 1.35 2018/05/31 05:27:45 mrg Exp $
+# $NetBSD: mkvars.mk,v 1.36 2019/03/10 11:04:08 mrg Exp $
 
 MKEXTRAVARS= \
 	MACHINE \
@@ -7,6 +7,7 @@ MKEXTRAVARS= \
 	HAVE_GCC \
 	HAVE_GDB \
 	HAVE_XORG_SERVER_VER \
+	HAVE_MESA_VER \
 	HAVE_BINUTILS \
 	HAVE_LIBGCC_EH \
 	HAVE_OPENSSL \

Index: src/distrib/sets/sets.subr
diff -u src/distrib/sets/sets.subr:1.184 src/distrib/sets/sets.subr:1.185
--- src/distrib/sets/sets.subr:1.184	Thu Apr 12 11:49:04 2018
+++ src/distrib/sets/sets.subr	Sun Mar 10 11:04:08 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.184 2018/04/12 11:49:04 nakayama Exp $
+#	$NetBSD: sets.subr,v 1.185 2019/03/10 11:04:08 mrg Exp $
 #
 
 #
@@ -180,7 +180,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.184 2018/04/12 11:49:04 nakayama Exp $
+# 	# $NetBSD: sets.subr,v 1.185 2019/03/10 11:04:08 mrg Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -215,6 +215,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 #	gdb=			 = value of ${HAVE_GDB}
 #	openssl=		 = value of ${HAVE_OPENSSL}
 #	xorg_server_ver=	 = value of ${HAVE_XORG_SERVER_VER}
+#	mesa_ver=		 = value of ${HAVE_MESA_VER}
 #
 #2. The USE_:
 #	use_inet6		${USE_INET6} != no
@@ -310,6 +311,9 @@ list_set_files()
 			if ("xorg_server_ver" in wanted) {
 wanted["xorg_server_ver=" "'"${HAVE_XORG_SERVER_VER}"'"] = 1
 			}
+			if ("mesa_ver" in wanted) {
+wanted["mesa_ver=" "'"${HAVE_MESA_VER}"'"] = 1
+			}
 			if (("man" in wanted) && ("catpages" in wanted))
 wanted[".cat"] = 1
 			if (("man" in wanted) && ("manpages" in wanted))



CVS commit: src/share/mk

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 11:02:46 UTC 2019

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
export HAVE_MESA_VER for use in makefiles and set lists.


To generate a diff of this commit:
cvs rdiff -u -r1.1110 -r1. src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1110 src/share/mk/bsd.own.mk:1.
--- src/share/mk/bsd.own.mk:1.1110	Sun Mar 10 02:29:52 2019
+++ src/share/mk/bsd.own.mk	Sun Mar 10 11:02:46 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1110 2019/03/10 02:29:52 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1. 2019/03/10 11:02:46 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1436,7 +1436,7 @@ X11SRCDIRMIT?=		${X11SRCDIR}/external/mi
 	FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \
 	Xdmcp Xevie Xext Xfixes Xfont Xfont2 Xft Xi Xinerama Xmu Xpresent Xpm \
 	Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \
-	epoxy fontenc xkbfile xkbui Xaw pciaccess xcb xshmfence \
+	epoxy fontenc vdpau xkbfile xkbui Xaw pciaccess xcb xshmfence \
 	pthread-stubs
 X11SRCDIR.${_lib}?=		${X11SRCDIRMIT}/lib${_lib}/dist
 .endfor
@@ -1467,7 +1467,12 @@ HAVE_XORG_SERVER_VER?=120
 .endif
 
 # MesaLib.old and MesaLib7 go together, and MesaLib is alone.
+HAVE_MESA_VER?=	10
+.if ${HAVE_MESA_VER} == "10"
 EXTERNAL_MESALIB_DIR?=	MesaLib.old
+.else
+EXTERNAL_MESALIB_DIR?=	MesaLib
+.endif
 
 .if ${HAVE_XORG_SERVER_VER} == "120"
 XORG_SERVER_SUBDIR?=xorg-server



CVS commit: src/external/mit/xorg

2019-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 10 10:51:59 UTC 2019

Modified Files:
src/external/mit/xorg/lib: driver.mk libglsl.mk libloader.mk libmesa.mk
src/external/mit/xorg/lib/dri: Makefile
src/external/mit/xorg/lib/gallium: Makefile
src/external/mit/xorg/lib/libGL: Makefile mesa-ver.mk
src/external/mit/xorg/lib/libgbm: Makefile
src/external/mit/xorg/lib/libglapi: Makefile
Added Files:
src/external/mit/xorg/include/KHR: Makefile

Log Message:
pull across most of the new build infrastruture for mesa18 from maya's
git tree.  this includes may of the changes from the changes below:

commit 52d85e74a1197aace38cc7acb705509e969120e6
Author: coypu 
Date:   Mon Mar 4 12:25:33 2019 +0200

Make 32bit archs happier.

except i386, which now suffers from locked atomics because we
don't have clever ifunc tricks in libc.

commit ee9b4c19c58127934ed3548ad0d68934cc95ccc7
Author: coypu 
Date:   Mon Mar 4 09:08:35 2019 +0200

Adjust includes, append rather than replace, appease clang ppc builds

commit a5341a3ad42572c78b6a2e6e5545bd323d7f2e4c
Author: coypu 
Date:   Sun Mar 3 11:52:19 2019 +0200

Resolve i386 atomic issue and set lists.

XXX libGL in i386 is still causing issues
XXX pkgconfig file for vdpau
XXX set lists for arm32

commit 27bffc20bc15186c92cc5b8d5cc08d7299966b34
Author: coypu 
Date:   Sat Mar 2 21:52:45 2019 +0200

make llvm sources x86 specific

hopefully not breaking non-x86 clang builds, which
have MKLLVM set.

commit f9d34922619cc8f2a224c0138a73985e50daf87f
Author: coypu 
Date:   Sat Mar 2 21:33:31 2019 +0200

move hack to build llvm libraries soon enough.

add u_process.c to libGL specifically (dri, gallium and libGL all need
it).

Add some missing includes for pipe-loader when it moved to gallium

commit 2b1083d0d538bb5d5dd88ab2ca0ca6c331e5dd5b
Author: coypu 
Date:   Sat Mar 2 16:47:58 2019 +0200

shuffle around:

some files move from shared driver.mk/loader.mk into gallium.
others move to shared.

add i915 files.

now i965 glxgears works (amd64).

commit 1897a90569b30b294bcbedadb3745092eca0bb33
Author: Maya Rashish 
Date:   Sun Feb 24 23:36:26 2019 +0200

Progress towards glxgears on i915

commit 28c9c99a236404de41ae74e88ea6d9578c088b92
Author: Maya Rashish 
Date:   Sun Feb 24 21:55:56 2019 +0200

rototill i965/i915 causing it to no longer startx.

Now missing sw_screen_create in the dri driver.

commit 48eb746983a5a7967fba221e7b167808af36f44a
Author: Maya Rashish 
Date:   Sun Feb 24 09:31:22 2019 +0200

More of vdpau. Cogs spin.

commit d9fbba8f61a43648d32f160c5fa62626788566ff
Author: Maya Rashish 
Date:   Sat Feb 23 22:36:37 2019 +0200

Adjust for MesaLib 18.

Build llvmpipe driver on x86 (the driver itself is x86-only).
build llvm on all x86, even on GCC builds.
galahad driver removed (upstream).
Don't build mesa 7 at all.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/mit/xorg/include/KHR/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/mit/xorg/lib/driver.mk \
src/external/mit/xorg/lib/libloader.mk
cvs rdiff -u -r1.3 -r1.4 src/external/mit/xorg/lib/libglsl.mk \
src/external/mit/xorg/lib/libmesa.mk
cvs rdiff -u -r1.29 -r1.30 src/external/mit/xorg/lib/dri/Makefile
cvs rdiff -u -r1.18 -r1.19 src/external/mit/xorg/lib/gallium/Makefile
cvs rdiff -u -r1.22 -r1.23 src/external/mit/xorg/lib/libGL/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/mit/xorg/lib/libGL/mesa-ver.mk
cvs rdiff -u -r1.2 -r1.3 src/external/mit/xorg/lib/libgbm/Makefile
cvs rdiff -u -r1.3 -r1.4 src/external/mit/xorg/lib/libglapi/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/driver.mk
diff -u src/external/mit/xorg/lib/driver.mk:1.2 src/external/mit/xorg/lib/driver.mk:1.3
--- src/external/mit/xorg/lib/driver.mk:1.2	Sun Mar 10 02:29:52 2019
+++ src/external/mit/xorg/lib/driver.mk	Sun Mar 10 10:51:58 2019
@@ -1,20 +1,47 @@
-#	$NetBSD: driver.mk,v 1.2 2019/03/10 02:29:52 mrg Exp $
+#	$NetBSD: driver.mk,v 1.3 2019/03/10 10:51:58 mrg Exp $
 
 # stuff both dri and gallium drivers need.
 
 # util
 .PATH:		${X11SRCDIR.Mesa}/src/util
+
 SRCS.util=	\
-	hash_table.c\
-MESAralloc.c
-.PATH:		${X11SRCDIR.Mesa}/../src/util
-SRCS.util+=	\
-	format_srgb.c
+	hash_table.c \
+	build_id.c \
+	crc32.c \
+	disk_cache.c \
+	fast_idiv_by_const.c \
+	half_float.c \
+	format_srgb.c \
+	mesa-sha1.c \
+	os_time.c \
+	ralloc.c \
+	UTILdebug.c \
+	rand_xor.c \
+	rb_tree.c \
+	register_allocate.c \
+	rgtc.c \
+	set.c \
+	slab.c \
+	string_buffer.c \
+	strtod.c \
+	u_atomic.c \
+	u_cpu_detect.c \
+	u_math.c \
+	u_queue.c \
+	u_process.c \
+	u_vector.c \
+	vma.c
+
 CPPFLAGS.format_srgb.c+=	-I${X11SRCDIR.Mesa}/src/util
 CPPFLAGS.hash_table.c+=		-I${X11SRCDIR.Mesa}/src/util
 CPPFLAGS.MESAralloc.c+=		

CVS commit: src/external/bsd/jemalloc

2019-03-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 10 10:00:29 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: jemalloc.c
src/external/bsd/jemalloc/include/jemalloc: jemalloc.h

Log Message:
Rename je_mallctltomib to je_mallctlnametomib

This unbreaks the build.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/jemalloc/dist/src/jemalloc.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/jemalloc/include/jemalloc/jemalloc.h

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/jemalloc/dist/src/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.3 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.4
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.3	Sun Mar 10 02:49:52 2019
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c	Sun Mar 10 10:00:29 2019
@@ -29,7 +29,7 @@ __weak_alias(sdallocx, je_sdallocx)
 __weak_alias(nallocx, je_nallocx)
 
 __weak_alias(mallctl, je_mallctl)
-__weak_alias(mallctltomib, je_mallctltomib)
+__weak_alias(mallctlnametomib, je_mallctlnametomib)
 __weak_alias(mallctlbymib, je_mallctlbymib)
 
 __weak_alias(malloc_stats_print, je_malloc_stats_print)

Index: src/external/bsd/jemalloc/include/jemalloc/jemalloc.h
diff -u src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.2 src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.3
--- src/external/bsd/jemalloc/include/jemalloc/jemalloc.h:1.2	Sun Mar 10 02:49:52 2019
+++ src/external/bsd/jemalloc/include/jemalloc/jemalloc.h	Sun Mar 10 10:00:29 2019
@@ -94,7 +94,7 @@ extern "C" {
 #undef je_nallocx
 
 #undef je_mallctl
-#undef je_mallctltomib
+#undef je_mallctlnametomib
 #undef je_mallctlbymib
 
 #undef je_malloc_stats_print