CVS commit: src/sys/dev/pci

2020-01-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 07:12:41 UTC 2020

Modified Files:
src/sys/dev/pci: if_bnx.c if_bnxvar.h

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/if_bnxvar.h

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

Modified files:

Index: src/sys/dev/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.89 src/sys/dev/pci/if_bnx.c:1.90
--- src/sys/dev/pci/if_bnx.c:1.89	Fri Dec 27 08:22:50 2019
+++ src/sys/dev/pci/if_bnx.c	Sat Feb  1 07:12:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.89 2019/12/27 08:22:50 msaitoh Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.90 2020/02/01 07:12:40 thorpej Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.89 2019/12/27 08:22:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.90 2020/02/01 07:12:40 thorpej Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -4685,7 +4685,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 			len < (BNX_MIN_MTU - ETHER_CRC_LEN) ||
 			len >
 			(BNX_MAX_JUMBO_ETHER_MTU_VLAN - ETHER_CRC_LEN)) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 DBRUNIF(1, sc->l2fhdr_status_errors++);
 
 /* Reuse the mbuf for a new frame. */
@@ -4710,7 +4710,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 "Failed to allocate "
 "new mbuf, incoming frame dropped!\n"));
 
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 
 /* Try and reuse the exisitng mbuf. */
 if (bnx_add_buf(sc, m, _prod,
@@ -4911,7 +4911,7 @@ bnx_tx_intr(struct bnx_softc *sc)
 			m_freem(pkt->pkt_mbuf);
 			DBRUNIF(1, sc->tx_mbuf_alloc--);
 
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 
 			mutex_enter(>tx_pkt_mtx);
 			TAILQ_INSERT_TAIL(>tx_free_pkts, pkt, pkt_entry);
@@ -5456,7 +5456,7 @@ bnx_watchdog(struct ifnet *ifp)
 
 	bnx_init(ifp);
 
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 }
 
 /*
@@ -5672,22 +5672,31 @@ bnx_stats_update(struct bnx_softc *sc)
 
 	stats = (struct statistics_block *)sc->stats_block;
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	uint64_t value;
+
 	/*
 	 * Update the interface statistics from the
 	 * hardware statistics.
 	 */
-	ifp->if_collisions = (u_long)stats->stat_EtherStatsCollisions;
+	value = (u_long)stats->stat_EtherStatsCollisions;
+	if_statadd_ref(nsr, if_collisions, value - sc->if_stat_collisions);
+	sc->if_stat_collisions = value;
 
-	ifp->if_ierrors = (u_long)stats->stat_EtherStatsUndersizePkts +
+	value = (u_long)stats->stat_EtherStatsUndersizePkts +
 	(u_long)stats->stat_EtherStatsOverrsizePkts +
 	(u_long)stats->stat_IfInMBUFDiscards +
 	(u_long)stats->stat_Dot3StatsAlignmentErrors +
 	(u_long)stats->stat_Dot3StatsFCSErrors;
+	if_statadd_ref(nsr, if_ierrors, value - sc->if_stat_ierrors);
+	sc->if_stat_ierrors = value;
 
-	ifp->if_oerrors = (u_long)
+	value = (u_long)
 	stats->stat_emac_tx_stat_dot3statsinternalmactransmiterrors +
 	(u_long)stats->stat_Dot3StatsExcessiveCollisions +
 	(u_long)stats->stat_Dot3StatsLateCollisions;
+	if_statadd_ref(nsr, if_oerrors, value - sc->if_stat_oerrors);
+	sc->if_stat_oerrors = value;
 
 	/*
 	 * Certain controllers don't report
@@ -5695,8 +5704,12 @@ bnx_stats_update(struct bnx_softc *sc)
 	 * See errata E11_5708CA0_1165.
 	 */
 	if (!(BNX_CHIP_NUM(sc) == BNX_CHIP_NUM_5706) &&
-	!(BNX_CHIP_ID(sc) == BNX_CHIP_ID_5708_A0))
-		ifp->if_oerrors += (u_long) stats->stat_Dot3StatsCarrierSenseErrors;
+	!(BNX_CHIP_ID(sc) == BNX_CHIP_ID_5708_A0)) {
+		if_statadd_ref(nsr, if_oerrors,
+		(u_long) stats->stat_Dot3StatsCarrierSenseErrors);
+	}
+
+	IF_STAT_PUTREF(ifp);
 
 	/*
 	 * Update the sysctl statistics from the

Index: src/sys/dev/pci/if_bnxvar.h
diff -u src/sys/dev/pci/if_bnxvar.h:1.11 src/sys/dev/pci/if_bnxvar.h:1.12
--- src/sys/dev/pci/if_bnxvar.h:1.11	Thu Apr 11 14:38:06 2019
+++ src/sys/dev/pci/if_bnxvar.h	Sat Feb  1 07:12:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnxvar.h,v 1.11 2019/04/11 14:38:06 kamil Exp $	*/
+/*	$NetBSD: if_bnxvar.h,v 1.12 2020/02/01 07:12:40 thorpej Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -290,6 +290,11 @@ struct bnx_softc
 	uint16_t		used_tx_bd;
 	uint16_t		max_tx_bd;
 
+	/* For interfacing with if_stats */
+	uint64_t	if_stat_collisions;
+	uint64_t	if_stat_ierrors;
+	uint64_t	if_stat_oerrors;
+
 	/* Provides access to hardware statistics through sysctl. */
 	uint64_t 	stat_IfHCInOctets;
 	uint64_t 	stat_IfHCInBadOctets;



CVS commit: src/sys/dev/pci

2020-01-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 06:38:58 UTC 2020

Modified Files:
src/sys/dev/pci: if_ti.c if_tireg.h

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_ti.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_tireg.h

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

Modified files:

Index: src/sys/dev/pci/if_ti.c
diff -u src/sys/dev/pci/if_ti.c:1.113 src/sys/dev/pci/if_ti.c:1.114
--- src/sys/dev/pci/if_ti.c:1.113	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/if_ti.c	Sat Feb  1 06:38:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.113 2019/11/10 21:16:36 chs Exp $ */
+/* $NetBSD: if_ti.c,v 1.114 2020/02/01 06:38:58 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.113 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.114 2020/02/01 06:38:58 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -1923,13 +1923,13 @@ ti_rxeof(struct ti_softc *sc)
 			m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx];
 			sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL;
 			if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 ti_newbuf_jumbo(sc, sc->ti_jumbo, m);
 continue;
 			}
 			if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL)
 			== ENOBUFS) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 ti_newbuf_jumbo(sc, sc->ti_jumbo, m);
 continue;
 			}
@@ -1940,13 +1940,13 @@ ti_rxeof(struct ti_softc *sc)
 			dmamap = sc->mini_dmamap[rxidx];
 			sc->mini_dmamap[rxidx] = 0;
 			if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 ti_newbuf_mini(sc, sc->ti_mini, m, dmamap);
 continue;
 			}
 			if (ti_newbuf_mini(sc, sc->ti_mini, NULL, dmamap)
 			== ENOBUFS) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 ti_newbuf_mini(sc, sc->ti_mini, m, dmamap);
 continue;
 			}
@@ -1957,13 +1957,13 @@ ti_rxeof(struct ti_softc *sc)
 			dmamap = sc->std_dmamap[rxidx];
 			sc->std_dmamap[rxidx] = 0;
 			if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 ti_newbuf_std(sc, sc->ti_std, m, dmamap);
 continue;
 			}
 			if (ti_newbuf_std(sc, sc->ti_std, NULL, dmamap)
 			== ENOBUFS) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 ti_newbuf_std(sc, sc->ti_std, m, dmamap);
 continue;
 			}
@@ -2068,7 +2068,7 @@ ti_txeof_tigon1(struct ti_softc *sc)
 			TI_TX_RING_BASE);
 		cur_tx = >ti_tx_ring_nic[idx % 128];
 		if (cur_tx->ti_flags & TI_BDFLAG_END)
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		if (sc->ti_cdata.ti_tx_chain[idx] != NULL) {
 			m_freem(sc->ti_cdata.ti_tx_chain[idx]);
 			sc->ti_cdata.ti_tx_chain[idx] = NULL;
@@ -2113,7 +2113,7 @@ ti_txeof_tigon2(struct ti_softc *sc)
 		idx = sc->ti_tx_saved_considx;
 		cur_tx = >ti_rdata->ti_tx_ring[idx];
 		if (cur_tx->ti_flags & TI_BDFLAG_END)
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		if (sc->ti_cdata.ti_tx_chain[idx] != NULL) {
 			m_freem(sc->ti_cdata.ti_tx_chain[idx]);
 			sc->ti_cdata.ti_tx_chain[idx] = NULL;
@@ -2181,18 +2181,17 @@ ti_intr(void *xsc)
 static void
 ti_stats_update(struct ti_softc *sc)
 {
-	struct ifnet		*ifp;
-
-	ifp = >ethercom.ec_if;
+	struct ifnet *ifp = >ethercom.ec_if;
 
 	TI_CDSTATSSYNC(sc, BUS_DMASYNC_POSTREAD);
 
-	ifp->if_collisions +=
+	uint64_t collisions = 
 	   (sc->ti_rdata->ti_info.ti_stats.dot3StatsSingleCollisionFrames +
-	   sc->ti_rdata->ti_info.ti_stats.dot3StatsMultipleCollisionFrames +
-	   sc->ti_rdata->ti_info.ti_stats.dot3StatsExcessiveCollisions +
-	   sc->ti_rdata->ti_info.ti_stats.dot3StatsLateCollisions) -
-	   ifp->if_collisions;
+	sc->ti_rdata->ti_info.ti_stats.dot3StatsMultipleCollisionFrames +
+	sc->ti_rdata->ti_info.ti_stats.dot3StatsExcessiveCollisions +
+	sc->ti_rdata->ti_info.ti_stats.dot3StatsLateCollisions);
+	if_statadd(ifp, if_collisions, collisions - sc->ti_if_collisions);
+	sc->ti_if_collisions = collisions;
 
 	TI_CDSTATSSYNC(sc, BUS_DMASYNC_PREREAD);
 }
@@ -2792,7 +2791,7 @@ ti_watchdog(struct ifnet *ifp)
 	ti_stop(sc);
 	ti_init(sc);
 
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 }
 
 /*

Index: src/sys/dev/pci/if_tireg.h
diff -u src/sys/dev/pci/if_tireg.h:1.22 src/sys/dev/pci/if_tireg.h:1.23
--- src/sys/dev/pci/if_tireg.h:1.22	Fri Sep 13 07:55:07 2019
+++ src/sys/dev/pci/if_tireg.h	Sat Feb  1 06:38:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tireg.h,v 1.22 2019/09/13 07:55:07 msaitoh Exp $ */
+/* $NetBSD: if_tireg.h,v 1.23 2020/02/01 06:38:58 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -1104,6 +1104,8 @@ struct ti_softc {
 
 	struct ti_chain_data	ti_cdata;	/* mbufs */
 
+	uint64_t		ti_if_collisions;
+
 	/*
 	 * Function pointers to deal with Tigon 1 vs. Tigon 2 differences.
 	 */



CVS commit: src/sys/arch

2020-01-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  1 06:17:12 UTC 2020

Modified Files:
src/sys/arch/m68k/include: pmap_motorola.h
src/sys/arch/sun2/include: pmap.h
src/sys/arch/sun3/include: pmap.h

Log Message:
Use "__nothing" macro defined in  for empty pmap_update().

Suggested by pgoyette@ in PR/54869.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sun2/include/pmap.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sun3/include/pmap.h

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

Modified files:

Index: src/sys/arch/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.34 src/sys/arch/m68k/include/pmap_motorola.h:1.35
--- src/sys/arch/m68k/include/pmap_motorola.h:1.34	Sat Oct 29 18:26:19 2011
+++ src/sys/arch/m68k/include/pmap_motorola.h	Sat Feb  1 06:17:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.34 2011/10/29 18:26:19 tsutsui Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.35 2020/02/01 06:17:11 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -202,7 +202,7 @@ extern struct pv_header	*pv_table;	/* ar
 #define	pmap_resident_count(pmap)	((pmap)->pm_stats.resident_count)
 #define	pmap_wired_count(pmap)		((pmap)->pm_stats.wired_count)
 
-#define	pmap_update(pmap)		/* nothing (yet) */
+#define	pmap_update(pmap)		__nothing	/* nothing (yet) */
 
 static __inline void
 pmap_remove_all(struct pmap *pmap)

Index: src/sys/arch/sun2/include/pmap.h
diff -u src/sys/arch/sun2/include/pmap.h:1.26 src/sys/arch/sun2/include/pmap.h:1.27
--- src/sys/arch/sun2/include/pmap.h:1.26	Wed Jan  9 08:11:09 2013
+++ src/sys/arch/sun2/include/pmap.h	Sat Feb  1 06:17:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.26 2013/01/09 08:11:09 he Exp $	*/
+/*	$NetBSD: pmap.h,v 1.27 2020/02/01 06:17:11 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@ extern segsz_t pmap_wired_pages(pmap_t);
 /* We use the PA plus some low bits for device mmap. */
 #define pmap_phys_address(addr) 	(addr)
 
-#define	pmap_update(pmap)		/* nothing (yet) */
+#define	pmap_update(pmap)		__nothing	/* nothing (yet) */
 
 /* Map a given physical region to a virtual region */
 extern vaddr_t pmap_map(vaddr_t, paddr_t, paddr_t, int);

Index: src/sys/arch/sun3/include/pmap.h
diff -u src/sys/arch/sun3/include/pmap.h:1.33 src/sys/arch/sun3/include/pmap.h:1.34
--- src/sys/arch/sun3/include/pmap.h:1.33	Sat Jan 18 20:47:15 2020
+++ src/sys/arch/sun3/include/pmap.h	Sat Feb  1 06:17:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.33 2020/01/18 20:47:15 tsutsui Exp $	*/
+/*	$NetBSD: pmap.h,v 1.34 2020/02/01 06:17:12 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  * Some pmap(9) API macros should be defined here for module(7)
  * because they are common between sun3 and sun3x. (see PR/54869)
  */
-#define	pmap_update(pmap)		/* nothing (yet) */
+#define	pmap_update(pmap)		__nothing	/* nothing (yet) */
 
 void pmap_procwr(struct proc *, vaddr_t, size_t);
 #endif



CVS commit: src/sys/dev/pci

2020-01-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 06:17:23 UTC 2020

Modified Files:
src/sys/dev/pci: if_bge.c if_bgevar.h

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.342 -r1.343 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/if_bgevar.h

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.342 src/sys/dev/pci/if_bge.c:1.343
--- src/sys/dev/pci/if_bge.c:1.342	Mon Nov 25 05:35:26 2019
+++ src/sys/dev/pci/if_bge.c	Sat Feb  1 06:17:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.342 2019/11/25 05:35:26 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.343 2020/02/01 06:17:23 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.342 2019/11/25 05:35:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.343 2020/02/01 06:17:23 thorpej Exp $");
 
 #include 
 #include 
@@ -4453,13 +4453,13 @@ bge_rxeof(struct bge_softc *sc)
 			mtod(m, char *) - (char *)sc->bge_cdata.bge_jumbo_buf,
 			BGE_JLEN, BUS_DMASYNC_POSTREAD);
 			if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 bge_newbuf_jumbo(sc, sc->bge_jumbo, m);
 continue;
 			}
 			if (bge_newbuf_jumbo(sc, sc->bge_jumbo,
 	 NULL)== ENOBUFS) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 bge_newbuf_jumbo(sc, sc->bge_jumbo, m);
 continue;
 			}
@@ -4472,7 +4472,7 @@ bge_rxeof(struct bge_softc *sc)
 			dmamap = sc->bge_cdata.bge_rx_std_map[rxidx];
 			sc->bge_cdata.bge_rx_std_map[rxidx] = NULL;
 			if (dmamap == NULL) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 bge_newbuf_std(sc, sc->bge_std, m, dmamap);
 continue;
 			}
@@ -4480,13 +4480,13 @@ bge_rxeof(struct bge_softc *sc)
 			dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD);
 			bus_dmamap_unload(sc->bge_dmatag, dmamap);
 			if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 bge_newbuf_std(sc, sc->bge_std, m, dmamap);
 continue;
 			}
 			if (bge_newbuf_std(sc, sc->bge_std,
 			NULL, dmamap) == ENOBUFS) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 bge_newbuf_std(sc, sc->bge_std, m, dmamap);
 continue;
 			}
@@ -4617,7 +4617,7 @@ bge_txeof(struct bge_softc *sc)
 		idx = sc->bge_tx_saved_considx;
 		cur_tx = >bge_rdata->bge_tx_ring[idx];
 		if (cur_tx->bge_flags & BGE_TXBDFLAG_END)
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		m = sc->bge_cdata.bge_tx_chain[idx];
 		if (m != NULL) {
 			sc->bge_cdata.bge_tx_chain[idx] = NULL;
@@ -4812,8 +4812,11 @@ bge_stats_update_regs(struct bge_softc *
 {
 	struct ifnet *ifp = >ethercom.ec_if;
 
-	ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS +
-	offsetof(struct bge_mac_stats_regs, etherStatsCollisions));
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
+	if_statadd_ref(nsr, if_collisions,
+	CSR_READ_4(sc, BGE_MAC_STATS +
+	offsetof(struct bge_mac_stats_regs, etherStatsCollisions)));
 
 	/*
 	 * On BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0,
@@ -4824,10 +4827,15 @@ bge_stats_update_regs(struct bge_softc *
 	if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 &&
 	sc->bge_chipid != BGE_CHIPID_BCM5719_A0 &&
 	sc->bge_chipid != BGE_CHIPID_BCM5720_A0) {
-		ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
+		if_statadd_ref(nsr, if_ierrors,
+		CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS));
 	}
-	ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS);
-	ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS);
+	if_statadd_ref(nsr, if_ierrors,
+	CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS));
+	if_statadd_ref(nsr, if_ierrors,
+	CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS));
+
+	IF_STAT_PUTREF(ifp);
 
 	if (sc->bge_flags & BGEF_RDMA_BUG) {
 		uint32_t val, ucast, mcast, bcast;
@@ -4865,12 +4873,15 @@ bge_stats_update(struct bge_softc *sc)
 #define READ_STAT(sc, stats, stat) \
 	  CSR_READ_4(sc, stats + offsetof(struct bge_stats, stat))
 
-	ifp->if_collisions +=
+	uint64_t collisions =
 	  (READ_STAT(sc, stats, dot3StatsSingleCollisionFrames.bge_addr_lo) +
 	   READ_STAT(sc, stats, dot3StatsMultipleCollisionFrames.bge_addr_lo) +
 	   READ_STAT(sc, stats, dot3StatsExcessiveCollisions.bge_addr_lo) +
-	   READ_STAT(sc, stats, dot3StatsLateCollisions.bge_addr_lo)) -
-	  ifp->if_collisions;
+	   READ_STAT(sc, stats, dot3StatsLateCollisions.bge_addr_lo));
+
+	if_statadd(ifp, if_collisions, collisions - sc->bge_if_collisions);
+	sc->bge_if_collisions = collisions;
+
 
 	BGE_EVCNT_UPD(sc->bge_ev_tx_xoff,
 		  READ_STAT(sc, stats, outXoffSent.bge_addr_lo));
@@ -5942,7 +5953,7 @@ bge_watchdog(struct ifnet *ifp)
 	ifp->if_flags &= ~IFF_RUNNING;
 	bge_init(ifp);
 
-	ifp->if_oerrors++;
+	

CVS commit: src

2020-01-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  1 06:02:00 UTC 2020

Modified Files:
src/distrib/news68k/floppies/ramdisk: Makefile
src/sys/arch/news68k/conf: INSTALL

Log Message:
Add and enable dhcpcd for news68k installation.

news68k has already required two floppies since 9.0
so there is no popular demand to shrink ramdisk.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/distrib/news68k/floppies/ramdisk/Makefile
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/news68k/conf/INSTALL

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

Modified files:

Index: src/distrib/news68k/floppies/ramdisk/Makefile
diff -u src/distrib/news68k/floppies/ramdisk/Makefile:1.37 src/distrib/news68k/floppies/ramdisk/Makefile:1.38
--- src/distrib/news68k/floppies/ramdisk/Makefile:1.37	Fri Nov 16 17:07:42 2018
+++ src/distrib/news68k/floppies/ramdisk/Makefile	Sat Feb  1 06:02:00 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.37 2018/11/16 17:07:42 martin Exp $
+#	$NetBSD: Makefile,v 1.38 2020/02/01 06:02:00 tsutsui Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	1800k
+IMAGESIZE=	1856k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1
@@ -29,6 +29,7 @@ HACKSRC=	${DISTRIBDIR}/utils/libhack
 ${CRUNCHBIN}:	libhack.o
 
 .include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
 .include "${DISTRIBDIR}/common/Makefile.makedev"
 .include "${DISTRIBDIR}/common/Makefile.image"
 

Index: src/sys/arch/news68k/conf/INSTALL
diff -u src/sys/arch/news68k/conf/INSTALL:1.65 src/sys/arch/news68k/conf/INSTALL:1.66
--- src/sys/arch/news68k/conf/INSTALL:1.65	Fri Nov 16 17:07:10 2018
+++ src/sys/arch/news68k/conf/INSTALL	Sat Feb  1 06:02:00 2020
@@ -1,4 +1,4 @@
-# 	$NetBSD: INSTALL,v 1.65 2018/11/16 17:07:10 martin Exp $
+# 	$NetBSD: INSTALL,v 1.66 2020/02/01 06:02:00 tsutsui Exp $
 
 #	config for bootable floppy kernel
 #
@@ -18,7 +18,7 @@ options 	CPU_SINGLE		# Will IOP be suppo
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=3600	# 1.80 Megabytes
+options 	MEMORY_DISK_ROOT_SIZE=3712	# 1.85 Megabytes
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 # Standard system options
@@ -137,6 +137,7 @@ cd*	at scsibus? target ? lun ?		# SCSI C
 #romcons0 at mainbus0
 
 # Misc.
+pseudo-device	bpfilter		# Berkeley Packet Filter
 pseudo-device	loop			# loopback interface; required
 pseudo-device	pty			# pseudo-terminals
 pseudo-device	md			# memory disk device



CVS commit: src/sys/dev/pci

2020-01-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 05:14:28 UTC 2020

Modified Files:
src/sys/dev/pci: if_vte.c if_vtevar.h

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_vte.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_vtevar.h

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

Modified files:

Index: src/sys/dev/pci/if_vte.c
diff -u src/sys/dev/pci/if_vte.c:1.28 src/sys/dev/pci/if_vte.c:1.29
--- src/sys/dev/pci/if_vte.c:1.28	Tue Nov 12 19:44:46 2019
+++ src/sys/dev/pci/if_vte.c	Sat Feb  1 05:14:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vte.c,v 1.28 2019/11/12 19:44:46 maya Exp $	*/
+/*	$NetBSD: if_vte.c,v 1.29 2020/02/01 05:14:28 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2011 Manuel Bouyer.  All rights reserved.
@@ -55,7 +55,7 @@
 /* Driver for DM Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.28 2019/11/12 19:44:46 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.29 2020/02/01 05:14:28 thorpej Exp $");
 
 #include 
 #include 
@@ -829,7 +829,7 @@ vte_ifwatchdog(struct ifnet *ifp)
 		return;
 
 	aprint_error_dev(sc->vte_dev, "watchdog timeout -- resetting\n");
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	vte_init(ifp);
 	if (!IFQ_IS_EMPTY(>if_snd))
 		vte_ifstart(ifp);
@@ -918,36 +918,46 @@ vte_stats_update(struct vte_softc *sc)
 
 	stat = >vte_stats;
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	CSR_READ_2(sc, VTE_MECISR);
+
 	/* RX stats. */
 	stat->rx_frames += CSR_READ_2(sc, VTE_CNT_RX_DONE);
+
 	value = CSR_READ_2(sc, VTE_CNT_MECNT0);
 	stat->rx_bcast_frames += (value >> 8);
 	stat->rx_mcast_frames += (value & 0xFF);
+
 	value = CSR_READ_2(sc, VTE_CNT_MECNT1);
-	stat->rx_runts += (value >> 8);
-	stat->rx_crcerrs += (value & 0xFF);
+	if_statadd_ref(nsr, if_ierrors,
+	(value >> 8) +			/* rx_runts */
+	(value & 0xFF));			/* rx_crcerrs */
+
 	value = CSR_READ_2(sc, VTE_CNT_MECNT2);
-	stat->rx_long_frames += (value & 0xFF);
+	if_statadd_ref(nsr, if_ierrors,
+	(value & 0xFF));			/* rx_long_frames */
+
 	value = CSR_READ_2(sc, VTE_CNT_MECNT3);
-	stat->rx_fifo_full += (value >> 8);
+	if_statadd_ref(nsr, if_ierrors,
+	(value >> 8));			/* rx_fifo_full */
 	stat->rx_desc_unavail += (value & 0xFF);
 
 	/* TX stats. */
-	stat->tx_frames += CSR_READ_2(sc, VTE_CNT_TX_DONE);
+	if_statadd_ref(nsr, if_opackets,
+	CSR_READ_2(sc, VTE_CNT_TX_DONE));	/* tx_frames */
+
 	value = CSR_READ_2(sc, VTE_CNT_MECNT4);
-	stat->tx_underruns += (value >> 8);
-	stat->tx_late_colls += (value & 0xFF);
+	if_statadd_ref(nsr, if_oerrors,
+	(value >> 8) +			/* tx_underruns */
+	(value & 0xFF));			/* tx_late_colls */
 
+	/* Pause stats. */
 	value = CSR_READ_2(sc, VTE_CNT_PAUSE);
 	stat->tx_pause_frames += (value >> 8);
 	stat->rx_pause_frames += (value & 0xFF);
 
-	/* Update ifp counters. */
-	ifp->if_opackets = stat->tx_frames;
-	ifp->if_oerrors = stat->tx_late_colls + stat->tx_underruns;
-	ifp->if_ierrors = stat->rx_crcerrs + stat->rx_runts +
-	stat->rx_long_frames + stat->rx_fifo_full;
+	IF_STAT_PUTREF(ifp);
 }
 
 static int
@@ -1019,7 +1029,7 @@ vte_txeof(struct vte_softc *sc)
 		if ((status & VTE_DTST_TX_OWN) != 0)
 			break;
 		if ((status & VTE_DTST_TX_OK) != 0)
-			ifp->if_collisions += (status & 0xf);
+			if_statadd(ifp, if_collisions, (status & 0xf));
 		sc->vte_cdata.vte_tx_cnt--;
 		/* Reclaim transmitted mbufs. */
 		bus_dmamap_sync(sc->vte_dmatag, txd->tx_dmamap, 0,
@@ -1125,7 +1135,7 @@ vte_rxeof(struct vte_softc *sc)
 		}
 		if (vte_newbuf(sc, rxd) != 0) {
 			DPRINTF(("vte_rxeof newbuf failed\n"));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			rxd->rx_desc->drlen =
 			htole16(MCLBYTES - sizeof(uint32_t));
 			rxd->rx_desc->drst = htole16(VTE_DRST_RX_OWN);

Index: src/sys/dev/pci/if_vtevar.h
diff -u src/sys/dev/pci/if_vtevar.h:1.4 src/sys/dev/pci/if_vtevar.h:1.5
--- src/sys/dev/pci/if_vtevar.h:1.4	Tue Apr 14 20:32:36 2015
+++ src/sys/dev/pci/if_vtevar.h	Sat Feb  1 05:14:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vtevar.h,v 1.4 2015/04/14 20:32:36 riastradh Exp $	*/
+/*	$NetBSD: if_vtevar.h,v 1.5 2020/02/01 05:14:28 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2010, Pyun YongHyeon 
@@ -101,17 +101,21 @@ struct vte_hw_stats {
 	uint32_t rx_frames;
 	uint32_t rx_bcast_frames;
 	uint32_t rx_mcast_frames;
+#if 0 /* unused fields; if_stats used instead. */
 	uint32_t rx_runts;
 	uint32_t rx_crcerrs;
 	uint32_t rx_long_frames;
 	uint32_t rx_fifo_full;
+#endif
 	uint32_t rx_desc_unavail;
 	uint32_t rx_pause_frames;
 
 	/* TX stats. */
+#if 0 /* unused fields; if_stats used instead. */
 	uint32_t tx_frames;
 	uint32_t tx_underruns;
 	uint32_t tx_late_colls;
+#endif
 	uint32_t tx_pause_frames;
 };
 



CVS commit: src/sys/net

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:58:06 UTC 2020

Modified Files:
src/sys/net: if_l2tp.c if_l2tp.h

Log Message:
Switch if_l2tp to atomic_load/store_*.

Fix missing membar_datadep_consumer -- now atomic_load_consume -- in
l2tp_lookup_session_ref.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.8 -r1.9 src/sys/net/if_l2tp.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/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.41 src/sys/net/if_l2tp.c:1.42
--- src/sys/net/if_l2tp.c:1.41	Wed Jan 29 04:18:34 2020
+++ src/sys/net/if_l2tp.c	Sat Feb  1 02:58:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.41 2020/01/29 04:18:34 thorpej Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.42 2020/02/01 02:58:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.41 2020/01/29 04:18:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.42 2020/02/01 02:58:05 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1061,7 +1061,6 @@ l2tp_set_tunnel(struct ifnet *ifp, struc
 		encap_lock_exit();
 		goto error;
 	}
-	membar_producer();
 	l2tp_variant_update(sc, nvar);
 
 	mutex_exit(>l2tp_lock);
@@ -1110,7 +1109,6 @@ l2tp_delete_tunnel(struct ifnet *ifp)
 	psref_target_init(>lv_psref, lv_psref_class);
 	nvar->lv_psrc = NULL;
 	nvar->lv_pdst = NULL;
-	membar_producer();
 	l2tp_variant_update(sc, nvar);
 
 	mutex_exit(>l2tp_lock);
@@ -1185,7 +1183,6 @@ l2tp_set_session(struct l2tp_softc *sc, 
 	psref_target_init(>lv_psref, lv_psref_class);
 	nvar->lv_my_sess_id = my_sess_id;
 	nvar->lv_peer_sess_id = peer_sess_id;
-	membar_producer();
 
 	mutex_enter(_hash.lock);
 	if (ovar->lv_my_sess_id > 0 && ovar->lv_peer_sess_id > 0) {
@@ -1226,7 +1223,6 @@ l2tp_clear_session(struct l2tp_softc *sc
 	psref_target_init(>lv_psref, lv_psref_class);
 	nvar->lv_my_sess_id = 0;
 	nvar->lv_peer_sess_id = 0;
-	membar_producer();
 
 	mutex_enter(_hash.lock);
 	if (ovar->lv_my_sess_id > 0 && ovar->lv_peer_sess_id > 0) {
@@ -1253,7 +1249,7 @@ l2tp_lookup_session_ref(uint32_t id, str
 	s = pserialize_read_enter();
 	PSLIST_READER_FOREACH(sc, _hash.lists[idx], struct l2tp_softc,
 	l2tp_hash) {
-		struct l2tp_variant *var = sc->l2tp_var;
+		struct l2tp_variant *var = atomic_load_consume(>l2tp_var);
 		if (var == NULL)
 			continue;
 		if (var->lv_my_sess_id != id)
@@ -1282,17 +1278,12 @@ l2tp_variant_update(struct l2tp_softc *s
 
 	KASSERT(mutex_owned(>l2tp_lock));
 
-	sc->l2tp_var = nvar;
+	atomic_store_release(>l2tp_var, nvar);
 	pserialize_perform(sc->l2tp_psz);
 	psref_target_destroy(>lv_psref, lv_psref_class);
 
-	/*
-	 * In the manual of atomic_swap_ptr(3), there is no mention if 2nd
-	 * argument is rewrite or not. So, use sc->l2tp_var instead of nvar.
-	 */
-	if (sc->l2tp_var != NULL) {
-		if (sc->l2tp_var->lv_psrc != NULL
-		&& sc->l2tp_var->lv_pdst != NULL)
+	if (nvar != NULL) {
+		if (nvar->lv_psrc != NULL && nvar->lv_pdst != NULL)
 			ifp->if_flags |= IFF_RUNNING;
 		else
 			ifp->if_flags &= ~IFF_RUNNING;
@@ -1323,7 +1314,6 @@ l2tp_set_cookie(struct l2tp_softc *sc, u
 	nvar->lv_peer_cookie = peer_cookie;
 	nvar->lv_peer_cookie_len = peer_cookie_len;
 	nvar->lv_use_cookie = L2TP_COOKIE_ON;
-	membar_producer();
 	l2tp_variant_update(sc, nvar);
 
 	mutex_exit(>l2tp_lock);
@@ -1357,7 +1347,6 @@ l2tp_clear_cookie(struct l2tp_softc *sc)
 	nvar->lv_peer_cookie = 0;
 	nvar->lv_peer_cookie_len = 0;
 	nvar->lv_use_cookie = L2TP_COOKIE_OFF;
-	membar_producer();
 	l2tp_variant_update(sc, nvar);
 
 	mutex_exit(>l2tp_lock);
@@ -1376,7 +1365,6 @@ l2tp_set_state(struct l2tp_softc *sc, in
 	*nvar = *sc->l2tp_var;
 	psref_target_init(>lv_psref, lv_psref_class);
 	nvar->lv_state = state;
-	membar_producer();
 	l2tp_variant_update(sc, nvar);
 
 	if (nvar->lv_state == L2TP_STATE_UP) {

Index: src/sys/net/if_l2tp.h
diff -u src/sys/net/if_l2tp.h:1.8 src/sys/net/if_l2tp.h:1.9
--- src/sys/net/if_l2tp.h:1.8	Thu Sep 19 06:07:24 2019
+++ src/sys/net/if_l2tp.h	Sat Feb  1 02:58:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.h,v 1.8 2019/09/19 06:07:24 knakahara Exp $	*/
+/*	$NetBSD: if_l2tp.h,v 1.9 2020/02/01 02:58:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -131,12 +131,11 @@ l2tp_getref_variant(struct l2tp_softc *s
 	int s;
 
 	s = pserialize_read_enter();
-	var = sc->l2tp_var;
+	var = atomic_load_consume(>l2tp_var);
 	if (var == NULL) {
 		pserialize_read_exit(s);
 		return NULL;
 	}
-	membar_datadep_consumer();
 	psref_acquire(psref, >lv_psref, lv_psref_class);
 	pserialize_read_exit(s);
 



CVS commit: src/sys/net

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:57:45 UTC 2020

Modified Files:
src/sys/net: if_gif.c if_gif.h

Log Message:
Switch if_gif to atomic_load/store_*.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/net/if_gif.c
cvs rdiff -u -r1.34 -r1.35 src/sys/net/if_gif.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/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.151 src/sys/net/if_gif.c:1.152
--- src/sys/net/if_gif.c:1.151	Wed Jan 29 04:18:34 2020
+++ src/sys/net/if_gif.c	Sat Feb  1 02:57:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.151 2020/01/29 04:18:34 thorpej Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.152 2020/02/01 02:57:45 riastradh Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.151 2020/01/29 04:18:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.152 2020/02/01 02:57:45 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1125,7 +1126,6 @@ gif_set_tunnel(struct ifnet *ifp, struct
 	if (error)
 		goto out;
 	psref_target_init(>gv_psref, gv_psref_class);
-	membar_producer();
 	gif_update_variant(sc, nvar);
 
 	mutex_exit(>gif_lock);
@@ -1202,7 +1202,6 @@ gif_delete_tunnel(struct ifnet *ifp)
 	nvar->gv_encap_cookie6 = NULL;
 	nvar->gv_output = NULL;
 	psref_target_init(>gv_psref, gv_psref_class);
-	membar_producer();
 	gif_update_variant(sc, nvar);
 
 	mutex_exit(>gif_lock);
@@ -1235,7 +1234,7 @@ gif_update_variant(struct gif_softc *sc,
 
 	KASSERT(mutex_owned(>gif_lock));
 
-	sc->gif_var = nvar;
+	atomic_store_release(>gif_var, nvar);
 	pserialize_perform(sc->gif_psz);
 	psref_target_destroy(>gv_psref, gv_psref_class);
 

Index: src/sys/net/if_gif.h
diff -u src/sys/net/if_gif.h:1.34 src/sys/net/if_gif.h:1.35
--- src/sys/net/if_gif.h:1.34	Wed Oct 30 03:45:59 2019
+++ src/sys/net/if_gif.h	Sat Feb  1 02:57:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.h,v 1.34 2019/10/30 03:45:59 knakahara Exp $	*/
+/*	$NetBSD: if_gif.h,v 1.35 2020/02/01 02:57:45 riastradh Exp $	*/
 /*	$KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $	*/
 
 /*
@@ -101,9 +101,8 @@ gif_getref_variant(struct gif_softc *sc,
 	int s;
 
 	s = pserialize_read_enter();
-	var = sc->gif_var;
+	var = atomic_load_consume(>gif_var);
 	KASSERT(var != NULL);
-	membar_datadep_consumer();
 	psref_acquire(psref, >gv_psref, gv_psref_class);
 	pserialize_read_exit(s);
 



CVS commit: src/sys/net

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:58:15 UTC 2020

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

Log Message:
Switch if_vlan to atomic_load/store_*.

Fix missing membar_datadep_consumer -- now atomic_load_consume -- in
vlan_lookup_tag_psref.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.150 src/sys/net/if_vlan.c:1.151
--- src/sys/net/if_vlan.c:1.150	Wed Jan 29 04:28:27 2020
+++ src/sys/net/if_vlan.c	Sat Feb  1 02:58:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.150 2020/01/29 04:28:27 thorpej Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.151 2020/02/01 02:58:15 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.150 2020/01/29 04:28:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.151 2020/02/01 02:58:15 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -780,12 +780,11 @@ vlan_getref_linkmib(struct ifvlan *sc, s
 	int s;
 
 	s = pserialize_read_enter();
-	mib = sc->ifv_mib;
+	mib = atomic_load_consume(>ifv_mib);
 	if (mib == NULL) {
 		pserialize_read_exit(s);
 		return NULL;
 	}
-	membar_datadep_consumer();
 	psref_acquire(psref, >ifvm_psref, ifvm_psref_class);
 	pserialize_read_exit(s);
 
@@ -812,7 +811,7 @@ vlan_lookup_tag_psref(struct ifnet *ifp,
 	s = pserialize_read_enter();
 	PSLIST_READER_FOREACH(sc, _hash.lists[idx], struct ifvlan,
 	ifv_hash) {
-		struct ifvlan_linkmib *mib = sc->ifv_mib;
+		struct ifvlan_linkmib *mib = atomic_load_consume(>ifv_mib);
 		if (mib == NULL)
 			continue;
 		if (mib->ifvm_tag != tag)
@@ -835,8 +834,7 @@ vlan_linkmib_update(struct ifvlan *ifv, 
 
 	KASSERT(mutex_owned(>ifv_lock));
 
-	membar_producer();
-	ifv->ifv_mib = nmib;
+	atomic_store_release(>ifv_mib, nmib);
 
 	pserialize_perform(ifv->ifv_psz);
 	psref_target_destroy(>ifvm_psref, ifvm_psref_class);



CVS commit: src/sys/net

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:57:56 UTC 2020

Modified Files:
src/sys/net: if_ipsec.c if_ipsec.h

Log Message:
Fix order in rollback case; switch if_ipsec to atomic_load/store_*.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.6 -r1.7 src/sys/net/if_ipsec.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/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.26 src/sys/net/if_ipsec.c:1.27
--- src/sys/net/if_ipsec.c:1.26	Wed Jan 29 04:34:10 2020
+++ src/sys/net/if_ipsec.c	Sat Feb  1 02:57:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.26 2020/01/29 04:34:10 thorpej Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.27 2020/02/01 02:57:55 riastradh Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,13 +27,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.26 2020/01/29 04:34:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.27 2020/02/01 02:57:55 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
 #endif
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1130,7 +1131,6 @@ if_ipsec_set_tunnel(struct ifnet *ifp,
 	if_ipsec_copy_variant(nullvar, ovar);
 	if_ipsec_clear_config(nullvar);
 	psref_target_init(>iv_psref, iv_psref_class);
-	membar_producer();
 	/*
 	 * (2-3) Swap variant include its SPs.
 	 */
@@ -1236,7 +1236,6 @@ if_ipsec_delete_tunnel(struct ifnet *ifp
 	if_ipsec_copy_variant(nullvar, ovar);
 	if_ipsec_clear_config(nullvar);
 	psref_target_init(>iv_psref, iv_psref_class);
-	membar_producer();
 	/*
 	 * (2-3) Swap variant include its SPs.
 	 */
@@ -1323,7 +1322,6 @@ if_ipsec_ensure_flags(struct ifnet *ifp,
 	if_ipsec_copy_variant(nullvar, ovar);
 	if_ipsec_clear_config(nullvar);
 	psref_target_init(>iv_psref, iv_psref_class);
-	membar_producer();
 	/*
 	 * (2-3) Swap variant include its SPs.
 	 */
@@ -1894,16 +1892,16 @@ if_ipsec_update_variant(struct ipsec_sof
 	 * we stop packet processing while replacing SPs, that is, we set
 	 * "null" config variant to sc->ipsec_var.
 	 */
-	sc->ipsec_var = nullvar;
+	atomic_store_release(>ipsec_var, nullvar);
 	pserialize_perform(sc->ipsec_psz);
 	psref_target_destroy(>iv_psref, iv_psref_class);
 
 	error = if_ipsec_replace_sp(sc, ovar, nvar);
 	if (!error)
-		sc->ipsec_var = nvar;
+		atomic_store_release(>ipsec_var, nvar);
 	else {
-		sc->ipsec_var = ovar; /* rollback */
 		psref_target_init(>iv_psref, iv_psref_class);
+		atomic_store_release(>ipsec_var, ovar); /* rollback */
 	}
 
 	pserialize_perform(sc->ipsec_psz);

Index: src/sys/net/if_ipsec.h
diff -u src/sys/net/if_ipsec.h:1.6 src/sys/net/if_ipsec.h:1.7
--- src/sys/net/if_ipsec.h:1.6	Fri Nov  1 04:28:14 2019
+++ src/sys/net/if_ipsec.h	Sat Feb  1 02:57:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.h,v 1.6 2019/11/01 04:28:14 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.h,v 1.7 2020/02/01 02:57:55 riastradh Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -165,9 +165,8 @@ if_ipsec_getref_variant(struct ipsec_sof
 	int s;
 
 	s = pserialize_read_enter();
-	var = sc->ipsec_var;
+	var = atomic_load_consume(>ipsec_var);
 	KASSERT(var != NULL);
-	membar_datadep_consumer();
 	psref_acquire(psref, >iv_psref, iv_psref_class);
 	pserialize_read_exit(s);
 



CVS commit: src/sys/net

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:54:31 UTC 2020

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

Log Message:
Fix wrong memory order and switch pfil to atomic_load/store_*.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/net/pfil.c

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

Modified files:

Index: src/sys/net/pfil.c
diff -u src/sys/net/pfil.c:1.35 src/sys/net/pfil.c:1.36
--- src/sys/net/pfil.c:1.35	Fri Mar 10 07:35:58 2017
+++ src/sys/net/pfil.c	Sat Feb  1 02:54:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfil.c,v 1.35 2017/03/10 07:35:58 ryo Exp $	*/
+/*	$NetBSD: pfil.c,v 1.36 2020/02/01 02:54:31 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius 
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.35 2017/03/10 07:35:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.36 2020/02/01 02:54:31 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -232,8 +232,7 @@ pfil_list_add(pfil_listset_t *phlistset,
 	pfh->pfil_arg  = arg;
 
 	/* switch from oldlist to newlist */
-	membar_producer();
-	phlistset->active = newlist;
+	atomic_store_release(>active, newlist);
 #ifdef NET_MPSAFE
 	pserialize_perform(pfil_psz);
 #endif
@@ -336,8 +335,7 @@ pfil_list_remove(pfil_listset_t *phlists
 		newlist->nhooks--;
 
 		/* switch from oldlist to newlist */
-		phlistset->active = newlist;
-		membar_producer();
+		atomic_store_release(>active, newlist);
 #ifdef NET_MPSAFE
 		pserialize_perform(pfil_psz);
 #endif
@@ -406,8 +404,7 @@ pfil_run_hooks(pfil_head_t *ph, struct m
 
 	bound = curlwp_bind();
 	s = pserialize_read_enter();
-	phlist = phlistset->active;
-	membar_datadep_consumer();
+	phlist = atomic_load_consume(>active);
 	psref_acquire(, >psref, pfil_psref_class);
 	pserialize_read_exit(s);
 	for (u_int i = 0; i < phlist->nhooks; i++) {
@@ -436,8 +433,7 @@ pfil_run_arg(pfil_listset_t *phlistset, 
 
 	bound = curlwp_bind();
 	s = pserialize_read_enter();
-	phlist = phlistset->active;
-	membar_datadep_consumer();
+	phlist = atomic_load_consume(>active);
 	psref_acquire(, >psref, pfil_psref_class);
 	pserialize_read_exit(s);
 	for (u_int i = 0; i < phlist->nhooks; i++) {



CVS commit: src/sys/net

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:54:02 UTC 2020

Modified Files:
src/sys/net: bpf.c bpfjit.c

Log Message:
Fix wrong memory order and switch bpf to atomic_load/store_*.


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/net/bpf.c
cvs rdiff -u -r1.47 -r1.48 src/sys/net/bpfjit.c

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

Modified files:

Index: src/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.233 src/sys/net/bpf.c:1.234
--- src/sys/net/bpf.c:1.233	Sun Jan 19 05:07:22 2020
+++ src/sys/net/bpf.c	Sat Feb  1 02:54:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.233 2020/01/19 05:07:22 thorpej Exp $	*/
+/*	$NetBSD: bpf.c,v 1.234 2020/02/01 02:54:02 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.233 2020/01/19 05:07:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.234 2020/02/01 02:54:02 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -301,10 +301,13 @@ const struct cdevsw bpf_cdevsw = {
 bpfjit_func_t
 bpf_jit_generate(bpf_ctx_t *bc, void *code, size_t size)
 {
-
-	membar_consumer();
-	if (bpfjit_module_ops.bj_generate_code != NULL) {
-		return bpfjit_module_ops.bj_generate_code(bc, code, size);
+	struct bpfjit_ops *ops = _module_ops;
+	bpfjit_func_t (*generate_code)(const bpf_ctx_t *,
+	const struct bpf_insn *, size_t);
+
+	generate_code = atomic_load_acquire(>bj_generate_code);
+	if (generate_code != NULL) {
+		return generate_code(bc, code, size);
 	}
 	return NULL;
 }
@@ -1289,7 +1292,6 @@ bpf_setf(struct bpf_d *d, struct bpf_pro
 			kmem_free(fcode, size);
 			return EINVAL;
 		}
-		membar_consumer();
 		if (bpf_jit)
 			jcode = bpf_jit_generate(NULL, fcode, flen);
 	} else {
@@ -1306,8 +1308,7 @@ bpf_setf(struct bpf_d *d, struct bpf_pro
 	mutex_enter(_mtx);
 	mutex_enter(d->bd_mtx);
 	oldf = d->bd_filter;
-	d->bd_filter = newf;
-	membar_producer();
+	atomic_store_release(>bd_filter, newf);
 	reset_d(d);
 	pserialize_perform(bpf_psz);
 	mutex_exit(d->bd_mtx);
@@ -1607,8 +1608,7 @@ bpf_deliver(struct bpf_if *bp, void *(*c
 		atomic_inc_ulong(>bd_rcount);
 		BPF_STATINC(recv);
 
-		filter = d->bd_filter;
-		membar_datadep_consumer();
+		filter = atomic_load_consume(>bd_filter);
 		if (filter != NULL) {
 			if (filter->bf_jitcode != NULL)
 slen = filter->bf_jitcode(NULL, );
@@ -2308,13 +2308,6 @@ sysctl_net_bpf_jit(SYSCTLFN_ARGS)
 		return error;
 
 	bpf_jit = newval;
-
-	/*
-	 * Do a full sync to publish new bpf_jit value and
-	 * update bpfjit_module_ops.bj_generate_code variable.
-	 */
-	membar_sync();
-
 	if (newval && bpfjit_module_ops.bj_generate_code == NULL) {
 		printf("JIT compilation is postponed "
 		"until after bpfjit module is loaded\n");

Index: src/sys/net/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.47 src/sys/net/bpfjit.c:1.48
--- src/sys/net/bpfjit.c:1.47	Sun Jan 20 23:36:57 2019
+++ src/sys/net/bpfjit.c	Sat Feb  1 02:54:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.47 2019/01/20 23:36:57 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.48 2020/02/01 02:54:02 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2011-2015 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include 
 #ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.47 2019/01/20 23:36:57 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.48 2020/02/01 02:54:02 riastradh Exp $");
 #else
-__RCSID("$NetBSD: bpfjit.c,v 1.47 2019/01/20 23:36:57 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.48 2020/02/01 02:54:02 riastradh Exp $");
 #endif
 
 #include 
@@ -231,9 +231,8 @@ bpfjit_modcmd(modcmd_t cmd, void *arg)
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 		bpfjit_module_ops.bj_free_code = _free_code;
-		membar_producer();
-		bpfjit_module_ops.bj_generate_code = _generate_code;
-		membar_producer();
+		atomic_store_release(_module_ops.bj_generate_code,
+		_generate_code);
 		return 0;
 
 	case MODULE_CMD_FINI:



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

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:33:09 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_netbsd.c

Log Message:
Use atomic_load_acquire for FreeBSDish atomic_load_acq_uint shim.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.12 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.13
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.12	Tue Jan 21 14:55:55 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c	Sat Feb  1 02:33:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.12 2020/01/21 14:55:55 msaitoh Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.13 2020/02/01 02:33:08 riastradh Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -303,15 +303,5 @@ ixgbe_pci_enable_busmaster(pci_chipset_t
 u_int
 atomic_load_acq_uint(volatile u_int *p)
 {
-	u_int rv;
-
-	rv = *p;
-	/*
-	 * XXX
-	 * membar_sync() is far more than we need on most CPUs;
-	 * we just don't have an MI load-acqure operation.
-	 */
-	membar_sync();
-
-	return rv;
+	return atomic_load_acquire(p);
 }



CVS commit: src/sys/dev/pci

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:32:40 UTC 2020

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

Log Message:
Use atomic_load/store_* in ena(4), not questionable membar_sync.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/if_ena.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_ena.c
diff -u src/sys/dev/pci/if_ena.c:1.19 src/sys/dev/pci/if_ena.c:1.20
--- src/sys/dev/pci/if_ena.c:1.19	Mon Dec  2 03:06:51 2019
+++ src/sys/dev/pci/if_ena.c	Sat Feb  1 02:32:40 2020
@@ -31,7 +31,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.19 2019/12/02 03:06:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.20 2020/02/01 02:32:40 riastradh Exp $");
 
 #include 
 #include 
@@ -3349,7 +3349,6 @@ static void ena_keep_alive_wd(void *adap
 {
 	struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
 	struct ena_admin_aenq_keep_alive_desc *desc;
-	sbintime_t stime;
 	uint64_t rx_drops;
 
 	desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e;
@@ -3358,8 +3357,7 @@ static void ena_keep_alive_wd(void *adap
 	counter_u64_zero(adapter->hw_stats.rx_drops);
 	counter_u64_add(adapter->hw_stats.rx_drops, rx_drops);
 
-	stime = getsbinuptime();
-	(void) atomic_swap_64(>keep_alive_timestamp, stime);
+	atomic_store_release(>keep_alive_timestamp, getsbinuptime());
 }
 
 /* Check for keep alive expiration */
@@ -3373,9 +3371,7 @@ static void check_for_missing_keep_alive
 	if (likely(adapter->keep_alive_timeout == 0))
 		return;
 
-	/* FreeBSD uses atomic_load_acq_64() in place of the membar + read */
-	membar_sync();
-	timestamp = adapter->keep_alive_timestamp;
+	timestamp = atomic_load_acquire(>keep_alive_timestamp);
 
 	time = getsbinuptime() - timestamp;
 	if (unlikely(time > adapter->keep_alive_timeout)) {



CVS commit: src/sys

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:23:23 UTC 2020

Modified Files:
src/sys/ddb: db_xxx.c
src/sys/kern: kern_descrip.c kern_sig.c subr_exec_fd.c uipc_socket2.c
uipc_usrreq.c

Log Message:
Load struct fdfile::ff_file with atomic_load_consume.

Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper.  And a little clearer without a long comment.)


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/ddb/db_xxx.c
cvs rdiff -u -r1.244 -r1.245 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.383 -r1.384 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_exec_fd.c
cvs rdiff -u -r1.135 -r1.136 src/sys/kern/uipc_socket2.c
cvs rdiff -u -r1.195 -r1.196 src/sys/kern/uipc_usrreq.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/ddb/db_xxx.c
diff -u src/sys/ddb/db_xxx.c:1.72 src/sys/ddb/db_xxx.c:1.73
--- src/sys/ddb/db_xxx.c:1.72	Sat Feb  1 02:23:04 2020
+++ src/sys/ddb/db_xxx.c	Sat Feb  1 02:23:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_xxx.c,v 1.72 2020/02/01 02:23:04 riastradh Exp $	*/
+/*	$NetBSD: db_xxx.c,v 1.73 2020/02/01 02:23:23 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.72 2020/02/01 02:23:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.73 2020/02/01 02:23:23 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kgdb.h"
@@ -179,7 +179,7 @@ db_show_files_cmd(db_expr_t addr, bool h
 		if ((ff = dt->dt_ff[i]) == NULL)
 			continue;
 
-		fp = ff->ff_file;
+		fp = atomic_load_consume(>ff_file);
 
 		/* Only look at vnodes... */
 		if (fp != NULL && fp->f_type == DTYPE_VNODE

Index: src/sys/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.244 src/sys/kern/kern_descrip.c:1.245
--- src/sys/kern/kern_descrip.c:1.244	Sat Feb  1 02:23:04 2020
+++ src/sys/kern/kern_descrip.c	Sat Feb  1 02:23:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.244 2020/02/01 02:23:04 riastradh Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.245 2020/02/01 02:23:23 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.244 2020/02/01 02:23:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.245 2020/02/01 02:23:23 riastradh Exp $");
 
 #include 
 #include 
@@ -403,7 +403,7 @@ fd_getfile(unsigned fd)
 	 * If the file is not open or is being closed then put the
 	 * reference back.
 	 */
-	fp = ff->ff_file;
+	fp = atomic_load_consume(>ff_file);
 	if (__predict_true(fp != NULL)) {
 		return fp;
 	}
@@ -557,7 +557,7 @@ fd_getfile2(proc_t *p, unsigned fd)
 		mutex_exit(>fd_lock);
 		return NULL;
 	}
-	if ((fp = ff->ff_file) == NULL) {
+	if ((fp = atomic_load_consume(>ff_file)) == NULL) {
 		mutex_exit(>fd_lock);
 		return NULL;
 	}
@@ -595,7 +595,8 @@ fd_close(unsigned fd)
 
 	mutex_enter(>fd_lock);
 	KASSERT((ff->ff_refcnt & FR_MASK) > 0);
-	if (__predict_false(ff->ff_file == NULL)) {
+	fp = atomic_load_consume(>ff_file);
+	if (__predict_false(fp == NULL)) {
 		/*
 		 * Another user of the file is already closing, and is
 		 * waiting for other users of the file to drain.  Release
@@ -620,7 +621,6 @@ fd_close(unsigned fd)
 	 * will prevent them from adding additional uses to this file
 	 * while we are closing it.
 	 */
-	fp = ff->ff_file;
 	ff->ff_file = NULL;
 	ff->ff_exclose = false;
 
@@ -1150,7 +1150,8 @@ fd_affix(proc_t *p, file_t *fp, unsigned
 	 * The memory barriers provided by lock activity in this routine
 	 * ensure that any updates to the file structure become globally
 	 * visible before the file becomes visible to other LWPs in the
-	 * current process.
+	 * current process; otherwise we would set ff->ff_file with
+	 * atomic_store_release(>ff_file, fp) at the bottom.
 	 */
 	fdp = p->p_fd;
 	dt = atomic_load_consume(>fd_dt);
@@ -1462,7 +1463,8 @@ fd_copy(void)
 		KASSERT(i >= NDFDFILE ||
 		*nffp == (fdfile_t *)newfdp->fd_dfdfile[i]);
 		ff = *ffp;
-		if (ff == NULL || (fp = ff->ff_file) == NULL) {
+		if (ff == NULL ||
+		(fp = atomic_load_consume(>ff_file)) == NULL) {
 			/* Descriptor unused, or descriptor half open. */
 			KASSERT(!fd_isused(newfdp, i));
 			continue;
@@ -1549,7 +1551,7 @@ fd_free(void)
 		ff == (fdfile_t *)fdp->fd_dfdfile[fd]);
 		if (ff == NULL)
 			continue;
-		if ((fp = ff->ff_file) != NULL) {
+		if ((fp = atomic_load_consume(>ff_file)) != NULL) {
 			

CVS commit: src/sys

2020-01-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 02:23:04 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c
src/sys/ddb: db_xxx.c
src/sys/kern: kern_descrip.c kern_event.c kern_sig.c subr_exec_fd.c
sys_aio.c sys_descrip.c sys_select.c uipc_socket2.c uipc_usrreq.c
src/sys/miscfs/fdesc: fdesc_vnops.c
src/sys/miscfs/procfs: procfs_vnops.c

Log Message:
Load struct filedesc::fd_dt with atomic_load_consume.

Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:

- Restore KASSERT(mutex_owned(>fd_lock)) in fd_unused.
  => This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
  => atomic_load_consume serves the same purpose now.
  => Was needed only on alpha anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.71 -r1.72 src/sys/ddb/db_xxx.c
cvs rdiff -u -r1.243 -r1.244 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.105 -r1.106 src/sys/kern/kern_event.c
cvs rdiff -u -r1.382 -r1.383 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_exec_fd.c
cvs rdiff -u -r1.45 -r1.46 src/sys/kern/sys_aio.c
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/sys_descrip.c
cvs rdiff -u -r1.50 -r1.51 src/sys/kern/sys_select.c
cvs rdiff -u -r1.134 -r1.135 src/sys/kern/uipc_socket2.c
cvs rdiff -u -r1.194 -r1.195 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.131 -r1.132 src/sys/miscfs/fdesc/fdesc_vnops.c
cvs rdiff -u -r1.207 -r1.208 src/sys/miscfs/procfs/procfs_vnops.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.106 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.107
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.106	Mon Nov 18 04:17:08 2019
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Sat Feb  1 02:23:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.106 2019/11/18 04:17:08 rin Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.107 2020/02/01 02:23:03 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,13 +31,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.106 2019/11/18 04:17:08 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.107 2020/02/01 02:23:03 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
 #endif
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1132,7 +1133,7 @@ netbsd32_ioctl(struct lwp *l,
 		goto out;
 	}
 
-	ff = fdp->fd_dt->dt_ff[SCARG(uap, fd)];
+	ff = atomic_load_consume(>fd_dt)->dt_ff[SCARG(uap, fd)];
 	switch (com = SCARG(uap, com)) {
 	case FIOCLEX:
 		ff->ff_exclose = true;

Index: src/sys/ddb/db_xxx.c
diff -u src/sys/ddb/db_xxx.c:1.71 src/sys/ddb/db_xxx.c:1.72
--- src/sys/ddb/db_xxx.c:1.71	Fri Feb 27 00:47:30 2015
+++ src/sys/ddb/db_xxx.c	Sat Feb  1 02:23:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_xxx.c,v 1.71 2015/02/27 00:47:30 ozaki-r Exp $	*/
+/*	$NetBSD: db_xxx.c,v 1.72 2020/02/01 02:23:04 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.71 2015/02/27 00:47:30 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.72 2020/02/01 02:23:04 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kgdb.h"
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1
 #endif
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -173,7 +174,7 @@ db_show_files_cmd(db_expr_t addr, bool h
 	p = (struct proc *) (uintptr_t) addr;
 
 	fdp = p->p_fd;
-	dt = fdp->fd_dt;
+	dt = atomic_load_consume(>fd_dt);
 	for (i = 0; i < dt->dt_nfiles; i++) {
 		if ((ff = dt->dt_ff[i]) == NULL)
 			continue;

Index: src/sys/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.243 src/sys/kern/kern_descrip.c:1.244
--- src/sys/kern/kern_descrip.c:1.243	Wed Feb 20 19:42:14 2019
+++ src/sys/kern/kern_descrip.c	Sat Feb  1 02:23:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.243 2019/02/20 19:42:14 christos Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.244 2020/02/01 02:23:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.243 2019/02/20 19:42:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.244 2020/02/01 02:23:04 riastradh Exp $");
 
 #include 
 #include 
@@ -186,7 +186,7 @@ fd_isused(filedesc_t *fdp, unsigned fd)
 {
 	u_int off = fd >> NDENTRYSHIFT;
 
-	KASSERT(fd < fdp->fd_dt->dt_nfiles);
+	KASSERT(fd < atomic_load_consume(>fd_dt)->dt_nfiles);
 
 	return (fdp->fd_lomap[off] & (1U << (fd & NDENTRYMASK))) != 0;
 }
@@ -201,6 +201,8 @@ 

CVS commit: src/sys/dev/acpi

2020-01-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan 31 23:12:13 UTC 2020

Modified Files:
src/sys/dev/acpi: xhci_acpi.c

Log Message:
Match HID 808622B7 (DesignWare USB3)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/xhci_acpi.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/acpi/xhci_acpi.c
diff -u src/sys/dev/acpi/xhci_acpi.c:1.6 src/sys/dev/acpi/xhci_acpi.c:1.7
--- src/sys/dev/acpi/xhci_acpi.c:1.6	Tue Jan 21 11:29:17 2020
+++ src/sys/dev/acpi/xhci_acpi.c	Fri Jan 31 23:12:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci_acpi.c,v 1.6 2020/01/21 11:29:17 jmcneill Exp $ */
+/* $NetBSD: xhci_acpi.c,v 1.7 2020/01/31 23:12:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,v 1.6 2020/01/21 11:29:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,v 1.7 2020/01/31 23:12:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,
 static const char * const compatible[] = {
 	"PNP0D10",	/* XHCI-compliant USB controller without standard debug */
 	"PNP0D15",	/* XHCI-compliant USB controller with standard debug */
+	"808622B7",	/* DesignWare Dual Role SuperSpeed USB controller */
 	NULL
 };
 



CVS commit: src/sys/dev/pci

2020-01-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 31 22:41:07 UTC 2020

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

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/if_aq.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_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.5 src/sys/dev/pci/if_aq.c:1.6
--- src/sys/dev/pci/if_aq.c:1.5	Sat Jan 25 07:57:48 2020
+++ src/sys/dev/pci/if_aq.c	Fri Jan 31 22:41:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.5 2020/01/25 07:57:48 msaitoh Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.6 2020/01/31 22:41:07 thorpej Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.5 2020/01/25 07:57:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.6 2020/01/31 22:41:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -867,12 +867,6 @@ struct aq_txring {
 	unsigned int txr_prodidx;
 	unsigned int txr_considx;
 	int txr_nfree;
-
-	/* counters */
-	uint64_t txr_opackets;
-	uint64_t txr_obytes;
-	uint64_t txr_omcasts;
-	uint64_t txr_oerrors;
 };
 
 struct aq_rxring {
@@ -890,12 +884,6 @@ struct aq_rxring {
 		bus_dmamap_t dmamap;
 	} rxr_mbufs[AQ_RXD_NUM];
 	unsigned int rxr_readidx;
-
-	/* counters */
-	uint64_t rxr_ipackets;
-	uint64_t rxr_ibytes;
-	uint64_t rxr_ierrors;
-	uint64_t rxr_iqdrops;
 };
 
 struct aq_queue {
@@ -4173,6 +4161,8 @@ aq_tx_intr(void *arg)
 		goto tx_intr_done;
 	}
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	for (idx = txring->txr_considx; idx != hw_head;
 	idx = TXRING_NEXTIDX(idx), n++) {
 
@@ -4180,10 +4170,10 @@ aq_tx_intr(void *arg)
 			bus_dmamap_unload(sc->sc_dmat,
 			txring->txr_mbufs[idx].dmamap);
 
-			txring->txr_opackets++;
-			txring->txr_obytes += m->m_pkthdr.len;
+			if_statinc_ref(nsr, if_opackets);
+			if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 			if (m->m_flags & M_MCAST)
-txring->txr_omcasts++;
+if_statinc_ref(nsr, if_omcasts);
 
 			m_freem(m);
 			txring->txr_mbufs[idx].m = NULL;
@@ -4193,6 +4183,8 @@ aq_tx_intr(void *arg)
 	}
 	txring->txr_considx = idx;
 
+	IF_STAT_PUTREF(ifp);
+
 	if (ringidx == 0 && txring->txr_nfree >= AQ_TXD_MIN)
 		ifp->if_flags &= ~IFF_OACTIVE;
 
@@ -4231,6 +4223,8 @@ aq_rx_intr(void *arg)
 		goto rx_intr_done;
 	}
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	m0 = mprev = NULL;
 	for (idx = rxring->rxr_readidx;
 	idx != AQ_READ_REG_BIT(sc, RX_DMA_DESC_HEAD_PTR_REG(ringidx),
@@ -4254,7 +4248,7 @@ aq_rx_intr(void *arg)
 
 		if ((rxd_status & RXDESC_STATUS_MACERR) ||
 		(rxd_type & RXDESC_TYPE_MAC_DMA_ERR)) {
-			rxring->rxr_ierrors++;
+			if_statinc_ref(nsr, if_ierrors);
 			goto rx_next;
 		}
 
@@ -4269,7 +4263,7 @@ aq_rx_intr(void *arg)
 			 * cannot allocate new mbuf.
 			 * discard this packet, and reuse mbuf for next.
 			 */
-			rxring->rxr_iqdrops++;
+			if_statinc_ref(nsr, if_iqdrops);
 			goto rx_next;
 		}
 		rxring->rxr_mbufs[idx].m = NULL;
@@ -4371,8 +4365,8 @@ aq_rx_intr(void *arg)
 			}
 #endif
 			m_set_rcvif(m0, ifp);
-			rxring->rxr_ipackets++;
-			rxring->rxr_ibytes += m0->m_pkthdr.len;
+			if_statinc_ref(nsr, if_ipackets);
+			if_statadd_ref(nsr, if_ibytes, m0->m_pkthdr.len);
 			if_percpuq_enqueue(ifp->if_percpuq, m0);
 			m0 = mprev = NULL;
 		}
@@ -4383,6 +4377,8 @@ aq_rx_intr(void *arg)
 	}
 	rxring->rxr_readidx = idx;
 
+	IF_STAT_PUTREF(ifp);
+
  rx_intr_done:
 	mutex_exit(>rxr_mutex);
 
@@ -4511,7 +4507,7 @@ aq_send_common_locked(struct ifnet *ifp,
 		if (error != 0) {
 			/* too many mbuf chains? or not enough descriptors? */
 			m_freem(m);
-			txring->txr_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			if (txring->txr_index == 0 && error == ENOBUFS)
 ifp->if_flags |= IFF_OACTIVE;
 			break;
@@ -4668,61 +4664,12 @@ aq_ioctl(struct ifnet *ifp, unsigned lon
 {
 	struct aq_softc *sc __unused;
 	struct ifreq *ifr __unused;
-	uint64_t opackets, oerrors, obytes, omcasts;
-	uint64_t ipackets, ierrors, ibytes, iqdrops;
-	int error, i, s;
+	int error, s;
 
 	sc = (struct aq_softc *)ifp->if_softc;
 	ifr = (struct ifreq *)data;
 	error = 0;
 
-	switch (cmd) {
-	case SIOCGIFDATA:
-	case SIOCZIFDATA:
-		opackets = oerrors = obytes = omcasts = 0;
-		ipackets = ierrors = ibytes = iqdrops = 0;
-		for (i = 0; i < sc->sc_nqueues; i++) {
-			struct aq_txring *txring = >sc_queue[i].txring;
-			mutex_enter(>txr_mutex);
-			if (cmd == SIOCZIFDATA) {
-txring->txr_opackets = 0;
-txring->txr_obytes = 0;
-txring->txr_omcasts = 0;
-txring->txr_oerrors = 0;
-			} else {
-opackets += txring->txr_opackets;
-oerrors += txring->txr_oerrors;
-obytes += txring->txr_obytes;
-omcasts += txring->txr_omcasts;
-			}
-			mutex_exit(>txr_mutex);
-
-			struct aq_rxring *rxring = >sc_queue[i].rxring;
-			mutex_enter(>rxr_mutex);
-			if (cmd == SIOCZIFDATA) {
-rxring->rxr_ipackets = 0;
-

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

2020-01-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan 31 21:13:40 UTC 2020

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

Log Message:
Bump MESA_LLVM_VERSION_STRING


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/external/mit/xorg/lib/gallium/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/gallium/Makefile
diff -u src/external/mit/xorg/lib/gallium/Makefile:1.42 src/external/mit/xorg/lib/gallium/Makefile:1.43
--- src/external/mit/xorg/lib/gallium/Makefile:1.42	Fri Jan 31 20:56:03 2020
+++ src/external/mit/xorg/lib/gallium/Makefile	Fri Jan 31 21:13:40 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.42 2020/01/31 20:56:03 jmcneill Exp $
+# $NetBSD: Makefile,v 1.43 2020/01/31 21:13:40 jmcneill Exp $
 
 # Link the gallium mega driver.
 
@@ -1113,8 +1113,8 @@ CPPFLAGS.streaming-load-memcpy.c+= -msse
 CPPFLAGS.i386+= -march=i586
 CPPFLAGS+=	${CPPFLAGS.${XORG_MACHINE_ARCH:U${MACHINE_ARCH}}}
 
-CPPFLAGS.r600_pipe_common.c+=	-DMESA_LLVM_VERSION_STRING=\"7.0.0\"
-CPPFLAGS.si_get.c+=	-DMESA_LLVM_VERSION_STRING=\"7.0.0\"
+CPPFLAGS.r600_pipe_common.c+=	-DMESA_LLVM_VERSION_STRING=\"9.0.0\"
+CPPFLAGS.si_get.c+=	-DMESA_LLVM_VERSION_STRING=\"9.0.0\"
 
 .include "../driver.mk"
 



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

2020-01-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan 31 20:58:18 UTC 2020

Modified Files:
src/external/mit/xorg/lib: libmesa.mk
src/external/mit/xorg/lib/libglapi: Makefile

Log Message:
Change HAVE_LLVM from 0x0700 to 0x0900.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/xorg/lib/libmesa.mk
cvs rdiff -u -r1.5 -r1.6 src/external/mit/xorg/lib/libglapi/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/libmesa.mk
diff -u src/external/mit/xorg/lib/libmesa.mk:1.9 src/external/mit/xorg/lib/libmesa.mk:1.10
--- src/external/mit/xorg/lib/libmesa.mk:1.9	Tue Sep 24 21:33:48 2019
+++ src/external/mit/xorg/lib/libmesa.mk	Fri Jan 31 20:58:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: libmesa.mk,v 1.9 2019/09/24 21:33:48 maya Exp $
+#	$NetBSD: libmesa.mk,v 1.10 2020/01/31 20:58:18 jmcneill Exp $
 #
 # Consumer of this Makefile should set MESA_SRC_MODULES.
 
@@ -534,7 +534,7 @@ CPPFLAGS+=	\
 
 .if ${MKLLVMRT} != "no"
 CPPFLAGS+=	\
-	-DHAVE_LLVM=0x0700
+	-DHAVE_LLVM=0x0900
 CXXFLAGS+=	-fno-rtti
 .endif
 

Index: src/external/mit/xorg/lib/libglapi/Makefile
diff -u src/external/mit/xorg/lib/libglapi/Makefile:1.5 src/external/mit/xorg/lib/libglapi/Makefile:1.6
--- src/external/mit/xorg/lib/libglapi/Makefile:1.5	Tue Sep 24 19:29:42 2019
+++ src/external/mit/xorg/lib/libglapi/Makefile	Fri Jan 31 20:58:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2019/09/24 19:29:42 maya Exp $
+#	$NetBSD: Makefile,v 1.6 2020/01/31 20:58:18 jmcneill Exp $
 
 .include 
 
@@ -73,7 +73,7 @@ CPPFLAGS+=	\
 	-DHAVE_DRM_PLATFORM \
 	-DENABLE_SHADER_CACHE \
 	-DHAVE_MINCORE \
-	-DHAVE_LLVM=0x0700 \
+	-DHAVE_LLVM=0x0900 \
 	-DMESA_LLVM_VERSION_PATCH=0 \
 	-I. \
 	-DSTDC_HEADERS=1 \



CVS commit: src

2020-01-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan 31 20:56:03 UTC 2020

Modified Files:
src/distrib/sets/lists/xdebug: md.amd64 md.evbarm md.i386
src/distrib/sets/lists/xserver: md.amd64 md.evbarm md.i386
src/external/mit/xorg/lib/gallium: Makefile

Log Message:
Build radeonsi driver.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/distrib/sets/lists/xdebug/md.amd64
cvs rdiff -u -r1.26 -r1.27 src/distrib/sets/lists/xdebug/md.evbarm
cvs rdiff -u -r1.46 -r1.47 src/distrib/sets/lists/xdebug/md.i386
cvs rdiff -u -r1.111 -r1.112 src/distrib/sets/lists/xserver/md.amd64
cvs rdiff -u -r1.19 -r1.20 src/distrib/sets/lists/xserver/md.evbarm
cvs rdiff -u -r1.128 -r1.129 src/distrib/sets/lists/xserver/md.i386
cvs rdiff -u -r1.41 -r1.42 src/external/mit/xorg/lib/gallium/Makefile

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

Modified files:

Index: src/distrib/sets/lists/xdebug/md.amd64
diff -u src/distrib/sets/lists/xdebug/md.amd64:1.50 src/distrib/sets/lists/xdebug/md.amd64:1.51
--- src/distrib/sets/lists/xdebug/md.amd64:1.50	Sun Nov  3 01:35:47 2019
+++ src/distrib/sets/lists/xdebug/md.amd64	Fri Jan 31 20:56:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.50 2019/11/03 01:35:47 uki Exp $
+# $NetBSD: md.amd64,v 1.51 2020/01/31 20:56:03 jmcneill Exp $
 ./usr/X11R7/lib/libI810XvMC_g.axdebug-libI810XvMC-debuglib	xorg,debuglib,compatx11file
 ./usr/X11R7/lib/libIntelXvMC_g.a			xdebug-libIntelXvMC-debuglib	xorg,debuglib,compatx11file
 ./usr/X11R7/lib/libchromeXvMCPro_g.a			xdebug-libchromeXvMCPro-debuglib	xorg,debuglib,compatx11file
@@ -70,6 +70,7 @@
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/r300_dri.so.0.debug	xdebug-gallium-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/r600_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/radeon_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug
+./usr/libdata/debug/usr/X11R7/lib/modules/dri/radeonsi_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/s3v_dri.so.0.debug	xdebug-obsolete		xorg,obsolete
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/savage_dri.so.0.debug	xdebug-obsolete		xorg,obsolete
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/sis_dri.so.0.debug	xdebug-obsolete		xorg,obsolete

Index: src/distrib/sets/lists/xdebug/md.evbarm
diff -u src/distrib/sets/lists/xdebug/md.evbarm:1.26 src/distrib/sets/lists/xdebug/md.evbarm:1.27
--- src/distrib/sets/lists/xdebug/md.evbarm:1.26	Sun Jan 19 10:45:49 2020
+++ src/distrib/sets/lists/xdebug/md.evbarm	Fri Jan 31 20:56:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbarm,v 1.26 2020/01/19 10:45:49 jmcneill Exp $
+# $NetBSD: md.evbarm,v 1.27 2020/01/31 20:56:03 jmcneill Exp $
 ./usr/X11R7/lib/libdrm_amdgpu_g.a			xdebug-libdrm_amdgpu-debuglib	xorg,debuglib,compatx11file
 ./usr/X11R7/lib/libdrm_nouveau_g.a			xdebug-libdrm_nouveau-debuglib	xorg,debuglib
 ./usr/X11R7/lib/libvdpau_g.axdebug-libvdpau-debuglib	xorg,debuglib
@@ -29,6 +29,7 @@
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/r300_dri.so.0.debug	xdebug-gallium-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/r600_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/radeon_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug
+./usr/libdata/debug/usr/X11R7/lib/modules/dri/radeonsi_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/drivers/ati_drv.so.6.debug	xdebug-xf86-video-ati-debug		xorg,debug
 ./usr/libdata/debug/usr/X11R7/lib/modules/drivers/libati_drv.so.6.debug	xdebug-obsolete	xorg,obsolete
 ./usr/libdata/debug/usr/X11R7/lib/modules/drivers/kbd_drv.so.1.debug	xdebug-xf86-input-keyboard-debug	xorg,debug

Index: src/distrib/sets/lists/xdebug/md.i386
diff -u src/distrib/sets/lists/xdebug/md.i386:1.46 src/distrib/sets/lists/xdebug/md.i386:1.47
--- src/distrib/sets/lists/xdebug/md.i386:1.46	Sun Dec 29 03:00:35 2019
+++ src/distrib/sets/lists/xdebug/md.i386	Fri Jan 31 20:56:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.46 2019/12/29 03:00:35 uki Exp $
+# $NetBSD: md.i386,v 1.47 2020/01/31 20:56:03 jmcneill Exp $
 ./usr/X11R7/lib/libI810XvMC_g.axdebug-libI810XvMC-debuglib	xorg,debuglib
 ./usr/X11R7/lib/libIntelXvMC_g.a			xdebug-libIntelXvMC-debuglib	xorg,debuglib
 ./usr/X11R7/lib/libchromeXvMCPro_g.a			xdebug-libchromeXvMCPro-debuglib	xorg,debuglib
@@ -80,6 +80,7 @@
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/r300_dri.so.0.debug	xdebug-gallium-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/r600_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug,llvmrt
 ./usr/libdata/debug/usr/X11R7/lib/modules/dri/radeon_dri.so.0.debug	xdebug-xf86-video-radeon-debug		xorg,debug

CVS commit: src/lib/libpthread

2020-01-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan 31 17:52:15 UTC 2020

Modified Files:
src/lib/libpthread: pthread_mutex.c pthread_rwlock.c pthread_spin.c

Log Message:
Refactor libpthread checks for invalid arguments

Switch from manual functions to pthread__error().


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libpthread/pthread_mutex.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libpthread/pthread_rwlock.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libpthread/pthread_spin.c

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

Modified files:

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.71 src/lib/libpthread/pthread_mutex.c:1.72
--- src/lib/libpthread/pthread_mutex.c:1.71	Fri Jan 31 02:37:46 2020
+++ src/lib/libpthread/pthread_mutex.c	Fri Jan 31 17:52:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.71 2020/01/31 02:37:46 christos Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.72 2020/01/31 17:52:14 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_mutex.c,v 1.71 2020/01/31 02:37:46 christos Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.72 2020/01/31 17:52:14 kamil Exp $");
 
 #include 
 #include 
@@ -131,6 +131,9 @@ pthread_mutex_init(pthread_mutex_t *ptm,
 		return __libc_mutex_init_stub(ptm, attr);
 #endif
 
+	pthread__error(EINVAL, "Invalid mutes attribute",
+	attr == NULL || attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
+
 	if (attr == NULL) {
 		type = PTHREAD_MUTEX_NORMAL;
 		proto = PTHREAD_PRIO_NONE;

Index: src/lib/libpthread/pthread_rwlock.c
diff -u src/lib/libpthread/pthread_rwlock.c:1.37 src/lib/libpthread/pthread_rwlock.c:1.38
--- src/lib/libpthread/pthread_rwlock.c:1.37	Mon Jan 13 18:22:56 2020
+++ src/lib/libpthread/pthread_rwlock.c	Fri Jan 31 17:52:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_rwlock.c,v 1.37 2020/01/13 18:22:56 ad Exp $ */
+/*	$NetBSD: pthread_rwlock.c,v 1.38 2020/01/31 17:52:14 kamil Exp $ */
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_rwlock.c,v 1.37 2020/01/13 18:22:56 ad Exp $");
+__RCSID("$NetBSD: pthread_rwlock.c,v 1.38 2020/01/31 17:52:14 kamil Exp $");
 
 #include 
 #include 
@@ -91,8 +91,9 @@ pthread_rwlock_init(pthread_rwlock_t *pt
 	if (__predict_false(__uselibcstub))
 		return __libc_rwlock_init_stub(ptr, attr);
 
-	if (attr && (attr->ptra_magic != _PT_RWLOCKATTR_MAGIC))
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid rwlock attribute",
+	attr == NULL || attr->ptra_magic == _PT_RWLOCKATTR_MAGIC);
+
 	ptr->ptr_magic = _PT_RWLOCK_MAGIC;
 	PTQ_INIT(>ptr_rblocked);
 	PTQ_INIT(>ptr_wblocked);
@@ -109,8 +110,10 @@ pthread_rwlock_destroy(pthread_rwlock_t 
 	if (__predict_false(__uselibcstub))
 		return __libc_rwlock_destroy_stub(ptr);
 
-	if ((ptr->ptr_magic != _PT_RWLOCK_MAGIC) ||
-	(!PTQ_EMPTY(>ptr_rblocked)) ||
+	pthread__error(EINVAL, "Invalid rwlock",
+	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
+
+	if ((!PTQ_EMPTY(>ptr_rblocked)) ||
 	(!PTQ_EMPTY(>ptr_wblocked)) ||
 	(ptr->ptr_nreaders != 0) ||
 	(ptr->ptr_owner != NULL))
@@ -156,8 +159,8 @@ pthread__rwlock_rdlock(pthread_rwlock_t 
 	int error;
 
 #ifdef ERRORCHECK
-	if (ptr->ptr_magic != _PT_RWLOCK_MAGIC)
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid rwlock",
+	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
 #endif
 
 	for (owner = (uintptr_t)ptr->ptr_owner;; owner = next) {
@@ -246,8 +249,8 @@ pthread_rwlock_tryrdlock(pthread_rwlock_
 		return __libc_rwlock_tryrdlock_stub(ptr);
 
 #ifdef ERRORCHECK
-	if (ptr->ptr_magic != _PT_RWLOCK_MAGIC)
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid rwlock",
+	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
 #endif
 
 	/*
@@ -281,8 +284,8 @@ pthread__rwlock_wrlock(pthread_rwlock_t 
 	_DIAGASSERT(((uintptr_t)self & RW_FLAGMASK) == 0);
 
 #ifdef ERRORCHECK
-	if (ptr->ptr_magic != _PT_RWLOCK_MAGIC)
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid rwlock",
+	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
 #endif
 
 	for (owner = (uintptr_t)ptr->ptr_owner;; owner = next) {
@@ -372,8 +375,8 @@ pthread_rwlock_trywrlock(pthread_rwlock_
 		return __libc_rwlock_trywrlock_stub(ptr);
 
 #ifdef ERRORCHECK
-	if (ptr->ptr_magic != _PT_RWLOCK_MAGIC)
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid rwlock",
+	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
 #endif
 
 	self = pthread__self();
@@ -451,8 +454,8 @@ pthread_rwlock_unlock(pthread_rwlock_t *
 		return __libc_rwlock_unlock_stub(ptr);
 
 #ifdef ERRORCHECK
-	if ((ptr == NULL) || (ptr->ptr_magic != _PT_RWLOCK_MAGIC))
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid rwlock",
+	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
 #endif
 
 #ifndef PTHREAD__ATOMIC_IS_MEMBAR
@@ -650,6 +653,10 @@ int
 pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict attr,
 int * 

CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common

2020-01-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan 31 14:01:36 UTC 2020

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common:
sanitizer_interceptors_ioctl_netbsd.inc
sanitizer_platform_limits_netbsd.cc

Log Message:
Fix the build of LLVM sanitizers after the urio(4) removal

Cherry-pick a part of the upstream commit:

[compiler-rt] Fix build on NetBSD 9.99.44

Fix build on >= 9.99.44 after the removal of urio(4).
Add compat code for the device as NetBSD-9.0 is supported.

https://github.com/llvm/llvm-project/commit/3a200f3f2e52e671b8d9911e3724d6b11dbbbe08


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
cvs rdiff -u -r1.4 -r1.5 \

src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc

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

Modified files:

Index: src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
diff -u src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc:1.3 src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc:1.4
--- src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc:1.3	Wed Dec 18 14:51:24 2019
+++ src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc	Fri Jan 31 14:01:36 2020
@@ -447,9 +447,6 @@ static void ioctl_table_fill() {
   _(STICIO_STOPQ, NONE, 0);
   /* Entries from file: dev/usb/ukyopon.h */
   _(UKYOPON_IDENTIFY, WRITE, struct_ukyopon_identify_sz);
-  /* Entries from file: dev/usb/urio.h */
-  _(URIO_SEND_COMMAND, READWRITE, struct_urio_command_sz);
-  _(URIO_RECV_COMMAND, READWRITE, struct_urio_command_sz);
   /* Entries from file: dev/usb/usb.h */
   _(USB_REQUEST, READWRITE, struct_usb_ctl_request_sz);
   _(USB_SETDEBUG, READ, sizeof(int));
@@ -1406,6 +1403,9 @@ static void ioctl_table_fill() {
   /* Entries from file: dev/filemon/filemon.h (compat <= 9.99.26) */
   _(FILEMON_SET_FD, READWRITE, sizeof(int));
   _(FILEMON_SET_PID, READWRITE, sizeof(int));
+  /* Entries from file: dev/usb/urio.h (compat <= 9.99.43) */
+  _(URIO_SEND_COMMAND, READWRITE, struct_urio_command_sz);
+  _(URIO_RECV_COMMAND, READWRITE, struct_urio_command_sz);
 #undef _
 } // NOLINT
 

Index: src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
diff -u src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:1.4 src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:1.5
--- src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:1.4	Tue Dec 24 19:51:00 2019
+++ src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc	Fri Jan 31 14:01:36 2020
@@ -191,7 +191,21 @@
 #include 
 #include 
 #include 
+#if !__NetBSD_Prereq__(9, 99, 44)
 #include 
+#else
+struct urio_command {
+  unsigned short length;
+  int request;
+  int requesttype;
+  int value;
+  int index;
+  void *buffer;
+  int timeout;
+};
+#define URIO_SEND_COMMAND  _IOWR('U', 200, struct urio_command)
+#define URIO_RECV_COMMAND  _IOWR('U', 201, struct urio_command)
+#endif
 #include 
 #include 
 #include 



CVS commit: [netbsd-9] src

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 12:19:17 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0
src/external/gpl2/groff/tmac [netbsd-9]: mdoc.local
src/sys/sys [netbsd-9]: param.h

Log Message:
Welcome to 9.0_RC2


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.172 -r1.1.2.173 src/doc/CHANGES-9.0
cvs rdiff -u -r1.5.6.2 -r1.5.6.3 src/external/gpl2/groff/tmac/mdoc.local
cvs rdiff -u -r1.599.2.3 -r1.599.2.4 src/sys/sys/param.h

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.172 src/doc/CHANGES-9.0:1.1.2.173
--- src/doc/CHANGES-9.0:1.1.2.172	Fri Jan 31 11:33:59 2020
+++ src/doc/CHANGES-9.0	Fri Jan 31 12:19:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.172 2020/01/31 11:33:59 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.173 2020/01/31 12:19:17 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8652,3 +8652,8 @@ sys/netipsec/ipsecif.c1.19
 	Fix IPv6 over IPv4 ipsecif(4) uses wrong SP.
 	[knakahara, ticket #679]
 
+external/gpl2/groff/tmac/mdoc.local		(edited manually)
+sys/sys/param.h	(edited manually)
+
+	Welcome to 9.0_RC2 !
+

Index: src/external/gpl2/groff/tmac/mdoc.local
diff -u src/external/gpl2/groff/tmac/mdoc.local:1.5.6.2 src/external/gpl2/groff/tmac/mdoc.local:1.5.6.3
--- src/external/gpl2/groff/tmac/mdoc.local:1.5.6.2	Wed Nov 27 14:34:31 2019
+++ src/external/gpl2/groff/tmac/mdoc.local	Fri Jan 31 12:19:17 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: mdoc.local,v 1.5.6.2 2019/11/27 14:34:31 martin Exp $
+.\" $NetBSD: mdoc.local,v 1.5.6.3 2020/01/31 12:19:17 martin Exp $
 .\"
 .\" Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -44,9 +44,9 @@
 .as doc-str-St--ieee1275-94 " (\*[Lq]\*[doc-Tn-font-size]Open Firmware\*[doc-str-St]\*[Rq])
 .
 .\" Default .Os value
-.ds doc-operating-system NetBSD\~9.0_RC1
+.ds doc-operating-system NetBSD\~9.0_RC2
 .\" Default footer operating system value
-.ds doc-default-operating-system NetBSD\~9.0_RC1
+.ds doc-default-operating-system NetBSD\~9.0_RC2
 .\" Other known versions, not yet in groff distribution
 .ds doc-operating-system-NetBSD-1.3.3  1.3.3
 .ds doc-operating-system-NetBSD-1.6.3  1.6.3

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.599.2.3 src/sys/sys/param.h:1.599.2.4
--- src/sys/sys/param.h:1.599.2.3	Sun Dec  8 13:23:23 2019
+++ src/sys/sys/param.h	Fri Jan 31 12:19:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.599.2.3 2019/12/08 13:23:23 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.599.2.4 2020/01/31 12:19:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	9	/* NetBSD 9.0_RC1 */
+#define	__NetBSD_Version__	9	/* NetBSD 9.0_RC2 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/dev/pci

2020-01-31 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Jan 31 12:09:13 UTC 2020

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

Log Message:
wm(4) unset RSS UDP flags like ixg(4) and other OS's one.

To handle IP fragmented UDP first packet and second packet by the same
Rx queue.

I tested on I354.


To generate a diff of this commit:
cvs rdiff -u -r1.665 -r1.666 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.665 src/sys/dev/pci/if_wm.c:1.666
--- src/sys/dev/pci/if_wm.c:1.665	Fri Jan 31 12:04:57 2020
+++ src/sys/dev/pci/if_wm.c	Fri Jan 31 12:09:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.665 2020/01/31 12:04:57 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.666 2020/01/31 12:09:13 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.665 2020/01/31 12:04:57 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.666 2020/01/31 12:09:13 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5323,8 +5323,11 @@ wm_init_rss(struct wm_softc *sc)
 	 */
 	mrqc |= (MRQC_RSS_FIELD_IPV4 | MRQC_RSS_FIELD_IPV4_TCP);
 	mrqc |= (MRQC_RSS_FIELD_IPV6 | MRQC_RSS_FIELD_IPV6_TCP);
+#if 0
 	mrqc |= (MRQC_RSS_FIELD_IPV4_UDP | MRQC_RSS_FIELD_IPV6_UDP);
-	mrqc |= (MRQC_RSS_FIELD_IPV6_UDP_EX | MRQC_RSS_FIELD_IPV6_TCP_EX);
+	mrqc |= MRQC_RSS_FIELD_IPV6_UDP_EX;
+#endif
+	mrqc |= MRQC_RSS_FIELD_IPV6_TCP_EX;
 
 	CSR_WRITE(sc, WMREG_MRQC, mrqc);
 }



CVS commit: src/sys/dev/pci

2020-01-31 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Jan 31 12:04:57 UTC 2020

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

Log Message:
Fix missing workqueue_destroy().  ok by msaitoh@n.o


To generate a diff of this commit:
cvs rdiff -u -r1.664 -r1.665 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.664 src/sys/dev/pci/if_wm.c:1.665
--- src/sys/dev/pci/if_wm.c:1.664	Fri Jan 31 12:03:23 2020
+++ src/sys/dev/pci/if_wm.c	Fri Jan 31 12:04:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.664 2020/01/31 12:03:23 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.665 2020/01/31 12:04:57 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.664 2020/01/31 12:03:23 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.665 2020/01/31 12:04:57 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3127,6 +3127,9 @@ wm_detach(device_t self, int flags __unu
 	}
 	pci_intr_release(sc->sc_pc, sc->sc_intrs, sc->sc_nintrs);
 
+	/* wm_stop() ensure workqueue is stopped. */
+	workqueue_destroy(sc->sc_queue_wq);
+
 	for (i = 0; i < sc->sc_nqueues; i++)
 		softint_disestablish(sc->sc_queue[i].wmq_si);
 
@@ -6401,6 +6404,16 @@ wm_stop(struct ifnet *ifp, int disable)
 	WM_CORE_LOCK(sc);
 	wm_stop_locked(ifp, disable);
 	WM_CORE_UNLOCK(sc);
+
+	/*
+	 * After wm_set_stopping_flags(), it is guaranteed
+	 * wm_handle_queue_work() does not call workqueue_enqueue().
+	 * However, workqueue_wait() cannot call in wm_stop_locked()
+	 * because it can sleep...
+	 * so, call workqueue_wait() here.
+	 */
+	for (int i = 0; i < sc->sc_nqueues; i++)
+		workqueue_wait(sc->sc_queue_wq, >sc_queue[i].wmq_cookie);
 }
 
 static void



CVS commit: src/sys/dev/pci

2020-01-31 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Jan 31 12:03:23 UTC 2020

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

Log Message:
Fix wm(4) create too many workqueue.  Pointed out by msaitoh@n.o


To generate a diff of this commit:
cvs rdiff -u -r1.663 -r1.664 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.663 src/sys/dev/pci/if_wm.c:1.664
--- src/sys/dev/pci/if_wm.c:1.663	Wed Jan 29 06:44:27 2020
+++ src/sys/dev/pci/if_wm.c	Fri Jan 31 12:03:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.663 2020/01/29 06:44:27 thorpej Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.664 2020/01/31 12:03:23 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.663 2020/01/29 06:44:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.664 2020/01/31 12:03:23 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -750,7 +750,7 @@ static void	wm_init_rss(struct wm_softc 
 static void	wm_adjust_qnum(struct wm_softc *, int);
 static inline bool	wm_is_using_msix(struct wm_softc *);
 static inline bool	wm_is_using_multiqueue(struct wm_softc *);
-static int	wm_softhandler_establish(struct wm_softc *, int, int);
+static int	wm_softint_establish(struct wm_softc *, int, int);
 static int	wm_setup_legacy(struct wm_softc *);
 static int	wm_setup_msix(struct wm_softc *);
 static int	wm_init(struct ifnet *);
@@ -1822,6 +1822,7 @@ wm_attach(device_t parent, device_t self
 	prop_number_t pn;
 	uint8_t enaddr[ETHER_ADDR_LEN];
 	char buf[256];
+	char wqname[MAXCOMLEN];
 	uint16_t cfg1, cfg2, swdpin, nvmword;
 	pcireg_t preg, memtype;
 	uint16_t eeprom_data, apme_mask;
@@ -2055,6 +2056,16 @@ alloc_retry:
 		}
 	}
 
+	snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(sc->sc_dev));
+	error = workqueue_create(>sc_queue_wq, wqname,
+	wm_handle_queue_work, sc, WM_WORKQUEUE_PRI, IPL_NET,
+	WM_WORKQUEUE_FLAGS);
+	if (error) {
+		aprint_error_dev(sc->sc_dev,
+		"unable to create workqueue\n");
+		goto out;
+	}
+
 	/*
 	 * Check the function ID (unit number of the chip).
 	 */
@@ -5415,11 +5426,9 @@ wm_is_using_multiqueue(struct wm_softc *
 }
 
 static int
-wm_softhandler_establish(struct wm_softc *sc, int qidx, int intr_idx)
+wm_softint_establish(struct wm_softc *sc, int qidx, int intr_idx)
 {
-	char wqname[MAXCOMLEN];
 	struct wm_queue *wmq = >sc_queue[qidx];
-	int error;
 
 	wmq->wmq_id = qidx;
 	wmq->wmq_intr_idx = intr_idx;
@@ -5428,28 +5437,11 @@ wm_softhandler_establish(struct wm_softc
 	| SOFTINT_MPSAFE
 #endif
 	, wm_handle_queue, wmq);
-	if (wmq->wmq_si == NULL) {
-		aprint_error_dev(sc->sc_dev,
-		"unable to establish queue[%d] softint handler\n",
-		wmq->wmq_id);
-		goto err;
-	}
-
-	snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(sc->sc_dev));
-	error = workqueue_create(>sc_queue_wq, wqname,
-	wm_handle_queue_work, sc, WM_WORKQUEUE_PRI, IPL_NET,
-	WM_WORKQUEUE_FLAGS);
-	if (error) {
-		softint_disestablish(wmq->wmq_si);
-		aprint_error_dev(sc->sc_dev,
-		"unable to create queue[%d] workqueue\n",
-		wmq->wmq_id);
-		goto err;
-	}
-
-	return 0;
+	if (wmq->wmq_si != NULL)
+		return 0;
 
-err:
+	aprint_error_dev(sc->sc_dev, "unable to establish queue[%d] handler\n",
+	wmq->wmq_id);
 	pci_intr_disestablish(sc->sc_pc, sc->sc_ihs[wmq->wmq_intr_idx]);
 	sc->sc_ihs[wmq->wmq_intr_idx] = NULL;
 	return ENOMEM;
@@ -5489,7 +5481,7 @@ wm_setup_legacy(struct wm_softc *sc)
 	aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);
 	sc->sc_nintrs = 1;
 
-	return wm_softhandler_establish(sc, 0, 0);
+	return wm_softint_establish(sc, 0, 0);
 }
 
 static int
@@ -5567,7 +5559,7 @@ wm_setup_msix(struct wm_softc *sc)
 			"for TX and RX interrupting at %s\n", intrstr);
 		}
 		sc->sc_ihs[intr_idx] = vih;
-		if (wm_softhandler_establish(sc, qidx, intr_idx) != 0)
+		if (wm_softint_establish(sc, qidx, intr_idx) != 0)
 			goto fail;
 		txrx_established++;
 		intr_idx++;



CVS commit: [netbsd-9] src/doc

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:33:59 UTC 2020

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

Log Message:
Tickets #670 - #672, #675 - #679


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

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.171 src/doc/CHANGES-9.0:1.1.2.172
--- src/doc/CHANGES-9.0:1.1.2.171	Wed Jan 29 23:33:15 2020
+++ src/doc/CHANGES-9.0	Fri Jan 31 11:33:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.171 2020/01/29 23:33:15 msaitoh Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.172 2020/01/31 11:33:59 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8544,3 +8544,111 @@ usr.sbin/sysinst/arch/evbarm/md.c		1.15
 
 	Do not compare a char array to NULL, test for empty string instead.
 	[martin, ticket #673]
+
+sys/dev/pci/pcidevs1.1392-1.1397
+sys/dev/pci/pcidevs_data.h			(regen)
+sys/dev/pci/pcidevs.h(regen)
+
+	- Add Intel Xeon D-1500 NTB-secondary and Xeon D NS QuickData DMA
+	  channel 0-7.
+	- Add Intel I219 LM10-LM15 and V10-V14.
+	- Add AMD Family14h PCIe.
+	- Add Realtek Killer E3000.
+	- Add Aquantia AQC 10G network adapters.
+	- Remove duplicated entries.
+	[msaitoh, ticket #670]
+
+sys/dev/ic/am79900reg.h1.10
+sys/dev/ic/rt2860.c1.34
+sys/dev/ieee1394/firewire.c			1.49
+sys/dev/ieee1394/fwohci.c			1.143
+sys/dev/ieee1394/fwohcireg.h			1.20
+sys/dev/pci/if_age.c1.65
+sys/dev/pci/if_alc.c1.45
+sys/dev/pci/if_ale.c1.37
+sys/dev/pci/if_bce.c1.53
+sys/dev/pci/if_mcx.c1.5
+sys/dev/pci/if_pcn.c1.72
+sys/dev/pci/pccbbreg.h1.16
+
+	Use unsigned to avoid undefined behavior.
+	[msaitoh, ticket #671]
+
+sys/dev/acpi/thinkpad_acpi.c			1.47
+sys/dev/ic/aic6915reg.h1.6
+sys/dev/ic/tulip.c1.198
+sys/dev/pci/agp.c1.86
+sys/dev/pci/if_jme.c1.45
+sys/dev/pci/if_lii.c1.27
+sys/dev/scsipi/scsipi_base.c			1.183
+
+	kUBSan fixes:
+	- thinkpad(4): Fix undefined behavior in thinkpad_mask_init().
+	- sf(4): Use unsigned when initialize the transmit completion ring
+	  to avoid undefined behavior.
+	- tlp(4): Avoid undefined behavior when setting multicast address.
+	- agp(4): Use unsigned to avoid undefined behavior in agpattach().
+	- jme(4): Avoid undefined behavior in jme_mii_write().
+	- lii(4): Use unsigned to avoid undefined behavior in lii_setmulti().
+	- scsipi(9): Use unsigned to avoid undefined behavior in
+	  scsipi_{get,put}_tag().
+	[msaitoh, ticket #672]
+
+etc/rc.d/autounmountd1.3
+etc/rc.d/ip6addrctl1.4
+
+	Add NetBSD CVS marker.
+	[kim, ticket #675]
+
+etc/rc.d/ipsec	1.16
+
+	Skip link local IPv6 addresses.
+	[kim, ticket #676]
+
+sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	1.10
+sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	1.11
+sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	1.13
+sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	1.8
+sys/external/bsd/drm2/dist/drm/i915/intel_pm.c	1.18
+sys/external/bsd/drm2/dist/drm/i915/intel_pm.c	1.19
+sys/external/bsd/drm2/dist/drm/radeon/cikd.h	1.3
+sys/external/bsd/drm2/dist/drm/radeon/evergreend.h 1.3
+sys/external/bsd/drm2/dist/drm/radeon/evergreend.h 1.4
+sys/external/bsd/drm2/dist/drm/radeon/nid.h	1.3
+sys/external/bsd/drm2/dist/drm/radeon/r600d.h	1.3
+sys/external/bsd/drm2/dist/drm/radeon/r600d.h	1.4
+sys/external/bsd/drm2/dist/drm/radeon/radeon_mode.h 1.5
+sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c 1.2
+sys/external/bsd/drm2/dist/drm/radeon/radeon_reg.h 1.3
+sys/external/bsd/drm2/dist/drm/radeon/radeon_rv770_smc.c 1.2
+sys/external/bsd/drm2/dist/drm/radeon/radeon_si_smc.c 1.2
+sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v1_0.c 1.2
+sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v1_0.c 1.3
+sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v2_2.c 1.2
+sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v4_2.c 1.2
+sys/external/bsd/drm2/dist/drm/radeon/rv730d.h	1.3
+sys/external/bsd/drm2/dist/drm/radeon/rv770d.h	1.3
+sys/external/bsd/drm2/dist/drm/radeon/sid.h	1.3
+sys/external/bsd/drm2/dist/drm/radeon/sid.h	1.4
+sys/external/bsd/drm2/dist/drm/radeon/sumod.h	1.3
+sys/external/bsd/drm2/dist/include/drm/drm_fixed.h 1.3
+
+	Use unsigned to avoid undefined behavior.
+	[msaitoh, ticket #677]
+
+sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c 1.12
+sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	1.9,1.12
+sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c 1.2
+
+	- Use unsigned to avoid undefined behavior in g4x_update_wm() and
+	  gen7_get_stolen_reserved().
+	- Avoid undefined behavior in g4x_get_stolen_reserved().
+	- Don't call memcpy() when the length is 0 (and the source pointer is
+	  NULL) in radeon_dp_aux_transfer_atom() to avoid undefined behavior.
+	[msaitoh, ticket #678]
+
+sys/netipsec/ipsecif.c1.19
+
+	Fix IPv6 over IPv4 ipsecif(4) 

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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:30:24 UTC 2020

Modified Files:
src/sys/netipsec [netbsd-9]: ipsecif.c

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

sys/netipsec/ipsecif.c: revision 1.19

Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wrongly.  Pointed out by ohishi@IIJ.
XXX pullup-8, pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/netipsec/ipsecif.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/netipsec/ipsecif.c
diff -u src/sys/netipsec/ipsecif.c:1.16.2.1 src/sys/netipsec/ipsecif.c:1.16.2.2
--- src/sys/netipsec/ipsecif.c:1.16.2.1	Tue Sep 24 03:10:35 2019
+++ src/sys/netipsec/ipsecif.c	Fri Jan 31 11:30:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsecif.c,v 1.16.2.1 2019/09/24 03:10:35 martin Exp $  */
+/*	$NetBSD: ipsecif.c,v 1.16.2.2 2020/01/31 11:30:24 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.16.2.1 2019/09/24 03:10:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.16.2.2 2020/01/31 11:30:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -380,7 +380,17 @@ ipsecif4_output(struct ipsec_variant *va
 	KASSERT(var->iv_psrc->sa_family == AF_INET);
 	KASSERT(var->iv_pdst->sa_family == AF_INET);
 
-	sp = IV_SP_OUT(var);
+	switch (family) {
+	case AF_INET:
+		sp = IV_SP_OUT(var);
+		break;
+	case AF_INET6:
+		sp = IV_SP_OUT6(var);
+		break;
+	default:
+		m_freem(m);
+		return EAFNOSUPPORT;
+	}
 	KASSERT(sp != NULL);
 	/*
 	 * The SPs in ipsec_variant are prevented from freed by



CVS commit: [netbsd-9] src/sys/external/bsd/drm2/dist/drm

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:28:38 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-9]: i915_gem_stolen.c
i915_reg.h
src/sys/external/bsd/drm2/dist/drm/radeon [netbsd-9]:
radeon_atombios_dp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #678):

sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c: revision 1.12
sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c: revision 1.2
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.9
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.12

 Use unsigned to avoid undefined behavior in gen7_get_stolen_reserved().
Found by kUBSan.

 Use unsigned to avoid undefined behavior in g4x_update_wm().

 Avoid undefined behavior in g4x_get_stolen_reserved().

The change is the same as newer i915_gem_stolen.c.

 Don't call memcpy() when the length is 0 (and the source pointer is NULL)
in radeon_dp_aux_transfer_atom() to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.1 -r1.1.8.1 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.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/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.11 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.11.4.1
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.11	Thu Sep 13 08:25:55 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c	Fri Jan 31 11:28:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_stolen.c,v 1.11 2018/09/13 08:25:55 mrg Exp $	*/
+/*	$NetBSD: i915_gem_stolen.c,v 1.11.4.1 2020/01/31 11:28:38 martin Exp $	*/
 
 /*
  * Copyright © 2008-2012 Intel Corporation
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.11 2018/09/13 08:25:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.11.4.1 2020/01/31 11:28:38 martin Exp $");
 
 #include 
 #include 
@@ -308,18 +308,13 @@ static void g4x_get_stolen_reserved(stru
 	unsigned long stolen_top = dev_priv->mm.stolen_base +
 		dev_priv->gtt.stolen_size;
 
-	*base = (reg_val & G4X_STOLEN_RESERVED_ADDR2_MASK) << 16;
+	if (!(reg_val & G4X_STOLEN_RESERVED_ADDR2_MASK))
+		return;
 
+	*base = (reg_val & G4X_STOLEN_RESERVED_ADDR2_MASK) << 16;
 	WARN_ON((reg_val & G4X_STOLEN_RESERVED_ADDR1_MASK) < *base);
 
-	/* On these platforms, the register doesn't have a size field, so the
-	 * size is the distance between the base and the top of the stolen
-	 * memory. We also have the genuine case where base is zero and there's
-	 * nothing reserved. */
-	if (*base == 0)
-		*size = 0;
-	else
-		*size = stolen_top - *base;
+	*size = stolen_top - *base;
 }
 
 static void gen6_get_stolen_reserved(struct drm_i915_private *dev_priv,

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7.2.2 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7.2.3
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7.2.2	Fri Jan 31 11:25:09 2020
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Fri Jan 31 11:28:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_reg.h,v 1.7.2.2 2020/01/31 11:25:09 martin Exp $	*/
+/*	$NetBSD: i915_reg.h,v 1.7.2.3 2020/01/31 11:28:38 martin Exp $	*/
 
 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -187,7 +187,7 @@
 
 #define GEN6_STOLEN_RESERVED		0x1082C0
 #define GEN6_STOLEN_RESERVED_ADDR_MASK	(0xFFFUL << 20)
-#define GEN7_STOLEN_RESERVED_ADDR_MASK	(0x3FFF << 18)
+#define GEN7_STOLEN_RESERVED_ADDR_MASK	(0x3FFFUL << 18)
 #define GEN6_STOLEN_RESERVED_SIZE_MASK	(3 << 4)
 #define GEN6_STOLEN_RESERVED_1M		(0 << 4)
 #define GEN6_STOLEN_RESERVED_512K	(1 << 4)
@@ -4616,7 +4616,7 @@ enum skl_disp_power_wells {
 #define   DSPFW_SPRITEA_MASK		(0x7f<<0) /* g4x */
 #define   DSPFW_SPRITEA_MASK_VLV	(0xff<<0) /* vlv/chv */
 #define DSPFW3			(dev_priv->info.display_mmio_offset + 0x7003c)
-#define   DSPFW_HPLL_SR_EN		(1<<31)
+#define   DSPFW_HPLL_SR_EN		(1U<<31)
 #define   PINEVIEW_SELF_REFRESH_EN	(1<<30)
 #define   DSPFW_CURSOR_SR_SHIFT		24
 #define   DSPFW_CURSOR_SR_MASK		(0x3f<<24)

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c:1.1 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c:1.1.8.1
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c:1.1	Mon Aug 27 14:38:20 2018
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c	Fri Jan 31 11:28:38 

CVS commit: [netbsd-9] src/sys/external/bsd/drm2/dist

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:25:09 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-9]: i915_reg.h
intel_pm.c
src/sys/external/bsd/drm2/dist/drm/radeon [netbsd-9]: cikd.h
evergreend.h nid.h r600d.h radeon_mode.h radeon_r600.c radeon_reg.h
radeon_rv770_smc.c radeon_si_smc.c radeon_uvd_v1_0.c
radeon_uvd_v2_2.c radeon_uvd_v4_2.c rv730d.h rv770d.h sid.h sumod.h
src/sys/external/bsd/drm2/dist/include/drm [netbsd-9]: drm_fixed.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #677):

sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v2_2.c: revision 1.2
sys/external/bsd/drm2/dist/drm/i915/intel_pm.c: revision 1.18
sys/external/bsd/drm2/dist/drm/radeon/nid.h: revision 1.3
sys/external/bsd/drm2/dist/drm/i915/intel_pm.c: revision 1.19
sys/external/bsd/drm2/dist/drm/radeon/rv770d.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/cikd.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v4_2.c: revision 1.2
sys/external/bsd/drm2/dist/include/drm/drm_fixed.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/sumod.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_reg.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_mode.h: revision 1.5
sys/external/bsd/drm2/dist/drm/radeon/r600d.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/r600d.h: revision 1.4
sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v1_0.c: revision 1.2
sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v1_0.c: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c: revision 1.2
sys/external/bsd/drm2/dist/drm/radeon/evergreend.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/evergreend.h: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.10
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.8
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.11
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.13
sys/external/bsd/drm2/dist/drm/radeon/rv730d.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_rv770_smc.c: revision 1.2
sys/external/bsd/drm2/dist/drm/radeon/sid.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_si_smc.c: revision 1.2
sys/external/bsd/drm2/dist/drm/radeon/sid.h: revision 1.4

Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.17.2.1 -r1.17.2.2 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/external/bsd/drm2/dist/drm/radeon/cikd.h \
src/sys/external/bsd/drm2/dist/drm/radeon/evergreend.h \
src/sys/external/bsd/drm2/dist/drm/radeon/nid.h \
src/sys/external/bsd/drm2/dist/drm/radeon/r600d.h \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_reg.h \
src/sys/external/bsd/drm2/dist/drm/radeon/rv730d.h \
src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h \
src/sys/external/bsd/drm2/dist/drm/radeon/sid.h \
src/sys/external/bsd/drm2/dist/drm/radeon/sumod.h
cvs rdiff -u -r1.4 -r1.4.4.1 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_mode.h
cvs rdiff -u -r1.1 -r1.1.8.1 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_rv770_smc.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_smc.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v1_0.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v2_2.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd_v4_2.c
cvs rdiff -u -r1.2 -r1.2.4.1 \
src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.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/external/bsd/drm2/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7.2.1 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7.2.2
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7.2.1	Thu Dec 12 21:00:32 2019
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Fri Jan 31 11:25:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_reg.h,v 1.7.2.1 2019/12/12 21:00:32 martin Exp $	*/
+/*	$NetBSD: i915_reg.h,v 1.7.2.2 2020/01/31 11:25:09 martin Exp $	*/
 
 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -1652,7 +1652,7 @@ enum skl_disp_power_wells {
 
 #define ERROR_GEN6	0x040a0
 #define GEN7_ERR_INT	0x44040
-#define   ERR_INT_POISON		(1<<31)
+#define   ERR_INT_POISON		(1U<<31)
 #define   ERR_INT_MMIO_UNCLAIMED	(1<<13)
 #define   ERR_INT_PIPE_CRC_DONE_C	(1<<8)
 

CVS commit: [netbsd-9] src/etc/rc.d

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:21:42 UTC 2020

Modified Files:
src/etc/rc.d [netbsd-9]: ipsec

Log Message:
Pull up following revision(s) (requested by kim in ticket #676):

etc/rc.d/ipsec: revision 1.16

Skip inet6 addresses that begin with fe80: (not just exact match).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.2.1 src/etc/rc.d/ipsec

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

Modified files:

Index: src/etc/rc.d/ipsec
diff -u src/etc/rc.d/ipsec:1.15 src/etc/rc.d/ipsec:1.15.2.1
--- src/etc/rc.d/ipsec:1.15	Mon Aug 13 09:16:06 2018
+++ src/etc/rc.d/ipsec	Fri Jan 31 11:21:42 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ipsec,v 1.15 2018/08/13 09:16:06 christos Exp $
+# $NetBSD: ipsec,v 1.15.2.1 2020/01/31 11:21:42 martin Exp $
 #
 
 # PROVIDE: ipsec
@@ -34,7 +34,7 @@ ipsec_getip() {
 		case "$what" in
 		inet)	echo "local v4_addr=$address;";;
 		inet6)	case "$address" in
-			fe80:)	;;
+			fe80:*)	;;
 			*)	echo "local v6_addr=$address;";;
 			esac;;
 		esac



CVS commit: [netbsd-9] src/etc/rc.d

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:19:58 UTC 2020

Modified Files:
src/etc/rc.d [netbsd-9]: autounmountd ip6addrctl

Log Message:
Pull up following revision(s) (requested by kim in ticket #675):

etc/rc.d/autounmountd: revision 1.3
etc/rc.d/ip6addrctl: revision 1.4

Add NetBSD ID


To generate a diff of this commit:
cvs rdiff -u -r1.1.6.1 -r1.1.6.2 src/etc/rc.d/autounmountd
cvs rdiff -u -r1.2.18.1 -r1.2.18.2 src/etc/rc.d/ip6addrctl

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

Modified files:

Index: src/etc/rc.d/autounmountd
diff -u src/etc/rc.d/autounmountd:1.1.6.1 src/etc/rc.d/autounmountd:1.1.6.2
--- src/etc/rc.d/autounmountd:1.1.6.1	Thu Aug  8 11:48:58 2019
+++ src/etc/rc.d/autounmountd	Fri Jan 31 11:19:58 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD$
+# $NetBSD: autounmountd,v 1.1.6.2 2020/01/31 11:19:58 martin Exp $
 #
 
 # PROVIDE: autounmountd

Index: src/etc/rc.d/ip6addrctl
diff -u src/etc/rc.d/ip6addrctl:1.2.18.1 src/etc/rc.d/ip6addrctl:1.2.18.2
--- src/etc/rc.d/ip6addrctl:1.2.18.1	Thu Aug  8 11:48:58 2019
+++ src/etc/rc.d/ip6addrctl	Fri Jan 31 11:19:58 2020
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
-# $FreeBSD: head/etc/rc.d/ip6addrctl 270836 2014-08-30 07:08:10Z hrs $
+# $NetBSD: ip6addrctl,v 1.2.18.2 2020/01/31 11:19:58 martin Exp $
+# FreeBSD: head/etc/rc.d/ip6addrctl 270836 2014-08-30 07:08:10Z hrs
 #
 
 # PROVIDE: ip6addrctl



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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:17:32 UTC 2020

Modified Files:
src/sys/dev/acpi [netbsd-9]: thinkpad_acpi.c
src/sys/dev/ic [netbsd-9]: aic6915reg.h tulip.c
src/sys/dev/pci [netbsd-9]: agp.c if_jme.c if_lii.c
src/sys/dev/scsipi [netbsd-9]: scsipi_base.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #672):

sys/dev/ic/tulip.c: revision 1.198
sys/dev/pci/if_jme.c: revision 1.45
sys/dev/pci/agp.c: revision 1.86
sys/dev/pci/if_lii.c: revision 1.27
sys/dev/acpi/thinkpad_acpi.c: revision 1.47
sys/dev/scsipi/scsipi_base.c: revision 1.183
sys/dev/ic/aic6915reg.h: revision 1.6

 Fix undefined behavior in thinkpad_mask_init(). Found by kUBSan.

 Use unsigned when initialize the transmit completion ring to avoid undefined
behavior. Found by kUBSan.

Avoid undefined behavior when setting multicast address. found by kUBSan.

 Use unsigned to avoid undefined behavior in agpattach(). Found by kUBSan.

 Avoid undefined behavior in jme_mii_write(). Found by kUBSan.

 Use unsigned to avoid undefined behavior in lii_setmulti().

 Use unsigned to avoid undefined behavior in scsipi_{get,put}_tag().

Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.46.24.1 src/sys/dev/acpi/thinkpad_acpi.c
cvs rdiff -u -r1.5 -r1.5.94.1 src/sys/dev/ic/aic6915reg.h
cvs rdiff -u -r1.197 -r1.197.2.1 src/sys/dev/ic/tulip.c
cvs rdiff -u -r1.85 -r1.85.6.1 src/sys/dev/pci/agp.c
cvs rdiff -u -r1.44.2.1 -r1.44.2.2 src/sys/dev/pci/if_jme.c
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/dev/pci/if_lii.c
cvs rdiff -u -r1.182 -r1.182.4.1 src/sys/dev/scsipi/scsipi_base.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/acpi/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.46 src/sys/dev/acpi/thinkpad_acpi.c:1.46.24.1
--- src/sys/dev/acpi/thinkpad_acpi.c:1.46	Sun Apr  3 10:36:00 2016
+++ src/sys/dev/acpi/thinkpad_acpi.c	Fri Jan 31 11:17:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.46 2016/04/03 10:36:00 mlelstv Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.46.24.1 2020/01/31 11:17:32 martin Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.46 2016/04/03 10:36:00 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.46.24.1 2020/01/31 11:17:32 martin Exp $");
 
 #include 
 #include 
@@ -565,7 +565,7 @@ thinkpad_mask_init(thinkpad_softc_t *sc,
 
 	for (i = 0; i < 32; i++) {
 		param[0].Integer.Value = i + 1;
-		param[1].Integer.Value = (((1 << i) & mask) != 0);
+		param[1].Integer.Value = ((__BIT(i) & mask) != 0);
 
 		rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "MHKM",
 		, NULL);

Index: src/sys/dev/ic/aic6915reg.h
diff -u src/sys/dev/ic/aic6915reg.h:1.5 src/sys/dev/ic/aic6915reg.h:1.5.94.1
--- src/sys/dev/ic/aic6915reg.h:1.5	Mon Apr 28 20:23:49 2008
+++ src/sys/dev/ic/aic6915reg.h	Fri Jan 31 11:17:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic6915reg.h,v 1.5 2008/04/28 20:23:49 martin Exp $	*/
+/*	$NetBSD: aic6915reg.h,v 1.5.94.1 2020/01/31 11:17:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -194,7 +194,7 @@ struct sf_tcd {
 	uint32_t	tcd_word0;	/* index, priority, flags */
 };
 
-#define	TCD_DMA_ID		(0x4 << 29)
+#define	TCD_DMA_ID		(0x4U << 29)
 #define	TCD_INDEX(x)		((x) & 0x7fff)
 #define	TCD_PR			(1U << 15)
 #define	TCD_TIMESTAMP(x)	(((x) >> 16) & 0x1fff)

Index: src/sys/dev/ic/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.197 src/sys/dev/ic/tulip.c:1.197.2.1
--- src/sys/dev/ic/tulip.c:1.197	Tue May 28 08:59:34 2019
+++ src/sys/dev/ic/tulip.c	Fri Jan 31 11:17:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tulip.c,v 1.197 2019/05/28 08:59:34 msaitoh Exp $	*/
+/*	$NetBSD: tulip.c,v 1.197.2.1 2020/01/31 11:17:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.197 2019/05/28 08:59:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.197.2.1 2020/01/31 11:17:32 martin Exp $");
 
 
 #include 
@@ -2943,7 +2943,7 @@ tlp_al981_filter_setup(struct tulip_soft
 		}
 
 		hash = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) & 0x3f;
-		mchash[hash >> 5] |= 1 << (hash & 0x1f);
+		mchash[hash >> 5] |= __BIT(hash & 0x1f);
 		ETHER_NEXT_MULTI(step, enm);
 	}
 	ETHER_UNLOCK(ec);

Index: src/sys/dev/pci/agp.c
diff -u src/sys/dev/pci/agp.c:1.85 src/sys/dev/pci/agp.c:1.85.6.1
--- src/sys/dev/pci/agp.c:1.85	Mon Aug 27 07:34:54 2018
+++ src/sys/dev/pci/agp.c	Fri Jan 31 11:17:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp.c,v 1.85 2018/08/27 07:34:54 riastradh Exp $	*/
+/*	$NetBSD: agp.c,v 1.85.6.1 2020/01/31 11:17:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -65,7 +65,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp.c,v 

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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:14:51 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-9]: am79900reg.h rt2860.c
src/sys/dev/ieee1394 [netbsd-9]: firewire.c fwohci.c fwohcireg.h
src/sys/dev/pci [netbsd-9]: if_age.c if_alc.c if_ale.c if_bce.c
if_mcx.c if_pcn.c pccbbreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #671):

sys/dev/pci/if_bce.c: revision 1.53
sys/dev/pci/pccbbreg.h: revision 1.16
sys/dev/ic/rt2860.c: revision 1.34
sys/dev/pci/if_alc.c: revision 1.45
sys/dev/pci/if_mcx.c: revision 1.5
sys/dev/pci/if_pcn.c: revision 1.72
sys/dev/pci/if_ale.c: revision 1.37
sys/dev/pci/if_age.c: revision 1.65
sys/dev/ieee1394/fwohcireg.h: revision 1.20
sys/dev/ieee1394/fwohci.c: revision 1.143
sys/dev/ieee1394/firewire.c: revision 1.49
sys/dev/ic/am79900reg.h: revision 1.10

 Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.94.1 src/sys/dev/ic/am79900reg.h
cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/dev/ic/rt2860.c
cvs rdiff -u -r1.48 -r1.48.4.1 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.142.2.1 -r1.142.2.2 src/sys/dev/ieee1394/fwohci.c
cvs rdiff -u -r1.19 -r1.19.8.1 src/sys/dev/ieee1394/fwohcireg.h
cvs rdiff -u -r1.60.2.4 -r1.60.2.5 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.38.2.3 -r1.38.2.4 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.33.2.2 -r1.33.2.3 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.52.2.1 -r1.52.2.2 src/sys/dev/pci/if_bce.c
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/dev/pci/if_mcx.c
cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/pci/if_pcn.c
cvs rdiff -u -r1.15 -r1.15.70.1 src/sys/dev/pci/pccbbreg.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/am79900reg.h
diff -u src/sys/dev/ic/am79900reg.h:1.9 src/sys/dev/ic/am79900reg.h:1.9.94.1
--- src/sys/dev/ic/am79900reg.h:1.9	Mon Apr 28 20:23:49 2008
+++ src/sys/dev/ic/am79900reg.h	Fri Jan 31 11:14:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79900reg.h,v 1.9 2008/04/28 20:23:49 martin Exp $	*/
+/*	$NetBSD: am79900reg.h,v 1.9.94.1 2020/01/31 11:14:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@ struct leinit {
 };
 
 /* Receive message descriptor 1 (rmd1_bits) */
-#define	LE_R1_OWN	(1<<31)		/* LANCE owns the packet */
+#define	LE_R1_OWN	(1U<<31)	/* LANCE owns the packet */
 #define	LE_R1_ERR	(1<<30)		/* error summary */
 #define	LE_R1_FRAM	(1<<29)		/* framing error */
 #define	LE_R1_OFLO	(1<<28)		/* overflow error */
@@ -111,7 +111,7 @@ struct leinit {
 "\20\40OWN\37ERR\36FRAM\35OFLO\34CRC\33BUFF\32STP\31ENP"
 
 /* Transmit message descriptor 1 (tmd1_bits) */
-#define	LE_T1_OWN	(1<<31)		/* LANCE owns the packet */
+#define	LE_T1_OWN	(1U<<31)	/* LANCE owns the packet */
 #define	LE_T1_ERR	(1<<30)		/* error summary */
 #define	LE_T1_ADD_FCS	(1<<29)		/* add FCS (PCnet-PCI) */
 #define	LE_T1_NO_FCS	(1<<29)		/* no FCS (ILACC) */

Index: src/sys/dev/ic/rt2860.c
diff -u src/sys/dev/ic/rt2860.c:1.33 src/sys/dev/ic/rt2860.c:1.33.4.1
--- src/sys/dev/ic/rt2860.c:1.33	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ic/rt2860.c	Fri Jan 31 11:14:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2860.c,v 1.33 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: rt2860.c,v 1.33.4.1 2020/01/31 11:14:51 martin Exp $	*/
 /*	$OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $	*/
 /*	$FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
 
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.33 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.33.4.1 2020/01/31 11:14:51 martin Exp $");
 
 #include 
 #include 
@@ -2233,7 +2233,7 @@ static void
 rt2860_enable_mrr(struct rt2860_softc *sc)
 {
 #define CCK(mcs)	(mcs)
-#define OFDM(mcs)	(1 << 3 | (mcs))
+#define OFDM(mcs)	(1U << 3 | (mcs))
 	RAL_WRITE(sc, RT2860_LG_FBK_CFG0,
 	OFDM(6) << 28 |	/* 54->48 */
 	OFDM(5) << 24 |	/* 48->36 */
@@ -3294,7 +3294,7 @@ b4inc(uint32_t b32, int8_t delta)
 			b4 = 0;
 		else if (b4 > 0xf)
 			b4 = 0xf;
-		b32 = b32 >> 4 | b4 << 28;
+		b32 = b32 >> 4 | (uint32_t)b4 << 28;
 	}
 	return b32;
 }

Index: src/sys/dev/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.48 src/sys/dev/ieee1394/firewire.c:1.48.4.1
--- src/sys/dev/ieee1394/firewire.c:1.48	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ieee1394/firewire.c	Fri Jan 31 11:14:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: firewire.c,v 1.48.4.1 2020/01/31 11:14:51 martin Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 

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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:07:51 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-9]: pcidevs.h pcidevs_data.h

Log Message:
regen (for ticket #670)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.4 -r1.1371.2.5 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.4 -r1.1370.2.5 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:06:31 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-9]: pcidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #670):

sys/dev/pci/pcidevs: revision 1.1396
sys/dev/pci/pcidevs: revision 1.1397
sys/dev/pci/pcidevs: revision 1.1392
sys/dev/pci/pcidevs: revision 1.1393
sys/dev/pci/pcidevs: revision 1.1394
sys/dev/pci/pcidevs: revision 1.1395

- Add Xeon D-1500 NTB-secondary

- Add Xeon D NS QuickData DMA channel 0-7

Add AMD Family14h PCIe.

Killer E3000
from OpenBSD

add Aquantia AQC 10G network adapters

 Add Intel I219 LM10-LM15 and V10-V14 from OpenBSD.

 Remove duplicated entries.


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.4 -r1.1383.2.5 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1383.2.4 src/sys/dev/pci/pcidevs:1.1383.2.5
--- src/sys/dev/pci/pcidevs:1.1383.2.4	Tue Nov 19 13:03:32 2019
+++ src/sys/dev/pci/pcidevs	Fri Jan 31 11:06:31 2020
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.4 2019/11/19 13:03:32 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.5 2020/01/31 11:06:31 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -651,6 +651,7 @@ vendor SYMPHONY2	0x1c1c	Symphony Labs (2
 vendor HGST		0x1c58	HGST, Inc.
 vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor AMAZON		0x1d0f	Amazon.com, Inc.
+vendor AQUANTIA		0x1d6a	Aquantia
 vendor ROCKCHIP		0x1d87	Rockchip
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
 vendor SUNIX2		0x1fd4	SUNIX Co
@@ -1030,6 +1031,11 @@ product AMD F17_7X_IOMMU	0x1481	Family17
 product AMD F17_7X_RESV_SPP	0x1485	Family17h/7xh Reserved SPP
 product AMD F17_7X_USB3		0x149c	Family17h/7xh USB 3.0 Host Controller
 product AMD F14_RC		0x1510	Family14h Root Complex
+product AMD F14_PCIE_1		0x1512	Family14h PCIe
+product AMD F14_PCIE_2		0x1513	Family14h PCIe
+product AMD F14_PCIE_3		0x1514	Family14h PCIe
+product AMD F14_PCIE_4		0x1515	Family14h PCIe
+product AMD F14_PCIE_5		0x1516	Family14h PCIe
 product AMD F16_HT		0x1530	Family16h HyperTransport Configuration
 product AMD F16_ADDR		0x1531	Family16h Address Map Configuration
 product AMD F16_DRAM		0x1532	Family16h DRAM Configuration
@@ -1282,6 +1288,21 @@ product APPLE INTREPID2_FW	0x006a	Intrep
 product APPLE INTREPID2_GMAC	0x006b	Intrepid 2 GMAC
 product APPLE BCM5701		0x1645	BCM5701
 
+/* Aquantia Corp. */
+product AQUANTIA AQC107		0x07b1	AQC107 10 Gigabit Network Adapter
+product AQUANTIA AQC108		0x08b1	AQC108 5 Gigabit Network Adapter
+product AQUANTIA AQC109		0x09b1	AQC109 2.5 Gigabit Network Adapter
+product AQUANTIA AQC111		0x11b1	AQC111 5 Gigabit Network Adapter
+product AQUANTIA AQC112		0x12b1	AQC112 2.5 Gigabit Network Adapter
+product AQUANTIA AQC107S	0x87b1	AQC107S 10 Gigabit Network Adapter
+product AQUANTIA AQC108S	0x88b1	AQC108S 5 Gigabit Network Adapter
+product AQUANTIA AQC109S	0x89b1	AQC109S 2.5 Gigabit Network Adapter
+product AQUANTIA AQC111S	0x91b1	AQC111S 5 Gigabit Network Adapter
+product AQUANTIA AQC112S	0x92b1	AQC112S 2.5 Gigabit Network Adapter
+product AQUANTIA D107		0xd107	D107 10 Gigabit Network Adapter
+product AQUANTIA D108		0xd108	D108 5 Gigabit Network Adapter
+product AQUANTIA D109		0xd109	D109 2.5 Gigabit Network Adapter
+
 /* ARC Logic products */
 product ARC 1000PV	0xa091	1000PV
 product ARC 2000PV	0xa099	2000PV
@@ -3169,6 +3190,12 @@ product INTEL S1200_ILB		0x0c60	Atom S12
 product INTEL S1200_S1220	0x0c72	Atom S1220 Internal
 product INTEL S1200_S1240	0x0c73	Atom S1240 Internal
 product INTEL S1200_S1260	0x0c75	Atom S1260 Internal
+product INTEL I219_LM11		0x0d4c	I219-LM Ethernet Connection
+product INTEL I219_V11		0x0d4d	I219-V Ethernet Connection
+product INTEL I219_LM10		0x0d4e	I219-LM Ethernet Connection
+product INTEL I219_V10		0x0d4f	I219-V Ethernet Connection
+product INTEL I219_LM12		0x0d53	I219-LM Ethernet Connection
+product INTEL I219_V12		0x0d55	I219-V Ethernet Connection
 product INTEL E5V2_DMI2		0x0e00	E5 v2 DMI2
 product INTEL E5V2_PCIE_1	0x0e01	E5 v2 PCIe x4 (DMI2 Mode)
 product INTEL E5V2_PCIE_2	0x0e02	E5 v2 PCIe
@@ -3196,8 +3223,6 @@ product INTEL E5V2_ADDRMAP	0x0e28	E5 v2 
 product INTEL E5V2_HOTPLUG	0x0e29	E5 v2 Hot-Plug
 product INTEL E5V2_IIO_RAS	0x0e2a	E5 v2 IIO RAS
 product INTEL E5V2_IOAPIC	0x0e2c	E5 v2 I/O APIC
-product INTEL E5_IOAT_RAID_1	0x3c2e	E5 I/OAT DMA (RAID 5/6)
-product INTEL E5_IOAT_RAID_2	0x3c2f	E5 I/OAT DMA (RAID 5/6)
 product INTEL E5V2_HA_2		0x0e30	E5 v2 Home Agent
 product INTEL E5V2_PCIE_PM_1	0x0e34	E5 v2 PCIe Performance Monitor
 product INTEL E5V2_QPI_PM_1	0x0e36	E5 v2 QPI Performance Monitor
@@ -3602,7 +3627,12 @@ product INTEL I219_V9		0x15e2	I219-V Eth
 product INTEL I219_LM5		0x15e3	I219-LM Ethernet Connection
 product INTEL C3K_X553_SGMII	

CVS commit: [netbsd-8] src/doc

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:02:57 UTC 2020

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

Log Message:
Tickets #1494 - #1497


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

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

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.92 src/doc/CHANGES-8.2:1.1.2.93
--- src/doc/CHANGES-8.2:1.1.2.92	Tue Jan 28 09:36:21 2020
+++ src/doc/CHANGES-8.2	Fri Jan 31 11:02:56 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.92 2020/01/28 09:36:21 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.93 2020/01/31 11:02:56 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1976,3 +1976,31 @@ sys/dev/mii/makphyreg.h			1.10
 	- Fix comment. KNF.
 	[msaitoh, ticket #1493]
 
+sys/arch/x86/include/specialreg.h	1.146, 1.151-1.154, 1.156 via patch
+usr.sbin/cpuctl/arch/i386.c		1.105-1.107 via patch
+
+	- Add definitions of AMD's CPUID Fn8000_0008 %ebx.
+	- Add definitions of AMD's CPUID Fn8000_001f Encrypted Memory features.
+	- Add definition of AMD's CPUID Fn8000_000a %edx bit 11 "GMET".
+	- Define CPUID_AMD_SVM_PFThreshold correctly.
+	- Modify comment a bit for consistency.
+	- Call cpu_dcp_cacheinfo() only when the cpuid Topology Extension flag
+	  is set on AMD processor.
+	- Fix typos.
+	[msaitoh, ticket #1494]
+
+sys/dev/usb/if_urlreg.h1.16
+
+	url(4): set inter frame gap correctly.
+	[msaitoh, ticket #1495]
+
+sys/dev/pci/if_stgereg.h			1.7
+
+	stge(4): fix max frame size.
+	[msaitoh, ticket #1496]
+
+sys/netipsec/ipsecif.c1.19
+
+	Fix IPv6 over IPv4 ipsecif(4) uses wrong SP.
+	[knakahara, ticket #1497]
+



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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 11:01:38 UTC 2020

Modified Files:
src/sys/netipsec [netbsd-8]: ipsecif.c

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

sys/netipsec/ipsecif.c: revision 1.19

Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wrongly.  Pointed out by ohishi@IIJ.
XXX pullup-8, pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/netipsec/ipsecif.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/netipsec/ipsecif.c
diff -u src/sys/netipsec/ipsecif.c:1.1.2.9 src/sys/netipsec/ipsecif.c:1.1.2.10
--- src/sys/netipsec/ipsecif.c:1.1.2.9	Tue Sep 24 18:27:09 2019
+++ src/sys/netipsec/ipsecif.c	Fri Jan 31 11:01:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsecif.c,v 1.1.2.9 2019/09/24 18:27:09 martin Exp $  */
+/*	$NetBSD: ipsecif.c,v 1.1.2.10 2020/01/31 11:01:38 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.1.2.9 2019/09/24 18:27:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.1.2.10 2020/01/31 11:01:38 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -382,7 +382,17 @@ ipsecif4_output(struct ipsec_variant *va
 	KASSERT(var->iv_psrc->sa_family == AF_INET);
 	KASSERT(var->iv_pdst->sa_family == AF_INET);
 
-	sp = IV_SP_OUT(var);
+	switch (family) {
+	case AF_INET:
+		sp = IV_SP_OUT(var);
+		break;
+	case AF_INET6:
+		sp = IV_SP_OUT6(var);
+		break;
+	default:
+		m_freem(m);
+		return EAFNOSUPPORT;
+	}
 	KASSERT(sp != NULL);
 	/*
 	 * The SPs in ipsec_variant are prevented from freed by



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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 10:57:29 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-8]: if_stgereg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1496):

sys/dev/pci/if_stgereg.h: revision 1.7

 Fix address of STGE_MaxFrameSize. Same as other OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.80.1 src/sys/dev/pci/if_stgereg.h

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

Modified files:

Index: src/sys/dev/pci/if_stgereg.h
diff -u src/sys/dev/pci/if_stgereg.h:1.5 src/sys/dev/pci/if_stgereg.h:1.5.80.1
--- src/sys/dev/pci/if_stgereg.h:1.5	Mon Apr 28 20:23:55 2008
+++ src/sys/dev/pci/if_stgereg.h	Fri Jan 31 10:57:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stgereg.h,v 1.5 2008/04/28 20:23:55 martin Exp $	*/
+/*	$NetBSD: if_stgereg.h,v 1.5.80.1 2020/01/31 10:57:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -319,7 +319,7 @@ struct stge_rfd {
 
 #define	STGE_VLANId			0x80
 
-#define	STGE_MaxFrameSize		0x84
+#define	STGE_MaxFrameSize		0x86
 
 #define	STGE_ReceiveMode		0x88	/* 16-bit */
 #define	RM_ReceiveUnicast		(1U << 0)



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

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 10:55:37 UTC 2020

Modified Files:
src/sys/dev/usb [netbsd-8]: if_urlreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1495):

sys/dev/usb/if_urlreg.h: revision 1.16

URL_TCR_IFG0 is not bit 4 but bit3. From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.10.1 src/sys/dev/usb/if_urlreg.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/usb/if_urlreg.h
diff -u src/sys/dev/usb/if_urlreg.h:1.11 src/sys/dev/usb/if_urlreg.h:1.11.10.1
--- src/sys/dev/usb/if_urlreg.h:1.11	Sat Apr 23 10:15:31 2016
+++ src/sys/dev/usb/if_urlreg.h	Fri Jan 31 10:55:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urlreg.h,v 1.11 2016/04/23 10:15:31 skrll Exp $	*/
+/*	$NetBSD: if_urlreg.h,v 1.11.10.1 2020/01/31 10:55:37 martin Exp $	*/
 /*
  * Copyright (c) 2001, 2002
  * Shingo WATANABE .  All rights reserved.
@@ -84,7 +84,7 @@
 #define	 URL_TCR_TXRR1		(1<<7) /* TX Retry Count */
 #define	 URL_TCR_TXRR0		(1<<6) /* TX Retry Count */
 #define	 URL_TCR_IFG1		(1<<4) /* Interframe Gap Time */
-#define	 URL_TCR_IFG0		(1<<4) /* Interframe Gap Time */
+#define	 URL_TCR_IFG0		(1<<3) /* Interframe Gap Time */
 #define	 URL_TCR_NOCRC		(1<<0) /* no CRC Append */
 
 #define	URL_RCR			0x0130 /* Receive Configuration Register */



CVS commit: [netbsd-8] src

2020-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 31 10:53:29 UTC 2020

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h
src/usr.sbin/cpuctl/arch [netbsd-8]: i386.c

Log Message:
Pull up the following, requested by msaitoh in ticket #1494:

sys/arch/x86/include/specialreg.h   1.146, 1.151-1.154, 1.156 via 
patch
usr.sbin/cpuctl/arch/i386.c 1.105-1.107 via patch

- Add definitions of AMD's CPUID Fn8000_0008 %ebx.
- Add definitions of AMD's CPUID Fn8000_001f Encrypted Memory features.
- Add definition of AMD's CPUID Fn8000_000a %edx bit 11 "GMET".
- Define CPUID_AMD_SVM_PFThreshold correctly.
- Modify comment a bit for consistency.
- Call cpu_dcp_cacheinfo() only when the cpuid Topology Extension flag
  is set on AMD processor.
- Fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.17 -r1.98.2.18 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.74.6.8 -r1.74.6.9 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.17 src/sys/arch/x86/include/specialreg.h:1.98.2.18
--- src/sys/arch/x86/include/specialreg.h:1.98.2.17	Tue Nov 19 10:45:11 2019
+++ src/sys/arch/x86/include/specialreg.h	Fri Jan 31 10:53:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.17 2019/11/19 10:45:11 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.18 2020/01/31 10:53:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -104,7 +104,7 @@
 #define XCR0_Hi16_ZMM	0x0080	/* AVX-512 512 bits upper registers */
 
 /*
- * Known fpu bits - only these get enabled. The save area is sized for all the
+ * Known FPU bits, only these get enabled. The save area is sized for all the
  * fields below (max 2680 bytes).
  */
 #define XCR0_FPU	(XCR0_X87 | XCR0_SSE | XCR0_YMM_Hi128 | \
@@ -351,12 +351,12 @@
 /* %ebx */
 #define CPUID_SEF_FSGSBASE	__BIT(0)  /* {RD,WR}{FS,GS}BASE */
 #define CPUID_SEF_TSC_ADJUST	__BIT(1)  /* IA32_TSC_ADJUST MSR support */
-#define CPUID_SEF_SGX		__BIT(2)  /* Software Guard Extentions */
+#define CPUID_SEF_SGX		__BIT(2)  /* Software Guard Extensions */
 #define CPUID_SEF_BMI1		__BIT(3)  /* advanced bit manipulation ext. 1st grp */
 #define CPUID_SEF_HLE		__BIT(4)  /* Hardware Lock Elision */
 #define CPUID_SEF_AVX2		__BIT(5)  /* Advanced Vector Extensions 2 */
 #define CPUID_SEF_FDPEXONLY	__BIT(6)  /* x87FPU Data ptr updated only on x87exp */
-#define CPUID_SEF_SMEP		__BIT(7)  /* Supervisor-Mode Excecution Prevention */
+#define CPUID_SEF_SMEP		__BIT(7)  /* Supervisor-Mode Execution Prevention */
 #define CPUID_SEF_BMI2		__BIT(8)  /* advanced bit manipulation ext. 2nd grp */
 #define CPUID_SEF_ERMS		__BIT(9)  /* Enhanced REP MOVSB/STOSB */
 #define CPUID_SEF_INVPCID	__BIT(10) /* INVPCID instruction */
@@ -605,7 +605,7 @@
 	"\31" "FXSR"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP"	\
 			"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
 
-/* AMD Fn8001 extended features - %ecx */
+/* AMD Fn8000_0001 extended features - %ecx */
 /* 	CPUID_LAHF			   LAHF/SAHF instruction */
 #define CPUID_CMPLEGACY	0x0002	/* Compare Legacy */
 #define CPUID_SVM	0x0004	/* Secure Virtual Machine */
@@ -671,7 +671,40 @@
 	"\11" "TSC"	"\12" "CPB"	"\13" "EffFreq"	"\14" "PROCFI"	  \
 	"\15" "PROCPR"	"\16" "CONNSTBY" "\17" "RAPL"
 
-/* AMD Fn800a %edx features (SVM features) */
+/*
+ * AMD Processor Capacity Parameters and Extended Features
+ * CPUID Fn8000_0008
+ * %eax: Long Mode Size Identifiers
+ * %ebx: Extended Feature Identifiers
+ * %ecx: Size Identifiers
+ */
+
+/* %ebx */
+#define CPUID_CAPEX_CLZERO	__BIT(0)	/* CLZERO instruction */
+#define CPUID_CAPEX_IRPERF	__BIT(1)	/* InstRetCntMsr */
+#define CPUID_CAPEX_XSAVEERPTR	__BIT(2)	/* RstrFpErrPtrs by XRSTOR */
+#define CPUID_CAPEX_RDPRU	__BIT(4)	/* RDPRU instruction */
+#define CPUID_CAPEX_MCOMMIT	__BIT(8)	/* MCOMMIT instruction */
+#define CPUID_CAPEX_WBNOINVD	__BIT(9)	/* WBNOINVD instruction */
+#define CPUID_CAPEX_IBPB	__BIT(12)	/* Speculation Control IBPB */
+#define CPUID_CAPEX_IBRS	__BIT(14)	/* Speculation Control IBRS */
+#define CPUID_CAPEX_STIBP	__BIT(15)	/* Speculation Control STIBP */
+#define CPUID_CAPEX_IBRS_ALWAYSON __BIT(16)	/* IBRS always on mode */
+#define CPUID_CAPEX_STIBP_ALWAYSON __BIT(17)	/* STIBP always on mode */
+#define CPUID_CAPEX_PREFER_IBRS	__BIT(18)	/* IBRS preferred */
+#define CPUID_CAPEX_SSBD	__BIT(24)	/* Speculation Control SSBD */
+#define CPUID_CAPEX_VIRT_SSBD	__BIT(25)	/* Virt Spec Control SSBD */
+#define CPUID_CAPEX_SSB_NO	__BIT(26)	/* SSBD not required */
+
+#define CPUID_CAPEX_FLAGS	"\20"	 \
+	"\1CLZERO"	"\2IRPERF"	"\3XSAVEERPTR"			 \
+	"\5RDPRU"			"\7B6" \
+	"\11MCOMMIT"	"\12WBNOINVD"	"\13B10"			 \
+	"\15IBPB"	"\16B13"	"\17IBRS"	"\20STIBP"	 \
+	"\21IBRS_ALWAYSON" 

CVS commit: src/sys/arch/aarch64

2020-01-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 31 09:23:58 UTC 2020

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

Log Message:
BTI definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/trap.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/include/pte.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/trap.c
diff -u src/sys/arch/aarch64/aarch64/trap.c:1.24 src/sys/arch/aarch64/aarch64/trap.c:1.25
--- src/sys/arch/aarch64/aarch64/trap.c:1.24	Mon Jan  6 08:36:08 2020
+++ src/sys/arch/aarch64/aarch64/trap.c	Fri Jan 31 09:23:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.24 2020/01/06 08:36:08 skrll Exp $ */
+/* $NetBSD: trap.c,v 1.25 2020/01/31 09:23:58 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.24 2020/01/06 08:36:08 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.25 2020/01/31 09:23:58 maxv Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
@@ -94,6 +94,8 @@ const char * const trap_names[] = {
 	[ESR_EC_WFX]		= "WFI or WFE instruction execution",
 	[ESR_EC_ILL_STATE]	= "Illegal Execution State",
 
+	[ESR_EC_BTE_A64]	= "Branch Target Exception",
+
 	[ESR_EC_SYS_REG]	= "MSR/MRS/SYS instruction",
 	[ESR_EC_SVC_A64]	= "SVC Instruction Execution",
 	[ESR_EC_HVC_A64]	= "HVC Instruction Execution",

Index: src/sys/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.34 src/sys/arch/aarch64/include/armreg.h:1.35
--- src/sys/arch/aarch64/include/armreg.h:1.34	Tue Jan 28 18:02:30 2020
+++ src/sys/arch/aarch64/include/armreg.h	Fri Jan 31 09:23:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.34 2020/01/28 18:02:30 maxv Exp $ */
+/* $NetBSD: armreg.h,v 1.35 2020/01/31 09:23:58 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -547,6 +547,7 @@ AARCH64REG_WRITE_INLINE(esr_el1)
 #define	 ESR_EC_FP_ACCESS	 0x07	// AXX: Access to SIMD/FP Registers
 #define	 ESR_EC_FPID		 0x08	// A32: MCR/MRC access to CP10 !EC=7
 #define	 ESR_EC_CP14_RRT	 0x0c	// A32: MRRC access to CP14
+#define	 ESR_EC_BTE_A64		 0x0d	// A64: Branch Target Exception (V8.5)
 #define	 ESR_EC_ILL_STATE	 0x0e	// AXX: Illegal Execution State
 #define	 ESR_EC_SVC_A32		 0x11	// A32: SVC Instruction Execution
 #define	 ESR_EC_HVC_A32		 0x12	// A32: HVC Instruction Execution
@@ -778,6 +779,7 @@ AARCH64REG_WRITE_INLINE(spsr_el1)
 #define	SPSR_IT4 		__BIT(12)	// A32: IT[4]
 #define	SPSR_IT3 		__BIT(11)	// A32: IT[3]
 #define	SPSR_IT2 		__BIT(10)	// A32: IT[2]
+#define	SPSR_A64_BTYPE 		__BIT(11,10)	// A64: BTYPE
 #define	SPSR_A64_D 		__BIT(9)	// A64: Debug Exception Mask
 #define	SPSR_A32_E 		__BIT(9)	// A32: BE Endian Mode
 #define	SPSR_A	 		__BIT(8)	// Async abort (SError) Mask

Index: src/sys/arch/aarch64/include/pte.h
diff -u src/sys/arch/aarch64/include/pte.h:1.10 src/sys/arch/aarch64/include/pte.h:1.11
--- src/sys/arch/aarch64/include/pte.h:1.10	Wed Sep 11 18:23:31 2019
+++ src/sys/arch/aarch64/include/pte.h	Fri Jan 31 09:23:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.10 2019/09/11 18:23:31 skrll Exp $ */
+/* $NetBSD: pte.h,v 1.11 2020/01/31 09:23:58 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -65,6 +65,7 @@ typedef uint64_t pt_entry_t;	/* L3(4k) t
 #define LX_BLKPAG_PXN		__BIT(53)	/* Privileged Execute Never */
 #define LX_BLKPAG_CONTIG	__BIT(52)	/* Hint of TLB cache */
 #define LX_BLKPAG_DBM		__BIT(51)	/* Dirty Bit Modifier (V8.1) */
+#define LX_BLKPAG_GP		__BIT(50)	/* Guarded Page (V8.5) */
 #define LX_TBL_PA		__BITS(47, 12)
 #define LX_BLKPAG_OA		__BITS(47, 12)
 #define LX_BLKPAG_NG		__BIT(11)	/* Not Global */



CVS commit: src/sys/arch/aarch64/aarch64

2020-01-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 31 09:08:57 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: netbsd32_machdep.c

Log Message:
D means E here (aarch32), so don't check it. A-I-F are checked below
already, so drop the whole line.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/netbsd32_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/aarch64/aarch64/netbsd32_machdep.c
diff -u src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.9 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.10
--- src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.9	Sun Nov 24 04:08:36 2019
+++ src/sys/arch/aarch64/aarch64/netbsd32_machdep.c	Fri Jan 31 09:08:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.9 2019/11/24 04:08:36 rin Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.10 2020/01/31 09:08:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.9 2019/11/24 04:08:36 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.10 2020/01/31 09:08:57 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -318,8 +318,6 @@ cpu_mcontext32_validate(struct lwp *l, c
 
 	if (__SHIFTOUT(spsr, SPSR_M) != SPSR_M_USR32)
 		return EINVAL;
-	if ((spsr & (SPSR_A64_D|SPSR_A|SPSR_I|SPSR_F)) != 0)
-		return EINVAL;
 
 #ifdef __AARCH64EB__
 	if ((spsr & SPSR_A32_E) == 0)



CVS commit: src/sys/compat

2020-01-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 31 09:01:23 UTC 2020

Modified Files:
src/sys/compat/common: vfs_syscalls_30.c
src/sys/compat/netbsd32: netbsd32_compat_30.c netbsd32_fs.c

Log Message:
Fix copyout overflows in fhstat, found by the LGTM bot. Not a big problem
since this syscall is privileged.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/compat/common/vfs_syscalls_30.c
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/netbsd32/netbsd32_compat_30.c
cvs rdiff -u -r1.85 -r1.86 src/sys/compat/netbsd32/netbsd32_fs.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/compat/common/vfs_syscalls_30.c
diff -u src/sys/compat/common/vfs_syscalls_30.c:1.40 src/sys/compat/common/vfs_syscalls_30.c:1.41
--- src/sys/compat/common/vfs_syscalls_30.c:1.40	Fri Jan 17 20:08:06 2020
+++ src/sys/compat/common/vfs_syscalls_30.c	Fri Jan 31 09:01:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_30.c,v 1.40 2020/01/17 20:08:06 ad Exp $	*/
+/*	$NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.40 2020/01/17 20:08:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -190,7 +190,7 @@ compat_30_sys_fhstat(struct lwp *l,
 	if (error)
 		return (error);
 	cvtstat(, );
-	error = copyout(, SCARG(uap, sb), sizeof(sb));
+	error = copyout(, SCARG(uap, sb), sizeof(osb));
 	return (error);
 }
 

Index: src/sys/compat/netbsd32/netbsd32_compat_30.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_30.c:1.34 src/sys/compat/netbsd32/netbsd32_compat_30.c:1.35
--- src/sys/compat/netbsd32/netbsd32_compat_30.c:1.34	Fri Jan 17 20:08:06 2020
+++ src/sys/compat/netbsd32/netbsd32_compat_30.c	Fri Jan 31 09:01:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_30.c,v 1.34 2020/01/17 20:08:06 ad Exp $	*/
+/*	$NetBSD: netbsd32_compat_30.c,v 1.35 2020/01/31 09:01:23 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.34 2020/01/17 20:08:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.35 2020/01/31 09:01:23 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include 
@@ -199,7 +199,7 @@ compat_30_netbsd32_fhstat(struct lwp *l,
 	if (error)
 		return (error);
 	netbsd32_from___stat13(, );
-	error = copyout(, SCARG_P32(uap, sb), sizeof(sb));
+	error = copyout(, SCARG_P32(uap, sb), sizeof(sb32));
 	return (error);
 }
 

Index: src/sys/compat/netbsd32/netbsd32_fs.c
diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.85 src/sys/compat/netbsd32/netbsd32_fs.c:1.86
--- src/sys/compat/netbsd32/netbsd32_fs.c:1.85	Thu Sep 26 01:32:09 2019
+++ src/sys/compat/netbsd32/netbsd32_fs.c	Fri Jan 31 09:01:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_fs.c,v 1.85 2019/09/26 01:32:09 christos Exp $	*/
+/*	$NetBSD: netbsd32_fs.c,v 1.86 2020/01/31 09:01:23 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.85 2019/09/26 01:32:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.86 2020/01/31 09:01:23 maxv Exp $");
 
 #include 
 #include 
@@ -630,7 +630,7 @@ netbsd32___fhstat50(struct lwp *l, const
 	error = do_fhstat(l, SCARG_P32(uap, fhp), SCARG(uap, fh_size), );
 	if (error == 0) {
 		netbsd32_from_stat(, );
-		error = copyout(, SCARG_P32(uap, sb), sizeof(sb));
+		error = copyout(, SCARG_P32(uap, sb), sizeof(sb32));
 	}
 	return error;
 }



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

2020-01-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 31 08:55:38 UTC 2020

Modified Files:
src/sys/arch/x86/x86: dbregs.c fpu.c spectre.c svs.c

Log Message:
'oldlwp' is never NULL now, so remove the NULL checks.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/dbregs.c
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/x86/svs.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/dbregs.c
diff -u src/sys/arch/x86/x86/dbregs.c:1.14 src/sys/arch/x86/x86/dbregs.c:1.15
--- src/sys/arch/x86/x86/dbregs.c:1.14	Mon Jan 14 18:54:07 2019
+++ src/sys/arch/x86/x86/dbregs.c	Fri Jan 31 08:55:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbregs.c,v 1.14 2019/01/14 18:54:07 maxv Exp $	*/
+/*	$NetBSD: dbregs.c,v 1.15 2020/01/31 08:55:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -297,13 +297,10 @@ x86_dbregs_switch(struct lwp *oldlwp, st
 	struct pcb *oldpcb, *newpcb;
 	bool olddb, newdb;
 
-	oldpcb = (oldlwp != NULL) ? lwp_getpcb(oldlwp) : NULL;
+	oldpcb = lwp_getpcb(oldlwp);
 	newpcb = lwp_getpcb(newlwp);
 
-	olddb = false;
-	if (oldpcb) {
-		olddb = (oldpcb->pcb_flags & PCB_DBREGS) != 0;
-	}
+	olddb = (oldpcb->pcb_flags & PCB_DBREGS) != 0;
 	newdb = (newpcb->pcb_flags & PCB_DBREGS) != 0;
 
 	if (__predict_true(!olddb && !newdb)) {

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.60 src/sys/arch/x86/x86/fpu.c:1.61
--- src/sys/arch/x86/x86/fpu.c:1.60	Wed Nov 27 06:24:33 2019
+++ src/sys/arch/x86/x86/fpu.c	Fri Jan 31 08:55:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.60 2019/11/27 06:24:33 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.61 2020/01/31 08:55:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.60 2019/11/27 06:24:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.61 2020/01/31 08:55:38 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -301,7 +301,7 @@ fpu_switch(struct lwp *oldlwp, struct lw
 {
 	struct pcb *pcb;
 
-	if ((oldlwp != NULL) && (oldlwp->l_md.md_flags & MDL_FPU_IN_CPU)) {
+	if (oldlwp->l_md.md_flags & MDL_FPU_IN_CPU) {
 		KASSERT(!(oldlwp->l_flag & LW_SYSTEM));
 		pcb = lwp_getpcb(oldlwp);
 		fpu_area_save(>pcb_savefpu, x86_xsave_features);

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.32 src/sys/arch/x86/x86/spectre.c:1.33
--- src/sys/arch/x86/x86/spectre.c:1.32	Thu Dec 12 16:49:20 2019
+++ src/sys/arch/x86/x86/spectre.c	Fri Jan 31 08:55:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.32 2019/12/12 16:49:20 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.33 2020/01/31 08:55:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.32 2019/12/12 16:49:20 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.33 2020/01/31 08:55:38 maxv Exp $");
 
 #include "opt_spectre.h"
 
@@ -966,8 +966,7 @@ speculation_barrier(struct lwp *oldlwp, 
 	/*
 	 * From kernel thread to kernel thread, no need for a barrier.
 	 */
-	if ((oldlwp != NULL && (oldlwp->l_flag & LW_SYSTEM)) &&
-	(newlwp->l_flag & LW_SYSTEM))
+	if ((oldlwp->l_flag & LW_SYSTEM) && (newlwp->l_flag & LW_SYSTEM))
 		return;
 
 	switch (v2_mitigation_method) {

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.31 src/sys/arch/x86/x86/svs.c:1.32
--- src/sys/arch/x86/x86/svs.c:1.31	Sun Dec  8 20:42:48 2019
+++ src/sys/arch/x86/x86/svs.c	Fri Jan 31 08:55:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.31 2019/12/08 20:42:48 ad Exp $	*/
+/*	$NetBSD: svs.c,v 1.32 2020/01/31 08:55:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.31 2019/12/08 20:42:48 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.32 2020/01/31 08:55:38 maxv Exp $");
 
 #include "opt_svs.h"
 #include "opt_user_ldt.h"
@@ -540,7 +540,7 @@ svs_lwp_switch(struct lwp *oldlwp, struc
 	}
 
 #ifdef DIAGNOSTIC
-	if (oldlwp != NULL && !(oldlwp->l_flag & LW_SYSTEM)) {
+	if (!(oldlwp->l_flag & LW_SYSTEM)) {
 		pcb = lwp_getpcb(oldlwp);
 		rsp0 = pcb->pcb_rsp0;
 		va = rounddown(rsp0, PAGE_SIZE);



CVS commit: src/sys/kern

2020-01-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 31 08:26:11 UTC 2020

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

Log Message:
Be more informative.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_msan.c

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

Modified files:

Index: src/sys/kern/subr_msan.c
diff -u src/sys/kern/subr_msan.c:1.6 src/sys/kern/subr_msan.c:1.7
--- src/sys/kern/subr_msan.c:1.6	Sat Jan 25 15:55:33 2020
+++ src/sys/kern/subr_msan.c	Fri Jan 31 08:26:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_msan.c,v 1.6 2020/01/25 15:55:33 maxv Exp $	*/
+/*	$NetBSD: subr_msan.c,v 1.7 2020/01/31 08:26:10 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.6 2020/01/25 15:55:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.7 2020/01/31 08:26:10 maxv Exp $");
 
 #include 
 #include 
@@ -163,7 +163,7 @@ kmsan_report_hook(const void *addr, size
 	orig = (msan_orig_t *)((uintptr_t)orig & ~0x3);
 
 	if (*orig == 0) {
-		REPORT("MSan: Uninitialized Memory In %s() At Offset "
+		REPORT("MSan: Uninitialized Memory In %s At Offset "
 		"%zu\n", hook, off);
 		goto out;
 	}
@@ -173,13 +173,13 @@ kmsan_report_hook(const void *addr, size
 
 	if (kmsan_md_is_pc(ptr)) {
 		if (ksyms_getname(, , (vaddr_t)ptr, KSYMS_PROC)) {
-			REPORT("MSan: Uninitialized %s Memory In %s() "
-			"At Offset %zu, IP %p\n", typename, hook, off,
-			(void *)ptr);
+			REPORT("MSan: Uninitialized %s Memory In %s "
+			"At Offset %zu/%zu, IP %p\n", typename, hook, off,
+			size, (void *)ptr);
 		} else {
-			REPORT("MSan: Uninitialized %s Memory In %s() "
-			"At Offset %zu, From %s()\n", typename, hook, off,
-			sym);
+			REPORT("MSan: Uninitialized %s Memory In %s "
+			"At Offset %zu/%zu, From %s()\n", typename, hook,
+			off, size, sym);
 		}
 	} else {
 		var = (char *)ptr + 4;
@@ -187,7 +187,7 @@ kmsan_report_hook(const void *addr, size
 		var = buf;
 		fn = __builtin_strchr(buf, '@');
 		*fn++ = '\0';
-		REPORT("MSan: Uninitialized %s Memory In %s() At Offset "
+		REPORT("MSan: Uninitialized %s Memory In %s At Offset "
 		"%zu, Variable '%s' From %s()\n", typename, hook, off,
 		var, fn);
 	}
@@ -513,7 +513,7 @@ kmsan_check_mbuf(void *buf)
 	struct mbuf *m = buf;
 
 	do {
-		kmsan_shadow_check(mtod(m, void *), m->m_len, "if_transmit");
+		kmsan_shadow_check(mtod(m, void *), m->m_len, "if_transmit()");
 	} while ((m = m->m_next) != NULL);
 }
 
@@ -522,7 +522,7 @@ kmsan_check_buf(void *buf)
 {
 	buf_t *bp = buf;
 
-	kmsan_shadow_check(bp->b_data, bp->b_bcount, "bwrite");
+	kmsan_shadow_check(bp->b_data, bp->b_bcount, "bwrite()");
 }
 
 void
@@ -646,13 +646,14 @@ kmsan_memcmp(const void *b1, const void 
 	const uint8_t *_b1 = b1, *_b2 = b2;
 	size_t i;
 
-	kmsan_check_arg(sizeof(b1) + sizeof(b2) + sizeof(len), "memcmp");
+	kmsan_check_arg(sizeof(b1) + sizeof(b2) + sizeof(len),
+	"memcmp():args");
 	kmsan_init_ret(sizeof(int));
 
 	for (i = 0; i < len; i++) {
 		if (*_b1 != *_b2) {
-			kmsan_shadow_check(b1, i + 1, "memcmp");
-			kmsan_shadow_check(b2, i + 1, "memcmp");
+			kmsan_shadow_check(b1, i + 1, "memcmp():arg1");
+			kmsan_shadow_check(b2, i + 1, "memcmp():arg2");
 			return *_b1 - *_b2;
 		}
 		_b1++, _b2++;
@@ -690,7 +691,7 @@ kmsan_strcpy(char *dst, const char *src)
 	char *_dst = dst;
 	size_t len = 0;
 
-	kmsan_check_arg(sizeof(dst) + sizeof(src), "strcpy");
+	kmsan_check_arg(sizeof(dst) + sizeof(src), "strcpy():args");
 
 	while (1) {
 		len++;
@@ -700,7 +701,7 @@ kmsan_strcpy(char *dst, const char *src)
 		src++, dst++;
 	}
 
-	kmsan_shadow_check(_src, len, "strcpy");
+	kmsan_shadow_check(_src, len, "strcpy():arg2");
 	kmsan_shadow_fill(_dst, KMSAN_STATE_INITED, len);
 	kmsan_init_ret(sizeof(char *));
 	return _dst;
@@ -712,7 +713,7 @@ kmsan_strcmp(const char *s1, const char 
 	const char *_s1 = s1, *_s2 = s2;
 	size_t len = 0;
 
-	kmsan_check_arg(sizeof(s1) + sizeof(s2), "strcmp");
+	kmsan_check_arg(sizeof(s1) + sizeof(s2), "strcmp():args");
 	kmsan_init_ret(sizeof(int));
 
 	while (1) {
@@ -720,15 +721,15 @@ kmsan_strcmp(const char *s1, const char 
 		if (*s1 != *s2)
 			break;
 		if (*s1 == '\0') {
-			kmsan_shadow_check(_s1, len, "strcmp");
-			kmsan_shadow_check(_s2, len, "strcmp");
+			kmsan_shadow_check(_s1, len, "strcmp():arg1");
+			kmsan_shadow_check(_s2, len, "strcmp():arg2");
 			return 0;
 		}
 		s1++, s2++;
 	}
 
-	kmsan_shadow_check(_s1, len, "strcmp");
-	kmsan_shadow_check(_s2, len, "strcmp");
+	kmsan_shadow_check(_s1, len, "strcmp():arg1");
+	kmsan_shadow_check(_s2, len, "strcmp():arg2");
 
 	return (*(const unsigned char *)s1 - *(const unsigned char *)s2);
 }
@@ -738,7 +739,7 @@ kmsan_strlen(const char *str)
 {
 	const char *s;
 
-	kmsan_check_arg(sizeof(str), "strlen");
+	kmsan_check_arg(sizeof(str), "strlen():args");
 
 	s = 

CVS commit: src/sys/arch

2020-01-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 31 08:21:11 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/i386/i386: machdep.c mtrr_k6.c
src/sys/arch/x86/include: mtrr.h
src/sys/arch/x86/x86: mtrr_i686.c

Log Message:
constify


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.824 -r1.825 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/i386/mtrr_k6.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/include/mtrr.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/x86/mtrr_i686.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/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.345 src/sys/arch/amd64/amd64/machdep.c:1.346
--- src/sys/arch/amd64/amd64/machdep.c:1.345	Thu Jan  9 00:42:24 2020
+++ src/sys/arch/amd64/amd64/machdep.c	Fri Jan 31 08:21:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.345 2020/01/09 00:42:24 manu Exp $	*/
+/*	$NetBSD: machdep.c,v 1.346 2020/01/31 08:21:11 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.345 2020/01/09 00:42:24 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.346 2020/01/31 08:21:11 maxv Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -232,7 +232,7 @@ int cpureset_delay = 2000; /* default to
 int cpu_class = CPUCLASS_686;
 
 #ifdef MTRR
-struct mtrr_funcs *mtrr_funcs;
+const struct mtrr_funcs *mtrr_funcs;
 #endif
 
 int cpu_class;

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.824 src/sys/arch/i386/i386/machdep.c:1.825
--- src/sys/arch/i386/i386/machdep.c:1.824	Tue Dec 10 18:04:54 2019
+++ src/sys/arch/i386/i386/machdep.c	Fri Jan 31 08:21:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.824 2019/12/10 18:04:54 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.825 2020/01/31 08:21:11 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.824 2019/12/10 18:04:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.825 2020/01/31 08:21:11 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -203,7 +203,7 @@ int cpureset_delay = 2000; /* default to
 #endif
 
 #ifdef MTRR
-struct mtrr_funcs *mtrr_funcs;
+const struct mtrr_funcs *mtrr_funcs;
 #endif
 
 int cpu_class;

Index: src/sys/arch/i386/i386/mtrr_k6.c
diff -u src/sys/arch/i386/i386/mtrr_k6.c:1.14 src/sys/arch/i386/i386/mtrr_k6.c:1.15
--- src/sys/arch/i386/i386/mtrr_k6.c:1.14	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/i386/i386/mtrr_k6.c	Fri Jan 31 08:21:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mtrr_k6.c,v 1.14 2019/11/10 21:16:28 chs Exp $	*/
+/*	$NetBSD: mtrr_k6.c,v 1.15 2020/01/31 08:21:11 maxv Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.14 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.15 2020/01/31 08:21:11 maxv Exp $");
 
 #include 
 #include 
@@ -71,7 +71,7 @@ mtrr_var_raw[] = {
 
 static struct mtrr *mtrr_var;
 
-struct mtrr_funcs k6_mtrr_funcs = {
+const struct mtrr_funcs k6_mtrr_funcs = {
 	k6_mtrr_init_cpu,
 	k6_mtrr_reload_cpu,
 	k6_mtrr_clean,

Index: src/sys/arch/x86/include/mtrr.h
diff -u src/sys/arch/x86/include/mtrr.h:1.5 src/sys/arch/x86/include/mtrr.h:1.6
--- src/sys/arch/x86/include/mtrr.h:1.5	Thu Dec 15 09:38:21 2011
+++ src/sys/arch/x86/include/mtrr.h	Fri Jan 31 08:21:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mtrr.h,v 1.5 2011/12/15 09:38:21 abs Exp $ */
+/* $NetBSD: mtrr.h,v 1.6 2020/01/31 08:21:11 maxv Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -124,9 +124,9 @@ struct mtrr_funcs {
 	void (*dump)(const char *tag);
 };
 
-extern struct mtrr_funcs i686_mtrr_funcs;
-extern struct mtrr_funcs k6_mtrr_funcs;
-extern struct mtrr_funcs *mtrr_funcs;
+extern const struct mtrr_funcs i686_mtrr_funcs;
+extern const struct mtrr_funcs k6_mtrr_funcs;
+extern const struct mtrr_funcs *mtrr_funcs;
 
 #define mtrr_init_cpu(ci)	mtrr_funcs->init_cpu(ci)
 #define mtrr_reload_cpu(ci)	mtrr_funcs->reload_cpu(ci)

Index: src/sys/arch/x86/x86/mtrr_i686.c
diff -u src/sys/arch/x86/x86/mtrr_i686.c:1.30 src/sys/arch/x86/x86/mtrr_i686.c:1.31
--- src/sys/arch/x86/x86/mtrr_i686.c:1.30	Sun Mar  4 10:02:10 2018
+++ src/sys/arch/x86/x86/mtrr_i686.c	Fri Jan 31 08:21:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mtrr_i686.c,v 1.30 2018/03/04 10:02:10 jdolecek Exp $ */
+/*	$NetBSD: mtrr_i686.c,v 1.31 2020/01/31 08:21:11 maxv Exp $ */
 
 /*-
  * Copyright (c) 2000, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.30 2018/03/04 10:02:10 jdolecek Exp $");