CVS commit: src

2020-04-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 25 05:17:17 UTC 2020

Modified Files:
src/lib/libkvm: kvm_i386.c kvm_i386pae.c kvm_x86_64.c
src/sys/arch/amd64/include: pte.h
src/sys/arch/i386/i386: genassym.cf
src/sys/arch/i386/include: kcore.h pte.h
src/sys/external/bsd/drm2/dist/drm/i915: i915_gem_gtt.c

Log Message:
Switch to the new PTE naming. The old naming is now unused, remove it.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libkvm/kvm_i386.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libkvm/kvm_i386pae.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libkvm/kvm_x86_64.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/include/pte.h
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/include/kcore.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/include/pte.h
cvs rdiff -u -r1.17 -r1.18 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c

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

Modified files:

Index: src/lib/libkvm/kvm_i386.c
diff -u src/lib/libkvm/kvm_i386.c:1.30 src/lib/libkvm/kvm_i386.c:1.31
--- src/lib/libkvm/kvm_i386.c:1.30	Wed Feb 19 20:21:22 2014
+++ src/lib/libkvm/kvm_i386.c	Sat Apr 25 05:17:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_i386.c,v 1.30 2014/02/19 20:21:22 dsl Exp $	*/
+/*	$NetBSD: kvm_i386.c,v 1.31 2020/04/25 05:17:16 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm_hp300.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: kvm_i386.c,v 1.30 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_i386.c,v 1.31 2020/04/25 05:17:16 maxv Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -148,7 +148,7 @@ _kvm_kvatop_i386(kvm_t *kd, vaddr_t va, 
 	 * Find and read the page directory entry.
 	 * pdppaddr being PAGE_SIZE aligned, we mask the option bits.
 	 */
-	pde_pa = (cpu_kh->pdppaddr & PG_FRAME) + (pl2_pi(va) * sizeof(pde));
+	pde_pa = (cpu_kh->pdppaddr & PTE_FRAME) + (pl2_pi(va) * sizeof(pde));
 	if (_kvm_pread(kd, kd->pmfd, (void *)&pde, sizeof(pde),
 	_kvm_pa2off(kd, pde_pa)) != sizeof(pde)) {
 		_kvm_syserr(kd, 0, "could not read PDE");
@@ -158,19 +158,19 @@ _kvm_kvatop_i386(kvm_t *kd, vaddr_t va, 
 	/*
 	 * Find and read the page table entry.
 	 */
-	if ((pde & PG_V) == 0) {
+	if ((pde & PTE_P) == 0) {
 		_kvm_err(kd, 0, "invalid translation (invalid PDE)");
 		goto lose;
 	}
-	if ((pde & PG_PS) != 0) {
+	if ((pde & PTE_PS) != 0) {
 		/*
 		 * This is a 4MB page.
 		 */
-		page_off = va & ~PG_LGFRAME;
-		*pa = (pde & PG_LGFRAME) + page_off;
+		page_off = va & ~PTE_LGFRAME;
+		*pa = (pde & PTE_LGFRAME) + page_off;
 		return (int)(NBPD_L2 - page_off);
 	}
-	pte_pa = (pde & PG_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
+	pte_pa = (pde & PTE_FRAME) + (pl1_pi(va) * sizeof(pt_entry_t));
 	if (_kvm_pread(kd, kd->pmfd, (void *) &pte, sizeof(pte),
 	_kvm_pa2off(kd, pte_pa)) != sizeof(pte)) {
 		_kvm_syserr(kd, 0, "could not read PTE");
@@ -180,11 +180,11 @@ _kvm_kvatop_i386(kvm_t *kd, vaddr_t va, 
 	/*
 	 * Validate the PTE and return the physical address.
 	 */
-	if ((pte & PG_V) == 0) {
+	if ((pte & PTE_P) == 0) {
 		_kvm_err(kd, 0, "invalid translation (invalid PTE)");
 		goto lose;
 	}
-	*pa = (pte & PG_FRAME) + page_off;
+	*pa = (pte & PTE_FRAME) + page_off;
 	return (int)(NBPG - page_off);
 
  lose:

Index: src/lib/libkvm/kvm_i386pae.c
diff -u src/lib/libkvm/kvm_i386pae.c:1.2 src/lib/libkvm/kvm_i386pae.c:1.3
--- src/lib/libkvm/kvm_i386pae.c:1.2	Wed Feb 19 20:21:22 2014
+++ src/lib/libkvm/kvm_i386pae.c	Sat Apr 25 05:17:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_i386pae.c,v 1.2 2014/02/19 20:21:22 dsl Exp $ */
+/* $NetBSD: kvm_i386pae.c,v 1.3 2020/04/25 05:17:16 maxv Exp $ */
 
 /*
  * Copyright (c) 2010 Jean-Yves Migeon.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: kvm_i386pae.c,v 1.2 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_i386pae.c,v 1.3 2020/04/25 05:17:16 maxv Exp $");
 
 /*
  * This will expose PAE functions, macros, definitions and constants.
@@ -83,7 +83,7 @@ _kvm_kvatop_i386pae(kvm_t *kd, vaddr_t v
 	 * to increment pdppaddr to compute the address of the PDE.
 	 * pdppaddr being PAGE_SIZE aligned, we mask the option bits.
 	 */
-	pde_pa = (cpu_kh->pdppaddr & PG_FRAME) + (pl2_pi(va) * sizeof(pde));
+	pde_pa = (cpu_kh->pdppaddr & PTE_FRAME) + (pl2_pi(va) * sizeof(pde));
 	if (_kvm_pread(kd, kd->pmfd, (void *)&pde, sizeof(pde),
 	_kvm_pa2off(kd, pde_pa)) != sizeof(pde)) {
 		_kvm_syserr(kd, 0, "could not read PDE");
@@ -93,20 +93,20 @@ _kvm_kvatop_i386pae(kvm_t *kd, vaddr_t v
 	/*
 	 * Find and read the page table entry.
 	 */
-	if ((pde & PG_V) == 0) {
+	if ((pde & PTE_P) == 0) {
 		_kvm_err(kd, 0, "invalid translation (invalid PDE)");
 		goto lose;
 	}
-	if ((pde & PG_PS) != 0) {
+	if ((pde & PTE_PS) != 0) {
 		/*
 		 * This is a 2MB page.
 		 */
-		page_off = va & ((vaddr_t)~P

CVS commit: src/sys/dev/ata

2020-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Apr 25 00:07:27 UTC 2020

Modified Files:
src/sys/dev/ata: ata.c ata_subr.c atavar.h

Log Message:
Rather than creating a kthread-per-channel, use a threadpool and a
threadpool-job-per-channel for the in-thread-context work that needs
to be done (which is rare).

On one of my test systems, this results in the total number of LWPs
after multi-user boot dropping from 116 to 78.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ata/ata_subr.c
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/ata/atavar.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.155 src/sys/dev/ata/ata.c:1.156
--- src/sys/dev/ata/ata.c:1.155	Mon Apr 13 10:49:34 2020
+++ src/sys/dev/ata/ata.c	Sat Apr 25 00:07:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.155 2020/04/13 10:49:34 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.156 2020/04/25 00:07:27 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.155 2020/04/13 10:49:34 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.156 2020/04/25 00:07:27 thorpej Exp $");
 
 #include "opt_ata.h"
 
@@ -425,47 +425,60 @@ atabusconfig_thread(void *arg)
 }
 
 /*
- * atabus_thread:
+ * atabus_tp_job:
  *
  *	Worker thread for the ATA bus.
  */
 static void
-atabus_thread(void *arg)
+atabus_tp_job(struct threadpool_job *j)
 {
-	struct atabus_softc *sc = arg;
-	struct ata_channel *chp = sc->sc_chan;
+	struct ata_channel *chp =
+	container_of(j, struct ata_channel, ch_tp_job);
+	struct atabus_softc *sc = device_private(chp->atabus);
 	struct ata_queue *chq = chp->ch_queue;
 	struct ata_xfer *xfer;
 	int i, rv;
 
+	/* XXX MPSAFE?? */
+	KERNEL_LOCK(1, NULL);
+
 	ata_channel_lock(chp);
-	KASSERT(ata_is_thread_run(chp));
+	chp->ch_job_thread = curlwp;	/* XXX gross */
 
-	/*
-	 * Probe the drives.  Reset type to indicate to controllers
-	 * that can re-probe that all drives must be probed..
-	 *
-	 * Note: ch_ndrives may be changed during the probe.
-	 */
-	KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
-	for (i = 0; i < chp->ch_ndrives; i++) {
-		chp->ch_drive[i].drive_flags = 0;
-		chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
+	/* XXX gross */
+	if (__predict_false(!chp->ch_initial_config_done)) {
+		/*
+		 * Probe the drives.  Reset type to indicate to controllers
+		 * that can re-probe that all drives must be probed..
+		 *
+		 * Note: ch_ndrives may be changed during the probe.
+		 */
+		KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
+		for (i = 0; i < chp->ch_ndrives; i++) {
+			chp->ch_drive[i].drive_flags = 0;
+			chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
+		}
+		chp->ch_initial_config_done = true;
+		ata_channel_unlock(chp);
+		atabusconfig(sc);
+		ata_channel_lock(chp);
 	}
-	ata_channel_unlock(chp);
 
-	atabusconfig(sc);
+#define	WORK_TO_DO			\
+	(ATACH_TH_RESCAN | ATACH_TH_RESET | ATACH_TH_DRIVE_RESET |	\
+	 ATACH_TH_RECOVERY)
 
-	ata_channel_lock(chp);
 	for (;;) {
-		if ((chp->ch_flags & (ATACH_TH_RESET | ATACH_TH_DRIVE_RESET
-		| ATACH_TH_RECOVERY | ATACH_SHUTDOWN)) == 0 &&
-		(chq->queue_active == 0 || chq->queue_freeze == 0)) {
-			cv_wait(&chp->ch_thr_idle, &chp->ch_lock);
-		}
 		if (chp->ch_flags & ATACH_SHUTDOWN) {
 			break;
 		}
+		if ((chp->ch_flags & WORK_TO_DO) == 0 &&
+		(chq->queue_active == 0 || chq->queue_freeze == 0)) {
+			break;
+		}
+
+#undef WORK_TO_DO
+
 		if (chp->ch_flags & ATACH_TH_RESCAN) {
 			chp->ch_flags &= ~ATACH_TH_RESCAN;
 			ata_channel_unlock(chp);
@@ -534,10 +547,11 @@ atabus_thread(void *arg)
 			ata_channel_lock(chp);
 		}
 	}
-	chp->ch_thread = NULL;
-	cv_signal(&chp->ch_thr_idle);
+	chp->ch_job_thread = NULL;	/* XXX gross */
+	threadpool_job_done(&chp->ch_tp_job);
 	ata_channel_unlock(chp);
-	kthread_exit(0);
+
+	KERNEL_UNLOCK_ONE(NULL);
 }
 
 bool
@@ -545,7 +559,7 @@ ata_is_thread_run(struct ata_channel *ch
 {
 	KASSERT(mutex_owned(&chp->ch_lock));
 
-	return (chp->ch_thread == curlwp && !cpu_intr_p());
+	return (chp->ch_job_thread == curlwp && !cpu_intr_p());
 }
 
 static void
@@ -553,7 +567,7 @@ ata_thread_wake_locked(struct ata_channe
 {
 	KASSERT(mutex_owned(&chp->ch_lock));
 	ata_channel_freeze_locked(chp);
-	cv_signal(&chp->ch_thr_idle);
+	threadpool_schedule_job(chp->ch_tp, &chp->ch_tp_job);
 }
 
 /*
@@ -587,7 +601,6 @@ atabus_attach(device_t parent, device_t 
 	struct atabus_softc *sc = device_private(self);
 	struct ata_channel *chp = aux;
 	struct atabus_initq *initq;
-	int error;
 
 	sc->sc_chan = chp;
 
@@ -608,11 +621,15 @@ atabus_attach(device_t parent, device_t 
 	mutex_exit(&atabus_qlock);
 	config_pending_incr(sc->sc_dev);
 
-	/* XXX MPSAFE - no KTHREAD_MPSAFE, so protected by KERNEL_LOCK() */
-	if ((er

CVS commit: src/sys/dev/ic

2020-04-24 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Apr 24 23:29:17 UTC 2020

Modified Files:
src/sys/dev/ic: hpetvar.h

Log Message:
On attach figure out how long a single read of the counter register takes
and use that for the adjustment in hpet_delay().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/hpetvar.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/ic/hpetvar.h
diff -u src/sys/dev/ic/hpetvar.h:1.5 src/sys/dev/ic/hpetvar.h:1.6
--- src/sys/dev/ic/hpetvar.h:1.5	Thu Apr 23 20:33:57 2020
+++ src/sys/dev/ic/hpetvar.h	Fri Apr 24 23:29:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hpetvar.h,v 1.5 2020/04/23 20:33:57 ad Exp $ */
+/* $NetBSD: hpetvar.h,v 1.6 2020/04/24 23:29:17 ad Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -41,6 +41,7 @@ struct hpet_softc {
 	bool			sc_mapped;
 	uint32_t		sc_config;
 	int32_t			sc_period;
+	int64_t			sc_adj;
 	struct			timecounter sc_tc;
 };
 



CVS commit: src/sys/kern

2020-04-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Apr 24 22:50:55 UTC 2020

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

Log Message:
add KASSERT() that the while data buffer in a mbuf or the mbuf
cluster fits within the same page

pools actually never return items whose memory cross page boundary for item
sizes smaller than PAGE_SIZE


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.238 src/sys/kern/uipc_mbuf.c:1.239
--- src/sys/kern/uipc_mbuf.c:1.238	Fri Apr 24 22:07:12 2020
+++ src/sys/kern/uipc_mbuf.c	Fri Apr 24 22:50:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.238 2020/04/24 22:07:12 jdolecek Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.239 2020/04/24 22:50:55 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.238 2020/04/24 22:07:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.239 2020/04/24 22:50:55 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -534,6 +534,7 @@ m_get(int how, int type)
 	how == M_WAIT ? PR_WAITOK|PR_LIMITFAIL : PR_NOWAIT);
 	if (m == NULL)
 		return NULL;
+	KASSERT(((vaddr_t)m->m_dat & PAGE_MASK) + MLEN <= PAGE_SIZE);
 
 	mbstat_type_add(type, 1);
 
@@ -587,6 +588,9 @@ m_clget(struct mbuf *m, int how)
 	if (m->m_ext_storage.ext_buf == NULL)
 		return;
 
+	KASSERT(((vaddr_t)m->m_ext_storage.ext_buf & PAGE_MASK) + mclbytes
+	<= PAGE_SIZE);
+
 	MCLINITREFERENCE(m);
 	m->m_data = m->m_ext.ext_buf;
 	m->m_flags = (m->m_flags & ~M_EXTCOPYFLAGS) |



CVS commit: src/sys/dev

2020-04-24 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Apr 24 22:31:36 UTC 2020

Modified Files:
src/sys/dev/ic: vga.c vga_raster.c
src/sys/dev/isa: pcdisplay.c

Log Message:
BUS_SPACE_MAP_PREFETCHABLE yields a write combining region on x86 and that's
not what I intended.. BUS_SPACE_MAP_CACHEABLE is enough.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/ic/vga.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ic/vga_raster.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/isa/pcdisplay.c

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

Modified files:

Index: src/sys/dev/ic/vga.c
diff -u src/sys/dev/ic/vga.c:1.117 src/sys/dev/ic/vga.c:1.118
--- src/sys/dev/ic/vga.c:1.117	Sun Dec  1 14:18:51 2019
+++ src/sys/dev/ic/vga.c	Fri Apr 24 22:31:35 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.117 2019/12/01 14:18:51 ad Exp $ */
+/* $NetBSD: vga.c,v 1.118 2020/04/24 22:31:35 ad Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.117 2019/12/01 14:18:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.118 2020/04/24 22:31:35 ad Exp $");
 
 #include "opt_vga.h"
 /* for WSCONS_SUPPORT_PCVTFONTS */
@@ -545,8 +545,7 @@ vga_init(struct vga_config *vc, bus_spac
 		panic("vga_init: couldn't map 6845 io");
 
 	if (bus_space_map(vh->vh_memt, 0xa, 0x2, 
-	BUS_SPACE_MAP_CACHEABLE | BUS_SPACE_MAP_PREFETCHABLE,
-	&vh->vh_allmemh))
+	BUS_SPACE_MAP_CACHEABLE, &vh->vh_allmemh))
 		panic("vga_init: couldn't map memory");
 
 	if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh,

Index: src/sys/dev/ic/vga_raster.c
diff -u src/sys/dev/ic/vga_raster.c:1.47 src/sys/dev/ic/vga_raster.c:1.48
--- src/sys/dev/ic/vga_raster.c:1.47	Sat Apr  4 00:01:28 2020
+++ src/sys/dev/ic/vga_raster.c	Fri Apr 24 22:31:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vga_raster.c,v 1.47 2020/04/04 00:01:28 riastradh Exp $	*/
+/*	$NetBSD: vga_raster.c,v 1.48 2020/04/24 22:31:36 ad Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Bang Jun-Young
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.47 2020/04/04 00:01:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.48 2020/04/24 22:31:36 ad Exp $");
 
 #include "opt_vga.h"
 #include "opt_wsmsgattrs.h" /* for WSDISPLAY_CUSTOM_OUTPUT */
@@ -396,8 +396,7 @@ vga_raster_init(struct vga_config *vc, b
 		panic("vga_raster_init: couldn't map 6845 io");
 
 	if (bus_space_map(vh->vh_memt, 0xa, 0x2,
-	BUS_SPACE_MAP_CACHEABLE | BUS_SPACE_MAP_PREFETCHABLE,
-	&vh->vh_allmemh))
+	BUS_SPACE_MAP_CACHEABLE, &vh->vh_allmemh))
 		panic("vga_init: couldn't map memory");
 
 	if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh, 0, 0x1,

Index: src/sys/dev/isa/pcdisplay.c
diff -u src/sys/dev/isa/pcdisplay.c:1.44 src/sys/dev/isa/pcdisplay.c:1.45
--- src/sys/dev/isa/pcdisplay.c:1.44	Sun Dec  1 14:18:51 2019
+++ src/sys/dev/isa/pcdisplay.c	Fri Apr 24 22:31:35 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pcdisplay.c,v 1.44 2019/12/01 14:18:51 ad Exp $ */
+/* $NetBSD: pcdisplay.c,v 1.45 2020/04/24 22:31:35 ad Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.44 2019/12/01 14:18:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.45 2020/04/24 22:31:35 ad Exp $");
 
 #include 
 #include 
@@ -190,8 +190,7 @@ pcdisplay_init(struct pcdisplay_config *
 	dc->mono = mono;
 
 	if (bus_space_map(memt, mono ? 0xb : 0xb8000, 0x8000,
-	BUS_SPACE_MAP_CACHEABLE | BUS_SPACE_MAP_PREFETCHABLE,
-	&ph->ph_memh))
+	BUS_SPACE_MAP_CACHEABLE, &ph->ph_memh))
 		panic("pcdisplay_init: cannot map memory");
 	if (bus_space_map(iot, mono ? 0x3b0 : 0x3d0, 0x10,
 			  0, &ph->ph_ioh_6845))



CVS commit: src/sys/dev/ic

2020-04-24 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Apr 24 22:25:07 UTC 2020

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

Log Message:
On attach figure out how long a single read of the counter register takes
and use that for the adjustment in hpet_delay().


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

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

Modified files:

Index: src/sys/dev/ic/hpet.c
diff -u src/sys/dev/ic/hpet.c:1.14 src/sys/dev/ic/hpet.c:1.15
--- src/sys/dev/ic/hpet.c:1.14	Thu Apr 23 20:33:57 2020
+++ src/sys/dev/ic/hpet.c	Fri Apr 24 22:25:07 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hpet.c,v 1.14 2020/04/23 20:33:57 ad Exp $ */
+/* $NetBSD: hpet.c,v 1.15 2020/04/24 22:25:07 ad Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.14 2020/04/23 20:33:57 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.15 2020/04/24 22:25:07 ad Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ hpet_attach_subr(device_t dv)
 	struct hpet_softc *sc = device_private(dv);
 	struct timecounter *tc;
 	uint64_t tmp;
-	uint32_t val;
+	uint32_t val, sval, eval;
 	int i;
 
 	tc = &sc->sc_tc;
@@ -130,6 +130,19 @@ hpet_attach_subr(device_t dv)
 
 	if (device_unit(dv) == 0)
 		hpet0 = sc;
+
+	/*
+	 * Determine approximately how long it takes to read the counter
+	 * register once, and compute an ajustment for hpet_delay() based on
+	 * that.
+	 */
+	(void)bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT_LO);
+	sval = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT_LO);
+	for (i = 0; i < 998; i++)
+		(void)bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT_LO);
+	eval = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT_LO);
+	val = eval - sval;
+	sc->sc_adj = (int64_t)val * sc->sc_period / 1000;
 }
 
 static u_int
@@ -168,13 +181,13 @@ hpet_delay(unsigned int us)
 	int64_t delta;
 
 	/*
-	 * Read timer before slow division.  Assume that each read of the
-	 * HPET costs ~500ns.  Aim for the middle and subtract 750ns for
-	 * overhead.
+	 * Read timer before slow division.  Convert microseconds to
+	 * femtoseconds, subtract the cost of 1 counter register access,
+	 * and convert to HPET units.
 	 */
 	sc = hpet0;
 	otick = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT_LO);
-	delta = (((int64_t)us * 10) - 75000) / sc->sc_period;
+	delta = (((int64_t)us * 10) - sc->sc_adj) / sc->sc_period;
 
 	while (delta > 0) {
 		SPINLOCK_BACKOFF_HOOK;



CVS commit: src/sys/kern

2020-04-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Apr 24 22:07:13 UTC 2020

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

Log Message:
change m_defrag() to coalesce the chain to single mbuf if it's short enough
and first mbuf doesn't use external storage

most fragmented packets end up with first short mbuf containing
frame + protocol header only, and second mbuf containing the data;
m_defrag() previously always returned chain of at least two mbufs,
now it should actually return all data in single mbuf for typical
mbuf chain with length < MCLBYTES


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.237 src/sys/kern/uipc_mbuf.c:1.238
--- src/sys/kern/uipc_mbuf.c:1.237	Sun Mar 15 23:14:41 2020
+++ src/sys/kern/uipc_mbuf.c	Fri Apr 24 22:07:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.237 2020/03/15 23:14:41 thorpej Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.238 2020/04/24 22:07:12 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.237 2020/03/15 23:14:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.238 2020/04/24 22:07:12 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -1672,6 +1672,40 @@ m_defrag(struct mbuf *m, int how)
 	if (m->m_next == NULL)
 		return m;
 
+	/* Defrag to single mbuf if at all possible */
+	if ((m->m_flags & M_EXT) == 0) {
+		if (m->m_pkthdr.len <= MHLEN) {
+			if (M_TRAILINGSPACE(m) < (m->m_pkthdr.len - m->m_len)) {
+KASSERT(M_LEADINGSPACE(m) >=
+(m->m_pkthdr.len - m->m_len));
+memmove(m->m_pktdat, m->m_data, m->m_len);
+m->m_data = m->m_pktdat;
+			}
+
+			KASSERT(M_TRAILINGSPACE(m) >=
+			(m->m_pkthdr.len - m->m_len));
+			if (__predict_false(!m_ensure_contig(&m,
+			m->m_pkthdr.len))) {
+panic("m_ensure_contig(%d) failed\n",
+m->m_pkthdr.len);
+			}
+			return m;
+		} else if (m->m_pkthdr.len <= MCLBYTES) {
+			void *odata = m->m_data;
+
+			MCLGET(m, how);
+			if ((m->m_flags & M_EXT) == 0)
+return NULL;
+			memcpy(m->m_data, odata, m->m_len);
+			if (m_pulldown(m, m->m_len, m->m_pkthdr.len - m->m_len,
+			NULL) == NULL) {
+panic("m_pulldown(%d, %d) failed\n",
+m->m_len, m->m_pkthdr.len - m->m_len);
+			}
+			return m;
+		}
+	}
+
 	m0 = m_get(how, MT_DATA);
 	if (m0 == NULL)
 		return NULL;



CVS commit: src/sys/uvm

2020-04-24 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Apr 24 19:47:03 UTC 2020

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

Log Message:
ubc_alloc_direct(): for a write make sure pages are always marked dirty
because there's no managed mapping.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/uvm/uvm_bio.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_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.111 src/sys/uvm/uvm_bio.c:1.112
--- src/sys/uvm/uvm_bio.c:1.111	Thu Apr 23 21:53:01 2020
+++ src/sys/uvm/uvm_bio.c	Fri Apr 24 19:47:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.111 2020/04/23 21:53:01 ad Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.112 2020/04/24 19:47:03 ad Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.111 2020/04/23 21:53:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.112 2020/04/24 19:47:03 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -888,6 +888,11 @@ again:
 
 		/* Page must be writable by now */
 		KASSERT((pg->flags & PG_RDONLY) == 0 || (flags & UBC_WRITE) == 0);
+
+		/* No managed mapping - mark the page dirty. */
+		if ((flags & UBC_WRITE) != 0) {
+			uvm_pagemarkdirty(pg, UVM_PAGE_STATUS_DIRTY);	
+		}
 	}
 	rw_exit(uobj->vmobjlock);
 
@@ -916,10 +921,10 @@ ubc_direct_release(struct uvm_object *uo
 
 		/* Page was changed, no longer fake and neither clean. */
 		if (flags & UBC_WRITE) {
-			pg->flags &= ~PG_FAKE;
 			KASSERTMSG(uvm_pagegetdirty(pg) ==
 			UVM_PAGE_STATUS_DIRTY,
 			"page %p not dirty", pg);
+			pg->flags &= ~PG_FAKE;
 		}
 	}
 	rw_exit(uobj->vmobjlock);



CVS commit: src/doc

2020-04-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 24 19:38:10 UTC 2020

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new openssl


To generate a diff of this commit:
cvs rdiff -u -r1.1713 -r1.1714 src/doc/3RDPARTY
cvs rdiff -u -r1.2679 -r1.2680 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1713 src/doc/3RDPARTY:1.1714
--- src/doc/3RDPARTY:1.1713	Tue Apr 21 09:39:26 2020
+++ src/doc/3RDPARTY	Fri Apr 24 15:38:10 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1713 2020/04/21 13:39:26 sevan Exp $
+#	$NetBSD: 3RDPARTY,v 1.1714 2020/04/24 19:38:10 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1087,12 +1087,12 @@ markus is very cooperative about it):
 - adjust the DEFAULT_PKCS11_WHITELIST for ssh-agent
 
 Package:	OpenSSL
-Version:	1.0.2o/1.1.1f
+Version:	1.0.2o/1.1.1g
 Current Vers:	1.0.2t/1.1.1g
 Maintainer:	The OpenSSL Project
 Archive Site:	ftp://ftp.openssl.org/source/
 Home Page:	http://www.openssl.org/
-Date:		2020-04-21
+Date:		2020-04-24
 Mailing List:	openssl-annou...@openssl.org
 Responsible:	christos, mjf, tls, riastradh, spz
 License:	OpenSSL and SSLeay license (both BSD-like)

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2679 src/doc/CHANGES:1.2680
--- src/doc/CHANGES:1.2679	Thu Apr 23 05:22:02 2020
+++ src/doc/CHANGES	Fri Apr 24 15:38:10 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2679 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2680 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -182,3 +182,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	dhcpcd(8): Import version 9.0.2 [roy 20200421]
 	xbdback(4): Support indirect segments [jdolecek 20200421]
 	xbdback(4): Make the driver MP-safe [jdolecek 20200423]
+	OpenSSL: Imported 1.1.1g. [christos 20200424]



CVS commit: src/crypto/external/bsd/openssl/dist

2020-04-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 24 19:37:09 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist: CHANGES NEWS README
src/crypto/external/bsd/openssl/dist/apps: ocsp.c s_time.c
src/crypto/external/bsd/openssl/dist/crypto/ec: ec_asn1.c ec_lib.c
ecp_smpl.c
src/crypto/external/bsd/openssl/dist/crypto/evp: e_aes.c
src/crypto/external/bsd/openssl/dist/crypto/x509: x509_vfy.c
src/crypto/external/bsd/openssl/dist/ssl: t1_lib.c

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/crypto/external/bsd/openssl/dist/CHANGES \
src/crypto/external/bsd/openssl/dist/NEWS \
src/crypto/external/bsd/openssl/dist/README
cvs rdiff -u -r1.21 -r1.22 src/crypto/external/bsd/openssl/dist/apps/ocsp.c
cvs rdiff -u -r1.10 -r1.11 src/crypto/external/bsd/openssl/dist/apps/s_time.c
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssl/dist/crypto/ec/ec_asn1.c
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/dist/crypto/ec/ec_lib.c
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/dist/crypto/ec/ecp_smpl.c
cvs rdiff -u -r1.22 -r1.23 \
src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c
cvs rdiff -u -r1.19 -r1.20 \
src/crypto/external/bsd/openssl/dist/crypto/x509/x509_vfy.c
cvs rdiff -u -r1.31 -r1.32 src/crypto/external/bsd/openssl/dist/ssl/t1_lib.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/CHANGES
diff -u src/crypto/external/bsd/openssl/dist/CHANGES:1.23 src/crypto/external/bsd/openssl/dist/CHANGES:1.24
--- src/crypto/external/bsd/openssl/dist/CHANGES:1.23	Sun Apr  5 17:53:44 2020
+++ src/crypto/external/bsd/openssl/dist/CHANGES	Fri Apr 24 15:37:09 2020
@@ -7,6 +7,27 @@
  https://github.com/openssl/openssl/commits/ and pick the appropriate
  release branch.
 
+ Changes between 1.1.1f and 1.1.1g [21 Apr 2020]
+
+  *) Fixed segmentation fault in SSL_check_chain()
+ Server or client applications that call the SSL_check_chain() function
+ during or after a TLS 1.3 handshake may crash due to a NULL pointer
+ dereference as a result of incorrect handling of the
+ "signature_algorithms_cert" TLS extension. The crash occurs if an invalid
+ or unrecognised signature algorithm is received from the peer. This could
+ be exploited by a malicious peer in a Denial of Service attack.
+ (CVE-2020-1967)
+ [Benjamin Kaduk]
+
+  *) Added AES consttime code for no-asm configurations
+ an optional constant time support for AES was added
+ when building openssl for no-asm.
+ Enable with: ./config no-asm -DOPENSSL_AES_CONST_TIME
+ Disable with: ./config no-asm -DOPENSSL_NO_AES_CONST_TIME
+ At this time this feature is by default disabled.
+ It will be enabled by default in 3.0.
+ [Bernd Edlinger]
+
  Changes between 1.1.1e and 1.1.1f [31 Mar 2020]
 
   *) Revert the change of EOF detection while reading in libssl to avoid
Index: src/crypto/external/bsd/openssl/dist/NEWS
diff -u src/crypto/external/bsd/openssl/dist/NEWS:1.23 src/crypto/external/bsd/openssl/dist/NEWS:1.24
--- src/crypto/external/bsd/openssl/dist/NEWS:1.23	Sun Apr  5 17:53:44 2020
+++ src/crypto/external/bsd/openssl/dist/NEWS	Fri Apr 24 15:37:09 2020
@@ -5,6 +5,10 @@
   This file gives a brief overview of the major changes between each OpenSSL
   release. For more details please read the CHANGES file.
 
+  Major changes between OpenSSL 1.1.1f and OpenSSL 1.1.1g [21 Apr 2020]
+
+  o Fixed segmentation fault in SSL_check_chain() (CVE-2020-1967)
+
   Major changes between OpenSSL 1.1.1e and OpenSSL 1.1.1f [31 Mar 2020]
 
   o Revert the unexpected EOF reporting via SSL_ERROR_SSL
Index: src/crypto/external/bsd/openssl/dist/README
diff -u src/crypto/external/bsd/openssl/dist/README:1.23 src/crypto/external/bsd/openssl/dist/README:1.24
--- src/crypto/external/bsd/openssl/dist/README:1.23	Sun Apr  5 17:53:44 2020
+++ src/crypto/external/bsd/openssl/dist/README	Fri Apr 24 15:37:09 2020
@@ -1,5 +1,5 @@
 
- OpenSSL 1.1.1f 31 Mar 2020
+ OpenSSL 1.1.1g 21 Apr 2020
 
  Copyright (c) 1998-2020 The OpenSSL Project
  Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

Index: src/crypto/external/bsd/openssl/dist/apps/ocsp.c
diff -u src/crypto/external/bsd/openssl/dist/apps/ocsp.c:1.21 src/crypto/external/bsd/openssl/dist/apps/ocsp.c:1.22
--- src/crypto/external/bsd/openssl/dist/apps/ocsp.c:1.21	Sat Mar 21 20:53:02 2020
+++ src/crypto/external/bsd/openssl/dist/apps/ocsp.c	Fri Apr 24 15:37:09 2020
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a co

CVS commit: [netbsd-9] src/doc

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 17:48:01 UTC 2020

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

Log Message:
Tickets #846 - #851


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-9.1

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.1
diff -u src/doc/CHANGES-9.1:1.1.2.40 src/doc/CHANGES-9.1:1.1.2.41
--- src/doc/CHANGES-9.1:1.1.2.40	Thu Apr 23 13:33:05 2020
+++ src/doc/CHANGES-9.1	Fri Apr 24 17:48:01 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.40 2020/04/23 13:33:05 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.41 2020/04/24 17:48:01 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -1000,3 +1000,60 @@ sys/netinet6/nd6_nbr.c1.178
 	solicited ND6 packet.
 	[roy, ticket #845]
 
+distrib/amd64/uefi-installimage/Makefile	1.7
+distrib/amd64/uefi-installimage/Makefile.bootimage 1.13
+distrib/amd64/uefi-installimage/Makefile.installimage 1.3
+distrib/common/bootimage/Makefile.bootimage	1.23,1.24
+distrib/common/bootimage/Makefile.installimage	1.6
+distrib/common/bootimage/diskproto.mbrfat.in	1.1
+distrib/hpcarm/Makefile1.7
+distrib/hpcarm/liveimage/Makefile		1.1
+distrib/hpcarm/liveimage/fstab.in		1.1
+distrib/hpcarm/liveimage/spec.in		1.1
+distrib/zaurus/Makefile1.3
+distrib/zaurus/liveimage/Makefile		1.1
+distrib/zaurus/liveimage/fstab.in		1.1
+distrib/zaurus/liveimage/spec.in		1.1
+
+	Add "live-image with a FAT partition for bootstrap files" support.
+	Add "build.sh live-image" support for zaurus and hpcarm.
+	[tsutsui, ticket #846]
+
+sys/arch/hp300/hp300/machdep.c			1.233
+
+	Fix garbages in dmesg caused by uninitialized variables.
+	[tsutsui, ticket #847]
+
+sys/dev/usb/if_urtwn.c1.85
+sys/dev/usb/usbdevs1.778
+sys/dev/usb/usbdevs.h(regen)
+sys/dev/usb/usbdevs_data.h			(regen)
+
+	Add D-Link DWA-121 rev B1 to list of supported devices.
+	[maya, ticket #848]
+
+distrib/common/Makefile.bootcd			1.43
+distrib/vax/cdroms/installcd/Makefile		1.19 (patch)
+
+	PR port-amd64/54776:
+	Do not populate /dev on CD images by default, instead rely on init
+	doing the tmpfs / MAKEDEV magic.
+	On images for machines with serious ram shortage (where the additional
+	tmpfs hurts, like VAX) override this with CDDEV_POPULATE=true.
+	[maya, ticket #849]
+
+sys/dev/dkwedge/dk.c1.98
+
+	PR kern/55026: fix a race condition that could cause a crash
+	on last close of a wedge.
+	[maya, ticket #850]
+
+share/man/man4/man4.x86/amdsmn.4		1.4
+share/man/man4/man4.x86/amdzentemp.4		1.7
+sys/arch/x86/pci/amdsmn.c			1.7-1.9
+sys/arch/x86/pci/amdzentemp.c			1.10
+
+
+	Add support for newer AMD Family 15 temperature sensors.
+	[simonb, ticket #851]
+



CVS commit: [netbsd-9] src

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 17:46:44 UTC 2020

Modified Files:
src/share/man/man4/man4.x86 [netbsd-9]: amdsmn.4 amdzentemp.4
src/sys/arch/x86/pci [netbsd-9]: amdsmn.c amdzentemp.c

Log Message:
Pull up following revision(s) (requested by simonb in ticket #851):

share/man/man4/man4.x86/amdzentemp.4: revision 1.7
share/man/man4/man4.x86/amdsmn.4: revision 1.4
sys/arch/x86/pci/amdsmn.c: revision 1.7
sys/arch/x86/pci/amdsmn.c: revision 1.8
sys/arch/x86/pci/amdsmn.c: revision 1.9
sys/arch/x86/pci/amdzentemp.c: revision 1.10

Update to support Family 15h Model 60 temperature sensors.

Changes based on FreeBSD amdtemp driver changes by Conrad Meyer.
XXX: Some code duplication between this driver and amdtemp as
 parts of the 15h refresh code share more in common with
 older CPUs while accessing the device more like 17h.
--
Note that these drivers are present on some newer AMD Family 15h
processors.
--
Don't mix sign and unsigned operands. Just use size_t for the loop.
--
Apply previous change ("Don't mix sign and unsigned operands. Just use
size_t for the loop.") to another loop variable.
--


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.8.1 src/share/man/man4/man4.x86/amdsmn.4
cvs rdiff -u -r1.6 -r1.6.8.1 src/share/man/man4/man4.x86/amdzentemp.4
cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/x86/pci/amdzentemp.c

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

Modified files:

Index: src/share/man/man4/man4.x86/amdsmn.4
diff -u src/share/man/man4/man4.x86/amdsmn.4:1.3 src/share/man/man4/man4.x86/amdsmn.4:1.3.8.1
--- src/share/man/man4/man4.x86/amdsmn.4:1.3	Fri Jan 26 15:12:37 2018
+++ src/share/man/man4/man4.x86/amdsmn.4	Fri Apr 24 17:46:44 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: amdsmn.4,v 1.3 2018/01/26 15:12:37 wiz Exp $
+.\"	$NetBSD: amdsmn.4,v 1.3.8.1 2020/04/24 17:46:44 martin Exp $
 .\"
 .\" Copyright (c) 2018 Ian Clark 
 .\" All rights reserved.
@@ -54,7 +54,7 @@
 .\"
 .\" $FreeBSD: head/share/man/man4/amdsmn.4 323184 2017-09-05 15:13:41Z cem $
 .\"
-.Dd January 22, 2018
+.Dd April 20, 2020
 .Dt AMDSMN 4 x86
 .Os
 .Sh NAME
@@ -66,7 +66,7 @@
 The
 .Nm
 driver provides support for resources on the System Management Network bus
-in AMD Family 17h processors.
+in AMD Family 17h processors and some later AMD Family 15h processors.
 .Sh SEE ALSO
 .Xr amdzentemp 4
 .Sh HISTORY

Index: src/share/man/man4/man4.x86/amdzentemp.4
diff -u src/share/man/man4/man4.x86/amdzentemp.4:1.6 src/share/man/man4/man4.x86/amdzentemp.4:1.6.8.1
--- src/share/man/man4/man4.x86/amdzentemp.4:1.6	Sat Jan 27 21:39:06 2018
+++ src/share/man/man4/man4.x86/amdzentemp.4	Fri Apr 24 17:46:44 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: amdzentemp.4,v 1.6 2018/01/27 21:39:06 pgoyette Exp $
+.\" $NetBSD: amdzentemp.4,v 1.6.8.1 2020/04/24 17:46:44 martin Exp $
 .\"-
 .\" Copyright (c) 2008 Christoph Egger
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/coretemp.4,v 1.4 2007/10/15 20:00:19 netchild Exp $
 .\"
-.Dd January 28, 2018
+.Dd April 20, 2020
 .Dt AMDZENTEMP 4 x86
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 The
 .Nm
 driver provides support for the on-die digital thermal sensor present
-on AMD Ryzen CPUs
+on AMD Ryzen CPUs and some later AMD Opteron CPUs.
 .Pp
 These sensors provide 0.125\(deC accuracy.
 There is one sensor for each CPU socket.

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.5 src/sys/arch/x86/pci/amdsmn.c:1.5.2.1
--- src/sys/arch/x86/pci/amdsmn.c:1.5	Thu Jul 18 12:04:16 2019
+++ src/sys/arch/x86/pci/amdsmn.c	Fri Apr 24 17:46:44 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: amdsmn.c,v 1.5 2019/07/18 12:04:16 msaitoh Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.5.2.1 2020/04/24 17:46:44 martin Exp $	*/
 
 /*-
- * Copyright (c) 2017 Conrad Meyer 
+ * Copyright (c) 2017, 2019 Conrad Meyer 
  * All rights reserved.
  *
  * NetBSD port by Ian Clark 
@@ -29,10 +29,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5 2019/07/18 12:04:16 msaitoh Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.1 2020/04/24 17:46:44 martin Exp $ ");
 
 /*
- * Driver for the AMD Family 17h CPU System Management Network.
+ * Driver for the AMD Family 15h (model 60+) and 17h CPU
+ * System Management Network.
  */
 
 #include 
@@ -52,11 +53,15 @@ __KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1
 #include "amdsmn.h"
 #include "ioconf.h"
 
-#define	SMN_ADDR_REG	0x60
-#define	SMN_DATA_REG	0x64
+#define	F15H_SMN_ADDR_REG	0xb8
+#define	F15H_SMN_DATA_REG	0xbc
+#define	F17H_SMN_ADDR_REG	0x60
+#define	F17H_SMN_DATA_REG	0x64
 
 struct amdsmn_softc {
 	kmutex_t smn_lock;
+	uint8_t smn_addr_reg;
+	uint8_t smn_data_reg;
 	struct pci_attach_args pa;
 	pci_chipset_tag_t pc;
 	pcitag_t pcitag;
@@ -64,10 +69,29 @@ struct amdsmn_softc {
 
 static const struct pciid {
 	uint16_t	amdsmn_devicei

CVS commit: [netbsd-9] src/sys/dev/dkwedge

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 17:42:53 UTC 2020

Modified Files:
src/sys/dev/dkwedge [netbsd-9]: dk.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #850):

sys/dev/dkwedge/dk.c: revision 1.98

Update sc->sc_parent->dk_rawvp while the lock named dk_rawlock held
to prevent a race condition

Fixes PR kern/55026

OKed by mlelstv@, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.97.8.2 -r1.97.8.3 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.97.8.2 src/sys/dev/dkwedge/dk.c:1.97.8.3
--- src/sys/dev/dkwedge/dk.c:1.97.8.2	Mon Apr  6 14:53:33 2020
+++ src/sys/dev/dkwedge/dk.c	Fri Apr 24 17:42:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.97.8.2 2020/04/06 14:53:33 martin Exp $	*/
+/*	$NetBSD: dk.c,v 1.97.8.3 2020/04/24 17:42:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.97.8.2 2020/04/06 14:53:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.97.8.3 2020/04/24 17:42:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1152,21 +1152,23 @@ dkopen(dev_t dev, int flags, int fmt, st
 static int
 dklastclose(struct dkwedge_softc *sc)
 {
-	int error = 0, doclose;
+	struct vnode *vp;
+	int error = 0;
 
-	doclose = 0;
+	vp = NULL;
 	if (sc->sc_parent->dk_rawopens > 0) {
-		if (--sc->sc_parent->dk_rawopens == 0)
-			doclose = 1;
+		if (--sc->sc_parent->dk_rawopens == 0) {
+			KASSERT(sc->sc_parent->dk_rawvp != NULL);
+			vp = sc->sc_parent->dk_rawvp;
+			sc->sc_parent->dk_rawvp = NULL;
+		}
 	}
 
 	mutex_exit(&sc->sc_parent->dk_rawlock);
 	mutex_exit(&sc->sc_dk.dk_openlock);
 
-	if (doclose) {
-		KASSERT(sc->sc_parent->dk_rawvp != NULL);
-		dk_close_parent(sc->sc_parent->dk_rawvp, FREAD | FWRITE);
-		sc->sc_parent->dk_rawvp = NULL;
+	if (vp) {
+		dk_close_parent(vp, FREAD | FWRITE);
 	}
 
 	return error;



CVS commit: [netbsd-9] src/distrib

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 17:40:54 UTC 2020

Modified Files:
src/distrib/common [netbsd-9]: Makefile.bootcd
src/distrib/vax/cdroms/installcd [netbsd-9]: Makefile

Log Message:
Pull up following revision(s) (requested by maya in ticket #849):

distrib/vax/cdroms/installcd/Makefile: revision 1.19
distrib/common/Makefile.bootcd: revision 1.43

Do not populate /dev on CD images by default, instead rely on init
doing the tmpfs / MAKEDEV magic.

On images for machines with serious ram shortage (where the additional
tmpfs hurts, like VAX) override this with CDDEV_POPULATE=true.

Should fix PR port-amd64/54776.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.2.1 src/distrib/common/Makefile.bootcd
cvs rdiff -u -r1.17 -r1.17.2.1 src/distrib/vax/cdroms/installcd/Makefile

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

Modified files:

Index: src/distrib/common/Makefile.bootcd
diff -u src/distrib/common/Makefile.bootcd:1.41 src/distrib/common/Makefile.bootcd:1.41.2.1
--- src/distrib/common/Makefile.bootcd:1.41	Fri Sep 28 15:03:34 2018
+++ src/distrib/common/Makefile.bootcd	Fri Apr 24 17:40:54 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.bootcd,v 1.41 2018/09/28 15:03:34 martin Exp $
+#	$NetBSD: Makefile.bootcd,v 1.41.2.1 2020/04/24 17:40:54 martin Exp $
 #
 # Makefile snipped to create a CD/DVD ISO
 #
@@ -22,6 +22,8 @@
 #			stuff to put on CD (use in Makefiles)
 #	CDEXTRA_SKIP	A list of file exclusion paths to exclude when copying
 #			directories of extra stuff in CDEXTRA AND CDBUILDEXTRA
+#	CDDEV_POPULATE	Set to 'true' to fully populate /dev on the CD (and
+#			safe a tmpfs union mount)
 #	BOOT		Defaults to $DESTDIR/usr/mdec/boot
 #	BOOTXX_CD9660	Defaults to $DESTDIR/usr/mdec/bootxx_cd9660
 #	CDBOOTOPTIONS	Options for installboot, eg -o console=com0,speed=9600
@@ -44,6 +46,7 @@ BOOT?=		${DESTDIR}/usr/mdec/boot
 BOOTXX_CD9660?=	${DESTDIR}/usr/mdec/bootxx_cd9660
 CDRELEASE?=	false
 CDSOURCE?=	false
+CDDEV_POPULATE?=false
 .if ${CDRELEASE} == false
 CDROMS_RELEASEDIR?=	${MACHINE}/installation/cdrom
 .else
@@ -269,15 +272,21 @@ copy-releasedir:
 	fi
 .endif
 
+.if ${CDDEV_POPULATE} != true
+DELDEV=-e '/^\.\/dev\/.*type=char/d'
+.endif
+
 image:
 	@echo Preparing spec files for makefs...
 	${RM} -f ${WORKSPEC}
 	if [ -d cdrom/etc/mtree ]; then\
 		cat cdrom/etc/mtree/* |\
 		${TOOL_SED} -e 's/ size=[0-9]*//'		\
+		 ${DELDEV}	\
 		 -e '/^\.\/etc\/gettytab/d' > ${WORKSPEC};	\
 	fi
-	if [ -r cdrom/dev/MAKEDEV ]; then			\
+	if [ -r cdrom/dev/MAKEDEV ] &&\
+		 ${CDDEV_POPULATE} == true; then		\
 		${HOST_SH} cdrom/dev/MAKEDEV -s init |		\
 		${TOOL_SED} -e '/^\. type=dir/d' 		\
 			-e 's,^\.,./dev,' >> ${WORKSPEC};	\

Index: src/distrib/vax/cdroms/installcd/Makefile
diff -u src/distrib/vax/cdroms/installcd/Makefile:1.17 src/distrib/vax/cdroms/installcd/Makefile:1.17.2.1
--- src/distrib/vax/cdroms/installcd/Makefile:1.17	Fri Sep 28 15:05:23 2018
+++ src/distrib/vax/cdroms/installcd/Makefile	Fri Apr 24 17:40:53 2020
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.17 2018/09/28 15:05:23 martin Exp $
+#	$NetBSD: Makefile,v 1.17.2.1 2020/04/24 17:40:53 martin Exp $
 CDBASE=		vaxcd			# gives ${CDBASE}.iso
 CDRELEASE=	true			# include $RELEASEDIR/$MACHINE
 CDRELEASE_NODEBUG=	true
+CDDEV_POPULATE=	true			# populate /dev on the CD
 CDKERNELS=	${RELEASEDIR}/${MACHINE}/binary/kernel/netbsd-GENERIC.gz	netbsd.gz
 CDRELEASE_NOISOS=true
 CD_SETS=	base etc	# no modules for VAX



CVS commit: src/sys/netinet6

2020-04-24 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Apr 24 17:36:55 UTC 2020

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

Log Message:
Fill in .pr_usrreqs for SOCK_SEQPACKET and SOCK_STREAM variants of SCTP too.

This should allow these socket types of SCTP to operate on IPv6 family
sockets, as .pr_usrreqs must not be NULL for socreate() to succeed.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/netinet6/in6_proto.c

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

Modified files:

Index: src/sys/netinet6/in6_proto.c
diff -u src/sys/netinet6/in6_proto.c:1.126 src/sys/netinet6/in6_proto.c:1.127
--- src/sys/netinet6/in6_proto.c:1.126	Tue Aug 14 14:49:14 2018
+++ src/sys/netinet6/in6_proto.c	Fri Apr 24 17:36:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_proto.c,v 1.126 2018/08/14 14:49:14 maxv Exp $	*/
+/*	$NetBSD: in6_proto.c,v 1.127 2020/04/24 17:36:55 jakllsch Exp $	*/
 /*	$KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.126 2018/08/14 14:49:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.127 2020/04/24 17:36:55 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -335,6 +335,7 @@ const struct ip6protosw inet6sw[] = {
 	.pr_input = sctp6_input,
 	.pr_ctlinput = sctp6_ctlinput,
 	.pr_ctloutput = sctp_ctloutput,
+	.pr_usrreqs = &sctp6_usrreqs,
 	.pr_drain = sctp_drain,
 },
 {	.pr_type = SOCK_STREAM,
@@ -344,6 +345,7 @@ const struct ip6protosw inet6sw[] = {
 	.pr_input = sctp6_input,
 	.pr_ctlinput = sctp6_ctlinput,
 	.pr_ctloutput = sctp_ctloutput,
+	.pr_usrreqs = &sctp6_usrreqs,
 	.pr_drain = sctp_drain,
 },
 #endif /* SCTP */



CVS commit: [netbsd-9] src/sys/dev/usb

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 17:28:22 UTC 2020

Modified Files:
src/sys/dev/usb [netbsd-9]: if_urtwn.c usbdevs

Log Message:
Pull up following revision(s) (requested by maya in ticket #848):

sys/dev/usb/usbdevs: revision 1.778
sys/dev/usb/if_urtwn.c: revision 1.85

Add D-Link DWA-121 rev B1 to list of supported devices
>From Miguel Landaeta in kern/55140


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.2 -r1.71.2.3 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.770.4.4 -r1.770.4.5 src/sys/dev/usb/usbdevs

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/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.71.2.2 src/sys/dev/usb/if_urtwn.c:1.71.2.3
--- src/sys/dev/usb/if_urtwn.c:1.71.2.2	Sat Dec 14 12:26:05 2019
+++ src/sys/dev/usb/if_urtwn.c	Fri Apr 24 17:28:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.71.2.2 2019/12/14 12:26:05 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.71.2.3 2020/04/24 17:28:21 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.2 2019/12/14 12:26:05 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.3 2020/04/24 17:28:21 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -194,6 +194,7 @@ static const struct urtwn_dev {
 	URTWN_RTL8188E_DEV(REALTEK, RTL8188EU),
 	URTWN_RTL8188E_DEV(ABOCOM, RTL8188EU),
 	URTWN_RTL8188E_DEV(TPLINK, RTL8188EU),
+	URTWN_RTL8188E_DEV(DLINK, DWA121B1),
 
 	/* URTWN_RTL8192EU */
 	URTWN_RTL8192EU_DEV(DLINK,	DWA131E),

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.770.4.4 src/sys/dev/usb/usbdevs:1.770.4.5
--- src/sys/dev/usb/usbdevs:1.770.4.4	Sun Apr 12 08:44:42 2020
+++ src/sys/dev/usb/usbdevs	Fri Apr 24 17:28:21 2020
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.4 2020/04/12 08:44:42 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.5 2020/04/24 17:28:21 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1398,6 +1398,7 @@ product DLINK RTL8192CU_4	0x330b	RTL8192
 product DLINK DWA131B		0x330d	DWA-131 rev B
 product DLINK DWA125D1		0x330f	DWA-125 rev D1
 product DLINK DWA131E		0x3319	DWA-131 rev E
+product DLINK DWA121B1		0x331b	DWA-121 rev B1
 product DLINK DWL122		0x3700	Wireless DWL122
 product DLINK DWLG120		0x3701	DWL-G120
 product DLINK DWL120F		0x3702	DWL-120 rev F



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

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 17:25:10 UTC 2020

Modified Files:
src/sys/arch/hp300/hp300 [netbsd-9]: machdep.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #847):

sys/arch/hp300/hp300/machdep.c: revision 1.233

Fix garbages in dmesg caused by uninitialized variables slipped in r1.228.

Noticed in HP9000/362 dmesg:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=5459

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


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.230.4.1 src/sys/arch/hp300/hp300/machdep.c

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

Modified files:

Index: src/sys/arch/hp300/hp300/machdep.c
diff -u src/sys/arch/hp300/hp300/machdep.c:1.230 src/sys/arch/hp300/hp300/machdep.c:1.230.4.1
--- src/sys/arch/hp300/hp300/machdep.c:1.230	Thu Mar 14 16:59:09 2019
+++ src/sys/arch/hp300/hp300/machdep.c	Fri Apr 24 17:25:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.230 2019/03/14 16:59:09 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.230.4.1 2020/04/24 17:25:10 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.230 2019/03/14 16:59:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.230.4.1 2020/04/24 17:25:10 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -433,6 +433,7 @@ identifycpu(void)
 	/*
 	 * ...and the FPU type.
 	 */
+	fpu[0] = '\0';
 	switch (fputype) {
 	case FPU_68040:
 		strlcpy(fpu, "+FPU", sizeof(fpu));
@@ -458,6 +459,7 @@ identifycpu(void)
 	/*
 	 * ...and finally, the cache type.
 	 */
+	cache[0] = '\0';
 	if (cputype == CPU_68040)
 		snprintf(cache, sizeof(cache),
 		", 4k on-chip physical I/D caches");



CVS commit: [netbsd-9] src/distrib

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 17:19:50 UTC 2020

Modified Files:
src/distrib/amd64/uefi-installimage [netbsd-9]: Makefile
Makefile.bootimage Makefile.installimage
src/distrib/common/bootimage [netbsd-9]: Makefile.bootimage
Makefile.installimage
src/distrib/hpcarm [netbsd-9]: Makefile
src/distrib/zaurus [netbsd-9]: Makefile
Added Files:
src/distrib/common/bootimage [netbsd-9]: diskproto.mbrfat.in
src/distrib/hpcarm/liveimage [netbsd-9]: Makefile fstab.in spec.in
src/distrib/zaurus/liveimage [netbsd-9]: Makefile fstab.in spec.in

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #846):

distrib/hpcarm/Makefile: revision 1.7
distrib/amd64/uefi-installimage/Makefile: revision 1.7
distrib/common/bootimage/Makefile.installimage: revision 1.6
distrib/hpcarm/liveimage/spec.in: revision 1.1
distrib/common/bootimage/Makefile.bootimage: revision 1.23
distrib/common/bootimage/Makefile.bootimage: revision 1.24
distrib/zaurus/liveimage/Makefile: revision 1.1
distrib/amd64/uefi-installimage/Makefile.installimage: revision 1.3
distrib/zaurus/Makefile: revision 1.3
distrib/hpcarm/liveimage/Makefile: revision 1.1
distrib/zaurus/liveimage/spec.in: revision 1.1
distrib/common/bootimage/diskproto.mbrfat.in: revision 1.1
distrib/amd64/uefi-installimage/Makefile.bootimage: revision 1.13
distrib/hpcarm/liveimage/fstab.in: revision 1.1
distrib/zaurus/liveimage/fstab.in: revision 1.1

Merge amd64's UEFI logic back into the generic bootimage handling.

Add "live-image with a FAT partition for bootstrap files" support.
See PR/55075 for more details.

Add "build.sh live-image" support for zaurus.
Tested on SL-C3000 and SL-C700.
See also PR/55075 for live-image with FAT partition support.

Add "build.sh live-image" support for hpcarm.
Tested on WS003SH.
See also PR/55075 for live-image with FAT partition support.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/distrib/amd64/uefi-installimage/Makefile
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 \
src/distrib/amd64/uefi-installimage/Makefile.bootimage
cvs rdiff -u -r1.2 -r1.2.18.1 \
src/distrib/amd64/uefi-installimage/Makefile.installimage
cvs rdiff -u -r1.21.2.1 -r1.21.2.2 \
src/distrib/common/bootimage/Makefile.bootimage
cvs rdiff -u -r1.5 -r1.5.14.1 \
src/distrib/common/bootimage/Makefile.installimage
cvs rdiff -u -r0 -r1.1.4.2 src/distrib/common/bootimage/diskproto.mbrfat.in
cvs rdiff -u -r1.6 -r1.6.64.1 src/distrib/hpcarm/Makefile
cvs rdiff -u -r0 -r1.1.4.2 src/distrib/hpcarm/liveimage/Makefile \
src/distrib/hpcarm/liveimage/fstab.in \
src/distrib/hpcarm/liveimage/spec.in
cvs rdiff -u -r1.2 -r1.2.48.1 src/distrib/zaurus/Makefile
cvs rdiff -u -r0 -r1.1.4.2 src/distrib/zaurus/liveimage/Makefile \
src/distrib/zaurus/liveimage/fstab.in \
src/distrib/zaurus/liveimage/spec.in

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

Modified files:

Index: src/distrib/amd64/uefi-installimage/Makefile
diff -u src/distrib/amd64/uefi-installimage/Makefile:1.6 src/distrib/amd64/uefi-installimage/Makefile:1.6.2.1
--- src/distrib/amd64/uefi-installimage/Makefile:1.6	Sat Dec 15 18:03:17 2018
+++ src/distrib/amd64/uefi-installimage/Makefile	Fri Apr 24 17:19:49 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2018/12/15 18:03:17 gson Exp $
+#	$NetBSD: Makefile,v 1.6.2.1 2020/04/24 17:19:49 martin Exp $
 
 .include 
 
@@ -40,4 +40,4 @@ IMGFILE_EXTRA=\
 	${SYSINSTDIR}/sysinstmsgs.pl	.\
 	${SYSINSTDIR}/sysinst		.
 
-.include "${.CURDIR}/Makefile.installimage"
+.include "${NETBSDSRCDIR}/distrib/common/bootimage//Makefile.installimage"

Index: src/distrib/amd64/uefi-installimage/Makefile.bootimage
diff -u src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.11.2.1 src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.11.2.2
--- src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.11.2.1	Sun Nov 17 07:04:37 2019
+++ src/distrib/amd64/uefi-installimage/Makefile.bootimage	Fri Apr 24 17:19:49 2020
@@ -1,500 +0,0 @@
-#	$NetBSD: Makefile.bootimage,v 1.11.2.1 2019/11/17 07:04:37 martin Exp $
-#
-# Copyright (c) 2009, 2010, 2011 Izumi Tsutsui.  All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#notice, this list of conditions and the following disclaimer in the
-#documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY

CVS commit: src/sys/arch

2020-04-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Apr 24 16:27:28 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c
src/sys/arch/amd64/include: gdt.h
src/sys/arch/i386/include: gdt.h
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c svs.c sys_machdep.c

Log Message:
Give the ldt a fixed size of one page (512 slots), and drop the variable-
sized mechanism that was too complex.

This fixes a race between USER_LDT and SVS: during context switches, the
way SVS installs the new ldt relies on the ldt pointer AND the ldt size,
but both cannot be accessed atomically at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amd64/include/gdt.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/include/gdt.h
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.381 -r1.382 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/x86/svs.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/x86/x86/sys_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.134 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.135
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.134	Thu Apr 23 16:16:14 2020
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Fri Apr 24 16:27:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.134 2020/04/23 16:16:14 christos Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.135 2020/04/24 16:27:27 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.134 2020/04/23 16:16:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.135 2020/04/24 16:27:27 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mac
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -628,7 +629,7 @@ x86_64_set_ldt32(struct lwp *l, void *ar
 	ua.start = ua32.start;
 	ua.num = ua32.num;
 
-	if (ua.num < 0 || ua.num > 8192)
+	if (ua.num < 0 || ua.num > MAX_USERLDT_SLOTS)
 		return EINVAL;
 
 	descv = malloc(sizeof(*descv) * ua.num, M_TEMP, M_WAITOK);
@@ -656,7 +657,7 @@ x86_64_get_ldt32(struct lwp *l, void *ar
 	ua.start = ua32.start;
 	ua.num = ua32.num;
 
-	if (ua.num < 0 || ua.num > 8192)
+	if (ua.num < 0 || ua.num > MAX_USERLDT_SLOTS)
 		return EINVAL;
 
 	cp = malloc(ua.num * sizeof(union descriptor), M_TEMP, M_WAITOK);

Index: src/sys/arch/amd64/include/gdt.h
diff -u src/sys/arch/amd64/include/gdt.h:1.10 src/sys/arch/amd64/include/gdt.h:1.11
--- src/sys/arch/amd64/include/gdt.h:1.10	Wed Feb  8 10:08:26 2017
+++ src/sys/arch/amd64/include/gdt.h	Fri Apr 24 16:27:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.h,v 1.10 2017/02/08 10:08:26 maxv Exp $	*/
+/*	$NetBSD: gdt.h,v 1.11 2020/04/24 16:27:28 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -45,5 +45,6 @@ int ldt_alloc(void *, size_t);
 void ldt_free(int);
 #endif
 
-#define MINGDTSIZ   PAGE_SIZE
-#define MAXGDTSIZ   65536
+#define MAXGDTSIZ		65536
+#define MAX_USERLDT_SIZE	PAGE_SIZE
+#define MAX_USERLDT_SLOTS	(int)(MAX_USERLDT_SIZE / sizeof(union descriptor))

Index: src/sys/arch/i386/include/gdt.h
diff -u src/sys/arch/i386/include/gdt.h:1.16 src/sys/arch/i386/include/gdt.h:1.17
--- src/sys/arch/i386/include/gdt.h:1.16	Sun Jul  2 09:02:06 2017
+++ src/sys/arch/i386/include/gdt.h	Fri Apr 24 16:27:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.h,v 1.16 2017/07/02 09:02:06 maxv Exp $	*/
+/*	$NetBSD: gdt.h,v 1.17 2020/04/24 16:27:28 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -44,5 +44,6 @@ void ldt_free(int);
 
 #endif /* LOCORE */
 
-#define	MINGDTSIZ	PAGE_SIZE
-#define	MAXGDTSIZ	65536
+#define MAXGDTSIZ		65536
+#define MAX_USERLDT_SIZE	PAGE_SIZE
+#define MAX_USERLDT_SLOTS	(int)(MAX_USERLDT_SIZE / sizeof(union descriptor))

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.117 src/sys/arch/x86/include/pmap.h:1.118
--- src/sys/arch/x86/include/pmap.h:1.117	Sun Apr  5 00:21:11 2020
+++ src/sys/arch/x86/include/pmap.h	Fri Apr 24 16:27:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.117 2020/04/05 00:21:11 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.118 2020/04/24 16:27:28 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -191,9 +191,13 @@ extern struct slotspace slotspace;
 #define MAXGDTSIZ 65536 /* XXX */
 #endif
 
+#ifndef MAX_USERLDT_SIZE
+#define MAX_USERLDT_SIZE PAGE_SIZE /* XXX */
+#endif
+
 struct pcpu_entry {
 	uint8_t gdt[MAXGDTSIZ];
-	uint8_t ldt[MAXGDTSIZ];
+	uint8_t ldt[MAX_USERLDT_SIZE];
 	uint8_t tss[PAGE_SIZE];
 	uint8_t ist0[PAGE_SIZE];
 	ui

CVS commit: [netbsd-8] src/doc

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 16:18:06 UTC 2020

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

Log Message:
Tickets #1540 and #1541


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/doc/CHANGES-8.3

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.3
diff -u src/doc/CHANGES-8.3:1.1.2.4 src/doc/CHANGES-8.3:1.1.2.5
--- src/doc/CHANGES-8.3:1.1.2.4	Thu Apr 23 14:13:05 2020
+++ src/doc/CHANGES-8.3	Fri Apr 24 16:18:06 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.4 2020/04/23 14:13:05 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.5 2020/04/24 16:18:06 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -100,4 +100,14 @@ external/bsd/bind/include/config.h		(app
 	This should make DNSSEC work on such hosts as well.
 	[he, ticket #1539]
 
+sys/arch/hp300/hp300/machdep.c			1.233
+
+	Fix garbages in dmesg caused by uninitialized variables.
+	[tsutsui, ticket #1540]
+
+sys/dev/dkwedge/dk.c1.98
+
+	PR kern/55026: fix a race condition that could cause a crash
+	on last close of a wedge.
+	[maya, ticket #1541]
 



CVS commit: [netbsd-8] src/sys/dev/dkwedge

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 16:15:24 UTC 2020

Modified Files:
src/sys/dev/dkwedge [netbsd-8]: dk.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1541):

sys/dev/dkwedge/dk.c: revision 1.98

Update sc->sc_parent->dk_rawvp while the lock named dk_rawlock held
to prevent a race condition

Fixes PR kern/55026

OKed by mlelstv@, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.96.6.1 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.96 src/sys/dev/dkwedge/dk.c:1.96.6.1
--- src/sys/dev/dkwedge/dk.c:1.96	Sun Mar  5 23:07:12 2017
+++ src/sys/dev/dkwedge/dk.c	Fri Apr 24 16:15:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.96 2017/03/05 23:07:12 mlelstv Exp $	*/
+/*	$NetBSD: dk.c,v 1.96.6.1 2020/04/24 16:15:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.96 2017/03/05 23:07:12 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.96.6.1 2020/04/24 16:15:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1152,21 +1152,23 @@ dkopen(dev_t dev, int flags, int fmt, st
 static int
 dklastclose(struct dkwedge_softc *sc)
 {
-	int error = 0, doclose;
+	struct vnode *vp;
+	int error = 0;
 
-	doclose = 0;
+	vp = NULL;
 	if (sc->sc_parent->dk_rawopens > 0) {
-		if (--sc->sc_parent->dk_rawopens == 0)
-			doclose = 1;
+		if (--sc->sc_parent->dk_rawopens == 0) {
+			KASSERT(sc->sc_parent->dk_rawvp != NULL);
+			vp = sc->sc_parent->dk_rawvp;
+			sc->sc_parent->dk_rawvp = NULL;
+		}
 	}
 
 	mutex_exit(&sc->sc_parent->dk_rawlock);
 	mutex_exit(&sc->sc_dk.dk_openlock);
 
-	if (doclose) {
-		KASSERT(sc->sc_parent->dk_rawvp != NULL);
-		dk_close_parent(sc->sc_parent->dk_rawvp, FREAD | FWRITE);
-		sc->sc_parent->dk_rawvp = NULL;
+	if (vp) {
+		dk_close_parent(vp, FREAD | FWRITE);
 	}
 
 	return error;



CVS commit: [netbsd-8] src/sys/arch/hp300/hp300

2020-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 24 16:07:05 UTC 2020

Modified Files:
src/sys/arch/hp300/hp300 [netbsd-8]: machdep.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1540):

sys/arch/hp300/hp300/machdep.c: revision 1.233

Fix garbages in dmesg caused by uninitialized variables slipped in r1.228.

Noticed in HP9000/362 dmesg:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=5459

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


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.229.20.1 src/sys/arch/hp300/hp300/machdep.c

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

Modified files:

Index: src/sys/arch/hp300/hp300/machdep.c
diff -u src/sys/arch/hp300/hp300/machdep.c:1.229 src/sys/arch/hp300/hp300/machdep.c:1.229.20.1
--- src/sys/arch/hp300/hp300/machdep.c:1.229	Sun Apr 20 04:12:54 2014
+++ src/sys/arch/hp300/hp300/machdep.c	Fri Apr 24 16:07:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.229 2014/04/20 04:12:54 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.229.20.1 2020/04/24 16:07:04 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.229 2014/04/20 04:12:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.229.20.1 2020/04/24 16:07:04 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -433,6 +433,7 @@ identifycpu(void)
 	/*
 	 * ...and the FPU type.
 	 */
+	fpu[0] = '\0';
 	switch (fputype) {
 	case FPU_68040:
 		strlcpy(fpu, "+FPU", sizeof(fpu));
@@ -458,6 +459,7 @@ identifycpu(void)
 	/*
 	 * ...and finally, the cache type.
 	 */
+	cache[0] = '\0';
 	if (cputype == CPU_68040)
 		snprintf(cache, sizeof(cache),
 		", 4k on-chip physical I/D caches");



CVS commit: src/tests/usr.bin/printf

2020-04-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr 24 14:29:19 UTC 2020

Modified Files:
src/tests/usr.bin/printf: printf.sh

Log Message:
ATF runs shell script tests with "sh -e" (WHY???)

Compensate for that by adding an explicit test to a command so
-e will not kill the shell when the command (expectedly) fails.

Previously this was saved by /bin/sh disabling -e in command subs.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/printf/printf.sh

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

Modified files:

Index: src/tests/usr.bin/printf/printf.sh
diff -u src/tests/usr.bin/printf/printf.sh:1.5 src/tests/usr.bin/printf/printf.sh:1.6
--- src/tests/usr.bin/printf/printf.sh:1.5	Tue Nov 12 18:59:51 2019
+++ src/tests/usr.bin/printf/printf.sh	Fri Apr 24 14:29:19 2020
@@ -1,4 +1,4 @@
-# $NetBSD: printf.sh,v 1.5 2019/11/12 18:59:51 kre Exp $
+# $NetBSD: printf.sh,v 1.6 2020/04/24 14:29:19 kre Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -178,7 +178,7 @@ expect_fail()
 	test -z "${RES}" &&
 		atf_fail "$*  ... failed (${STAT}) without error message"
 
-	RES="$( do_printf "$@" 2>/dev/null ; echo X )"
+	RES="$( do_printf "$@" 2>/dev/null || : ; echo X )"
 	RES=${RES%X}	# hack to defeat \n removal from $() output
 
 	case "${RES}" in



CVS commit: src/share/man/man4

2020-04-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Apr 24 13:54:56 UTC 2020

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

Log Message:
bump date


To generate a diff of this commit:
cvs rdiff -u -r1.511 -r1.512 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.511 src/share/man/man4/options.4:1.512
--- src/share/man/man4/options.4:1.511	Fri Apr 24 13:47:50 2020
+++ src/share/man/man4/options.4	Fri Apr 24 13:54:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.511 2020/04/24 13:47:50 jdolecek Exp $
+.\"	$NetBSD: options.4,v 1.512 2020/04/24 13:54:56 jdolecek Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -30,7 +30,7 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd March 7, 2020
+.Dd April 24, 2020
 .Dt OPTIONS 4
 .Os
 .Sh NAME



CVS commit: src/share/man/man4

2020-04-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Apr 24 13:47:50 UTC 2020

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

Log Message:
actually MBUFTRACE does splvm(), kpreempt_disable()/enable() and percpu,
this has non-slight overhead - amend documentation to stop claiming
the overhead is slight

adresses PR port-xen/50290


To generate a diff of this commit:
cvs rdiff -u -r1.510 -r1.511 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.510 src/share/man/man4/options.4:1.511
--- src/share/man/man4/options.4:1.510	Sat Apr  4 15:32:42 2020
+++ src/share/man/man4/options.4	Fri Apr 24 13:47:50 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.510 2020/04/04 15:32:42 jdolecek Exp $
+.\"	$NetBSD: options.4,v 1.511 2020/04/24 13:47:50 jdolecek Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -1965,8 +1965,9 @@ This option assumes the presence of
 .Em pseudo-device ipfilter .
 .It Cd options MBUFTRACE
 This option can help track down mbuf leaks.
-When enabled, mbufs are tagged with the devices and protocols using them,
-which slightly decreases network performance.
+When enabled, mbufs are tagged with the devices and protocols using them.
+This can significantly decrease network performance, particularly
+on MP systems.
 This additional information can be viewed with
 .Xr netstat 1 :
 .Dl Ic netstat Fl mssv



CVS commit: src/sys/rump/librump/rumpkern

2020-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 13:34:47 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: lwproc.c

Log Message:
lwp0.l_lid needs to be 0.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/rump/librump/rumpkern/lwproc.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/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.46 src/sys/rump/librump/rumpkern/lwproc.c:1.47
--- src/sys/rump/librump/rumpkern/lwproc.c:1.46	Fri Apr 24 03:56:12 2020
+++ src/sys/rump/librump/rumpkern/lwproc.c	Fri Apr 24 13:34:47 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.47 2020/04/24 13:34:47 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.47 2020/04/24 13:34:47 thorpej Exp $");
 
 #include 
 #include 
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1
 #include "rump_curlwp.h"
 
 struct lwp lwp0 = {
-	.l_lid = 1,
+	.l_lid = 0,
 	.l_proc = &proc0,
 	.l_fd = &filedesc0,
 };



CVS commit: src/sys/dev/hid

2020-04-24 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Fri Apr 24 13:29:46 UTC 2020

Modified Files:
src/sys/dev/hid: hidkbdmap.c

Log Message:
For usb keyboards with encoding *.swapctrlcaps, keep KS_Cmd1 on the same
key as KS_Control_L. This brings them in line with wskbdmap_mfii.c.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hid/hidkbdmap.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/hid/hidkbdmap.c
diff -u src/sys/dev/hid/hidkbdmap.c:1.2 src/sys/dev/hid/hidkbdmap.c:1.3
--- src/sys/dev/hid/hidkbdmap.c:1.2	Sat Jan 11 21:43:10 2020
+++ src/sys/dev/hid/hidkbdmap.c	Fri Apr 24 13:29:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hidkbdmap.c,v 1.2 2020/01/11 21:43:10 nia Exp $	*/
+/*	$NetBSD: hidkbdmap.c,v 1.3 2020/04/24 13:29:46 rhialto Exp $	*/
 
 /*
  * Copyright (c) 1999,2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hidkbdmap.c,v 1.2 2020/01/11 21:43:10 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hidkbdmap.c,v 1.3 2020/04/24 13:29:46 rhialto Exp $");
 
 #include 
 #include 
@@ -279,8 +279,8 @@ Static const keysym_t hidkbd_keydesc_us_
 
 Static const keysym_t hidkbd_keydesc_swapctrlcaps[] = {
 /*  pos  command		normal		shifted */
-KC(57), 			KS_Control_L,
-KC(224), KS_Cmd1,		KS_Caps_Lock,
+KC(57),  KS_Cmd1,		KS_Control_L,
+KC(224), 			KS_Caps_Lock,
 };
 
 Static const keysym_t hidkbd_keydesc_de[] = {



CVS commit: src/sys/dev/pci

2020-04-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Apr 24 12:58:42 UTC 2020

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

Log Message:
mcx: sync with OpenBSD sys/dev/pci/if_mcx.c r1.44

1.44:
Fix typo which could lead into a double free

1.43:
Commands that create objects return a 24 bit object ID, so mask off the
high 8 bits of the value we extract, in case the firmware leaves junk there.
Hrvoje Popovski has seen this with newer firmware on a ConnectX 5 card,
which now works properly.

1.42:
Increase the completion queue size to prevent overflow.  Under reasonably
unlikely circumstances - lots of single-fragment packets being sent, a
significant number of packets being received, while the interrupt handler
was unable to process the completion queue - the completion queue could
overflow, which would result in the interface locking up.

1.41:
Check if we've reached the end of the current mailbox before writing past
the end of it, rather than after.  Now we can actually allocate queues
big enough to need multiple mailboxes.

1.40:
Don't call mcx_intr() from mcx_cmdq_poll(); this was a leftover from early
development that I forgot about, but turns out to be a potential race with
the actual interrupt handler.

1.39:
fix previous: use the correct offset for sq/rq creation, and don't
reset the mbox counter to 0 after calculating it.

1.38:
Add a helper function for writing physical addresses for queues into
command queue mailboxes, and use this for all queue setup commands.
Previously we just assumed the addresses would fit in the first mailbox,
which is currently true but may not be for much longer.

1.37:
(skipped)

1.36:
The event queue consumer counter also needs to be unsigned like the others.

1.35:
try to make if_baudrate look plausible.
this updates the eth proto capability map so it records the baudrate
against the different link types and their media, and then reads
it when the link state changes.

1.34:
(skipped)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_mcx.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/if_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.12 src/sys/dev/pci/if_mcx.c:1.13
--- src/sys/dev/pci/if_mcx.c:1.12	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/pci/if_mcx.c	Fri Apr 24 12:58:42 2020
@@ -1,5 +1,5 @@
-/*	$NetBSD: if_mcx.c,v 1.12 2020/03/15 23:04:50 thorpej Exp $ */
-/*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.13 2020/04/24 12:58:42 jmcneill Exp $ */
+/*	$OpenBSD: if_mcx.c,v 1.44 2020/04/24 07:28:37 mestre Exp $ */
 
 /*
  * Copyright (c) 2017 David Gwynne 
@@ -83,7 +83,7 @@
 
 /* queue sizes */
 #define MCX_LOG_EQ_SIZE		 6		/* one page */
-#define MCX_LOG_CQ_SIZE		 11
+#define MCX_LOG_CQ_SIZE		 12
 #define MCX_LOG_RQ_SIZE		 10
 #define MCX_LOG_SQ_SIZE		 11
 
@@ -155,33 +155,33 @@
 #define MCX_REG_PPCNT		0x5008
 #define MCX_REG_MCIA		0x9014
 
-#define MCX_ETHER_CAP_SGMII	(1 << 0)
-#define MCX_ETHER_CAP_1000_KX	(1 << 1)
-#define MCX_ETHER_CAP_10G_CX4	(1 << 2)
-#define MCX_ETHER_CAP_10G_KX4	(1 << 3)
-#define MCX_ETHER_CAP_10G_KR	(1 << 4)
-#define MCX_ETHER_CAP_20G_KR2	(1 << 5)
-#define MCX_ETHER_CAP_40G_CR4	(1 << 6)
-#define MCX_ETHER_CAP_40G_KR4	(1 << 7)
-#define MCX_ETHER_CAP_56G_R4	(1 << 8)
-#define MCX_ETHER_CAP_10G_CR	(1 << 12)
-#define MCX_ETHER_CAP_10G_SR	(1 << 13)
-#define MCX_ETHER_CAP_10G_LR	(1 << 14)
-#define MCX_ETHER_CAP_40G_SR4	(1 << 15)
-#define MCX_ETHER_CAP_40G_LR4	(1 << 16)
-#define MCX_ETHER_CAP_50G_SR2	(1 << 18)
-#define MCX_ETHER_CAP_100G_CR4	(1 << 20)
-#define MCX_ETHER_CAP_100G_SR4	(1 << 21)
-#define MCX_ETHER_CAP_100G_KR4	(1 << 22)
-#define MCX_ETHER_CAP_100G_LR4	(1 << 23)
-#define MCX_ETHER_CAP_100_TX	(1 << 24)
-#define MCX_ETHER_CAP_1000_T	(1 << 25)
-#define MCX_ETHER_CAP_10G_T	(1 << 26)
-#define MCX_ETHER_CAP_25G_CR	(1 << 27)
-#define MCX_ETHER_CAP_25G_KR	(1 << 28)
-#define MCX_ETHER_CAP_25G_SR	(1 << 29)
-#define MCX_ETHER_CAP_50G_CR2	(1 << 30)
-#define MCX_ETHER_CAP_50G_KR2	(1 << 31)
+#define MCX_ETHER_CAP_SGMII	0
+#define MCX_ETHER_CAP_1000_KX	1
+#define MCX_ETHER_CAP_10G_CX4	2
+#define MCX_ETHER_CAP_10G_KX4	3
+#define MCX_ETHER_CAP_10G_KR	4
+#define MCX_ETHER_CAP_20G_KR2	5
+#define MCX_ETHER_CAP_40G_CR4	6
+#define MCX_ETHER_CAP_40G_KR4	7
+#define MCX_ETHER_CAP_56G_R4	8
+#define MCX_ETHER_CAP_10G_CR	12
+#define MCX_ETHER_CAP_10G_SR	13
+#define MCX_ETHER_CAP_10G_LR	14
+#define MCX_ETHER_CAP_40G_SR4	15
+#define MCX_ETHER_CAP_40G_LR4	16
+#define MCX_ETHER_CAP_50G_SR2	18
+#define MCX_ETHER_CAP_100G_CR4	20
+#define MCX_ETHER_CAP_100G_SR4	21
+#define MCX_ETHER_CAP_100G_KR4	22
+#define MCX_ETHER_CAP_100G_LR4	23
+#define MCX_ETHER_CAP_100_TX	24
+#define MCX_ETHER_CAP_1000_T	25
+#define MCX_ETHER_CAP_10G_T	26
+#define MCX_ETHER_CAP_25G_CR	27
+#define MCX_ETHER_CAP_25G_KR	28
+#define MCX_ETHER_CAP_25G_SR	29
+#define MCX_ETHER_CAP_50G_CR2	30
+#define MCX_ETHER_CAP_50

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

2020-04-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Apr 24 12:40:25 UTC 2020

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

Log Message:
add sudden motion sensor 'driver'.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 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.366 src/sys/arch/macppc/conf/GENERIC:1.367
--- src/sys/arch/macppc/conf/GENERIC:1.366	Sat Mar 28 08:35:36 2020
+++ src/sys/arch/macppc/conf/GENERIC	Fri Apr 24 12:40:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.366 2020/03/28 08:35:36 isaki Exp $
+# $NetBSD: GENERIC,v 1.367 2020/04/24 12:40:25 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.366 $"
+#ident 		"GENERIC-$Revision: 1.367 $"
 
 maxusers	32
 
@@ -373,13 +373,14 @@ iic*	at ki2c?
 # I2C devices
 dbcool* 	at iic?		# dbCool thermal monitor & fan control
 lmtemp* 	at iic?		# temperature sensor, found in PowerBook5,6
-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
 lmu* 		at iic?		# ambient / keyboard lights
+asms* 		at iic?		# sudden motion sensor, various later *Books
 videopll*	at iic?		# for valkyriefb
 sgsmix* 	at iic?		# Additional mixer found in beige G3
 # use with awacs.
+deq* 		at iic?		# mixer/equalizer, used by snapper
 
 wi* 		at obio?	# AirMac
 snapper* 	at obio?	# Snapper audio device



CVS commit: src/sys/dev/i2c

2020-04-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Apr 24 12:38:31 UTC 2020

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: asms.c

Log Message:
a very preliminary driver for the acclerometer found in later *Books
register definitions from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/asms.c
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/i2c/files.i2c

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.110 src/sys/dev/i2c/files.i2c:1.111
--- src/sys/dev/i2c/files.i2c:1.110	Sun Feb  2 06:41:27 2020
+++ src/sys/dev/i2c/files.i2c	Fri Apr 24 12:38:31 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.110 2020/02/02 06:41:27 macallan Exp $
+#	$NetBSD: files.i2c,v 1.111 2020/04/24 12:38:31 macallan Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -311,6 +311,11 @@ device	adadc: sysmon_envsys
 attach	adadc at iic
 file	dev/i2c/adadc.cadadc
 
+# Apple Sudden Motion Sensor
+device	asms: sysmon_envsys
+attach	asms at iic
+file	dev/i2c/asms.casms
+
 # HID over i2c
 # HID "bus"
 define  ihidbus {[ reportid = -1 ]}

Added files:

Index: src/sys/dev/i2c/asms.c
diff -u /dev/null src/sys/dev/i2c/asms.c:1.1
--- /dev/null	Fri Apr 24 12:38:31 2020
+++ src/sys/dev/i2c/asms.c	Fri Apr 24 12:38:31 2020
@@ -0,0 +1,200 @@
+/* $NetBSD: asms.c,v 1.1 2020/04/24 12:38:31 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2020 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.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: asms.c,v 1.1 2020/04/24 12:38:31 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+struct asms_softc {
+	device_t	sc_dev;
+	i2c_tag_t	sc_i2c;
+	i2c_addr_t	sc_addr;
+
+	struct sysmon_envsys *sc_sme;
+	envsys_data_t	sc_sensors[3];
+};
+
+static int	asms_match(device_t, cfdata_t, void *);
+static void	asms_attach(device_t, device_t, void *);
+
+static void	asms_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
+static void	asms_init(struct asms_softc *);
+
+CFATTACH_DECL_NEW(asms, sizeof(struct asms_softc),
+asms_match, asms_attach, NULL, NULL);
+
+static const struct device_compatible_entry compat_data[] = {
+	{ "accelerometer",		0 },
+	{ "AAPL,accelerometer_1",	0 },
+	{ NULL,0 }
+};
+
+/* ASMS Registers, from OpenBSD */
+#define ASMS_REG_COMMAND 0x00
+#define ASMS_REG_STATUS  0x01
+#define ASMS_REG_RCONTROL1 0x02
+#define ASMS_REG_RCONTROL2 0x03
+#define ASMS_REG_RCONTROL3 0x04
+#define ASMS_REG_RDATA1  0x05
+#define ASMS_REG_RDATA2  0x06
+#define ASMS_REG_DATA_X  0x20
+#define ASMS_REG_DATA_Y  0x21
+#define ASMS_REG_DATA_Z  0x22
+#define ASMS_REG_SENS_LOW 0x26 /* init with 0x15 */
+#define ASMS_REG_SENS_HIGH 0x27 /* init with 0x60 */
+#define ASMS_REG_CONTROL_X 0x28 /* init with 0x08 */
+#define ASMS_REG_CONTROL_Y 0x29 /* init with 0x0f */
+#define ASMS_REG_CONTROL_Z 0x2a /* init with 0x4f */
+#define ASMS_REG_UNKNOWN1 0x2b /* init with 0x14 */
+#define ASMS_REG_VENDOR  0x2e
+#define ASMS_CMD_READ_VER 0x01
+#define ASMS_CMD_READ_MEM 0x02
+#define ASMS_CMD_RESET  0x07
+#define ASMS_CMD_START  0x08
+
+static int
+asms_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, &match_result))
+		return match_result;
+	
+	if ((ia->ia_addr & 0xf8) == 0xd8)
+		return I2C_MATCH_ADDRESS_ONLY;
+
+	return 0;
+}
+
+static void
+asms_attach(device_t parent, device_t self, void *aux)
+{
+	struct asms_softc *sc = device_

CVS commit: src/tests/lib/libc/sys

2020-04-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Apr 24 12:17:45 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Reduce assumptions about LWP numbers


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.172 src/tests/lib/libc/sys/t_ptrace_wait.c:1.173
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.172	Fri Apr 24 03:25:20 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Fri Apr 24 12:17:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.172 2020/04/24 03:25:20 thorpej Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.173 2020/04/24 12:17:45 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.172 2020/04/24 03:25:20 thorpej Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.173 2020/04/24 12:17:45 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -7506,11 +7506,8 @@ syscall_body(const char *op)
 	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
 	SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
 
-	/*
-	 * N.B. 9.99.59 and later - single-LWP processes lwpid==pid.
-	 */
 	DPRINTF("Before checking siginfo_t and lwpid\n");
-	ATF_REQUIRE(info.psi_lwpid == 1 || info.psi_lwpid == child);
+	ATF_REQUIRE(info.psi_lwpid > 0);
 	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
 	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCE);
 
@@ -7552,13 +7549,8 @@ syscall_body(const char *op)
 			ptrace(PT_GET_SIGINFO, child, &info, sizeof(info))
 			!= -1);
 
-			/*
-			 * N.B. 9.99.59 and later - single-LWP processes
-			 * lwpid==pid.
-			 */
 			DPRINTF("Before checking siginfo_t and lwpid\n");
-			ATF_REQUIRE(info.psi_lwpid == 1 ||
-info.psi_lwpid == child);
+			ATF_REQUIRE(info.psi_lwpid > 0);
 			ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
 			ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCX);
 
@@ -8678,10 +8670,7 @@ ATF_TC_BODY(core_dump_procinfo, tc)
 	ATF_CHECK_EQ(procinfo.cpi_rgid, getgid());
 	ATF_CHECK_EQ(procinfo.cpi_egid, getegid());
 	ATF_CHECK_EQ(procinfo.cpi_nlwps, 1);
-	/*
-	 * N.B. 9.99.59 and later - single-LWP processes lwpid==pid.
-	 */
-	ATF_CHECK(procinfo.cpi_siglwp == 1 || procinfo.cpi_siglwp == child);
+	ATF_CHECK(procinfo.cpi_siglwp > 0);
 
 	unlink(core_path);
 



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

2020-04-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 24 09:49:05 UTC 2020

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
- AMD CPUID Fn8000_000a %edx bit 20 is "SPEC_CTRL".
- Add some bit definitions of AMD's CPUID Fn8000_001f Encrypted Memory
  features.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.161 src/sys/arch/x86/include/specialreg.h:1.162
--- src/sys/arch/x86/include/specialreg.h:1.161	Mon Apr  6 09:24:49 2020
+++ src/sys/arch/x86/include/specialreg.h	Fri Apr 24 09:49:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.161 2020/04/06 09:24:49 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.162 2020/04/24 09:49:05 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -772,7 +772,9 @@
 #define CPUID_AMD_SVM_V_VMSAVE_VMLOAD	0x8000 /* Virtual VM{SAVE/LOAD} */
 #define CPUID_AMD_SVM_vGIF		0x0001 /* Virtualized GIF */
 #define CPUID_AMD_SVM_GMET		0x0002
-#define CPUID_AMD_SVM_FLAGS	 "\20" \
+#define CPUID_AMD_SVM_SPEC_CTRL		__BIT(20)
+
+#define CPUID_AMD_SVM_FLAGS	 "\20"	\
 	"\1" "NP"	"\2" "LbrVirt"	"\3" "SVML"	"\4" "NRIPS"	\
 	"\5" "TSCRate"	"\6" "VMCBCleanBits" \
 			"\7" "FlushByASID" "\10" "DecodeAssist"	\
@@ -780,7 +782,7 @@
 	"\15" "PFThreshold" "\16" "AVIC" "\17" "B14"			\
 		"\20" "V_VMSAVE_VMLOAD"	\
 	"\21" "VGIF"	"\22" "GMET"	\
-	"\25" "B20"
+	"\25" "SPEC_CTRL"
 
 /*
  * AMD Fn8000_0001d Cache Topology Information.
@@ -795,6 +797,7 @@
  * %eax: flags
  * %ebx:  5-0: Cbit Position
  *   11-6: PhysAddrReduction
+ *  15-12: NumVMPL
  * %ecx: 31-0: NumEncryptedGuests
  * %edx: 31-0: MinSevNoEsAsid
  */
@@ -802,10 +805,21 @@
 #define CPUID_AMD_ENCMEM_SEV	__BIT(1)   /* Secure Encrypted Virtualiz. */
 #define CPUID_AMD_ENCMEM_PGFLMSR __BIT(2)  /* Page Flush MSR */
 #define CPUID_AMD_ENCMEM_SEVES	__BIT(3)   /* SEV Encrypted State */
+#define CPUID_AMD_ENCMEM_SEV_SNP __BIT(4)  /* Secure Nested Paging */
+#define CPUID_AMD_ENCMEM_VMPL	__BIT(5)   /* Virtual Machine Privilege Lvl */
+#define CPUID_AMD_ENCMEM_HECC	__BIT(10) /* HW Enf Cache Coh across enc dom */
+#define CPUID_AMD_ENCMEM_64BH	__BIT(11)  /* 64Bit Host */
+#define CPUID_AMD_ENCMEM_RSTRINJ __BIT(12) /* Restricted Injection */
+#define CPUID_AMD_ENCMEM_ALTINJ	__BIT(13)  /* Alternate Injection */
+#define CPUID_AMD_ENCMEM_DBGSWAP __BIT(14) /* Debug Swap */
+#define CPUID_AMD_ENCMEM_PREVHOSTIBS __BIT(15) /* Prevent Host IBS */
 #define CPUID_AMD_ENCMEM_VTE	__BIT(16)  /* Virtual Transparent Encryption */
 
 #define CPUID_AMD_ENCMEM_FLAGS	 "\20"	  \
 	"\1" "SME"	"\2" "SEV"	"\3" "PageFlushMsr"	"\4" "SEV-ES" \
+	"\5" "SEV-SNP"	"\6" "VMPL"	  \
+	"\13HwEnfCacheCoh"  "\14" "64BitHost" \
+	"\15" "RSTRINJ"	"\16" "ALTINJ"	"\17" "DebugSwap" "\20PreventHostlbs" \
 	"\21" "VTE"
 
 /*



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

2020-04-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr 24 09:29:26 UTC 2020

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c octeon_gmx.c octeon_gmxvar.h

Log Message:
fetch properties in attach rather than every re-init.

this avoids a rwlock while spinlock held problem likely introduced
with MII locking rework, as fetching a property takes an rwlock,
and prior to the rework, only kernel lock would have been held.

ok skrll@.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/cavium/dev/if_cnmac.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_gmx.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_gmxvar.h

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

Modified files:

Index: src/sys/arch/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.17 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.18
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.17	Tue Feb 18 15:00:42 2020
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Fri Apr 24 09:29:26 2020
@@ -1,8 +1,8 @@
-/*	$NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $	*/
 
 #include 
 #if 0
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $");
 #endif
 
 #include "opt_octeon.h"
@@ -292,6 +292,8 @@ octeon_eth_attach(device_t parent, devic
 	struct octeon_eth_softc *sc = device_private(self);
 	struct octeon_gmx_attach_args *ga = aux;
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+	prop_dictionary_t dict;
+	prop_object_t clk;
 	uint8_t enaddr[ETHER_ADDR_LEN];
 
 	sc->sc_dev = self;
@@ -399,6 +401,15 @@ octeon_eth_attach(device_t parent, devic
 
 	OCTEON_EVCNT_ATTACH_EVCNTS(sc, octeon_evcnt_entries,
 	device_xname(sc->sc_dev));
+
+	dict = device_properties(sc->sc_gmx->sc_dev);
+
+	clk = prop_dictionary_get(dict, "rgmii-tx");
+	KASSERT(clk != NULL);
+	sc->sc_gmx_port->sc_clk_tx_setting = prop_number_integer_value(clk);
+	clk = prop_dictionary_get(dict, "rgmii-rx");
+	KASSERT(clk != NULL);
+	sc->sc_gmx_port->sc_clk_rx_setting = prop_number_integer_value(clk);
 }
 
 /*  submodules */

Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.8 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.9
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.8	Wed Jan 29 05:30:14 2020
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c	Fri Apr 24 09:29:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $	*/
+/*	$NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $");
 
 #include "opt_octeon.h"
 
@@ -847,9 +847,6 @@ octeon_gmx_rgmii_speed_speed(struct octe
 static int
 octeon_gmx_rgmii_timing(struct octeon_gmx_port_softc *sc)
 {
-	prop_dictionary_t dict = device_properties(sc->sc_port_gmx->sc_dev);
-	prop_object_t clk;
-	int clk_tx_setting, clk_rx_setting;
 	uint64_t rx_frm_ctl;
 
 	/* RGMII TX Threshold Registers
@@ -887,14 +884,9 @@ octeon_gmx_rgmii_timing(struct octeon_gm
 	/* RGMII TX Clock-Delay Registers
 	 * Delay setting to place n TXC (RGMII transmit clock) delay line.
 	 */
-	clk = prop_dictionary_get(dict, "rgmii-tx");
-	KASSERT(clk != NULL);
-	clk_tx_setting = prop_number_integer_value(clk);
-	clk = prop_dictionary_get(dict, "rgmii-rx");
-	KASSERT(clk != NULL);
-	clk_rx_setting = prop_number_integer_value(clk);
 
-	octeon_asx_clk_set(sc->sc_port_asx, clk_tx_setting, clk_rx_setting);
+	octeon_asx_clk_set(sc->sc_port_asx,
+			   sc->sc_clk_tx_setting, sc->sc_clk_rx_setting);
 
 	return 0;
 }

Index: src/sys/arch/mips/cavium/dev/octeon_gmxvar.h
diff -u src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.2 src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.3
--- src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.2	Thu Apr 19 21:50:06 2018
+++ src/sys/arch/mips/cavium/dev/octeon_gmxvar.h	Fri Apr 24 09:29:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmxvar.h,v 1.2 2018/04/19 21:50:06 christos Exp $	*/
+/*	$NetBSD: octeon_gmxvar.h,v 1.3 2020/04/24 09:29:26 mrg Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -69,6 +69,9 @@ struct octeon_gmx_port_softc {
 	struct octeon_ipd_softc	*sc_ipd;
 	int			sc_port_flowflags;
 
+	int			sc_clk_tx_setting;
+	int			sc_clk_rx_setting;
+
 #if defined(OCTEON_DEBUG) || defined(OCTEON_ETH_DEBUG)
 #if 0
 	/* XXX */



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

2020-04-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 24 07:50:24 UTC 2020

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

Log Message:
 Lowercase ppin.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x86/x86/procfs_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.37 src/sys/arch/x86/x86/procfs_machdep.c:1.38
--- src/sys/arch/x86/x86/procfs_machdep.c:1.37	Fri Apr 24 02:27:59 2020
+++ src/sys/arch/x86/x86/procfs_machdep.c	Fri Apr 24 07:50:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.37 2020/04/24 02:27:59 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.38 2020/04/24 07:50:24 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.37 2020/04/24 02:27:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.38 2020/04/24 07:50:24 msaitoh Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ static const char * const x86_features[]
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "PPIN",
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
 	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */