CVS commit: src/doc

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 20:55:56 UTC 2019

Modified Files:
src/doc: HACKS

Log Message:
Describe workaround for PR port-alpha/54307.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.194 src/doc/HACKS:1.195
--- src/doc/HACKS:1.194	Wed Oct 30 00:26:54 2019
+++ src/doc/HACKS	Fri Nov  1 20:55:55 2019
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.194 2019/10/30 00:26:54 christos Exp $
+# $NetBSD: HACKS,v 1.195 2019/11/01 20:55:55 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -962,3 +962,12 @@ file	src/libexec/ld.elf_so/Makefile: 1.1
 descr	Disable optimization for rtld.c on the vax with gcc-7. Crashes on the
 	second pass loop with elm == 0x
 kcah
+
+port	alpha
+hack	userland binaries crash randomly (port-alpha/54307)
+cdate	Fri Nov  1 20:43:35 UTC 2019
+who	rin
+file	src/external/bsd/jemalloc/lib/Makefile.inc: 1.11
+descr	rtree.c and tcache.c need to be compiled with -O0, alternatively,
+	you can compile whole jemalloc with -DJEMALLOC_DEBUG.
+kcah



CVS commit: src/doc

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 20:55:56 UTC 2019

Modified Files:
src/doc: HACKS

Log Message:
Describe workaround for PR port-alpha/54307.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/doc/HACKS

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



CVS commit: src/sys/dev/rasops

2019-11-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov  2 01:14:57 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.h

Log Message:
Fix "Alignment Fault 3" kernel failure of NetBSD/zaurus 8.1 GENERIC.

#ifdef switch per kernel config options in definition of device driver
structure in header files could be problematic.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/31/msg79.html

Should be pulled up to netbsd-8 and netbsd-9.


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

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

Modified files:

Index: src/sys/dev/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.48 src/sys/dev/rasops/rasops.h:1.49
--- src/sys/dev/rasops/rasops.h:1.48	Wed Aug 14 00:51:10 2019
+++ src/sys/dev/rasops/rasops.h	Sat Nov  2 01:14:57 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.48 2019/08/14 00:51:10 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.49 2019/11/02 01:14:57 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -149,10 +149,8 @@ struct rasops_info {
 	/* Callbacks so we can share some code */
 	void	(*ri_do_cursor)(struct rasops_info *);
 
-#if NRASOPS_ROTATION > 0
 	/* Used to intercept putchar to permit display rotation */
 	struct	wsdisplay_emulops ri_real_ops;
-#endif
 };
 
 #define CHAR_IN_FONT(c, font)		\



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

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 20:53:10 UTC 2019

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

Log Message:
Workaround for random crash of userland binaries, as reported in
PR port-alpha/54307.

If rtree.c and tcache.c are compiled with -O0, userland just works
without problems as far as I can see. Alternately, you can specify
-DJEMALLOC_DEBUG to avoid random crash. Smells like compiler bug,
or wrong coding which relies on some undefined behavior.

Anyway, we need to pull this up into netbsd-9 asap.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/external/bsd/jemalloc/lib/Makefile.inc:1.11
--- src/external/bsd/jemalloc/lib/Makefile.inc:1.10	Tue Jul 23 06:31:20 2019
+++ src/external/bsd/jemalloc/lib/Makefile.inc	Fri Nov  1 20:53:10 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.10 2019/07/23 06:31:20 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.11 2019/11/01 20:53:10 rin Exp $
 
 JEMALLOC:=${.PARSEDIR}/..
 
@@ -51,6 +51,14 @@ COPTS.ctl.c+=-Wno-error=stack-protector
 COPTS.stats.c+=-Wno-error=stack-protector
 COPTS.tcache.c+=-Wno-error=stack-protector
 
+.if ${MACHINE} == "alpha"
+# These files need to be compiled with -O0, or build everything with
+# -DJEMALLOC_DEBUG. Otherwise, userland binaries crash randomly, as
+# reported in port-alpha/54307.
+COPTS.rtree.c+=-O0
+COPTS.tcache.c+=-O0
+.endif
+
 .if ${MACHINE_ARCH} == "vax"
 # in merge_overlapping_regs, at regrename.c
 COPTS.arena.c+=-O0



CVS commit: src/sys/dev/rasops

2019-11-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov  2 01:14:57 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.h

Log Message:
Fix "Alignment Fault 3" kernel failure of NetBSD/zaurus 8.1 GENERIC.

#ifdef switch per kernel config options in definition of device driver
structure in header files could be problematic.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/31/msg79.html

Should be pulled up to netbsd-8 and netbsd-9.


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

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



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

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 20:53:10 UTC 2019

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

Log Message:
Workaround for random crash of userland binaries, as reported in
PR port-alpha/54307.

If rtree.c and tcache.c are compiled with -O0, userland just works
without problems as far as I can see. Alternately, you can specify
-DJEMALLOC_DEBUG to avoid random crash. Smells like compiler bug,
or wrong coding which relies on some undefined behavior.

Anyway, we need to pull this up into netbsd-9 asap.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.



CVS commit: src/sys/uvm

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 08:26:18 UTC 2019

Modified Files:
src/sys/uvm: uvm_map.c

Log Message:
PR kern/54395

- Align hint for virtual address at the beginning of uvm_map() if
  required. Otherwise, it will be rounded up/down in an unexpected
  way by uvm_map_space_avail(), which results in assertion failure.

  Fix kernel panic when executing earm binary (8KB pages) on aarch64
  (4KB pages), which relies on mmap(2) with MAP_ALIGNED flag.

- Use inline functions/macros consistently.

- Add some more KASSERT's.

For more details, see the PR as well as discussion on port-kern:
http://mail-index.netbsd.org/tech-kern/2019/10/27/msg025629.html


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.364 src/sys/uvm/uvm_map.c:1.365
--- src/sys/uvm/uvm_map.c:1.364	Sat Aug 10 01:06:45 2019
+++ src/sys/uvm/uvm_map.c	Fri Nov  1 08:26:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.364 2019/08/10 01:06:45 mrg Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.365 2019/11/01 08:26:18 rin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.364 2019/08/10 01:06:45 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.365 2019/11/01 08:26:18 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -187,6 +187,23 @@ int user_va0_disable = __USER_VA0_DISABL
  */
 
 /*
+ * uvm_map_align_va: round down or up virtual address
+ */
+static __inline void
+uvm_map_align_va(vaddr_t *vap, vsize_t align, int topdown)
+{
+
+	KASSERT(powerof2(align));
+
+	if (align != 0 && (*vap & (align - 1)) != 0) {
+		if (topdown)
+			*vap = rounddown2(*vap, align);
+		else
+			*vap = roundup2(*vap, align);
+	}
+}
+
+/*
  * UVM_ET_ISCOMPATIBLE: check some requirements for map entry merging
  */
 extern struct vm_map *pager_map;
@@ -1063,6 +1080,7 @@ uvm_map(struct vm_map *map, vaddr_t *sta
 	int error;
 
 	KASSERT((size & PAGE_MASK) == 0);
+	KASSERT((flags & UVM_FLAG_FIXED) == 0 || align == 0);
 
 	/*
 	 * for pager_map, allocate the new entry first to avoid sleeping
@@ -1805,13 +1823,9 @@ uvm_map_space_avail(vaddr_t *start, vsiz
 *start = ptoa(hint + align); /* adjust to color */
 			}
 		}
-	} else if (align != 0) {
-		if ((*start & (align - 1)) != 0) {
-			if (topdown)
-*start &= ~(align - 1);
-			else
-*start = roundup(*start, align);
-		}
+	} else {
+		KASSERT(powerof2(align));
+		uvm_map_align_va(start, align, topdown);
 		/*
 		 * XXX Should we PMAP_PREFER() here again?
 		 * eh...i think we're okay
@@ -1861,7 +1875,7 @@ uvm_map_findspace(struct vm_map *map, va
 
 	UVMHIST_LOG(maphist, "(map=%#jx, hint=%#jx, len=%ju, flags=%#jx)",
 	(uintptr_t)map, hint, length, flags);
-	KASSERT((flags & UVM_FLAG_COLORMATCH) != 0 || (align & (align - 1)) == 0);
+	KASSERT((flags & UVM_FLAG_COLORMATCH) != 0 || powerof2(align));
 	KASSERT((flags & UVM_FLAG_COLORMATCH) == 0 || align < uvmexp.ncolors);
 	KASSERT((flags & UVM_FLAG_FIXED) == 0 || align == 0);
 
@@ -1888,6 +1902,12 @@ uvm_map_findspace(struct vm_map *map, va
 	}
 
 	/*
+	 * hint may not be aligned properly; we need round up or down it
+	 * before proceeding further.
+	 */
+	uvm_map_align_va(, align, topdown);
+
+	/*
 	 * Look for the first possible address; if there's already
 	 * something at this address, we have to start after it.
 	 */



CVS commit: src/sys/uvm

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 08:26:18 UTC 2019

Modified Files:
src/sys/uvm: uvm_map.c

Log Message:
PR kern/54395

- Align hint for virtual address at the beginning of uvm_map() if
  required. Otherwise, it will be rounded up/down in an unexpected
  way by uvm_map_space_avail(), which results in assertion failure.

  Fix kernel panic when executing earm binary (8KB pages) on aarch64
  (4KB pages), which relies on mmap(2) with MAP_ALIGNED flag.

- Use inline functions/macros consistently.

- Add some more KASSERT's.

For more details, see the PR as well as discussion on port-kern:
http://mail-index.netbsd.org/tech-kern/2019/10/27/msg025629.html


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/uvm/uvm_map.c

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



CVS commit: [netbsd-9] src/usr.sbin/syslogd

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:32:21 UTC 2019

Modified Files:
src/usr.sbin/syslogd [netbsd-9]: tls.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #386):

usr.sbin/syslogd/tls.c: revision 1.17

With TLSv1.3 a client has to receive and process metadata.

Update dispatch_tls_eof() to check for metadata and
rearm on success.

Ok: christos@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.6.1 src/usr.sbin/syslogd/tls.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/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.16 src/usr.sbin/syslogd/tls.c:1.16.6.1
--- src/usr.sbin/syslogd/tls.c:1.16	Thu Feb  8 17:45:29 2018
+++ src/usr.sbin/syslogd/tls.c	Fri Nov  1 09:32:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.16.6.1 2019/11/01 09:32:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $");
+__RCSID("$NetBSD: tls.c,v 1.16.6.1 2019/11/01 09:32:21 martin Exp $");
 
 #ifndef DISABLE_TLS
 #include 
@@ -1450,7 +1450,7 @@ dispatch_socket_accept(int fd, short eve
  *
  * I do not know if libevent can tell us the difference
  * between available data and an EOF. But it does not matter
- * because there should not be any incoming data.
+ * because there should not be any incoming data beside metadata.
  * So we close the connection either because the peer closed its
  * side or because the peer broke the protocol by sending us stuff  ;-)
  */
@@ -1460,11 +1460,26 @@ dispatch_tls_eof(int fd, short event, vo
 	struct tls_conn_settings *conn_info = (struct tls_conn_settings *) arg;
 	sigset_t newmask, omask;
 	struct timeval tv;
+	int rc;
+	char buf[1];
 
 	BLOCK_SIGNALS(omask, newmask);
 	DPRINTF((D_TLS|D_EVENT|D_CALL), "dispatch_eof_tls(%d, %d, %p)\n",
 	fd, event, arg);
 	assert(conn_info->state == ST_TLS_EST);
+
+	/* First check for incoming metadata. */
+	ST_CHANGE(conn_info->state, ST_READING);
+	rc = SSL_read(conn_info->sslptr, buf, sizeof(buf));
+	ST_CHANGE(conn_info->state, ST_TLS_EST);
+	if (rc <= 0 && tls_examine_error("SSL_read()", conn_info->sslptr,
+	conn_info, rc) == TLS_RETRY_READ) {
+		/* Connection is still alive, rearm and return. */
+		EVENT_ADD(conn_info->event);
+		RESTORE_SIGNALS(omask);
+		return;
+	}
+
 	ST_CHANGE(conn_info->state, ST_EOF);
 	DEL_EVENT(conn_info->event);
 



CVS commit: [netbsd-9] src/usr.sbin/syslogd

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:32:21 UTC 2019

Modified Files:
src/usr.sbin/syslogd [netbsd-9]: tls.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #386):

usr.sbin/syslogd/tls.c: revision 1.17

With TLSv1.3 a client has to receive and process metadata.

Update dispatch_tls_eof() to check for metadata and
rearm on success.

Ok: christos@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.6.1 src/usr.sbin/syslogd/tls.c

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



CVS commit: src/sys/dev/i2c

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 09:59:22 UTC 2019

Modified Files:
src/sys/dev/i2c: files.i2c
Removed Files:
src/sys/dev/i2c: tps65950.c

Log Message:
Remove tps65950pm (hardware now supported by twl4030.c)


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r1.6 -r0 src/sys/dev/i2c/tps65950.c

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



CVS commit: src/sys/dev/i2c

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 09:59:22 UTC 2019

Modified Files:
src/sys/dev/i2c: files.i2c
Removed Files:
src/sys/dev/i2c: tps65950.c

Log Message:
Remove tps65950pm (hardware now supported by twl4030.c)


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r1.6 -r0 src/sys/dev/i2c/tps65950.c

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

Modified files:

Index: src/sys/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.102 src/sys/dev/i2c/files.i2c:1.103
--- src/sys/dev/i2c/files.i2c:1.102	Wed Oct 30 21:38:28 2019
+++ src/sys/dev/i2c/files.i2c	Fri Nov  1 09:59:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.102 2019/10/30 21:38:28 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.103 2019/11/01 09:59:22 jmcneill Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -196,11 +196,6 @@ device	ibmhawk: sysmon_envsys
 attach	ibmhawk at iic
 file	dev/i2c/ibmhawk.c		ibmhawk
 
-# TI TPS65950 OMAP Power Management and System Companion Device
-device	tps65950pm: sysmon_wdog
-attach	tps65950pm at iic
-file	dev/i2c/tps65950.c		tps65950pm
-
 # TI TPS65217
 device	tps65217pmic { }: sysmon_envsys
 device	tps65217reg: tps65217pmic



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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 11:53:35 UTC 2019

Modified Files:
src/sys/arch/arm/ti: files.ti omap3_cm.c
Added Files:
src/sys/arch/arm/ti: omap2_gpmcreg.h omap2_nand.c ti_gpmc.c

Log Message:
Add NAND flash support.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/omap2_gpmcreg.h \
src/sys/arch/arm/ti/omap2_nand.c src/sys/arch/arm/ti/ti_gpmc.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/omap3_cm.c

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

Modified files:

Index: src/sys/arch/arm/ti/files.ti
diff -u src/sys/arch/arm/ti/files.ti:1.18 src/sys/arch/arm/ti/files.ti:1.19
--- src/sys/arch/arm/ti/files.ti:1.18	Thu Oct 31 17:08:54 2019
+++ src/sys/arch/arm/ti/files.ti	Fri Nov  1 11:53:35 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ti,v 1.18 2019/10/31 17:08:54 jmcneill Exp $
+#	$NetBSD: files.ti,v 1.19 2019/11/01 11:53:35 jmcneill Exp $
 #
 
 file	arch/arm/ti/ti_cpufreq.c	soc_ti
@@ -112,6 +112,16 @@ device	omapfb: rasops16, rasops8, wsemul
 attach	omapfb at fdt with omap3_dss
 file	arch/arm/ti/omap3_dss.c		omap3_dss
 
+# Memory controller
+device	tigpmc { } : fdt
+attach	tigpmc at fdt with ti_gpmc
+file	arch/arm/ti/ti_gpmc.c		ti_gpmc
+
+# NAND flash controller
+device	omapnand: nandbus
+attach	omapnand at fdt
+file	arch/arm/ti/omap2_nand.c	omapnand
+
 # SOC parameters
 defflag	opt_soc.h			SOC_TI
 defflag	opt_soc.h			SOC_AM33XX: SOC_TI

Index: src/sys/arch/arm/ti/omap3_cm.c
diff -u src/sys/arch/arm/ti/omap3_cm.c:1.3 src/sys/arch/arm/ti/omap3_cm.c:1.4
--- src/sys/arch/arm/ti/omap3_cm.c:1.3	Thu Oct 31 01:05:06 2019
+++ src/sys/arch/arm/ti/omap3_cm.c	Fri Nov  1 11:53:35 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: omap3_cm.c,v 1.3 2019/10/31 01:05:06 jmcneill Exp $ */
+/* $NetBSD: omap3_cm.c,v 1.4 2019/11/01 11:53:35 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: omap3_cm.c,v 1.3 2019/10/31 01:05:06 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: omap3_cm.c,v 1.4 2019/11/01 11:53:35 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,6 +55,12 @@ static int omap3_cm_match(device_t, cfda
 static void omap3_cm_attach(device_t, device_t, void *);
 
 static int
+omap3_cm_hwmod_nopenable(struct ti_prcm_softc *sc, struct ti_prcm_clk *tc, int enable)
+{
+	return 0;
+}
+
+static int
 omap3_cm_hwmod_enable(struct ti_prcm_softc *sc, struct ti_prcm_clk *tc, int enable)
 {
 	uint32_t val;
@@ -92,6 +98,8 @@ omap3_cm_hwmod_enable(struct ti_prcm_sof
 	TI_PRCM_HWMOD_MASK((_name), CM_PER_BASE, __BIT(_bit), (_parent), omap3_cm_hwmod_enable, (_flags))
 #define	OMAP3_CM_HWMOD_USBHOST(_name, _bit, _parent, _flags)	\
 	TI_PRCM_HWMOD_MASK((_name), CM_USBHOST_BASE, __BIT(_bit), (_parent), omap3_cm_hwmod_enable, (_flags))
+#define	OMAP3_CM_HWMOD_NOP(_name, _parent)			\
+	TI_PRCM_HWMOD_MASK((_name), 0, 0, (_parent), omap3_cm_hwmod_nopenable, 0)
 
 static const char * const compatible[] = {
 	"ti,omap3-cm",
@@ -154,6 +162,8 @@ static struct ti_prcm_clk omap3_cm_clks[
 	OMAP3_CM_HWMOD_PER("gpio6", 17, "PERIPH_CLK", 0),
 
 	OMAP3_CM_HWMOD_USBHOST("usb_host_hs", 0, "PERIPH_CLK", 0),
+
+	OMAP3_CM_HWMOD_NOP("gpmc", "PERIPH_CLK"),
 };
 
 static void

Added files:

Index: src/sys/arch/arm/ti/omap2_gpmcreg.h
diff -u /dev/null src/sys/arch/arm/ti/omap2_gpmcreg.h:1.1
--- /dev/null	Fri Nov  1 11:53:35 2019
+++ src/sys/arch/arm/ti/omap2_gpmcreg.h	Fri Nov  1 11:53:35 2019
@@ -0,0 +1,236 @@
+/*	$NetBSD: omap2_gpmcreg.h,v 1.1 2019/11/01 11:53:35 jmcneill Exp $	*/
+/*
+ * Copyright (c) 2007 Microsoft
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *	This product includes software developed by Microsoft
+ *
+ * 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 OR CONTRIBUTERS 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 

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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 11:53:35 UTC 2019

Modified Files:
src/sys/arch/arm/ti: files.ti omap3_cm.c
Added Files:
src/sys/arch/arm/ti: omap2_gpmcreg.h omap2_nand.c ti_gpmc.c

Log Message:
Add NAND flash support.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/ti/files.ti
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/ti/omap2_gpmcreg.h \
src/sys/arch/arm/ti/omap2_nand.c src/sys/arch/arm/ti/ti_gpmc.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/omap3_cm.c

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



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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 11:53:51 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: GENERIC

Log Message:
Add tigpmc, omapnand


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/evbarm/conf/GENERIC

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



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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 11:53:51 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: GENERIC

Log Message:
Add tigpmc, omapnand


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/evbarm/conf/GENERIC

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.64 src/sys/arch/evbarm/conf/GENERIC:1.65
--- src/sys/arch/evbarm/conf/GENERIC:1.64	Thu Oct 31 17:08:54 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Fri Nov  1 11:53:51 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.64 2019/10/31 17:08:54 jmcneill Exp $
+#	$NetBSD: GENERIC,v 1.65 2019/11/01 11:53:51 jmcneill Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -422,6 +422,7 @@ arml2cc* 	at l2cc?
 
 # Memory controller
 tegramc* 	at fdt?	pass 4		# NVIDIA Tegra MC
+tigpmc*		at fdt? pass 4		# TI OMAP2 GPMC
 
 # Firmware devices
 bcmmbox* 	at fdt?			# Broadcom VideoCore IV mailbox
@@ -633,7 +634,8 @@ ld3 		at sdmmc3
 ld* 		at sdmmc?
 
 # NAND Flash
-sunxinand* 	at fdt?			# NAND flash controller
+sunxinand* 	at fdt?			# Allwinner NAND flash controller
+omapnand*	at fdt?			# TI OMAP2 flash controller
 nand* 		at nandbus?
 flash* 		at nand? dynamic 1
 



CVS commit: [netbsd-9] src/sys

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:34:27 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c
src/sys/net [netbsd-9]: if_gre.c if_l2tp.c if_tap.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #387):

sys/net/if_gre.c: revision 1.176
sys/net/if_l2tp.c: revision 1.40
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.56
sys/net/if_tap.c: revision 1.114

Fix missing kpreempt_disable() before softint_schedule() like if_vmx.c:r1.51.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.1 -r1.54.2.2 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.175 -r1.175.2.1 src/sys/net/if_gre.c
cvs rdiff -u -r1.35.2.1 -r1.35.2.2 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.113 -r1.113.2.1 src/sys/net/if_tap.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.1 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.2
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.1	Thu Sep  5 09:11:03 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Nov  1 09:34:27 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.1 2019/09/05 09:11:03 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.2 2019/11/01 09:34:27 martin Exp $ */
 
 /**
 
@@ -266,8 +266,11 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 >wq_cookie, curcpu());
 			} else
 percpu_putref(adapter->txr_wq_enqueued);
-		} else
+		} else {
+			kpreempt_disable();
 			softint_schedule(txr->txr_si);
+			kpreempt_enable();
+		}
 	}
 
 	return (0);

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.175 src/sys/net/if_gre.c:1.175.2.1
--- src/sys/net/if_gre.c:1.175	Fri Apr 26 11:51:56 2019
+++ src/sys/net/if_gre.c	Fri Nov  1 09:34:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.175 2019/04/26 11:51:56 pgoyette Exp $ */
+/*	$NetBSD: if_gre.c,v 1.175.2.1 2019/11/01 09:34:27 martin Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.175 2019/04/26 11:51:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.175.2.1 2019/11/01 09:34:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_atalk.h"
@@ -964,8 +964,11 @@ gre_output(struct ifnet *ifp, struct mbu
 	if ((error = gre_bufq_enqueue(>sc_snd, m)) != 0) {
 		sc->sc_oflow_ev.ev_count++;
 		m_freem(m);
-	} else
+	} else {
+		kpreempt_disable();
 		softint_schedule(sc->sc_si);
+		kpreempt_enable();
+	}
 
 end:
 	if (error)

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.35.2.1 src/sys/net/if_l2tp.c:1.35.2.2
--- src/sys/net/if_l2tp.c:1.35.2.1	Tue Sep 24 03:10:35 2019
+++ src/sys/net/if_l2tp.c	Fri Nov  1 09:34:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.35.2.1 2019/09/24 03:10:35 martin Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.35.2.2 2019/11/01 09:34:27 martin Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.35.2.1 2019/09/24 03:10:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.35.2.2 2019/11/01 09:34:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -655,7 +655,9 @@ l2tp_start(struct ifnet *ifp)
 	if (var->lv_psrc == NULL || var->lv_pdst == NULL)
 		return;
 
+	kpreempt_disable();
 	softint_schedule(sc->l2tp_si);
+	kpreempt_enable();
 	l2tp_putref_variant(var, );
 }
 

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.113 src/sys/net/if_tap.c:1.113.2.1
--- src/sys/net/if_tap.c:1.113	Wed May 29 10:07:30 2019
+++ src/sys/net/if_tap.c	Fri Nov  1 09:34:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.113 2019/05/29 10:07:30 msaitoh Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.113.2.1 2019/11/01 09:34:27 martin Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.113 2019/05/29 10:07:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.113.2.1 2019/11/01 09:34:27 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -533,8 +533,11 @@ tap_start(struct ifnet *ifp)
 		ifp->if_flags |= IFF_OACTIVE;
 		cv_broadcast(>sc_cv);
 		selnotify(>sc_rsel, 0, 1);
-		if (sc->sc_flags & TAP_ASYNCIO)
+		if (sc->sc_flags & TAP_ASYNCIO) {
+			kpreempt_disable();
 			softint_schedule(sc->sc_sih);
+			kpreempt_enable();
+		}
 	}
 done:
 	mutex_exit(>sc_lock);
@@ -643,8 +646,11 @@ tap_stop(struct ifnet *ifp, int disable)
 	ifp->if_flags &= ~IFF_RUNNING;
 	cv_broadcast(>sc_cv);
 	selnotify(>sc_rsel, 0, 1);
-	if (sc->sc_flags & TAP_ASYNCIO)
+	if (sc->sc_flags & TAP_ASYNCIO) {
+		kpreempt_disable();
 		softint_schedule(sc->sc_sih);
+		kpreempt_enable();
+	}
 	mutex_exit(>sc_lock);
 }
 



CVS commit: [netbsd-9] src/sys

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:34:27 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c
src/sys/net [netbsd-9]: if_gre.c if_l2tp.c if_tap.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #387):

sys/net/if_gre.c: revision 1.176
sys/net/if_l2tp.c: revision 1.40
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.56
sys/net/if_tap.c: revision 1.114

Fix missing kpreempt_disable() before softint_schedule() like if_vmx.c:r1.51.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.1 -r1.54.2.2 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.175 -r1.175.2.1 src/sys/net/if_gre.c
cvs rdiff -u -r1.35.2.1 -r1.35.2.2 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.113 -r1.113.2.1 src/sys/net/if_tap.c

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



CVS commit: src/sys/dev/i2c

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 09:49:55 UTC 2019

Modified Files:
src/sys/dev/i2c: twl4030.c

Log Message:
Add RTC support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/twl4030.c

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



CVS commit: src/sys/dev/i2c

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 09:49:55 UTC 2019

Modified Files:
src/sys/dev/i2c: twl4030.c

Log Message:
Add RTC support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/twl4030.c

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

Modified files:

Index: src/sys/dev/i2c/twl4030.c
diff -u src/sys/dev/i2c/twl4030.c:1.1 src/sys/dev/i2c/twl4030.c:1.2
--- src/sys/dev/i2c/twl4030.c:1.1	Wed Oct 30 21:38:28 2019
+++ src/sys/dev/i2c/twl4030.c	Fri Nov  1 09:49:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: twl4030.c,v 1.1 2019/10/30 21:38:28 jmcneill Exp $ */
+/* $NetBSD: twl4030.c,v 1.2 2019/11/01 09:49:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: twl4030.c,v 1.1 2019/10/30 21:38:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twl4030.c,v 1.2 2019/11/01 09:49:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,6 +50,12 @@ __KERNEL_RCSID(0, "$NetBSD: twl4030.c,v 
 #define	ADDR_AUX	0x02
 #define	ADDR_POWER	0x03
 
+/* INTBR registers */
+#define	IDCODE_7_0	0x85
+#define	IDCODE_15_8	0x86
+#define	IDCODE_23_16	0x87
+#define	IDCODE_31_24	0x88
+
 /* GPIO registers */
 #define	GPIOBASE		0x98
 #define	GPIODATAIN(pin)		(GPIOBASE + 0x00 + (pin) / 8)
@@ -60,6 +66,18 @@ __KERNEL_RCSID(0, "$NetBSD: twl4030.c,v 
 #define	GPIOPUPDCTR(pin)	(GPIOBASE + 0x13 + (n) / 4)
 #define	 PUPD_BITS(pin)		__BITS((pin) % 4 + 1, (pin) % 4)
 
+/* POWER registers */
+#define	SECONDS_REG		0x1c
+#define	MINUTES_REG		0x1d
+#define	HOURS_REG		0x1e
+#define	DAYS_REG		0x1f
+#define	MONTHS_REG		0x20
+#define	YEARS_REG		0x21
+#define	WEEKS_REG		0x22
+#define	RTC_CTRL_REG		0x29
+#define	 GET_TIME		__BIT(6)
+#define	 STOP_RTC		__BIT(0)
+
 struct twl_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
@@ -67,6 +85,8 @@ struct twl_softc {
 	int		sc_phandle;
 
 	int		sc_npins;
+
+	struct todr_chip_handle sc_todr;
 };
 
 struct twl_pin {
@@ -81,6 +101,7 @@ static const struct device_compatible_en
 	{ NULL,0 }
 };
 
+static const char * const rtc_compatible[] = { "ti,twl4030-rtc", NULL };
 static const char * const gpio_compatible[] = { "ti,twl4030-gpio", NULL };
 
 static uint8_t
@@ -118,6 +139,70 @@ twl_write(struct twl_softc *sc, uint8_t 
 #define	INT_READ(sc, reg)	twl_read((sc), ADDR_INT, (reg), I2C_F_POLL)
 #define	INT_WRITE(sc, reg, val)	twl_write((sc), ADDR_INT, (reg), (val), I2C_F_POLL)
 
+#define	POWER_READ(sc, reg)	twl_read((sc), ADDR_POWER, (reg), I2C_F_POLL)
+#define	POWER_WRITE(sc, reg, val) twl_write((sc), ADDR_POWER, (reg), (val), I2C_F_POLL)
+
+static void
+twl_rtc_enable(struct twl_softc *sc, bool onoff)
+{
+	uint8_t rtc_ctrl;
+
+	rtc_ctrl = POWER_READ(sc, RTC_CTRL_REG);
+	if (onoff)
+		rtc_ctrl |= STOP_RTC;	/* 1: RTC is running */
+	else
+		rtc_ctrl &= ~STOP_RTC;	/* 0: RTC is frozen */
+	POWER_WRITE(sc, RTC_CTRL_REG, rtc_ctrl);
+}
+
+static int
+twl_rtc_gettime(todr_chip_handle_t tch, struct clock_ymdhms *dt)
+{
+	struct twl_softc *sc = tch->cookie;
+	uint8_t seconds_reg, minutes_reg, hours_reg,
+	days_reg, months_reg, years_reg, weeks_reg;
+
+	iic_acquire_bus(sc->sc_i2c, I2C_F_POLL);
+	seconds_reg = POWER_READ(sc, SECONDS_REG);
+	minutes_reg = POWER_READ(sc, MINUTES_REG);
+	hours_reg = POWER_READ(sc, HOURS_REG);
+	days_reg = POWER_READ(sc, DAYS_REG);
+	months_reg = POWER_READ(sc, MONTHS_REG);
+	years_reg = POWER_READ(sc, YEARS_REG);
+	weeks_reg = POWER_READ(sc, WEEKS_REG);
+	iic_release_bus(sc->sc_i2c, I2C_F_POLL);
+
+	dt->dt_sec = bcdtobin(seconds_reg);
+	dt->dt_min = bcdtobin(minutes_reg);
+	dt->dt_hour = bcdtobin(hours_reg);
+	dt->dt_day = bcdtobin(days_reg);
+	dt->dt_mon = bcdtobin(months_reg);
+	dt->dt_year = bcdtobin(years_reg) + 2000;
+	dt->dt_wday = bcdtobin(weeks_reg);
+
+	return 0;
+}
+
+static int
+twl_rtc_settime(todr_chip_handle_t tch, struct clock_ymdhms *dt)
+{
+	struct twl_softc *sc = tch->cookie;
+
+	iic_acquire_bus(sc->sc_i2c, I2C_F_POLL);
+	twl_rtc_enable(sc, false);
+POWER_WRITE(sc, SECONDS_REG, bintobcd(dt->dt_sec));
+POWER_WRITE(sc, MINUTES_REG, bintobcd(dt->dt_min));
+POWER_WRITE(sc, HOURS_REG, bintobcd(dt->dt_hour));
+POWER_WRITE(sc, DAYS_REG, bintobcd(dt->dt_day));
+POWER_WRITE(sc, MONTHS_REG, bintobcd(dt->dt_mon));
+POWER_WRITE(sc, YEARS_REG, bintobcd(dt->dt_year % 100));
+POWER_WRITE(sc, WEEKS_REG, bintobcd(dt->dt_wday));
+	twl_rtc_enable(sc, true);
+	iic_release_bus(sc->sc_i2c, I2C_F_POLL);
+
+	return 0;
+}
+
 static int
 twl_gpio_config(struct twl_softc *sc, int pin, int flags)
 {
@@ -235,6 +320,19 @@ static struct fdtbus_gpio_controller_fun
 };
 
 static void
+twl_rtc_attach(struct twl_softc *sc, const int phandle)
+{
+	iic_acquire_bus(sc->sc_i2c, I2C_F_POLL);
+	twl_rtc_enable(sc, true);
+	iic_release_bus(sc->sc_i2c, I2C_F_POLL);
+
+	sc->sc_todr.todr_gettime_ymdhms = twl_rtc_gettime;
+	sc->sc_todr.todr_settime_ymdhms = twl_rtc_settime;
+	

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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 12:01:09 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: GENERIC

Log Message:
Attach tiusb before the default pass since it adds a bus to reduce kernel output


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/evbarm/conf/GENERIC

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.65 src/sys/arch/evbarm/conf/GENERIC:1.66
--- src/sys/arch/evbarm/conf/GENERIC:1.65	Fri Nov  1 11:53:51 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Fri Nov  1 12:01:09 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.65 2019/11/01 11:53:51 jmcneill Exp $
+#	$NetBSD: GENERIC,v 1.66 2019/11/01 12:01:09 jmcneill Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -720,8 +720,8 @@ sunxiusb3phy* 	at fdt? pass 9		# Allwinn
 tegrausbphy* 	at fdt?			# NVIDIA Tegra USB PHY
 usbnopphy*	at fdt? pass 9		# Generic USB PHY
 tiotg*		at fdt?			# TI dual port OTG
-tiusb*		at fdt?			# TI HS USB host
-tiusbtll*	at fdt? pass 9		# TI HS USB host TLL
+tiusb*		at fdt? pass 9		# TI HS USB host
+tiusbtll*	at fdt? pass 8		# TI HS USB host TLL
 dwctwo* 	at fdt?			# Designware USB DRD
 ehci* 		at fdt?			# EHCI
 motg* 		at fdt?			# Mentor Graphics USB OTG



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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 12:01:09 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: GENERIC

Log Message:
Attach tiusb before the default pass since it adds a bus to reduce kernel output


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/evbarm/conf/GENERIC

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



CVS commit: [netbsd-9] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:37:31 UTC 2019

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

Log Message:
Tickets #386 - #388


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

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.90 src/doc/CHANGES-9.0:1.1.2.91
--- src/doc/CHANGES-9.0:1.1.2.90	Mon Oct 28 18:41:58 2019
+++ src/doc/CHANGES-9.0	Fri Nov  1 09:37:31 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.90 2019/10/28 18:41:58 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.91 2019/11/01 09:37:31 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -5368,3 +5368,21 @@ etc/etc.zaurus/ttys1.4
 	Switch default console tty from /dev/console to /dev/constty.
 	[abs, ticket #384]
 
+usr.sbin/syslogd/tls.c1.17
+
+	With TLSv1.3 a client has to receive and process metadata.
+	[hannken, ticket #386]
+
+sys/dev/pci/ixgbe/ix_txrx.c			1.56
+sys/net/if_gre.c1.176
+sys/net/if_l2tp.c1.40
+sys/net/if_tap.c1.114
+
+	Fix missing kpreempt_disable() before softint_schedule().
+	[knakahara, ticket #387]
+
+sys/uvm/uvm_map.c1.365
+
+	PR kern/54395: fix virtual address alignment in uvm_map().
+	[rin, ticket #388]
+



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:36:32 UTC 2019

Modified Files:
src/sys/uvm [netbsd-9]: uvm_map.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #388):

sys/uvm/uvm_map.c: revision 1.365

PR kern/54395

- Align hint for virtual address at the beginning of uvm_map() if
   required. Otherwise, it will be rounded up/down in an unexpected
   way by uvm_map_space_avail(), which results in assertion failure.
   Fix kernel panic when executing earm binary (8KB pages) on aarch64
   (4KB pages), which relies on mmap(2) with MAP_ALIGNED flag.
- Use inline functions/macros consistently.
- Add some more KASSERT's.

For more details, see the PR as well as discussion on port-kern:
http://mail-index.netbsd.org/tech-kern/2019/10/27/msg025629.html


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.362.2.1 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.362 src/sys/uvm/uvm_map.c:1.362.2.1
--- src/sys/uvm/uvm_map.c:1.362	Fri Jul 12 06:27:13 2019
+++ src/sys/uvm/uvm_map.c	Fri Nov  1 09:36:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.362 2019/07/12 06:27:13 mlelstv Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.362.2.1 2019/11/01 09:36:32 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.362 2019/07/12 06:27:13 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.362.2.1 2019/11/01 09:36:32 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -187,6 +187,23 @@ int user_va0_disable = __USER_VA0_DISABL
  */
 
 /*
+ * uvm_map_align_va: round down or up virtual address
+ */
+static __inline void
+uvm_map_align_va(vaddr_t *vap, vsize_t align, int topdown)
+{
+
+	KASSERT(powerof2(align));
+
+	if (align != 0 && (*vap & (align - 1)) != 0) {
+		if (topdown)
+			*vap = rounddown2(*vap, align);
+		else
+			*vap = roundup2(*vap, align);
+	}
+}
+
+/*
  * UVM_ET_ISCOMPATIBLE: check some requirements for map entry merging
  */
 extern struct vm_map *pager_map;
@@ -1063,6 +1080,7 @@ uvm_map(struct vm_map *map, vaddr_t *sta
 	int error;
 
 	KASSERT((size & PAGE_MASK) == 0);
+	KASSERT((flags & UVM_FLAG_FIXED) == 0 || align == 0);
 
 	/*
 	 * for pager_map, allocate the new entry first to avoid sleeping
@@ -1805,13 +1823,9 @@ uvm_map_space_avail(vaddr_t *start, vsiz
 *start = ptoa(hint + align); /* adjust to color */
 			}
 		}
-	} else if (align != 0) {
-		if ((*start & (align - 1)) != 0) {
-			if (topdown)
-*start &= ~(align - 1);
-			else
-*start = roundup(*start, align);
-		}
+	} else {
+		KASSERT(powerof2(align));
+		uvm_map_align_va(start, align, topdown);
 		/*
 		 * XXX Should we PMAP_PREFER() here again?
 		 * eh...i think we're okay
@@ -1861,7 +1875,7 @@ uvm_map_findspace(struct vm_map *map, va
 
 	UVMHIST_LOG(maphist, "(map=%#jx, hint=%#jx, len=%ju, flags=%#jx)",
 	(uintptr_t)map, hint, length, flags);
-	KASSERT((flags & UVM_FLAG_COLORMATCH) != 0 || (align & (align - 1)) == 0);
+	KASSERT((flags & UVM_FLAG_COLORMATCH) != 0 || powerof2(align));
 	KASSERT((flags & UVM_FLAG_COLORMATCH) == 0 || align < uvmexp.ncolors);
 	KASSERT((flags & UVM_FLAG_FIXED) == 0 || align == 0);
 
@@ -1888,6 +1902,12 @@ uvm_map_findspace(struct vm_map *map, va
 	}
 
 	/*
+	 * hint may not be aligned properly; we need round up or down it
+	 * before proceeding further.
+	 */
+	uvm_map_align_va(, align, topdown);
+
+	/*
 	 * Look for the first possible address; if there's already
 	 * something at this address, we have to start after it.
 	 */



CVS commit: [netbsd-9] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:37:31 UTC 2019

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

Log Message:
Tickets #386 - #388


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

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:36:32 UTC 2019

Modified Files:
src/sys/uvm [netbsd-9]: uvm_map.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #388):

sys/uvm/uvm_map.c: revision 1.365

PR kern/54395

- Align hint for virtual address at the beginning of uvm_map() if
   required. Otherwise, it will be rounded up/down in an unexpected
   way by uvm_map_space_avail(), which results in assertion failure.
   Fix kernel panic when executing earm binary (8KB pages) on aarch64
   (4KB pages), which relies on mmap(2) with MAP_ALIGNED flag.
- Use inline functions/macros consistently.
- Add some more KASSERT's.

For more details, see the PR as well as discussion on port-kern:
http://mail-index.netbsd.org/tech-kern/2019/10/27/msg025629.html


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.362.2.1 src/sys/uvm/uvm_map.c

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



CVS commit: [netbsd-8] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:30:36 UTC 2019

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

Log Message:
Ticket #1397


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

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



CVS commit: [netbsd-8] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:30:36 UTC 2019

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

Log Message:
Ticket #1397


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

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

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.56 src/doc/CHANGES-8.2:1.1.2.57
--- src/doc/CHANGES-8.2:1.1.2.56	Mon Oct 28 19:15:51 2019
+++ src/doc/CHANGES-8.2	Fri Nov  1 09:30:36 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.56 2019/10/28 19:15:51 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.57 2019/11/01 09:30:36 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1398,3 +1398,9 @@ sys/dev/audio.c	(apply patch)
 	Do not allow mmap(2) on audio devices opened read-only.
 	[nat, ticket #1419]
 
+sys/kern/subr_disk.c1.129
+
+	Avoid division by zero in bounds_check_with_label() on misbehaving
+	or broken drives.
+	[cnst, ticket #1397]
+



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:29:25 UTC 2019

Modified Files:
src/sys/kern [netbsd-8]: subr_disk.c

Log Message:
Pull up following revision(s) (requested by cnst in ticket #1397):

sys/kern/subr_disk.c: revision 1.129

kern/subr_disk: bounds_check_with_label: really protect against div by zero

Solves kernel panic in NetBSD 8.1 amd64 on VirtualBox 6.0.12 r133076.

Triggered with an NVMe controller without any actual discs behind it:

nvme0 at pci0 dev 14 function 0: vendor 80ee product 4e56 (rev. 0x00)
nvme0: NVMe 1.2
nvme0: interrupting at ioapic0 pin 22
nvme0: ORCL-VBOX-NVME-VER12, firmware 1.0, serial VB1234-56789
ld0 at nvme0 nsid 1
ld0: 0, 0 cyl, 16 head, 63 sec, 1 bytes/sect x 0 sectors

Code path is reached 4 times during normal boot, each time after wd0a
is already mounted; this patch avoids a crash with a dirty filesystem.


To generate a diff of this commit:
cvs rdiff -u -r1.119.2.1 -r1.119.2.2 src/sys/kern/subr_disk.c

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

Modified files:

Index: src/sys/kern/subr_disk.c
diff -u src/sys/kern/subr_disk.c:1.119.2.1 src/sys/kern/subr_disk.c:1.119.2.2
--- src/sys/kern/subr_disk.c:1.119.2.1	Fri Apr  5 08:40:19 2019
+++ src/sys/kern/subr_disk.c	Fri Nov  1 09:29:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk.c,v 1.119.2.1 2019/04/05 08:40:19 msaitoh Exp $	*/
+/*	$NetBSD: subr_disk.c,v 1.119.2.2 2019/11/01 09:29:25 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.119.2.1 2019/04/05 08:40:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.119.2.2 2019/11/01 09:29:25 martin Exp $");
 
 #include 
 #include 
@@ -374,7 +374,7 @@ bounds_check_with_label(struct disk *dk,
 	}
 
 	/* Protect against division by zero. XXX: Should never happen?!?! */
-	if (lp->d_secpercyl == 0) {
+	if ((lp->d_secsize / DEV_BSIZE) == 0 || lp->d_secpercyl == 0) {
 		bp->b_error = EINVAL;
 		return -1;
 	}



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 09:29:25 UTC 2019

Modified Files:
src/sys/kern [netbsd-8]: subr_disk.c

Log Message:
Pull up following revision(s) (requested by cnst in ticket #1397):

sys/kern/subr_disk.c: revision 1.129

kern/subr_disk: bounds_check_with_label: really protect against div by zero

Solves kernel panic in NetBSD 8.1 amd64 on VirtualBox 6.0.12 r133076.

Triggered with an NVMe controller without any actual discs behind it:

nvme0 at pci0 dev 14 function 0: vendor 80ee product 4e56 (rev. 0x00)
nvme0: NVMe 1.2
nvme0: interrupting at ioapic0 pin 22
nvme0: ORCL-VBOX-NVME-VER12, firmware 1.0, serial VB1234-56789
ld0 at nvme0 nsid 1
ld0: 0, 0 cyl, 16 head, 63 sec, 1 bytes/sect x 0 sectors

Code path is reached 4 times during normal boot, each time after wd0a
is already mounted; this patch avoids a crash with a dirty filesystem.


To generate a diff of this commit:
cvs rdiff -u -r1.119.2.1 -r1.119.2.2 src/sys/kern/subr_disk.c

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



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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 09:49:22 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_iic.c

Log Message:
Enable IRQ status bits for omap3 type and set speed properly


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_iic.c

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

Modified files:

Index: src/sys/arch/arm/ti/ti_iic.c
diff -u src/sys/arch/arm/ti/ti_iic.c:1.3 src/sys/arch/arm/ti/ti_iic.c:1.4
--- src/sys/arch/arm/ti/ti_iic.c:1.3	Thu Oct 31 10:21:29 2019
+++ src/sys/arch/arm/ti/ti_iic.c	Fri Nov  1 09:49:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_iic.c,v 1.3 2019/10/31 10:21:29 jmcneill Exp $ */
+/* $NetBSD: ti_iic.c,v 1.4 2019/11/01 09:49:21 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.3 2019/10/31 10:21:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.4 2019/11/01 09:49:21 jmcneill Exp $");
 
 #include 
 #include 
@@ -176,6 +176,7 @@ struct ti_iic_softc {
 	kmutex_t		sc_mtx;
 	kcondvar_t		sc_cv;
 	ti_i2cop_t		sc_op;
+	int			sc_opflags;
 	int			sc_buflen;
 	int			sc_bufidx;
 	char			*sc_buf;
@@ -308,14 +309,16 @@ ti_iic_intr(void *arg)
 	uint32_t stat;
 
 	mutex_enter(>sc_mtx);
-	DPRINTF(("ti_iic_intr\n"));
-	stat = I2C_READ_REG(sc, I2C_IRQSTATUS);
-	DPRINTF(("ti_iic_intr pre handle sc->sc_op eq %#x\n", sc->sc_op));
-	ti_iic_handle_intr(sc, stat);
-	I2C_WRITE_REG(sc, I2C_IRQSTATUS, stat);
-	if (sc->sc_op == TI_I2CERROR || sc->sc_op == TI_I2CDONE) {
-		DPRINTF(("ti_iic_intr post handle sc->sc_op %#x\n", sc->sc_op));
-		cv_broadcast(>sc_cv);
+	DPRINTF(("ti_iic_intr opflags=%#x\n", sc->sc_opflags));
+	if ((sc->sc_opflags & I2C_F_POLL) == 0) {
+		stat = I2C_READ_REG(sc, I2C_IRQSTATUS);
+		DPRINTF(("ti_iic_intr pre handle sc->sc_op eq %#x\n", sc->sc_op));
+		ti_iic_handle_intr(sc, stat);
+		I2C_WRITE_REG(sc, I2C_IRQSTATUS, stat);
+		if (sc->sc_op == TI_I2CERROR || sc->sc_op == TI_I2CDONE) {
+			DPRINTF(("ti_iic_intr post handle sc->sc_op %#x\n", sc->sc_op));
+			cv_broadcast(>sc_cv);
+		}
 	}
 	mutex_exit(>sc_mtx);
 	DPRINTF(("ti_iic_intr status 0x%x\n", stat));
@@ -423,9 +426,14 @@ ti_iic_reset(struct ti_iic_softc *sc)
 
 
 	/* XXX standard speed only */
-	psc = 3;
-	scll = 53;
-	sclh = 55;
+	if (sc->sc_type == TI_IIC_OMAP3) {
+		psc = (9600 / 1920) - 1;
+		scll = sclh = (1920 / (2 * 10)) - 6;
+	} else {
+		psc = 3;
+		scll = 53;
+		sclh = 55;
+	}
 
 	/* Clocks */
 	I2C_WRITE_REG(sc, I2C_PSC, psc);
@@ -481,6 +489,7 @@ ti_iic_op(struct ti_iic_softc *sc, i2c_a
 
 	mutex_enter(>sc_mtx);
 	sc->sc_op = op;
+	sc->sc_opflags = flags;
 	sc->sc_buf = buf;
 	sc->sc_buflen = buflen;
 	sc->sc_bufidx = 0;
@@ -491,7 +500,7 @@ ti_iic_op(struct ti_iic_softc *sc, i2c_a
 	I2C_WRITE_REG(sc, I2C_SA, (addr & I2C_SA_MASK));
 	DPRINTF(("SA 0x%x len %d\n", I2C_READ_REG(sc, I2C_SA), I2C_READ_REG(sc, I2C_CNT)));
 
-	if ((flags & I2C_F_POLL) == 0) {
+	if ((flags & I2C_F_POLL) == 0 || sc->sc_type == TI_IIC_OMAP3) {
 		/* clear any pending interrupt */
 		I2C_WRITE_REG(sc, I2C_IRQSTATUS,
 		I2C_READ_REG(sc, I2C_IRQSTATUS));



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

2019-11-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  1 09:49:22 UTC 2019

Modified Files:
src/sys/arch/arm/ti: ti_iic.c

Log Message:
Enable IRQ status bits for omap3 type and set speed properly


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_iic.c

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



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

2019-11-01 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Nov  1 12:44:54 UTC 2019

Modified Files:
src/sys/arch/arm/fdt: cpu_fdt.c

Log Message:
re-apply r1.26. but only #if !defined(AARCH64).

not necessary on armv8 and cache ops are not available that early there.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/fdt/cpu_fdt.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/fdt/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.28 src/sys/arch/arm/fdt/cpu_fdt.c:1.29
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.28	Sat Oct 19 18:04:26 2019
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Fri Nov  1 12:44:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.28 2019/10/19 18:04:26 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.29 2019/11/01 12:44:54 bad Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.28 2019/10/19 18:04:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.29 2019/11/01 12:44:54 bad Exp $");
 
 #include 
 #include 
@@ -347,6 +347,14 @@ cpu_enable_psci(int phandle)
 
 	fdtbus_get_reg64(phandle, 0, , NULL);
 
+#if !defined(AARCH64)
+	/*
+	 * not necessary on AARCH64. besids there it hangs the sysmte
+	 * because cache ops are only functional after cpu_attach()
+	 * was called.
+	 */
+	cpu_dcache_wbinv_all();
+#endif
 	ret = psci_cpu_on(mpidr, cpu_fdt_mpstart_pa(), 0);
 	if (ret != PSCI_SUCCESS)
 		return EIO;



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

2019-11-01 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Nov  1 12:44:54 UTC 2019

Modified Files:
src/sys/arch/arm/fdt: cpu_fdt.c

Log Message:
re-apply r1.26. but only #if !defined(AARCH64).

not necessary on armv8 and cache ops are not available that early there.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/fdt/cpu_fdt.c

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



CVS commit: src/sys/uvm

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 13:04:23 UTC 2019

Modified Files:
src/sys/uvm: uvm_map.c

Log Message:
Fix previous; semantics of align argument of uvm_map() is different
when UVM_FLAG_COLORMATCH is specified.

Should fix PR kern/54669.


To generate a diff of this commit:
cvs rdiff -u -r1.365 -r1.366 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.365 src/sys/uvm/uvm_map.c:1.366
--- src/sys/uvm/uvm_map.c:1.365	Fri Nov  1 08:26:18 2019
+++ src/sys/uvm/uvm_map.c	Fri Nov  1 13:04:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.365 2019/11/01 08:26:18 rin Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.366 2019/11/01 13:04:22 rin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.365 2019/11/01 08:26:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.366 2019/11/01 13:04:22 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -1905,7 +1905,8 @@ uvm_map_findspace(struct vm_map *map, va
 	 * hint may not be aligned properly; we need round up or down it
 	 * before proceeding further.
 	 */
-	uvm_map_align_va(, align, topdown);
+	if ((flags & UVM_FLAG_COLORMATCH) == 0)
+		uvm_map_align_va(, align, topdown);
 
 	/*
 	 * Look for the first possible address; if there's already



CVS commit: src/sys/uvm

2019-11-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Nov  1 13:04:23 UTC 2019

Modified Files:
src/sys/uvm: uvm_map.c

Log Message:
Fix previous; semantics of align argument of uvm_map() is different
when UVM_FLAG_COLORMATCH is specified.

Should fix PR kern/54669.


To generate a diff of this commit:
cvs rdiff -u -r1.365 -r1.366 src/sys/uvm/uvm_map.c

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



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

2019-11-01 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Nov  1 13:30:02 UTC 2019

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

Log Message:
fetch PHY id from FDT.  same as sunxi_emac.c.

prevents PHY 0 of RTL8211E from wrongly attaching on e.g. Bananpi M1.
requested by jmcneill@, patch by martin@.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_gmac.c

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



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

2019-11-01 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Nov  1 13:30:02 UTC 2019

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

Log Message:
fetch PHY id from FDT.  same as sunxi_emac.c.

prevents PHY 0 of RTL8211E from wrongly attaching on e.g. Bananpi M1.
requested by jmcneill@, patch by martin@.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_gmac.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_gmac.c
diff -u src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6 src/sys/arch/arm/sunxi/sunxi_gmac.c:1.7
--- src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6	Sun Jul 21 08:24:32 2019
+++ src/sys/arch/arm/sunxi/sunxi_gmac.c	Fri Nov  1 13:30:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $ */
+/* $NetBSD: sunxi_gmac.c,v 1.7 2019/11/01 13:30:02 bad Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.7 2019/11/01 13:30:02 bad Exp $");
 
 #include 
 #include 
@@ -94,6 +94,24 @@ sunxi_gmac_intr(void *arg)
 }
 
 static int
+sunxi_gmac_get_phyid(int phandle)
+{
+	bus_addr_t addr;
+	int phy_phandle;
+
+	phy_phandle = fdtbus_get_phandle(phandle, "phy");
+	if (phy_phandle == -1)
+		phy_phandle = fdtbus_get_phandle(phandle, "phy-handle");
+	if (phy_phandle == -1)
+		return MII_PHY_ANY;
+
+	if (fdtbus_get_reg(phy_phandle, 0, , NULL) != 0)
+		return MII_PHY_ANY;
+
+	return (int)addr;
+}
+
+static int
 sunxi_gmac_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct fdt_attach_args * const faa = aux;
@@ -192,7 +210,8 @@ sunxi_gmac_attach(device_t parent, devic
 	if (sunxi_gmac_reset(phandle) != 0)
 		aprint_error_dev(self, "PHY reset failed\n");
 
-	dwc_gmac_attach(sc, MII_PHY_ANY, GMAC_MII_CLK_150_250M_DIV102);
+	dwc_gmac_attach(sc, sunxi_gmac_get_phyid(phandle),
+	GMAC_MII_CLK_150_250M_DIV102);
 }
 
 CFATTACH_DECL_NEW(sunxi_gmac, sizeof(struct dwc_gmac_softc),



CVS commit: src/common/lib/libc/misc

2019-11-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Nov  1 14:54:07 UTC 2019

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
uubsan: Implement function_type_mismatch_v1

RTTI is not supported by micro-UBSan (by design) and this is now a stub
handler.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/misc/ubsan.c

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

Modified files:

Index: src/common/lib/libc/misc/ubsan.c
diff -u src/common/lib/libc/misc/ubsan.c:1.8 src/common/lib/libc/misc/ubsan.c:1.9
--- src/common/lib/libc/misc/ubsan.c:1.8	Wed Oct 30 00:13:46 2019
+++ src/common/lib/libc/misc/ubsan.c	Fri Nov  1 14:54:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsan.c,v 1.8 2019/10/30 00:13:46 kamil Exp $	*/
+/*	$NetBSD: ubsan.c,v 1.9 2019/11/01 14:54:07 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,9 +38,9 @@
 
 #include 
 #if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.8 2019/10/30 00:13:46 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.9 2019/11/01 14:54:07 kamil Exp $");
 #else
-__RCSID("$NetBSD: ubsan.c,v 1.8 2019/10/30 00:13:46 kamil Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.9 2019/11/01 14:54:07 kamil Exp $");
 #endif
 
 #if defined(_KERNEL)
@@ -290,6 +290,8 @@ void __ubsan_handle_float_cast_overflow(
 void __ubsan_handle_float_cast_overflow_abort(struct CFloatCastOverflowData *pData, unsigned long ulFrom);
 void __ubsan_handle_function_type_mismatch(struct CFunctionTypeMismatchData *pData, unsigned long ulFunction);
 void __ubsan_handle_function_type_mismatch_abort(struct CFunctionTypeMismatchData *pData, unsigned long ulFunction);
+void __ubsan_handle_function_type_mismatch_v1(struct CFunctionTypeMismatchData *pData, unsigned long ulFunction, unsigned long ulCalleeRTTI, unsigned long ulFnRTTI);
+void __ubsan_handle_function_type_mismatch_v1_abort(struct CFunctionTypeMismatchData *pData, unsigned long ulFunction, unsigned long ulCalleeRTTI, unsigned long ulFnRTTI);
 void __ubsan_handle_invalid_builtin(struct CInvalidBuiltinData *pData);
 void __ubsan_handle_invalid_builtin_abort(struct CInvalidBuiltinData *pData);
 void __ubsan_handle_load_invalid_value(struct CInvalidValueData *pData, unsigned long ulVal);
@@ -838,7 +840,45 @@ __ubsan_handle_function_type_mismatch_ab
 
 	ASSERT(pData);
 
+	HandleFunctionTypeMismatch(true, pData, ulFunction);
+}
+
+void
+__ubsan_handle_function_type_mismatch_v1(struct CFunctionTypeMismatchData *pData, unsigned long ulFunction, unsigned long ulCalleeRTTI, unsigned long ulFnRTTI)
+{
+
+	ASSERT(pData);
+#if 0
+	/*
+	 * Unimplemented.
+	 *
+	 * This UBSan handler is special as the check has to be impelemented
+	 * in an implementation. In order to handle it there is need to
+	 * introspect into C++ ABI internals (RTTI) and use low-level
+	 * C++ runtime interfaces.
+	 */
+
 	HandleFunctionTypeMismatch(false, pData, ulFunction);
+#endif
+}
+
+void
+__ubsan_handle_function_type_mismatch_v1_abort(struct CFunctionTypeMismatchData *pData, unsigned long ulFunction, unsigned long ulCalleeRTTI, unsigned long ulFnRTTI)
+{
+
+	ASSERT(pData);
+#if 0
+	/*
+	 * Unimplemented.
+	 *
+	 * This UBSan handler is special as the check has to be impelemented
+	 * in an implementation. In order to handle it there is need to
+	 * introspect into C++ ABI internals (RTTI) and use low-level
+	 * C++ runtime interfaces.
+	 */
+
+	HandleFunctionTypeMismatch(true, pData, ulFunction);
+#endif
 }
 
 void



CVS commit: src/common/lib/libc/misc

2019-11-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Nov  1 14:54:07 UTC 2019

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
uubsan: Implement function_type_mismatch_v1

RTTI is not supported by micro-UBSan (by design) and this is now a stub
handler.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/misc/ubsan.c

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



CVS commit: src/usr.sbin/npf/npfctl

2019-11-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov  1 13:58:32 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npf_show.c

Log Message:
PR/54670: Azuma OKAMOTO: Consistently use 'W' for TH_CWN, and bump buffer
size.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/npf/npfctl/npf_show.c

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



CVS commit: src/usr.sbin/npf/npfctl

2019-11-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov  1 13:58:32 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npf_show.c

Log Message:
PR/54670: Azuma OKAMOTO: Consistently use 'W' for TH_CWN, and bump buffer
size.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/npf/npfctl/npf_show.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/npf/npfctl/npf_show.c
diff -u src/usr.sbin/npf/npfctl/npf_show.c:1.29 src/usr.sbin/npf/npfctl/npf_show.c:1.30
--- src/usr.sbin/npf/npfctl/npf_show.c:1.29	Sat Aug 10 18:23:55 2019
+++ src/usr.sbin/npf/npfctl/npf_show.c	Fri Nov  1 09:58:32 2019
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_show.c,v 1.29 2019/08/10 22:23:55 rmind Exp $");
+__RCSID("$NetBSD: npf_show.c,v 1.30 2019/11/01 13:58:32 christos Exp $");
 
 #include 
 #define	__FAVOR_BSD
@@ -125,7 +125,7 @@ tcpflags2string(char *buf, u_int tfl)
 	if (tfl & TH_ACK)	buf[i++] = 'A';
 	if (tfl & TH_URG)	buf[i++] = 'U';
 	if (tfl & TH_ECE)	buf[i++] = 'E';
-	if (tfl & TH_CWR)	buf[i++] = 'C';
+	if (tfl & TH_CWR)	buf[i++] = 'W';
 	buf[i] = '\0';
 	return i;
 }
@@ -209,7 +209,7 @@ static char *
 print_tcpflags(npf_conf_info_t *ctx __unused, const uint32_t *words)
 {
 	const u_int tf = words[0], tf_mask = words[1];
-	char buf[16];
+	char buf[20];
 
 	size_t n = tcpflags2string(buf, tf);
 	if (tf != tf_mask) {



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

2019-11-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov  1 15:11:43 UTC 2019

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Fix KUBSAN: the kernel size now exceeds the mapping limit, so bump the
limit.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/include/pmap.h

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



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

2019-11-01 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Nov  1 13:22:08 UTC 2019

Modified Files:
src/sys/arch/arm/fdt: cpu_fdt.c

Log Message:
fix typos in comment in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/fdt/cpu_fdt.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/fdt/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.29 src/sys/arch/arm/fdt/cpu_fdt.c:1.30
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.29	Fri Nov  1 12:44:54 2019
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Fri Nov  1 13:22:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.29 2019/11/01 12:44:54 bad Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.30 2019/11/01 13:22:08 bad Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.29 2019/11/01 12:44:54 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.30 2019/11/01 13:22:08 bad Exp $");
 
 #include 
 #include 
@@ -349,7 +349,7 @@ cpu_enable_psci(int phandle)
 
 #if !defined(AARCH64)
 	/*
-	 * not necessary on AARCH64. besids there it hangs the sysmte
+	 * not necessary on AARCH64. beside there it hangs the system
 	 * because cache ops are only functional after cpu_attach()
 	 * was called.
 	 */



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

2019-11-01 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Nov  1 13:22:08 UTC 2019

Modified Files:
src/sys/arch/arm/fdt: cpu_fdt.c

Log Message:
fix typos in comment in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/fdt/cpu_fdt.c

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



CVS commit: src/sys/netinet

2019-11-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov  1 13:54:59 UTC 2019

Modified Files:
src/sys/netinet: tcp.h

Log Message:
Add comments to the tcp flags.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/netinet/tcp.h

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



CVS commit: src/sys/netinet

2019-11-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov  1 13:54:59 UTC 2019

Modified Files:
src/sys/netinet: tcp.h

Log Message:
Add comments to the tcp flags.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/netinet/tcp.h

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

Modified files:

Index: src/sys/netinet/tcp.h
diff -u src/sys/netinet/tcp.h:1.33 src/sys/netinet/tcp.h:1.34
--- src/sys/netinet/tcp.h:1.33	Tue Jan 10 15:32:27 2017
+++ src/sys/netinet/tcp.h	Fri Nov  1 09:54:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp.h,v 1.33 2017/01/10 20:32:27 christos Exp $	*/
+/*	$NetBSD: tcp.h,v 1.34 2019/11/01 13:54:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -61,14 +61,14 @@ struct tcphdr {
 		  th_x2:4;		/* (unused) */
 #endif
 	uint8_t  th_flags;
-#define	TH_FIN	  0x01
-#define	TH_SYN	  0x02
-#define	TH_RST	  0x04
-#define	TH_PUSH	  0x08
-#define	TH_ACK	  0x10
-#define	TH_URG	  0x20
-#define	TH_ECE	  0x40
-#define	TH_CWR	  0x80
+#define	TH_FIN	  0x01		/* Final: Set on the last segment */
+#define	TH_SYN	  0x02		/* Synchronization: New conn with dst port */
+#define	TH_RST	  0x04		/* Reset: Announce to peer conn terminated */
+#define	TH_PUSH	  0x08		/* Push: Immediately send, don't buffer seg */
+#define	TH_ACK	  0x10		/* Acknowledge: Part of connection establish */
+#define	TH_URG	  0x20		/* Urgent: send special marked segment now */
+#define	TH_ECE	  0x40		/* ECN Echo */
+#define	TH_CWR	  0x80		/* Congestion Window Reduced */
 	uint16_t th_win;			/* window */
 	uint16_t th_sum;			/* checksum */
 	uint16_t th_urp;			/* urgent pointer */



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

2019-11-01 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Fri Nov  1 15:01:27 UTC 2019

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

Log Message:
Check CPU support of RDRAND before calling cpu_rng_rdrand().

cpu_earlyrng() checks CPU support of RDSEED and RDRAND before calling
cpu_rng_rdseed() and cpu_rng_rdrand().

But cpu_rng_rdseed() did not check CPU support of RDRAND and system had
crashed on such an environment.  There is no such case with real CPU but
some VM environment.

Fix kern/54655 and confirmed by msaitoh@.

Needs pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/x86/cpu_rng.c

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



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

2019-11-01 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Fri Nov  1 15:01:27 UTC 2019

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

Log Message:
Check CPU support of RDRAND before calling cpu_rng_rdrand().

cpu_earlyrng() checks CPU support of RDSEED and RDRAND before calling
cpu_rng_rdseed() and cpu_rng_rdrand().

But cpu_rng_rdseed() did not check CPU support of RDRAND and system had
crashed on such an environment.  There is no such case with real CPU but
some VM environment.

Fix kern/54655 and confirmed by msaitoh@.

Needs pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/x86/cpu_rng.c

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

Modified files:

Index: src/sys/arch/x86/x86/cpu_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.9 src/sys/arch/x86/x86/cpu_rng.c:1.10
--- src/sys/arch/x86/x86/cpu_rng.c:1.9	Wed Aug 22 12:07:43 2018
+++ src/sys/arch/x86/x86/cpu_rng.c	Fri Nov  1 15:01:27 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.9 2018/08/22 12:07:43 maxv Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.10 2019/11/01 15:01:27 taca Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -53,6 +53,8 @@ static enum {
 	CPU_RNG_VIA
 } cpu_rng_mode __read_mostly = CPU_RNG_NONE;
 
+static bool has_rdrand;
+
 bool
 cpu_rng_init(void)
 {
@@ -131,7 +133,10 @@ cpu_rng_rdseed(cpu_rng_t *out)
 	 * to be seeded even in this case.
 	 */
 exhausted:
-	return cpu_rng_rdrand(out);
+	if (has_rdrand)
+		return cpu_rng_rdrand(out);
+	else
+		return 0;
 }
 
 static size_t
@@ -213,7 +218,7 @@ cpu_earlyrng(void *out, size_t sz)
 	int i;
 
 	bool has_rdseed = (cpu_feature[5] & CPUID_SEF_RDSEED) != 0;
-	bool has_rdrand = (cpu_feature[1] & CPUID2_RDRAND) != 0;
+	has_rdrand = (cpu_feature[1] & CPUID2_RDRAND) != 0;
 
 	KASSERT(sz + sizeof(uint64_t) <= SHA512_DIGEST_LENGTH);
 



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

2019-11-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov  1 15:11:43 UTC 2019

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
Fix KUBSAN: the kernel size now exceeds the mapping limit, so bump the
limit.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/include/pmap.h

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

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.62 src/sys/arch/amd64/include/pmap.h:1.63
--- src/sys/arch/amd64/include/pmap.h:1.62	Wed Aug  7 06:23:48 2019
+++ src/sys/arch/amd64/include/pmap.h	Fri Nov  1 15:11:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.62 2019/08/07 06:23:48 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.63 2019/11/01 15:11:43 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -68,6 +68,7 @@
 #if defined(_KERNEL_OPT)
 #include "opt_xen.h"
 #include "opt_kasan.h"
+#include "opt_kubsan.h"
 #endif
 
 #include 
@@ -139,7 +140,11 @@ extern pt_entry_t *pte_base;
 
 #define NKL4_KIMG_ENTRIES	1
 #define NKL3_KIMG_ENTRIES	1
+#if defined(KUBSAN)
+#define NKL2_KIMG_ENTRIES	64	/* really big kernel */
+#else
 #define NKL2_KIMG_ENTRIES	48
+#endif
 
 /*
  * Since kva space is below the kernel in its entirety, we start off



CVS commit: src/sys/arch/macppc

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:51:56 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: files.macppc
Added Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
the beginning of a driver for the 'Psoc' fan controller found in my 1GHz
TiBook. So far it does:
- initialize the fan controller via OF
- report temperatures to envsys
there is no documentation, only guesswork from looking at OF methods

With this my TiBook doesn't seem to overheat anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/dev/psoc.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/macppc/conf/files.macppc
diff -u src/sys/arch/macppc/conf/files.macppc:1.111 src/sys/arch/macppc/conf/files.macppc:1.112
--- src/sys/arch/macppc/conf/files.macppc:1.111	Wed May  8 13:40:15 2019
+++ src/sys/arch/macppc/conf/files.macppc	Fri Nov  1 17:51:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.111 2019/05/08 13:40:15 isaki Exp $
+#	$NetBSD: files.macppc,v 1.112 2019/11/01 17:51:56 macallan Exp $
 #
 # macppc-specific configuration info
 
@@ -312,3 +312,9 @@ defflag opt_valkyriefb.h VALKYRIEFB_DEBU
 device platinumfb: wsemuldisplaydev, rasops8, vcons, videomode
 attach platinumfb at mainbus
 file arch/macppc/dev/platinumfb.c			platinumfb
+
+# 'Psoc' fan controller found in (some?) TiBooks
+device	psoc: sysmon_envsys
+attach	psoc at iic
+file	arch/macppc/dev/psoc.cpsoc
+

Added files:

Index: src/sys/arch/macppc/dev/psoc.c
diff -u /dev/null src/sys/arch/macppc/dev/psoc.c:1.1
--- /dev/null	Fri Nov  1 17:51:56 2019
+++ src/sys/arch/macppc/dev/psoc.c	Fri Nov  1 17:51:56 2019
@@ -0,0 +1,206 @@
+ /* $NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2018 Michael Lorenz
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, 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.
+ */
+
+/*
+ * fan controller found in 1GHz TiBook
+ *
+ * register values from OF:
+ * fan1 - 0x20 ( status ), 0x31 ( data)
+ * fan2 - 0x26 ( status ), 0x45 ( data )
+ * fan3 - 0x59
+ * temperature sensors start at 6, two bytes each, first appears to be
+ * the temperature in degrees Celsius
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+struct psoc_softc {
+	device_t	sc_dev;
+	i2c_tag_t	sc_i2c;
+	i2c_addr_t	sc_addr;
+	int		sc_node;
+
+	struct sysmon_envsys *sc_sme;
+	envsys_data_t	sc_sensors[7];
+	int		sc_nsensors;
+	uint8_t		sc_temp[16];
+	time_t		sc_last;
+};
+
+static int	psoc_match(device_t, cfdata_t, void *);
+static void	psoc_attach(device_t, device_t, void *);
+
+static void	psoc_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
+
+CFATTACH_DECL_NEW(psoc, sizeof(struct psoc_softc),
+psoc_match, psoc_attach, NULL, NULL);
+
+static const struct device_compatible_entry compat_data[] = {
+	{ "Psoc",		0 },
+	{ NULL,			0 }
+};
+
+static int
+psoc_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+	int match_result;
+
+	if (iic_use_direct_match(ia, match, compat_data, _result))
+		return match_result;
+
+	return 0;
+}
+
+static void
+psoc_attach(device_t parent, device_t self, void *aux)
+{
+	struct psoc_softc *sc = device_private(self);
+	struct i2c_attach_args *ia = aux;
+	char path[256];
+	envsys_data_t *s;
+	int error, ih, r;
+
+	sc->sc_dev = self;
+	sc->sc_i2c = ia->ia_tag;
+	sc->sc_addr = ia->ia_addr;
+	sc->sc_node = ia->ia_cookie;
+	sc->sc_last = 0;

CVS commit: src/sys/arch/macppc

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:51:56 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: files.macppc
Added Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
the beginning of a driver for the 'Psoc' fan controller found in my 1GHz
TiBook. So far it does:
- initialize the fan controller via OF
- report temperatures to envsys
there is no documentation, only guesswork from looking at OF methods

With this my TiBook doesn't seem to overheat anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/macppc/conf/files.macppc
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/dev/psoc.c

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



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

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:55:12 UTC 2019

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

Log Message:
add psoc driver


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/arch/macppc/conf/GENERIC

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



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

2019-11-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov  1 17:55:12 UTC 2019

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

Log Message:
add psoc driver


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/arch/macppc/conf/GENERIC

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

Modified files:

Index: src/sys/arch/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.357 src/sys/arch/macppc/conf/GENERIC:1.358
--- src/sys/arch/macppc/conf/GENERIC:1.357	Mon Sep 16 07:11:08 2019
+++ src/sys/arch/macppc/conf/GENERIC	Fri Nov  1 17:55:12 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.357 2019/09/16 07:11:08 macallan Exp $
+# $NetBSD: GENERIC,v 1.358 2019/11/01 17:55:12 macallan Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/macppc/conf/std.macppc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.357 $"
+#ident 		"GENERIC-$Revision: 1.358 $"
 
 maxusers	32
 
@@ -373,6 +373,7 @@ iic*	at ki2c?
 dbcool* 	at iic?		# dbCool thermal monitor & fan control
 deq* 		at iic?		# mixer/equalizer, used by snapper
 admtemp* 	at iic?		# temperature sensor found in Mini, G5
+psoc* 		at iic?		# fan controller found in TiBooks
 videopll*	at iic?		# for valkyriefb
 sgsmix* 	at iic?		# Additional mixer found in beige G3
 # use with awacs.



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:12:26 UTC 2019

Modified Files:
src/sys/arch/arm/fdt [netbsd-9]: cpu_fdt.c

Log Message:
Pull up following revision(s) (requested by bad in ticket #342):

sys/arch/arm/fdt/cpu_fdt.c: revision 1.29
sys/arch/arm/fdt/cpu_fdt.c: revision 1.30

re-apply r1.26:
  flush the dcache in cpu_enable_psci() before calling psci_cpu_on().
  fixes the kernel hanging with multiple "mpstart" on (at least) NanoPi R1.
but only #if !defined(AARCH64).

not necessary on armv8 and cache ops are not available that early there.

fix typos in comment in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/arch/arm/fdt/cpu_fdt.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/fdt/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.25.4.1 src/sys/arch/arm/fdt/cpu_fdt.c:1.25.4.2
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.25.4.1	Wed Oct 23 19:14:19 2019
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Fri Nov  1 18:12:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.25.4.1 2019/10/23 19:14:19 martin Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.25.4.2 2019/11/01 18:12:26 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.25.4.1 2019/10/23 19:14:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.25.4.2 2019/11/01 18:12:26 martin Exp $");
 
 #include 
 #include 
@@ -347,6 +347,14 @@ cpu_enable_psci(int phandle)
 
 	fdtbus_get_reg64(phandle, 0, , NULL);
 
+#if !defined(AARCH64)
+	/*
+	 * not necessary on AARCH64. beside there it hangs the system
+	 * because cache ops are only functional after cpu_attach()
+	 * was called.
+	 */
+	cpu_dcache_wbinv_all();
+#endif
 	ret = psci_cpu_on(mpidr, cpu_fdt_mpstart_pa(), 0);
 	if (ret != PSCI_SUCCESS)
 		return EIO;



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:12:26 UTC 2019

Modified Files:
src/sys/arch/arm/fdt [netbsd-9]: cpu_fdt.c

Log Message:
Pull up following revision(s) (requested by bad in ticket #342):

sys/arch/arm/fdt/cpu_fdt.c: revision 1.29
sys/arch/arm/fdt/cpu_fdt.c: revision 1.30

re-apply r1.26:
  flush the dcache in cpu_enable_psci() before calling psci_cpu_on().
  fixes the kernel hanging with multiple "mpstart" on (at least) NanoPi R1.
but only #if !defined(AARCH64).

not necessary on armv8 and cache ops are not available that early there.

fix typos in comment in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/arch/arm/fdt/cpu_fdt.c

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:14:45 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_gmac.c

Log Message:
Pull up following revision(s) (requested by bad in ticket #389):

sys/arch/arm/sunxi/sunxi_gmac.c: revision 1.7

fetch PHY id from FDT.  same as sunxi_emac.c.

prevents PHY 0 of RTL8211E from wrongly attaching on e.g. Bananpi M1.
requested by jmcneill@, patch by martin@.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_gmac.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_gmac.c
diff -u src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6 src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6.2.1
--- src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6	Sun Jul 21 08:24:32 2019
+++ src/sys/arch/arm/sunxi/sunxi_gmac.c	Fri Nov  1 18:14:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $ */
+/* $NetBSD: sunxi_gmac.c,v 1.6.2.1 2019/11/01 18:14:45 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.6.2.1 2019/11/01 18:14:45 martin Exp $");
 
 #include 
 #include 
@@ -94,6 +94,24 @@ sunxi_gmac_intr(void *arg)
 }
 
 static int
+sunxi_gmac_get_phyid(int phandle)
+{
+	bus_addr_t addr;
+	int phy_phandle;
+
+	phy_phandle = fdtbus_get_phandle(phandle, "phy");
+	if (phy_phandle == -1)
+		phy_phandle = fdtbus_get_phandle(phandle, "phy-handle");
+	if (phy_phandle == -1)
+		return MII_PHY_ANY;
+
+	if (fdtbus_get_reg(phy_phandle, 0, , NULL) != 0)
+		return MII_PHY_ANY;
+
+	return (int)addr;
+}
+
+static int
 sunxi_gmac_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct fdt_attach_args * const faa = aux;
@@ -192,7 +210,8 @@ sunxi_gmac_attach(device_t parent, devic
 	if (sunxi_gmac_reset(phandle) != 0)
 		aprint_error_dev(self, "PHY reset failed\n");
 
-	dwc_gmac_attach(sc, MII_PHY_ANY, GMAC_MII_CLK_150_250M_DIV102);
+	dwc_gmac_attach(sc, sunxi_gmac_get_phyid(phandle),
+	GMAC_MII_CLK_150_250M_DIV102);
 }
 
 CFATTACH_DECL_NEW(sunxi_gmac, sizeof(struct dwc_gmac_softc),



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:14:45 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_gmac.c

Log Message:
Pull up following revision(s) (requested by bad in ticket #389):

sys/arch/arm/sunxi/sunxi_gmac.c: revision 1.7

fetch PHY id from FDT.  same as sunxi_emac.c.

prevents PHY 0 of RTL8211E from wrongly attaching on e.g. Bananpi M1.
requested by jmcneill@, patch by martin@.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_gmac.c

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:17:55 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: cpu_rng.c

Log Message:
Pull up following revision(s) (requested by taca in ticket #390):

sys/arch/x86/x86/cpu_rng.c: revision 1.10

Check CPU support of RDRAND before calling cpu_rng_rdrand().
cpu_earlyrng() checks CPU support of RDSEED and RDRAND before calling
cpu_rng_rdseed() and cpu_rng_rdrand().

But cpu_rng_rdseed() did not check CPU support of RDRAND and system had
crashed on such an environment.  There is no such case with real CPU but
some VM environment.

Fix kern/54655 and confirmed by msaitoh@.
Needs pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/cpu_rng.c

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:17:55 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: cpu_rng.c

Log Message:
Pull up following revision(s) (requested by taca in ticket #390):

sys/arch/x86/x86/cpu_rng.c: revision 1.10

Check CPU support of RDRAND before calling cpu_rng_rdrand().
cpu_earlyrng() checks CPU support of RDSEED and RDRAND before calling
cpu_rng_rdseed() and cpu_rng_rdrand().

But cpu_rng_rdseed() did not check CPU support of RDRAND and system had
crashed on such an environment.  There is no such case with real CPU but
some VM environment.

Fix kern/54655 and confirmed by msaitoh@.
Needs pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/cpu_rng.c

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

Modified files:

Index: src/sys/arch/x86/x86/cpu_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.9 src/sys/arch/x86/x86/cpu_rng.c:1.9.4.1
--- src/sys/arch/x86/x86/cpu_rng.c:1.9	Wed Aug 22 12:07:43 2018
+++ src/sys/arch/x86/x86/cpu_rng.c	Fri Nov  1 18:17:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.9 2018/08/22 12:07:43 maxv Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.9.4.1 2019/11/01 18:17:55 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -53,6 +53,8 @@ static enum {
 	CPU_RNG_VIA
 } cpu_rng_mode __read_mostly = CPU_RNG_NONE;
 
+static bool has_rdrand;
+
 bool
 cpu_rng_init(void)
 {
@@ -131,7 +133,10 @@ cpu_rng_rdseed(cpu_rng_t *out)
 	 * to be seeded even in this case.
 	 */
 exhausted:
-	return cpu_rng_rdrand(out);
+	if (has_rdrand)
+		return cpu_rng_rdrand(out);
+	else
+		return 0;
 }
 
 static size_t
@@ -213,7 +218,7 @@ cpu_earlyrng(void *out, size_t sz)
 	int i;
 
 	bool has_rdseed = (cpu_feature[5] & CPUID_SEF_RDSEED) != 0;
-	bool has_rdrand = (cpu_feature[1] & CPUID2_RDRAND) != 0;
+	has_rdrand = (cpu_feature[1] & CPUID2_RDRAND) != 0;
 
 	KASSERT(sz + sizeof(uint64_t) <= SHA512_DIGEST_LENGTH);
 



CVS commit: [netbsd-9] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:19:19 UTC 2019

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

Log Message:
Tickets #342, #389, and #390


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

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.91 src/doc/CHANGES-9.0:1.1.2.92
--- src/doc/CHANGES-9.0:1.1.2.91	Fri Nov  1 09:37:31 2019
+++ src/doc/CHANGES-9.0	Fri Nov  1 18:19:19 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.91 2019/11/01 09:37:31 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.92 2019/11/01 18:19:19 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -5386,3 +5386,19 @@ sys/uvm/uvm_map.c1.365
 	PR kern/54395: fix virtual address alignment in uvm_map().
 	[rin, ticket #388]
 
+sys/arch/arm/fdt/cpu_fdt.c			1.29,1.30
+
+	On arm older than v8 flush the dcache in cpu_enable_psci().
+	[bad, ticket #342]
+
+sys/arch/arm/sunxi/sunxi_gmac.c			1.7
+
+	Fetch PHY id from FDT.
+	[bad, ticket #389]
+
+sys/arch/x86/x86/cpu_rng.c			1.10
+
+	PR kern/54655: check CPU support of RDRAND before calling
+	cpu_rng_rdrand().
+	[taca, ticket #390]
+



CVS commit: [netbsd-9] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:19:19 UTC 2019

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

Log Message:
Tickets #342, #389, and #390


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

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



CVS commit: [netbsd-9] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:25:22 UTC 2019

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

Log Message:
Annotate ticket #388 for additional pullups


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

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:24:31 UTC 2019

Modified Files:
src/sys/uvm [netbsd-9]: uvm_map.c

Log Message:
Addionally pull up the following revision for ticket #388:

sys/uvm/uvm_map.c   1.366

Fix previous; semantics of align argument of uvm_map() is different
when UVM_FLAG_COLORMATCH is specified.

Should fix PR kern/54669.


To generate a diff of this commit:
cvs rdiff -u -r1.362.2.1 -r1.362.2.2 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.362.2.1 src/sys/uvm/uvm_map.c:1.362.2.2
--- src/sys/uvm/uvm_map.c:1.362.2.1	Fri Nov  1 09:36:32 2019
+++ src/sys/uvm/uvm_map.c	Fri Nov  1 18:24:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.362.2.1 2019/11/01 09:36:32 martin Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.362.2.2 2019/11/01 18:24:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.362.2.1 2019/11/01 09:36:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.362.2.2 2019/11/01 18:24:31 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -1905,7 +1905,8 @@ uvm_map_findspace(struct vm_map *map, va
 	 * hint may not be aligned properly; we need round up or down it
 	 * before proceeding further.
 	 */
-	uvm_map_align_va(, align, topdown);
+	if ((flags & UVM_FLAG_COLORMATCH) == 0)
+		uvm_map_align_va(, align, topdown);
 
 	/*
 	 * Look for the first possible address; if there's already



CVS commit: [netbsd-9] src/doc

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:25:22 UTC 2019

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

Log Message:
Annotate ticket #388 for additional pullups


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

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.92 src/doc/CHANGES-9.0:1.1.2.93
--- src/doc/CHANGES-9.0:1.1.2.92	Fri Nov  1 18:19:19 2019
+++ src/doc/CHANGES-9.0	Fri Nov  1 18:25:22 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.92 2019/11/01 18:19:19 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.93 2019/11/01 18:25:22 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -5381,7 +5381,7 @@ sys/net/if_tap.c1.114
 	Fix missing kpreempt_disable() before softint_schedule().
 	[knakahara, ticket #387]
 
-sys/uvm/uvm_map.c1.365
+sys/uvm/uvm_map.c1.365,1.366
 
 	PR kern/54395: fix virtual address alignment in uvm_map().
 	[rin, ticket #388]



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:24:31 UTC 2019

Modified Files:
src/sys/uvm [netbsd-9]: uvm_map.c

Log Message:
Addionally pull up the following revision for ticket #388:

sys/uvm/uvm_map.c   1.366

Fix previous; semantics of align argument of uvm_map() is different
when UVM_FLAG_COLORMATCH is specified.

Should fix PR kern/54669.


To generate a diff of this commit:
cvs rdiff -u -r1.362.2.1 -r1.362.2.2 src/sys/uvm/uvm_map.c

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