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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 05:49:57 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
do better work in ifmedia_upd. fix ucode injection.


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

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



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 05:49:57 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
do better work in ifmedia_upd. fix ucode injection.


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

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.4 src/sys/arch/arm/sociox/if_scx.c:1.5
--- src/sys/arch/arm/sociox/if_scx.c:1.4	Mon Mar 23 05:27:41 2020
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Mar 23 05:49:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.4 2020/03/23 05:27:41 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.5 2020/03/23 05:49:57 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.4 2020/03/23 05:27:41 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.5 2020/03/23 05:49:57 nisimura Exp $");
 
 #include 
 #include 
@@ -127,7 +127,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define  MCR_SPD100	(1U<<14)	/* force speed 100 */
 #define  MCR_USEFDX	(1U<<11)	/* force full duplex */
 #define  MCR_IPCKEN	(1U<<10)	/* handle checksum */
-#define  MCR_ACS	(1U<<7)		/* auto pad CRC strip */
+#define  MCR_ACS	(1U<<7)		/* auto pad strip CRC */
 #define  MCR_TXE	(1U<<3)		/* start Tx DMA engine */
 #define  MCR_RXE	(1U<<2)		/* start Rx DMA engine */
 #define  _MCR_FDX	0x280c	/* XXX TBD */
@@ -967,19 +967,21 @@ scx_ifmedia_upd(struct ifnet *ifp)
 		; /* advertise flow control pause */
 		; /* adv. 100FDX,100HDX,10FDX,10HDX */
 	} else {
-#if 1
+#if 1 /* XXX not sure to belong here XXX */
 		uint32_t mcr = mac_read(sc, GMACMCR);
 		if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_1000_T)
 			mcr &= ~MCR_USEMII; /* RGMII+SPD1000 */
 		else {
-			mcr |= MCR_USEMII;  /* RMII/MII */
-			if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX)
+			if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX
+			&& sc->sc_100mii)
 mcr |= MCR_SPD100;
+			mcr |= MCR_USEMII;
 		}
 		if (ifm->ifm_cur->ifm_media & IFM_FDX)
 			mcr |= MCR_USEFDX;
 		mcr |= MCR_CST | MCR_JE;
-		mcr |= MCR_IBN;
+		if (sc->sc_100mii == 0)
+			mcr |= MCR_IBN;
 		mac_write(sc, GMACMCR, mcr);
 #endif
 	}
@@ -1365,7 +1367,7 @@ spin_waitfor(struct scx_softc *sc, int r
 	do {
 		DELAY(10);
 		val = CSR_READ(sc, reg);
-	} while (--loop > 0 && (val & exist) != 0);
+	} while (--loop > 0 && (val & exist));
 	return (loop > 0) ? 0 : ETIMEDOUT;
 }
 
@@ -1451,18 +1453,15 @@ injectucode(struct scx_softc *sc, int po
 	bus_space_handle_t bsh;
 	bus_size_t off;
 	uint32_t ucode;
-	int i;
 
 	if (!bus_space_map(sc->sc_st, addr, size, 0, ) != 0) {
 		aprint_error_dev(sc->sc_dev,
 		"eeprom map failure for ucode port 0x%x\n", port);
 		return;
 	}
-	off = 0;
-	for (i = 0; i < size; i++) {
+	for (off = 0; off < size; off += 4) {
 		ucode = bus_space_read_4(sc->sc_st, bsh, off);
 		CSR_WRITE(sc, port, ucode);
-		off += 4;
 	}
 	bus_space_unmap(sc->sc_st, bsh, size);
 }



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 05:27:42 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
try to catch RMII/MII phy condition. fix divisor cal. nuke &= 03 error


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

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.3 src/sys/arch/arm/sociox/if_scx.c:1.4
--- src/sys/arch/arm/sociox/if_scx.c:1.3	Mon Mar 23 04:34:16 2020
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Mar 23 05:27:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.3 2020/03/23 04:34:16 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.4 2020/03/23 05:27:41 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.3 2020/03/23 04:34:16 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.4 2020/03/23 05:27:41 nisimura Exp $");
 
 #include 
 #include 
@@ -188,17 +188,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define  OMR_TXE	(1U<<13)	/* start Tx DMA engine, 0 to stop */
 #define  OMR_RXE	(1U<<1)		/* start Rx DMA engine, 0 to stop */
 
-const struct {
-	uint16_t freq, bit; /* GAR 5:2 MDIO frequency selection */
-} garclk[] = {
-	{ 35,	2 },	/* 25-35 MHz */
-	{ 60,	3 },	/* 35-60 MHz */
-	{ 100,	0 },	/* 60-100 MHz */
-	{ 150,	1 },	/* 100-150 MHz */
-	{ 250,	4 },	/* 150-250 MHz */
-	{ 300,	5 },	/* 250-300 MHz */
-	{ 0 },
-};
 static int get_garclk(uint32_t);
 
 /* descriptor format definition */
@@ -306,6 +295,7 @@ struct scx_softc {
 	uint32_t sc_gar;		/* GAR 5:2 clock selection */
 	uint32_t sc_t0coso;		/* T0_CSUM | T0_SGOL to run */
 	int sc_ucodeloaded;		/* ucode for H2M/M2H/PKT */
+	int sc_100mii;			/* 1<<15 RMII/MII, 0 for RGMII */
 	int sc_phandle;			/* fdt phandle */
 
 	bus_dmamap_t sc_cddmamap;	/* control data DMA map */
@@ -423,6 +413,7 @@ scx_fdt_attach(device_t parent, device_t
 	bus_addr_t addr[2];
 	bus_size_t size[2];
 	char intrstr[128];
+	const char *phy_mode;
 
 	if (fdtbus_get_reg(phandle, 0, addr+0, size+0) != 0
 	|| bus_space_map(faa->faa_bst, addr[0], size[0], 0, ) != 0) {
@@ -445,6 +436,12 @@ scx_fdt_attach(device_t parent, device_t
 		goto fail;
 	}
 
+	phy_mode = fdtbus_get_string(phandle, "phy-mode");
+	if (phy_mode == NULL) {
+		aprint_error(": missing 'phy-mode' property\n");
+		phy_mode = "rgmii";
+	}
+
 	aprint_naive("\n");
 	aprint_normal(": Gigabit Ethernet Controller\n");
 	aprint_normal_dev(self, "interrupt on %s\n", intrstr);
@@ -457,6 +454,7 @@ scx_fdt_attach(device_t parent, device_t
 	sc->sc_eesz = size[1];
 	sc->sc_dmat = faa->faa_dmat;
 	sc->sc_phandle = phandle;
+	sc->sc_100mii = (strcmp(phy_mode, "rgmii") != 0) ? MCR_USEMII : 0;
 
 	scx_attach_i(sc);
 	return;
@@ -1392,13 +1390,27 @@ mac_write(struct scx_softc *sc, int reg,
 static int
 get_garclk(uint32_t freq)
 {
+
+	const struct {
+		uint16_t freq, bit; /* GAR 5:2 MDIO frequency selection */
+	} garclk[] = {
+		{ 35,	2 },	/* 25-35 MHz */
+		{ 60,	3 },	/* 35-60 MHz */
+		{ 100,	0 },	/* 60-100 MHz */
+		{ 150,	1 },	/* 100-150 MHz */
+		{ 250,	4 },	/* 150-250 MHz */
+		{ 300,	5 },	/* 250-300 MHz */
+	};
 	int i;
 
-	for (i = 0; garclk[i].freq != 0; i++) {
+	/* convert MDIO clk to a divisor value */
+	if (freq < garclk[0].freq)
+		return garclk[0].bit;
+	for (i = 1; i < __arraycount(garclk); i++) {
 		if (freq < garclk[i].freq)
-			return garclk[i].bit;
+			return garclk[i-1].bit;
 	}
-	return garclk[i - 1].bit;
+	return garclk[__arraycount(garclk) - 1].bit;
 }
 
 static void
@@ -1441,7 +1453,6 @@ injectucode(struct scx_softc *sc, int po
 	uint32_t ucode;
 	int i;
 
-	port &= 03;
 	if (!bus_space_map(sc->sc_st, addr, size, 0, ) != 0) {
 		aprint_error_dev(sc->sc_dev,
 		"eeprom map failure for ucode port 0x%x\n", port);



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 05:27:42 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
try to catch RMII/MII phy condition. fix divisor cal. nuke &= 03 error


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

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



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 05:24:28 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
use sc_100mii variable name for RMII/MII


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sociox/if_ave.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.11 src/sys/arch/arm/sociox/if_ave.c:1.12
--- src/sys/arch/arm/sociox/if_ave.c:1.11	Mon Mar 23 03:21:31 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Mon Mar 23 05:24:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.11 2020/03/23 03:21:31 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.12 2020/03/23 05:24:28 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.11 2020/03/23 03:21:31 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.12 2020/03/23 05:24:28 nisimura Exp $");
 
 #include 
 #include 
@@ -230,7 +230,7 @@ struct ave_softc {
 	int sc_flowflags;		/* 802.3x PAUSE flow control */
 	void *sc_ih;			/* interrupt cookie */
 	int sc_phy_id;			/* PHY address */
-	uint32_t sc_phymode;		/* 1<<27: MII/RMII, 0: RGMII */
+	uint32_t sc_100mii;		/* 1<<27: RMII/MII, 0: RGMII */
 	uint32_t sc_rxc;		/* software copy of AVERXC */
 	int sc_model;			/* 64 paddr model or otherwise 32 */
 
@@ -362,10 +362,7 @@ ave_fdt_attach(device_t parent, device_t
 	sc->sc_model, hwver >> 8, hwver & 0xff, phy_mode);
 	aprint_normal_dev(self, "interrupt on %s\n", intrstr);
 
-	if (strcmp(phy_mode, "rgmii") == 0)
-		sc->sc_phymode = 0;		/* RGMII */
-	else
-		sc->sc_phymode = CFG_MII;	/* MII|RMII */
+	sc->sc_100mii = (strcmp(phy_mode, "rgmii") == 0) ? CFG_MII : 0;
 
 	CSR_WRITE(sc, AVEGR, GR_GRST | GR_PHYRST);
 	DELAY(20);
@@ -490,7 +487,7 @@ ave_reset(struct ave_softc *sc)
 
 	CSR_WRITE(sc, AVERXC, 0);	/* stop Rx first */
 	CSR_WRITE(sc, AVEDESCC, 0);	/* stop Tx/Rx descriptor engine */
-	if (sc->sc_phymode & CFG_MII) {
+	if (sc->sc_100mii & CFG_MII) {
 		csr = CSR_READ(sc, AVERMIIC);
 		CSR_WRITE(sc, AVERMIIC, csr &~ RMIIC_RST);
 		DELAY(10);
@@ -519,7 +516,7 @@ ave_init(struct ifnet *ifp)
 	/* make sure Rx circuit sane & stable state */
 	ave_reset(sc);
 
-	CSR_WRITE(sc, AVECFG, CFG_FLE | sc->sc_phymode);
+	CSR_WRITE(sc, AVECFG, CFG_FLE | sc->sc_100mii);
 
 	/* set Tx/Rx descriptor ring base addr offset and total size */
 	CSR_WRITE(sc, AVETXDES,	 0U|(sizeof(struct tdes)*AVE_NTXDESC) << 16);
@@ -624,7 +621,7 @@ ave_ifmedia_upd(struct ifnet *ifp)
 #if 1 /* XXX not sure to belong here XXX */
 		txcr &= ~(TXC_SPD1000 | TXC_SPD100);
 		rxcr &= ~RXC_USEFDX;
-		if ((sc->sc_phymode & CFG_MII) == 0 /* RGMII model */
+		if ((sc->sc_100mii == 0) /* RGMII model */
 		 && IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_1000_T)
 			txcr |= TXC_SPD1000;
 		else if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX)
@@ -632,9 +629,9 @@ ave_ifmedia_upd(struct ifnet *ifp)
 		if (ifm->ifm_media & IFM_FDX)
 			rxcr |= RXC_USEFDX;	
 
-		/* adjust LINKSEL when MII/RMII too */
-		if (sc->sc_phymode & CFG_MII) {
-			csr = CSR_READ(sc, AVELINKSEL) &~ LINKSEL_SPD100;;
+		/* adjust LINKSEL when RMII/MII too */
+		if (sc->sc_100mii) {
+			csr = CSR_READ(sc, AVELINKSEL) &~ LINKSEL_SPD100;
 			if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX)
 csr |= LINKSEL_SPD100;
 			CSR_WRITE(sc, AVELINKSEL, csr);



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 05:24:28 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
use sc_100mii variable name for RMII/MII


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sociox/if_ave.c

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



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 04:34:16 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
improve comment descriptions. DRT for ucode load


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sociox/if_scx.c

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



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 04:34:16 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
improve comment descriptions. DRT for ucode load


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sociox/if_scx.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.2 src/sys/arch/arm/sociox/if_scx.c:1.3
--- src/sys/arch/arm/sociox/if_scx.c:1.2	Mon Mar 23 03:55:49 2020
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Mar 23 04:34:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.2 2020/03/23 03:55:49 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.3 2020/03/23 04:34:16 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.2 2020/03/23 03:55:49 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.3 2020/03/23 04:34:16 nisimura Exp $");
 
 #include 
 #include 
@@ -104,8 +104,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define RXTIMER		0x45c
 #define TXCOUNT		0x410
 #define RXCOUNT		0x454
-#define DMACH2M		0x210		/* DMAC host2media ucode port */
-#define DMACM2H		0x21c		/* DMAC media2host ucode port */
+#define H2MENG		0x210		/* DMAC host2media ucode port */
+#define M2HENG		0x21c		/* DMAC media2host ucode port */
 #define PKTENG		0x0d0		/* packet engine ucode port */
 #define HWVER0		0x22c
 #define HWVER1		0x230
@@ -122,7 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define  MCR_IBN	(1U<<30)	/* */
 #define  MCR_CST	(1U<<25)	/* strip CRC */
 #define  MCR_TC		(1U<<24)	/* keep RGMII PHY notified */
-#define  MCR_JE		(1U<<20)	/* ignore oversized >9018 frame */
+#define  MCR_JE		(1U<<20)	/* ignore oversized >9018 condition */
 #define  MCR_USEMII	(1U<<15)	/* 1: RMII/MII, 0: RGMII */
 #define  MCR_SPD100	(1U<<14)	/* force speed 100 */
 #define  MCR_USEFDX	(1U<<11)	/* force full duplex */
@@ -157,7 +157,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define GMACFCR		0x0018		/* 802.3x flowcontrol */
 #define  FCR_RFE	(1U<<2)		/* accept PAUSE to throttle Tx */
 #define  FCR_TFE	(1U<<1)		/* generate PAUSE to moderate Rx lvl */
-#define GMACIMPL	0x0020		/* (dig this number .) */
+#define GMACIMPL	0x0020		/* implementation number . */
 #define GMACVTAG	0x001c		/* VLAN tag control */
 #define GMACMAH0	0x0040		/* MAC address 0 47:32 */
 #define GMACMAL0	0x0044		/* MAC address 0 31:0 */
@@ -165,7 +165,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define GMACMAL(i) 	((i)*8+0x44)
 #define GMACMHT0	0x0500		/* multicast hash table 0 - 8*/
 
-#define GMACBMR		0x1000		/* DMA bus mode
+#define GMACBMR		0x1000		/* DMA bus mode control
 	 * 244PBL
 	 * 22:17 RPBL
 	 * 16fix burst
@@ -185,8 +185,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define GMACTDLAR	0x1010		/* */
 #define  _TDLAR		0x1c000		/* XXX TBD */
 #define GMACOMR		0x1018		/* DMA operation */
-#define  OMR_TXE	(1U<<13)	/* start Tx DMA engine */
-#define  OMR_RXE	(1U<<1)		/* start Rx DMA engine */
+#define  OMR_TXE	(1U<<13)	/* start Tx DMA engine, 0 to stop */
+#define  OMR_RXE	(1U<<1)		/* start Rx DMA engine, 0 to stop */
 
 const struct {
 	uint16_t freq, bit; /* GAR 5:2 MDIO frequency selection */
@@ -298,14 +298,15 @@ struct scx_softc {
 	struct ethercom sc_ethercom;	/* Ethernet common data */
 	struct mii_data sc_mii;		/* MII */
 	callout_t sc_tick_ch;		/* PHY monitor callout */
-	int sc_flowflags;		/* 802.3x PAUSE flow control */
-	void *sc_ih;			/* interrupt cookie */
 	bus_dma_segment_t sc_seg;	/* descriptor store seg */
 	int sc_nseg;			/* descriptor store nseg */
+	void *sc_ih;			/* interrupt cookie */
 	int sc_phy_id;			/* PHY address */
+	int sc_flowflags;		/* 802.3x PAUSE flow control */
 	uint32_t sc_gar;		/* GAR 5:2 clock selection */
-	int sc_phandle;			/* fdt phandle */
 	uint32_t sc_t0coso;		/* T0_CSUM | T0_SGOL to run */
+	int sc_ucodeloaded;		/* ucode for H2M/M2H/PKT */
+	int sc_phandle;			/* fdt phandle */
 
 	bus_dmamap_t sc_cddmamap;	/* control data DMA map */
 #define sc_cddma	sc_cddmamap->dm_segs[0].ds_addr
@@ -569,9 +570,10 @@ scx_attach_i(struct scx_softc *sc)
 	csr = bus_space_read_4(sc->sc_st, sc->sc_eesh, 4);
 	enaddr[4] = csr >> 24;
 	enaddr[5] = csr >> 16;
+	csr = CSR_READ(sc, GMACIMPL);
 
-	aprint_normal_dev(sc->sc_dev, "NetSec GbE (%d.%d)\n",
-	hwver >> 16, hwver & 0x);
+	aprint_normal_dev(sc->sc_dev, "NetSec GbE (%d.%d) impl (%x.%x)\n",
+	hwver >> 16, hwver & 0x, csr >> 16, csr & 0x);
 	aprint_normal_dev(sc->sc_dev,
 	"Ethernet address %s\n", ether_sprintf(enaddr));
 
@@ -581,7 +583,7 @@ scx_attach_i(struct scx_softc *sc)
 
 	sc->sc_flowflags = 0;
 
-	if (0/*CONSTCOND*/)
+	if (sc->sc_ucodeloaded == 0)
 		loaducode(sc);
 
 	mii->mii_ifp = ifp;
@@ -1220,7 +1222,7 @@ scx_intr(void *arg)
 {
 	struct scx_softc *sc = arg;
 	

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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 03:55:49 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
try to DRT about EEPROM ucode


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

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.1 src/sys/arch/arm/sociox/if_scx.c:1.2
--- src/sys/arch/arm/sociox/if_scx.c:1.1	Mon Mar 23 03:25:06 2020
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Mar 23 03:55:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.1 2020/03/23 03:25:06 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.2 2020/03/23 03:55:49 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.1 2020/03/23 03:25:06 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.2 2020/03/23 03:55:49 nisimura Exp $");
 
 #include 
 #include 
@@ -133,7 +133,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define  _MCR_FDX	0x280c	/* XXX TBD */
 #define  _MCR_HDX	0x0001a00c	/* XXX TBD */
 #define GMACAFR		0x0004		/* frame DA/SA address filter */
-#define  AFR_RA		(1U<<31)	/* receive all on */
+#define  AFR_RA		(1U<<31)	/* receive block all on */
 #define  AFR_HPF	(1U<<10)	/* activate hash or perfect filter */
 #define  AFR_SAF	(1U<<9)		/* source address filter */
 #define  AFR_SAIF	(1U<<8)		/* SA inverse filtering */
@@ -161,9 +161,10 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #define GMACVTAG	0x001c		/* VLAN tag control */
 #define GMACMAH0	0x0040		/* MAC address 0 47:32 */
 #define GMACMAL0	0x0044		/* MAC address 0 31:0 */
-#define GMACMAH(i) 	((i)*8+0x40)	/* 0 - 15 */
+#define GMACMAH(i) 	((i)*8+0x40)	/* supplimental MAC addr 1 - 15 */
 #define GMACMAL(i) 	((i)*8+0x44)
-#define GMACMHT0	0x0500		/* multcast hash table 0 - 8*/
+#define GMACMHT0	0x0500		/* multicast hash table 0 - 8*/
+
 #define GMACBMR		0x1000		/* DMA bus mode
 	 * 244PBL
 	 * 22:17 RPBL
@@ -304,7 +305,7 @@ struct scx_softc {
 	int sc_phy_id;			/* PHY address */
 	uint32_t sc_gar;		/* GAR 5:2 clock selection */
 	int sc_phandle;			/* fdt phandle */
-	uint32_t sc_t0coso;		/* T0_CSUM | T0_SGOL */
+	uint32_t sc_t0coso;		/* T0_CSUM | T0_SGOL to run */
 
 	bus_dmamap_t sc_cddmamap;	/* control data DMA map */
 #define sc_cddma	sc_cddmamap->dm_segs[0].ds_addr
@@ -388,7 +389,7 @@ static int spin_waitfor(struct scx_softc
 static int mac_read(struct scx_softc *, int);
 static void mac_write(struct scx_softc *, int, int);
 static void loaducode(struct scx_softc *);
-static void injectucode(struct scx_softc *, int, uint64_t, uint32_t);
+static void injectucode(struct scx_softc *, int, bus_addr_t, bus_size_t);
 
 #define CSR_READ(sc,off) \
 	bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (off))
@@ -418,16 +419,15 @@ scx_fdt_attach(device_t parent, device_t
 	bus_space_tag_t bst = faa->faa_bst;
 	bus_space_handle_t bsh;
 	bus_space_handle_t eebsh;
-	bus_addr_t addr;
-	bus_size_t size;
+	bus_addr_t addr[2];
+	bus_size_t size[2];
 	char intrstr[128];
 
-	if (fdtbus_get_reg(phandle, 0, , ) != 0
-	|| bus_space_map(faa->faa_bst, addr, size, 0, ) != 0) {
+	if (fdtbus_get_reg(phandle, 0, addr+0, size+0) != 0
+	|| bus_space_map(faa->faa_bst, addr[0], size[0], 0, ) != 0) {
 		aprint_error(": unable to map device csr\n");
 		return;
 	}
-	sc->sc_sz = size;
 	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
 		aprint_error(": failed to decode interrupt\n");
 		goto fail;
@@ -438,12 +438,11 @@ scx_fdt_attach(device_t parent, device_t
 		aprint_error_dev(self, "couldn't establish interrupt\n");
 		goto fail;
 	}
-	if (fdtbus_get_reg(phandle, 1, , ) != 0
-	|| bus_space_map(faa->faa_bst, addr, size, 0, ) != 0) {
+	if (fdtbus_get_reg(phandle, 1, addr+1, size+1) != 0
+	|| bus_space_map(faa->faa_bst, addr[0], size[1], 0, ) != 0) {
 		aprint_error(": unable to map device eeprom\n");
 		goto fail;
 	}
-	sc->sc_eesz = size;
 
 	aprint_naive("\n");
 	aprint_normal(": Gigabit Ethernet Controller\n");
@@ -452,7 +451,9 @@ scx_fdt_attach(device_t parent, device_t
 	sc->sc_dev = self;
 	sc->sc_st = bst;
 	sc->sc_sh = bsh;
+	sc->sc_sz = size[0];
 	sc->sc_eesh = eebsh;
+	sc->sc_eesz = size[1];
 	sc->sc_dmat = faa->faa_dmat;
 	sc->sc_phandle = phandle;
 
@@ -945,7 +946,7 @@ printf("[%d] %s\n", i, ether_sprintf(enm
 	return;
 
  update:
-	/* With PM or AM, MHTE/MTL/MTH are never consulted. really? */
+	/* With PM or AM, MHTE/MHTL/MHTH are never consulted. really? */
 	if (ifp->if_flags & IFF_PROMISC)
 		csr |= AFR_PM;	/* run promisc. mode */
 	else
@@ -1407,38 +1408,48 @@ loaducode(struct scx_softc *sc)
 	up = EE_READ(sc, 0x08); /* H->M ucode addr high */
 	lo = EE_READ(sc, 0x0c); /* H->M ucode addr low */
 	sz = EE_READ(sc, 0x10); /* H->M ucode size */
+	sz *= 4;
 	addr = ((uint64_t)up << 32) | lo;
 

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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 03:55:49 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
try to DRT about EEPROM ucode


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

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



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 03:25:06 UTC 2020

Added Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
Socionext "NetSec" GbE driver


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sociox/if_scx.c

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



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 03:25:06 UTC 2020

Added Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
Socionext "NetSec" GbE driver


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sociox/if_scx.c

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

Added files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u /dev/null src/sys/arch/arm/sociox/if_scx.c:1.1
--- /dev/null	Mon Mar 23 03:25:06 2020
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Mar 23 03:25:06 2020
@@ -0,0 +1,1444 @@
+/*	$NetBSD: if_scx.c,v 1.1 2020/03/23 03:25:06 nisimura Exp $	*/
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tohru Nishimura.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define NOT_MP_SAFE	0
+
+/*
+ * Socionext SC2A11 SynQuacer NetSec GbE driver
+ *
+ *   (possibly incorrect notes to be removed eventually)
+ * - 32 byte descriptor for 64 bit paddr design.
+ * - multiple rings seems available. There are special descriptor fields
+ *   to designify ring number from which to arrive or to which go.
+ * - memory mapped EEPROM to hold MAC address. The rest of the area is
+ *   occupied by a set of ucode for two DMA engines and one packet engine.
+ * - The size of frame address filter is unknown. Might be 32
+ * - The first slot is my own station address. Always enabled to perform
+ *   to identify oneself.
+ * - 1~31 are for supplimental MAC addresses. Independently enabled
+ *   for use. Good to catch multicast. Byte-wise selective match available.
+ *   Use to catch { 0x01, 0x00, 0x00 } and/or { 0x33, 0x33 }.
+ * - The size of multicast hash filter store is unknown. Might be 256 bit.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.1 2020/03/23 03:25:06 nisimura Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define SWRESET		0x104
+#define COMINIT		0x120
+#define INTRST		0x200
+#define  IRQ_RX		(1U<<1)
+#define  IRQ_TX		(1U<<0)
+#define INTREN		0x204
+#define INTR_SET	0x234
+#define INTR_CLR	0x238
+#define TXINTST		0x400
+#define TXINTEN		0x404
+#define TXINT_SET	0x428
+#define TXINT_CLR	0x42c
+#define  TXI_NTOWNR	(1U<<17)
+#define  TXI_TR_ERR	(1U<<16)
+#define  TXI_TXDONE	(1U<<15)
+#define  TXI_TMREXP	(1U<<14)
+#define RXINTST		0x440
+#define RXINTEN		0x444
+#define RXINT_SET	0x468
+#define RXINT_CLR	0x46c
+#define  RXI_RC_ERR	(1U<<16)
+#define  RXI_PKTCNT	(1U<<15)
+#define  RXI_TMREXP	(1U<<14)
+#define TXTIMER		0x41c
+#define RXTIMER		0x45c
+#define TXCOUNT		0x410
+#define RXCOUNT		0x454
+#define DMACH2M		0x210		/* DMAC host2media ucode port */
+#define DMACM2H		0x21c		/* DMAC media2host ucode port */
+#define PKTENG		0x0d0		/* packet engine ucode port */
+#define HWVER0		0x22c
+#define HWVER1		0x230
+
+#define MACSTAT		0x1024		/* gmac status */
+#define MACDATA		0x11c0		/* gmac rd/wr data */
+#define MACCMD		0x11c4		/* gmac operation */
+#define  CMD_IOWR	(1U<<28)	/* write op */
+#define  CMD_BUSY	(1U<<31)	/* busy bit */
+#define DESCENG_INIT	0x11fc
+#define DESCENG_SRST	0x1204
+
+#define GMACMCR		0x		/* MAC configuration */
+#define  MCR_IBN	(1U<<30)	/* */
+#define  MCR_CST	(1U<<25)	/* strip CRC */
+#define  MCR_TC		(1U<<24)	/* keep RGMII PHY notified */
+#define  MCR_JE		(1U<<20)	/* ignore oversized >9018 frame */
+#define  MCR_USEMII	(1U<<15)	/* 1: RMII/MII, 0: RGMII */

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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 03:21:31 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
manifest non-MP_SAFE


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/sociox/if_ave.c

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



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

2020-03-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Mar 23 03:21:31 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
manifest non-MP_SAFE


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/sociox/if_ave.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.10 src/sys/arch/arm/sociox/if_ave.c:1.11
--- src/sys/arch/arm/sociox/if_ave.c:1.10	Sun Mar 22 00:14:16 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Mon Mar 23 03:21:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.10 2020/03/22 00:14:16 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.11 2020/03/23 03:21:31 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.10 2020/03/22 00:14:16 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.11 2020/03/23 03:21:31 nisimura Exp $");
 
 #include 
 #include 
@@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1
 
 #include 
 
-#define FDT_INTR_FLAGS	(0)	/* !MP_SAFE */
+#define NOT_MP_SAFE	(0)
 
 #define AVEID		0x000		/* hardware ID */
 #define AVEHWVER	0x004		/* hardware version */
@@ -71,7 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1
 #define AVECFG		0x00c		/* hw configuration */
 #define  CFG_FLE	(1U<<31)	/* filter function enable */
 #define  CFG_CKE	(1U<<30)	/* checksum enable */
-#define  CFG_MII	(1U<<27)	/* 1: MII/RMII, 0: RGMII */
+#define  CFG_MII	(1U<<27)	/* 1: RMII/MII, 0: RGMII */
 #define  CFG_IPFCKE	(1U<<24)	/* IP framgment csum enable */
 #define AVEGIMR		0x100		/* global interrupt mask */
 #define AVEGISR		0x104		/* global interrupt status */
@@ -331,7 +331,7 @@ ave_fdt_attach(device_t parent, device_t
 		aprint_error(": failed to decode interrupt\n");
 		return;
 	}
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_NET, 0,
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_NET, NOT_MP_SAFE,
 	ave_intr, sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt on %s\n",
@@ -513,7 +513,7 @@ ave_init(struct ifnet *ifp)
 
 	CSR_WRITE(sc, AVEGIMR, 0);
 
-	/* cancel pending I/O */
+	/* Cancel pending I/O. */
 	ave_stop(ifp, 0);
 
 	/* make sure Rx circuit sane & stable state */
@@ -531,7 +531,7 @@ ave_init(struct ifnet *ifp)
 	sc->sc_txd32 =   (void *)((uintptr_t)sc->sc_sh + AVE32TDB);
 	sc->sc_rxd32 =   (void *)((uintptr_t)sc->sc_sh + AVE32RDB);
 
-	/* build sane Tx and loaded Rx descriptors */
+	/* build sane Tx and load Rx descriptors with mbuf */
 	for (i = 0; i < AVE_NTXDESC; i++) {
 		struct tdes *tdes = >sc_txdescs[i];
 		tdes->t2 = tdes->t1 = 0;



Re: CVS commit: src/sys/dev/usb

2020-03-22 Thread Roy Marples

On 22/03/2020 08:30, Maxime Villard wrote:

Overall "From OpenBSD" is a redflag for buggy and vulnerable code..


We should be above this, no software is perfect, not even ours.

Roy


CVS commit: src/sys/kern

2020-03-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar 23 02:44:22 UTC 2020

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

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/exec_script.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/exec_script.c
diff -u src/sys/kern/exec_script.c:1.81 src/sys/kern/exec_script.c:1.82
--- src/sys/kern/exec_script.c:1.81	Mon Mar 23 00:46:11 2020
+++ src/sys/kern/exec_script.c	Mon Mar 23 02:44:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_script.c,v 1.81 2020/03/23 00:46:11 ad Exp $	*/
+/*	$NetBSD: exec_script.c,v 1.82 2020/03/23 02:44:22 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.81 2020/03/23 00:46:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.82 2020/03/23 02:44:22 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_script.h"
@@ -213,7 +213,7 @@ check_shell:
 	 * if the script isn't readable, or it's set-id, then we've
 	 * gotta supply a "/dev/fd/..." for the shell to read.
 	 * Note that stupid shells (csh) do the wrong thing, and
-	 * close all open fd's when the start.  That kills this
+	 * close all open fd's when they start.  That kills this
 	 * method of implementing "safe" set-id and x-only scripts.
 	 */
 	vn_lock(epp->ep_vp, LK_SHARED | LK_RETRY);



CVS commit: src/sys/kern

2020-03-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar 23 02:44:22 UTC 2020

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

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/exec_script.c

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



CVS commit: src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 00:46:11 UTC 2020

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

Log Message:
LK_SHARED is OK for VOP_ACCESS().


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/kern/exec_script.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/exec_script.c
diff -u src/sys/kern/exec_script.c:1.80 src/sys/kern/exec_script.c:1.81
--- src/sys/kern/exec_script.c:1.80	Sun Sep 15 20:21:12 2019
+++ src/sys/kern/exec_script.c	Mon Mar 23 00:46:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_script.c,v 1.80 2019/09/15 20:21:12 christos Exp $	*/
+/*	$NetBSD: exec_script.c,v 1.81 2020/03/23 00:46:11 ad Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.80 2019/09/15 20:21:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.81 2020/03/23 00:46:11 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_script.h"
@@ -216,7 +216,7 @@ check_shell:
 	 * close all open fd's when the start.  That kills this
 	 * method of implementing "safe" set-id and x-only scripts.
 	 */
-	vn_lock(epp->ep_vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(epp->ep_vp, LK_SHARED | LK_RETRY);
 	error = VOP_ACCESS(epp->ep_vp, VREAD, l->l_cred);
 	VOP_UNLOCK(epp->ep_vp);
 	if (error == EACCES



CVS commit: src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Mar 23 00:46:11 UTC 2020

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

Log Message:
LK_SHARED is OK for VOP_ACCESS().


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/kern/exec_script.c

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



CVS commit: src/sys/dev/acpi

2020-03-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Mar 23 00:37:19 UTC 2020

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

Log Message:
in acpi_debug_init(), the string we extract from the dictionary is
a normal C string, so use strlcpy() rather than memcpy() to copy it.
found by KASAN.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/acpi_debug.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/acpi_debug.c
diff -u src/sys/dev/acpi/acpi_debug.c:1.6 src/sys/dev/acpi/acpi_debug.c:1.7
--- src/sys/dev/acpi/acpi_debug.c:1.6	Sat Jan  5 20:40:26 2019
+++ src/sys/dev/acpi/acpi_debug.c	Mon Mar 23 00:37:19 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_debug.c,v 1.6 2019/01/05 20:40:26 christos Exp $ */
+/* $NetBSD: acpi_debug.c,v 1.7 2020/03/23 00:37:19 chs Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_debug.c,v 1.6 2019/01/05 20:40:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_debug.c,v 1.7 2020/03/23 00:37:19 chs Exp $");
 
 #include 
 #include 
@@ -124,8 +124,8 @@ acpi_debug_init(void)
 	layer = acpi_debug_getkey(acpi_debug_layer_d, AcpiDbgLayer);
 	level = acpi_debug_getkey(acpi_debug_level_d, AcpiDbgLevel);
 
-	(void)memcpy(acpi_debug_layer_s, layer, ACPI_DEBUG_MAX);
-	(void)memcpy(acpi_debug_level_s, level, ACPI_DEBUG_MAX);
+	strlcpy(acpi_debug_layer_s, layer, ACPI_DEBUG_MAX);
+	strlcpy(acpi_debug_level_s, level, ACPI_DEBUG_MAX);
 
 	return;
 



CVS commit: src/sys/dev/acpi

2020-03-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Mar 23 00:37:19 UTC 2020

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

Log Message:
in acpi_debug_init(), the string we extract from the dictionary is
a normal C string, so use strlcpy() rather than memcpy() to copy it.
found by KASAN.


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

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



CVS commit: src/sys/dev/ic

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 23:38:47 UTC 2020

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

Log Message:
Add a few more chip ID.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/bwfmvar.h

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



CVS commit: src/sys/dev/ic

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 23:38:47 UTC 2020

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

Log Message:
Add a few more chip ID.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/bwfmvar.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/bwfmvar.h
diff -u src/sys/dev/ic/bwfmvar.h:1.5 src/sys/dev/ic/bwfmvar.h:1.6
--- src/sys/dev/ic/bwfmvar.h:1.5	Mon Oct 28 06:37:51 2019
+++ src/sys/dev/ic/bwfmvar.h	Sun Mar 22 23:38:47 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmvar.h,v 1.5 2019/10/28 06:37:51 mlelstv Exp $ */
+/* $NetBSD: bwfmvar.h,v 1.6 2020/03/22 23:38:47 thorpej Exp $ */
 /* $OpenBSD: bwfmvar.h,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -30,6 +30,7 @@
 #define BRCM_CC_4330_CHIP_ID		0x4330
 #define BRCM_CC_4334_CHIP_ID		0x4334
 #define BRCM_CC_43340_CHIP_ID		43340
+#define BRCM_CC_43341_CHIP_ID		43341
 #define BRCM_CC_43362_CHIP_ID		43362
 #define BRCM_CC_4335_CHIP_ID		0x4335
 #define BRCM_CC_4339_CHIP_ID		0x4339
@@ -49,8 +50,10 @@
 #define BRCM_CC_43602_CHIP_ID		43602
 #define BRCM_CC_4365_CHIP_ID		0x4365
 #define BRCM_CC_4366_CHIP_ID		0x4366
+#define BRCM_CC_43664_CHIP_ID		43664
 #define BRCM_CC_4371_CHIP_ID		0x4371
 #define CY_CC_4373_CHIP_ID		0x4373
+#define CY_CC_43012_CHIP_ID		43012
 
 /* Defaults */
 #define BWFM_DEFAULT_SCAN_CHANNEL_TIME	40



CVS commit: src/sbin/mount_portal/examples

2020-03-22 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Mar 22 23:24:08 UTC 2020

Modified Files:
src/sbin/mount_portal/examples: rfilter.2

Log Message:
rfilter.2: fix a typo

Reported by Andrius V in PR kern/54889.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/mount_portal/examples/rfilter.2

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

Modified files:

Index: src/sbin/mount_portal/examples/rfilter.2
diff -u src/sbin/mount_portal/examples/rfilter.2:1.3 src/sbin/mount_portal/examples/rfilter.2:1.4
--- src/sbin/mount_portal/examples/rfilter.2:1.3	Tue May  9 23:26:49 2017
+++ src/sbin/mount_portal/examples/rfilter.2	Sun Mar 22 23:24:08 2020
@@ -1,4 +1,4 @@
-$NetBSD: rfilter.2,v 1.3 2017/05/09 23:26:49 kamil Exp $
+$NetBSD: rfilter.2,v 1.4 2020/03/22 23:24:08 gutteridge Exp $
 
 Advanced rfilter usage:  the strip key, and cmd:// notation
 
@@ -79,7 +79,7 @@ a file from ftp://...:
 
 The problem is, when tar sees a file of the form A:B, it assumes
 A is a hostname.  In this case, A is "portal/ftp", which is
-obviosly not a hostname.
+obviously not a hostname.
 
 If we want to avoid this problem, there are at least two
 solutions:



CVS commit: src/sbin/mount_portal/examples

2020-03-22 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Mar 22 23:24:08 UTC 2020

Modified Files:
src/sbin/mount_portal/examples: rfilter.2

Log Message:
rfilter.2: fix a typo

Reported by Andrius V in PR kern/54889.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/mount_portal/examples/rfilter.2

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



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 22:36:12 UTC 2020

Modified Files:
src/distrib/sets/lists/base: md.evbarm
src/external/broadcom/bwfm: Makefile

Log Message:
Install the common AP6212 nvram config and use it for sinovoip,bpi-m2-zero.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.6 -r1.7 src/external/broadcom/bwfm/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/base/md.evbarm
diff -u src/distrib/sets/lists/base/md.evbarm:1.16 src/distrib/sets/lists/base/md.evbarm:1.17
--- src/distrib/sets/lists/base/md.evbarm:1.16	Sun Mar 22 22:17:11 2020
+++ src/distrib/sets/lists/base/md.evbarm	Sun Mar 22 22:36:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbarm,v 1.16 2020/03/22 22:17:11 thorpej Exp $
+# $NetBSD: md.evbarm,v 1.17 2020/03/22 22:36:12 thorpej Exp $
 ./libdata/firmware/if_bwfm/brcmfmac43143-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43241b0-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43241b4-sdio.bin	base-firmware-root	firmware
@@ -13,8 +13,10 @@
 ./libdata/firmware/if_bwfm/brcmfmac43362-sdio.lemaker,bananapro.txt	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac4339-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43430-sdio.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43430-sdio.AP6212.txt	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43430a0-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43455-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt	base-firmware-root	firmware

Index: src/external/broadcom/bwfm/Makefile
diff -u src/external/broadcom/bwfm/Makefile:1.6 src/external/broadcom/bwfm/Makefile:1.7
--- src/external/broadcom/bwfm/Makefile:1.6	Sun Mar 22 22:17:11 2020
+++ src/external/broadcom/bwfm/Makefile	Sun Mar 22 22:36:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2020/03/22 22:17:11 thorpej Exp $
+# $NetBSD: Makefile,v 1.7 2020/03/22 22:36:12 thorpej Exp $
 
 NOMAN=	# define
 
@@ -66,6 +66,11 @@ FILES+=	dist/brcmfmac43456-sdio.pine64,p
 # raspberrypi,3-model-b.
 LINKS+=	${FILESDIR}/brcmfmac43430-sdio.raspberrypi,3-model-b.txt \
 	${FILESDIR}/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt
+
+# Boards that share the common AP6212 nvram config are listed here.
+FILES+=	dist/brcmfmac43430-sdio.AP6212.txt
+LINKS+=	${FILESDIR}/brcmfmac43430-sdio.AP6212.txt \
+	${FILESDIR}/brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt
 .endif
 
 .include 



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 22:36:12 UTC 2020

Modified Files:
src/distrib/sets/lists/base: md.evbarm
src/external/broadcom/bwfm: Makefile

Log Message:
Install the common AP6212 nvram config and use it for sinovoip,bpi-m2-zero.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.6 -r1.7 src/external/broadcom/bwfm/Makefile

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



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 22:17:11 UTC 2020

Modified Files:
src/distrib/sets/lists/base: md.evbarm
src/external/broadcom/bwfm: Makefile

Log Message:
The raspberrypi,model-zero-w uses the same nvram config file as the
raspberrypi,3-model-b.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.5 -r1.6 src/external/broadcom/bwfm/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/base/md.evbarm
diff -u src/distrib/sets/lists/base/md.evbarm:1.15 src/distrib/sets/lists/base/md.evbarm:1.16
--- src/distrib/sets/lists/base/md.evbarm:1.15	Sun Mar 22 21:13:35 2020
+++ src/distrib/sets/lists/base/md.evbarm	Sun Mar 22 22:17:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbarm,v 1.15 2020/03/22 21:13:35 thorpej Exp $
+# $NetBSD: md.evbarm,v 1.16 2020/03/22 22:17:11 thorpej Exp $
 ./libdata/firmware/if_bwfm/brcmfmac43143-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43241b0-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43241b4-sdio.bin	base-firmware-root	firmware
@@ -14,6 +14,7 @@
 ./libdata/firmware/if_bwfm/brcmfmac4339-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43430-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43430a0-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43455-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt	base-firmware-root	firmware

Index: src/external/broadcom/bwfm/Makefile
diff -u src/external/broadcom/bwfm/Makefile:1.5 src/external/broadcom/bwfm/Makefile:1.6
--- src/external/broadcom/bwfm/Makefile:1.5	Sun Mar 22 21:13:35 2020
+++ src/external/broadcom/bwfm/Makefile	Sun Mar 22 22:17:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2020/03/22 21:13:35 thorpej Exp $
+# $NetBSD: Makefile,v 1.6 2020/03/22 22:17:11 thorpej Exp $
 
 NOMAN=	# define
 
@@ -10,6 +10,8 @@ NOMAN=	# define
 BWFM_WANT_SDIO_FIRMWARE=	yes
 .endif
 
+FILESDIR=	${FIRMWAREDIR}/if_bwfm
+
 FILES=	dist/LICENCE.broadcom_bcm43xx
 
 FILES+=	dist/brcmfmac43143.bin
@@ -59,8 +61,12 @@ FILES+=	dist/brcmfmac43430-sdio.raspberr
 FILES+=	dist/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
 FILES+=	dist/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
 FILES+=	dist/brcmfmac43456-sdio.pine64,pinebook-pro.txt
-.endif
 
-FILESDIR=	${FIRMWAREDIR}/if_bwfm
+# The raspberrypi,model-zero-w uses the same nvram config as the
+# raspberrypi,3-model-b.
+LINKS+=	${FILESDIR}/brcmfmac43430-sdio.raspberrypi,3-model-b.txt \
+	${FILESDIR}/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt
+.endif
 
+.include 
 .include 



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 22:17:11 UTC 2020

Modified Files:
src/distrib/sets/lists/base: md.evbarm
src/external/broadcom/bwfm: Makefile

Log Message:
The raspberrypi,model-zero-w uses the same nvram config file as the
raspberrypi,3-model-b.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.5 -r1.6 src/external/broadcom/bwfm/Makefile

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



CVS commit: src/sys/arch/sparc/sparc

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 21:21:07 UTC 2020

Modified Files:
src/sys/arch/sparc/sparc: intr.c

Log Message:
cpu_intr_p(): use cpuinfo (always the same VA) for preemption safety.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/sparc/sparc/intr.c

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



CVS commit: src/sys/arch/sparc/sparc

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 21:21:07 UTC 2020

Modified Files:
src/sys/arch/sparc/sparc: intr.c

Log Message:
cpu_intr_p(): use cpuinfo (always the same VA) for preemption safety.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/sparc/sparc/intr.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/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.124 src/sys/arch/sparc/sparc/intr.c:1.125
--- src/sys/arch/sparc/sparc/intr.c:1.124	Sat Mar 14 13:34:43 2020
+++ src/sys/arch/sparc/sparc/intr.c	Sun Mar 22 21:21:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $ */
+/*	$NetBSD: intr.c,v 1.125 2020/03/22 21:21:07 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.125 2020/03/22 21:21:07 ad Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -889,17 +889,10 @@ intr_biglock_wrapper(void *vp)
 bool
 cpu_intr_p(void)
 {
-	uint64_t ncsw;
-	int idepth;
-	lwp_t *l;
-
-	l = curlwp;
-	do {
-		ncsw = l->l_ncsw;
-		__insn_barrier();
-		idepth = curcpu()->ci_idepth;
-		__insn_barrier();
-	} while (__predict_false(ncsw != l->l_ncsw));
 
-	return idepth != 0;
+	/* 
+	 * cpuinfo is the same VA on every CPU.  Even if preempted it will
+	 * give the correct answer.
+	 */
+	return cpuinfo.ci_idepth != 0;
 }



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 21:13:35 UTC 2020

Modified Files:
src/distrib/sets/lists/base: md.evbarm
src/external/broadcom/bwfm: Makefile

Log Message:
Install the "bwfm" firmware for the Pinebook Pro.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.4 -r1.5 src/external/broadcom/bwfm/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/base/md.evbarm
diff -u src/distrib/sets/lists/base/md.evbarm:1.14 src/distrib/sets/lists/base/md.evbarm:1.15
--- src/distrib/sets/lists/base/md.evbarm:1.14	Sun Mar 22 20:21:53 2020
+++ src/distrib/sets/lists/base/md.evbarm	Sun Mar 22 21:13:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbarm,v 1.14 2020/03/22 20:21:53 thorpej Exp $
+# $NetBSD: md.evbarm,v 1.15 2020/03/22 21:13:35 thorpej Exp $
 ./libdata/firmware/if_bwfm/brcmfmac43143-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43241b0-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43241b4-sdio.bin	base-firmware-root	firmware
@@ -18,6 +18,9 @@
 ./libdata/firmware/if_bwfm/brcmfmac43455-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43456-sdio.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43456-sdio.clm_blob	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43456-sdio.pine64,pinebook-pro.txt	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac4354-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac4356-sdio.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac4373-sdio.bin	base-firmware-root	firmware

Index: src/external/broadcom/bwfm/Makefile
diff -u src/external/broadcom/bwfm/Makefile:1.4 src/external/broadcom/bwfm/Makefile:1.5
--- src/external/broadcom/bwfm/Makefile:1.4	Sun Mar 22 20:21:53 2020
+++ src/external/broadcom/bwfm/Makefile	Sun Mar 22 21:13:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2020/03/22 20:21:53 thorpej Exp $
+# $NetBSD: Makefile,v 1.5 2020/03/22 21:13:35 thorpej Exp $
 
 NOMAN=	# define
 
@@ -44,6 +44,8 @@ FILES+=	dist/brcmfmac4339-sdio.bin
 FILES+=	dist/brcmfmac43430-sdio.bin
 FILES+=	dist/brcmfmac43430a0-sdio.bin
 FILES+=	dist/brcmfmac43455-sdio.bin
+FILES+=	dist/brcmfmac43456-sdio.bin
+FILES+=	dist/brcmfmac43456-sdio.clm_blob
 FILES+=	dist/brcmfmac4354-sdio.bin
 FILES+=	dist/brcmfmac4356-sdio.bin
 FILES+=	dist/brcmfmac4373-sdio.bin
@@ -56,6 +58,7 @@ FILES+=	dist/brcmfmac43362-sdio.lemaker,
 FILES+=	dist/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
 FILES+=	dist/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
 FILES+=	dist/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
+FILES+=	dist/brcmfmac43456-sdio.pine64,pinebook-pro.txt
 .endif
 
 FILESDIR=	${FIRMWAREDIR}/if_bwfm



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 21:13:35 UTC 2020

Modified Files:
src/distrib/sets/lists/base: md.evbarm
src/external/broadcom/bwfm: Makefile

Log Message:
Install the "bwfm" firmware for the Pinebook Pro.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.4 -r1.5 src/external/broadcom/bwfm/Makefile

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



CVS commit: src/external/broadcom/bwfm

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 21:06:35 UTC 2020

Added Files:
src/external/broadcom/bwfm: README

Log Message:
Add a note about "bwfm" firmware upstreams.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/broadcom/bwfm/README

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

Added files:

Index: src/external/broadcom/bwfm/README
diff -u /dev/null src/external/broadcom/bwfm/README:1.1
--- /dev/null	Sun Mar 22 21:06:35 2020
+++ src/external/broadcom/bwfm/README	Sun Mar 22 21:06:35 2020
@@ -0,0 +1,38 @@
+#	$NetBSD: README,v 1.1 2020/03/22 21:06:35 thorpej Exp $
+
+Firmware images for Broadcom Fullmac are available from the linux-firmware
+repository:
+
+  https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/
+
+It is always preferable to use firmware and configs from mainline Linux.
+
+When importing from linux-firmware, use vendor tag "LINUX" and release
+tag that's the name of the linux-firmware shapshot you're importing,
+e.g. "linux-firmware-20200316".
+
+
+There are some cases where the required files are not available from
+mainline linux-firmware.  In these cases, different vendor / release
+tags should be used for these specific files.  These special cases
+are listed here.
+
+Pinebook Pro "bwfm" firmware
+
+These firmware images come from Tobias Schramm's pinebook-firmware
+repository:
+
+  https://gitlab.manjaro.org/tsys/pinebook-firmware/-/tree/master/brcm
+
+When importing from this repository, use vendor tag "tsys-pinebook-firmware"
+and a release tag "commit-SHA" where SHA is the Git commit identifier.
+
+This applies to the following files:
+
+	dist/brcmfmac43456-sdio.bin
+	dist/brcmfmac43456-sdio.clm_blob
+	dist/brcmfmac43456-sdio.pine64,pinebook-pro.txt
+
+Note that in the pinebook-firmware repository, the file
+brcmfmac43456-sdio.pine64,pinebook-pro.txt is a symbolic link to
+brcmfmac43456-sdio.txt.



CVS commit: src/external/broadcom/bwfm

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 21:06:35 UTC 2020

Added Files:
src/external/broadcom/bwfm: README

Log Message:
Add a note about "bwfm" firmware upstreams.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/broadcom/bwfm/README

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



CVS import: src/external/broadcom/bwfm/dist

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 21:05:12 UTC 2020

Update of /cvsroot/src/external/broadcom/bwfm/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv13873

Log Message:
Pinebook Pro "bwfm" firmware from Tobias Schramm's pinebook-firmware
repository.

Status:

Vendor Tag: tsys-pinebook-firmware
Release Tags:   commit-64b1ceb9d4ef8fb7f014cb0a29b4b68b6d4d9098

N src/external/broadcom/bwfm/dist/brcmfmac43456-sdio.pine64,pinebook-pro.txt
N src/external/broadcom/bwfm/dist/brcmfmac43456-sdio.clm_blob
N src/external/broadcom/bwfm/dist/brcmfmac43456-sdio.bin

No conflicts created by this import



CVS import: src/external/broadcom/bwfm/dist

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 21:05:12 UTC 2020

Update of /cvsroot/src/external/broadcom/bwfm/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv13873

Log Message:
Pinebook Pro "bwfm" firmware from Tobias Schramm's pinebook-firmware
repository.

Status:

Vendor Tag: tsys-pinebook-firmware
Release Tags:   commit-64b1ceb9d4ef8fb7f014cb0a29b4b68b6d4d9098

N src/external/broadcom/bwfm/dist/brcmfmac43456-sdio.pine64,pinebook-pro.txt
N src/external/broadcom/bwfm/dist/brcmfmac43456-sdio.clm_blob
N src/external/broadcom/bwfm/dist/brcmfmac43456-sdio.bin

No conflicts created by this import



CVS commit: src/sys/arch/vax/vsa

2020-03-22 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Sun Mar 22 20:27:47 UTC 2020

Modified Files:
src/sys/arch/vax/vsa: ncr.c

Log Message:
Do not expect a struct buf to be present if doing DMA to kernel space.
Fixes bug reported by sadness on port-vax.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/vax/vsa/ncr.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/vax/vsa/ncr.c
diff -u src/sys/arch/vax/vsa/ncr.c:1.49 src/sys/arch/vax/vsa/ncr.c:1.50
--- src/sys/arch/vax/vsa/ncr.c:1.49	Mon Sep  3 16:29:28 2018
+++ src/sys/arch/vax/vsa/ncr.c	Sun Mar 22 20:27:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr.c,v 1.49 2018/09/03 16:29:28 riastradh Exp $	*/
+/*	$NetBSD: ncr.c,v 1.50 2020/03/22 20:27:47 ragge Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49 2018/09/03 16:29:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.50 2020/03/22 20:27:47 ragge Exp $");
 
 #include 
 #include 
@@ -275,7 +275,11 @@ found:
 	dh->dh_flags = SIDH_BUSY;
 	dh->dh_addr = ncr_sc->sc_dataptr;
 	dh->dh_len = xlen;
-	dh->dh_proc = xs->bp->b_proc;
+	if (((vaddr_t)ncr_sc->sc_dataptr & KERNBASE) == 0) {
+		if (xs->bp == NULL)
+			panic("si_dma_alloc");
+		dh->dh_proc = xs->bp->b_proc;
+	}
 
 	/* Remember dest buffer parameters */
 	if (xs->xs_control & XS_CTL_DATA_OUT)



CVS commit: src/sys/arch/vax/vsa

2020-03-22 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Sun Mar 22 20:27:47 UTC 2020

Modified Files:
src/sys/arch/vax/vsa: ncr.c

Log Message:
Do not expect a struct buf to be present if doing DMA to kernel space.
Fixes bug reported by sadness on port-vax.


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

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



CVS commit: src/doc

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 20:26:59 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note bwfm firmware update.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2660 src/doc/CHANGES:1.2661
--- src/doc/CHANGES:1.2660	Sun Mar 22 18:49:45 2020
+++ src/doc/CHANGES	Sun Mar 22 20:26:59 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2660 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2661 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -159,3 +159,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		red-black trees. [ad 20200322]
 	uvm: Process concurrent page faults on individual objects in parallel,
 		where the relevant pages are already in-core.  [ad 20200322]
+	bwfm: Update firmware to linux-firmware-20200316. [thorpej 20200322]



CVS commit: src/doc

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 20:26:59 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note bwfm firmware update.


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

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



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 20:21:53 UTC 2020

Modified Files:
src/distrib/sets/lists/base: mi
src/external/broadcom/bwfm: Makefile
Added Files:
src/distrib/sets/lists/base: md.evbarm

Log Message:
Add new bwfm firmware binaries and config files.  Only install the
SDIO firmware binaries and platform-specific config files on platforms
where they're relevant.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.14 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.1232 -r1.1233 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.3 -r1.4 src/external/broadcom/bwfm/Makefile

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



CVS commit: src

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 20:21:53 UTC 2020

Modified Files:
src/distrib/sets/lists/base: mi
src/external/broadcom/bwfm: Makefile
Added Files:
src/distrib/sets/lists/base: md.evbarm

Log Message:
Add new bwfm firmware binaries and config files.  Only install the
SDIO firmware binaries and platform-specific config files on platforms
where they're relevant.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.14 src/distrib/sets/lists/base/md.evbarm
cvs rdiff -u -r1.1232 -r1.1233 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.3 -r1.4 src/external/broadcom/bwfm/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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1232 src/distrib/sets/lists/base/mi:1.1233
--- src/distrib/sets/lists/base/mi:1.1232	Fri Mar 13 15:19:25 2020
+++ src/distrib/sets/lists/base/mi	Sun Mar 22 20:21:53 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1232 2020/03/13 15:19:25 roy Exp $
+# $NetBSD: mi,v 1.1233 2020/03/22 20:21:53 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -148,9 +148,17 @@
 ./libdata/firmware/if_bwfm/brcmfmac43236b.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43242a.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac4350-pcie.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4356-pcie.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac4350c2-pcie.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43569.bin	base-firmware-root	firmware
 ./libdata/firmware/if_bwfm/brcmfmac43602-pcie.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43570-pcie.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4358-pcie.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43602-pcie.ap.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4366b-pcie.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4366c-pcie.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4371-pcie.bin	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4373.bin	base-firmware-root	firmware
 ./libdata/firmware/if_ipw			base-firmware-root
 ./libdata/firmware/if_ipw/LICENSE		base-firmware-root	firmware
 ./libdata/firmware/if_ipw/ipw2100-1.2-i.fw	base-firmware-root	firmware

Index: src/external/broadcom/bwfm/Makefile
diff -u src/external/broadcom/bwfm/Makefile:1.3 src/external/broadcom/bwfm/Makefile:1.4
--- src/external/broadcom/bwfm/Makefile:1.3	Wed May 30 20:54:08 2018
+++ src/external/broadcom/bwfm/Makefile	Sun Mar 22 20:21:53 2020
@@ -1,15 +1,62 @@
-# $NetBSD: Makefile,v 1.3 2018/05/30 20:54:08 mrg Exp $
+# $NetBSD: Makefile,v 1.4 2020/03/22 20:21:53 thorpej Exp $
 
 NOMAN=	# define
 
+.include 
+
+# Only install the SDIO firmware binaries on platforms where it will
+# be useful.
+.if ${MACHINE} == "evbarm"
+BWFM_WANT_SDIO_FIRMWARE=	yes
+.endif
+
 FILES=	dist/LICENCE.broadcom_bcm43xx
+
 FILES+=	dist/brcmfmac43143.bin
 FILES+=	dist/brcmfmac43236b.bin
 FILES+=	dist/brcmfmac43242a.bin
 FILES+=	dist/brcmfmac43569.bin
+FILES+=	dist/brcmfmac4373.bin
+
 FILES+=	dist/brcmfmac4350-pcie.bin
 FILES+=	dist/brcmfmac4350c2-pcie.bin
+FILES+=	dist/brcmfmac4356-pcie.bin
+FILES+=	dist/brcmfmac43570-pcie.bin
+FILES+=	dist/brcmfmac4358-pcie.bin
+FILES+=	dist/brcmfmac43602-pcie.ap.bin
 FILES+=	dist/brcmfmac43602-pcie.bin
+FILES+=	dist/brcmfmac4366b-pcie.bin
+FILES+=	dist/brcmfmac4366c-pcie.bin
+FILES+=	dist/brcmfmac4371-pcie.bin
+
+.if defined(BWFM_WANT_SDIO_FIRMWARE)
+FILES+=	dist/brcmfmac43143-sdio.bin
+FILES+=	dist/brcmfmac43241b0-sdio.bin
+FILES+=	dist/brcmfmac43241b4-sdio.bin
+FILES+=	dist/brcmfmac43241b5-sdio.bin
+FILES+=	dist/brcmfmac4329-sdio.bin
+FILES+=	dist/brcmfmac4330-sdio.bin
+FILES+=	dist/brcmfmac4334-sdio.bin
+FILES+=	dist/brcmfmac43340-sdio.bin
+FILES+=	dist/brcmfmac4335-sdio.bin
+FILES+=	dist/brcmfmac43362-sdio.bin
+FILES+=	dist/brcmfmac4339-sdio.bin
+FILES+=	dist/brcmfmac43430-sdio.bin
+FILES+=	dist/brcmfmac43430a0-sdio.bin
+FILES+=	dist/brcmfmac43455-sdio.bin
+FILES+=	dist/brcmfmac4354-sdio.bin
+FILES+=	dist/brcmfmac4356-sdio.bin
+FILES+=	dist/brcmfmac4373-sdio.bin
+.endif	# BWFM_WANT_SDIO_FIRMWARE
+
+# Platform-specific configuration files
+.if ${MACHINE} == "evbarm"
+FILES+=	dist/brcmfmac43362-sdio.cubietech,cubietruck.txt
+FILES+=	dist/brcmfmac43362-sdio.lemaker,bananapro.txt
+FILES+=	dist/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+FILES+=	dist/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+FILES+=	dist/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
+.endif
 
 FILESDIR=	${FIRMWAREDIR}/if_bwfm
 

Added files:

Index: src/distrib/sets/lists/base/md.evbarm
diff -u /dev/null src/distrib/sets/lists/base/md.evbarm:1.14
--- /dev/null	Sun Mar 22 20:21:53 2020

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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:16:49 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/sha: sha256.c

Log Message:
reduce diff with upstream


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssl/dist/crypto/sha/sha256.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:16:49 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/sha: sha256.c

Log Message:
reduce diff with upstream


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssl/dist/crypto/sha/sha256.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/sha/sha256.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/sha/sha256.c:1.9 src/crypto/external/bsd/openssl/dist/crypto/sha/sha256.c:1.10
--- src/crypto/external/bsd/openssl/dist/crypto/sha/sha256.c:1.9	Sat Mar 21 20:53:08 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/sha/sha256.c	Sun Mar 22 16:16:49 2020
@@ -168,7 +168,7 @@ static const SHA_LONG K256[64] = {
 static void sha256_block_data_order(SHA256_CTX *ctx, const void *in,
 size_t num)
 {
-MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1, T2;
+unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1, T2;
 SHA_LONG X[16], l;
 int i;
 const unsigned char *data = in;
@@ -246,7 +246,7 @@ static void sha256_block_data_order(SHA2
 static void sha256_block_data_order(SHA256_CTX *ctx, const void *in,
 size_t num)
 {
-MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1;
+unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1;
 SHA_LONG X[16];
 int i;
 const unsigned char *data = in;



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:15:30 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/ripemd: rmd_dgst.c

Log Message:
reduce diff with upstream


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c:1.8 src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c:1.9
--- src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c:1.8	Sat Mar 21 20:53:08 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c	Sun Mar 22 16:15:29 2020
@@ -36,8 +36,8 @@ int RIPEMD160_Init(RIPEMD160_CTX *c)
 void ripemd160_block_data_order(RIPEMD160_CTX *ctx, const void *p, size_t num)
 {
 const unsigned char *data = p;
-register MD32_REG_T A, B, C, D, E;
-MD32_REG_T a, b, c, d, e, l;
+register unsigned MD32_REG_T A, B, C, D, E;
+unsigned MD32_REG_T a, b, c, d, e, l;
 # ifndef MD32_XARRAY
 /* See comment in crypto/sha/sha_local.h for details. */
 unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:15:30 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/ripemd: rmd_dgst.c

Log Message:
reduce diff with upstream


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmd_dgst.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:13:15 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/md5: md5_dgst.c

Log Message:
reduce diff with upstream


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/openssl/dist/crypto/md5/md5_dgst.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/md5/md5_dgst.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/md5/md5_dgst.c:1.6 src/crypto/external/bsd/openssl/dist/crypto/md5/md5_dgst.c:1.7
--- src/crypto/external/bsd/openssl/dist/crypto/md5/md5_dgst.c:1.6	Sat Mar 21 20:53:06 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/md5/md5_dgst.c	Sun Mar 22 16:13:15 2020
@@ -37,7 +37,7 @@ int MD5_Init(MD5_CTX *c)
 void md5_block_data_order(MD5_CTX *c, const void *data_, size_t num)
 {
 const unsigned char *data = data_;
-register MD32_REG_T A, B, C, D, l;
+register unsigned MD32_REG_T A, B, C, D, l;
 # ifndef MD32_XARRAY
 /* See comment in crypto/sha/sha_local.h for details. */
 unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:13:15 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/md5: md5_dgst.c

Log Message:
reduce diff with upstream


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/openssl/dist/crypto/md5/md5_dgst.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:09:17 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/evp: e_aes.c

Log Message:
reduce diff with upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:09:17 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/evp: e_aes.c

Log Message:
reduce diff with upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c:1.21 src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c:1.22
--- src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c:1.21	Sun Mar 22 16:05:29 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c	Sun Mar 22 16:09:17 2020
@@ -2551,7 +2551,7 @@ const EVP_CIPHER *EVP_aes_##keylen##_##m
 
 #if defined(OPENSSL_CPUID_OBJ) && defined(AES_ASM) && (defined(__arm__) || defined(__arm) || defined(__aarch64__))
 # include "arm_arch.h"
-# if __ARM_MAX_ARCH__>= 7
+# if __ARM_MAX_ARCH__>=7
 #  if defined(BSAES_ASM)
 #   define BSAES_CAPABLE (OPENSSL_armcap_P & ARMV7_NEON)
 #  endif
@@ -2559,7 +2559,7 @@ const EVP_CIPHER *EVP_aes_##keylen##_##m
 #   define VPAES_CAPABLE (OPENSSL_armcap_P & ARMV7_NEON)
 #  endif
 # endif
-# if __ARM_MAX_ARCH__>= 8
+# if __ARM_MAX_ARCH__>=8
 #  define HWAES_CAPABLE (OPENSSL_armcap_P & ARMV8_AES)
 #  define HWAES_set_encrypt_key aes_v8_set_encrypt_key
 #  define HWAES_set_decrypt_key aes_v8_set_decrypt_key



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:07:05 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bio: bss_log.c

Log Message:
eliminate diff with upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c:1.11 src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c:1.12
--- src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c:1.11	Sat Mar 21 20:53:03 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c	Sun Mar 22 16:07:05 2020
@@ -97,7 +97,7 @@ static const BIO_METHOD methods_slg = {
 slg_ctrl,
 slg_new,
 slg_free,
-NULL,
+NULL,  /* slg_callback_ctrl */
 };
 
 const BIO_METHOD *BIO_s_log(void)



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:07:05 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bio: bss_log.c

Log Message:
eliminate diff with upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:05:29 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/evp: e_aes.c

Log Message:
put back removed code


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:05:29 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/evp: e_aes.c

Log Message:
put back removed code


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c:1.20 src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c:1.21
--- src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c:1.20	Sat Mar 21 20:53:05 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/evp/e_aes.c	Sun Mar 22 16:05:29 2020
@@ -2801,6 +2801,8 @@ static int aes_cfb1_cipher(EVP_CIPHER_CT
 EVP_CIPHER_CTX_encrypting(ctx), dat->block);
 EVP_CIPHER_CTX_set_num(ctx, num);
 len -= MAXBITCHUNK;
+out += MAXBITCHUNK;
+in  += MAXBITCHUNK;
 }
 if (len) {
 int num = EVP_CIPHER_CTX_num(ctx);



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:01:48 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/apps: s_server.c

Log Message:
add back missing goto;


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/crypto/external/bsd/openssl/dist/apps/s_server.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/apps/s_server.c
diff -u src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.21 src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.22
--- src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.21	Sun Mar 22 15:56:07 2020
+++ src/crypto/external/bsd/openssl/dist/apps/s_server.c	Sun Mar 22 16:01:48 2020
@@ -1809,6 +1809,7 @@ int s_server_main(int argc, char *argv[]
 goto end;
 if (max_version != 0
 && SSL_CTX_set_max_proto_version(ctx, max_version) == 0)
+goto end;
 
 if (session_id_prefix) {
 if (strlen(session_id_prefix) >= 32)



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 20:01:48 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/apps: s_server.c

Log Message:
add back missing goto;


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/crypto/external/bsd/openssl/dist/apps/s_server.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 19:56:07 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/apps: s_client.c s_server.c

Log Message:
always use fdin


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/crypto/external/bsd/openssl/dist/apps/s_client.c
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/external/bsd/openssl/dist/apps/s_server.c

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



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

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 19:56:07 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/apps: s_client.c s_server.c

Log Message:
always use fdin


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/crypto/external/bsd/openssl/dist/apps/s_client.c
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/external/bsd/openssl/dist/apps/s_server.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/apps/s_client.c
diff -u src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.21 src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.22
--- src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.21	Sat Mar 21 20:53:02 2020
+++ src/crypto/external/bsd/openssl/dist/apps/s_client.c	Sun Mar 22 15:56:07 2020
@@ -2804,7 +2804,7 @@ int s_client_main(int argc, char **argv)
  * set the flag so we exit.
  */
 if (read_tty && !at_eof)
-openssl_fdset(fileno_stdin(), );
+openssl_fdset(fdin, );
 #if !defined(OPENSSL_SYS_VMS)
 if (write_tty)
 openssl_fdset(fdout, );

Index: src/crypto/external/bsd/openssl/dist/apps/s_server.c
diff -u src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.20 src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.21
--- src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.20	Sat Mar 21 20:53:02 2020
+++ src/crypto/external/bsd/openssl/dist/apps/s_server.c	Sun Mar 22 15:56:07 2020
@@ -2423,7 +2423,7 @@ static int sv_body(int s, int stype, int
 }
 FD_ZERO();
 #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
-openssl_fdset(fileno_stdin(), );
+openssl_fdset(fdin, );
 #endif
 openssl_fdset(s, );
 /*



Re: CVS import: src/external/broadcom/bwfm/dist

2020-03-22 Thread Jason Thorpe


> On Mar 22, 2020, at 12:00 PM, Jason R Thorpe  wrote:
> 
> 3 conflicts created by this import.

Note: These are false conflicts that are the result of the files being "cvs 
add"ed rather than imported originally.  I verified before the import that all 
files that we currently distribute are identical to versions in the current 
linux-firmware snapshot.

-- thorpej



CVS import: src/external/broadcom/bwfm/dist

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 19:00:21 UTC 2020

Update of /cvsroot/src/external/broadcom/bwfm/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv19963

Log Message:
Import bwfm firmware from linux-firmware snapshot on 2020-03-16.

Status:

Vendor Tag: LINUX
Release Tags:   linux-firmware-20200316

N src/external/broadcom/bwfm/dist/brcmfmac43602-pcie.ap.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.AP6212.txt
N src/external/broadcom/bwfm/dist/brcmfmac43241b5-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43241b4-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4356-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43362-sdio.lemaker,bananapro.txt
N src/external/broadcom/bwfm/dist/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt
N src/external/broadcom/bwfm/dist/brcmfmac4356-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4373.bin
C src/external/broadcom/bwfm/dist/brcmfmac4350-pcie.bin
U src/external/broadcom/bwfm/dist/brcmfmac43236b.bin
N src/external/broadcom/bwfm/dist/brcmfmac4356-pcie.gpd-win-pocket.txt
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
N src/external/broadcom/bwfm/dist/brcmfmac4366c-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac4366b-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac4330-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.bin
C src/external/broadcom/bwfm/dist/brcmfmac4350c2-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43143-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4373-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430a0-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4329-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43340-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
N src/external/broadcom/bwfm/dist/brcmfmac43570-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac4354-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.bin
C src/external/broadcom/bwfm/dist/brcmfmac43602-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43362-sdio.cubietech,cubietruck.txt
U src/external/broadcom/bwfm/dist/brcmfmac43242a.bin
N src/external/broadcom/bwfm/dist/brcmfmac43362-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4335-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4334-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43340-sdio.pov-tab-p1006w-data.txt
N src/external/broadcom/bwfm/dist/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
N src/external/broadcom/bwfm/dist/brcmfmac4339-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4371-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43241b0-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43340-sdio.meegopad-t08.txt
U src/external/broadcom/bwfm/dist/brcmfmac43143.bin
N src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.MINIX-NEO Z83-4.txt
N src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
N 
src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
N src/external/broadcom/bwfm/dist/brcmfmac4358-pcie.bin
U src/external/broadcom/bwfm/dist/LICENCE.broadcom_bcm43xx
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.MUR1DX.txt
N src/external/broadcom/bwfm/dist/brcmfmac4330-sdio.Prowise-PT301.txt
U src/external/broadcom/bwfm/dist/brcmfmac43569.bin

3 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jLINUX:yesterday -jLINUX src/external/broadcom/bwfm/dist



CVS import: src/external/broadcom/bwfm/dist

2020-03-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 22 19:00:21 UTC 2020

Update of /cvsroot/src/external/broadcom/bwfm/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv19963

Log Message:
Import bwfm firmware from linux-firmware snapshot on 2020-03-16.

Status:

Vendor Tag: LINUX
Release Tags:   linux-firmware-20200316

N src/external/broadcom/bwfm/dist/brcmfmac43602-pcie.ap.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.AP6212.txt
N src/external/broadcom/bwfm/dist/brcmfmac43241b5-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43241b4-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4356-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43362-sdio.lemaker,bananapro.txt
N src/external/broadcom/bwfm/dist/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt
N src/external/broadcom/bwfm/dist/brcmfmac4356-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4373.bin
C src/external/broadcom/bwfm/dist/brcmfmac4350-pcie.bin
U src/external/broadcom/bwfm/dist/brcmfmac43236b.bin
N src/external/broadcom/bwfm/dist/brcmfmac4356-pcie.gpd-win-pocket.txt
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
N src/external/broadcom/bwfm/dist/brcmfmac4366c-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac4366b-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac4330-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.bin
C src/external/broadcom/bwfm/dist/brcmfmac4350c2-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43143-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4373-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430a0-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4329-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43340-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
N src/external/broadcom/bwfm/dist/brcmfmac43570-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac4354-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.bin
C src/external/broadcom/bwfm/dist/brcmfmac43602-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43362-sdio.cubietech,cubietruck.txt
U src/external/broadcom/bwfm/dist/brcmfmac43242a.bin
N src/external/broadcom/bwfm/dist/brcmfmac43362-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4335-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4334-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43340-sdio.pov-tab-p1006w-data.txt
N src/external/broadcom/bwfm/dist/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
N src/external/broadcom/bwfm/dist/brcmfmac4339-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac4371-pcie.bin
N src/external/broadcom/bwfm/dist/brcmfmac43241b0-sdio.bin
N src/external/broadcom/bwfm/dist/brcmfmac43340-sdio.meegopad-t08.txt
U src/external/broadcom/bwfm/dist/brcmfmac43143.bin
N src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.MINIX-NEO Z83-4.txt
N src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
N 
src/external/broadcom/bwfm/dist/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
N src/external/broadcom/bwfm/dist/brcmfmac4358-pcie.bin
U src/external/broadcom/bwfm/dist/LICENCE.broadcom_bcm43xx
N src/external/broadcom/bwfm/dist/brcmfmac43430-sdio.MUR1DX.txt
N src/external/broadcom/bwfm/dist/brcmfmac4330-sdio.Prowise-PT301.txt
U src/external/broadcom/bwfm/dist/brcmfmac43569.bin

3 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jLINUX:yesterday -jLINUX src/external/broadcom/bwfm/dist



CVS commit: src/doc

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 18:49:45 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note some recent changes I made.


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

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



CVS commit: src/doc

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 18:49:45 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note some recent changes I made.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2659 src/doc/CHANGES:1.2660
--- src/doc/CHANGES:1.2659	Sun Mar 22 00:56:18 2020
+++ src/doc/CHANGES	Sun Mar 22 18:49:45 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2659 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2660 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -117,8 +117,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	amd64, i386: Replace the global PV hash table with radix trees,
 		yielding significant performance and scalability benefits.
 		[ad 20200112]
-	amd64, i386: Use the pmap module as a source of pre-zeroed pages
-		for the VM system. [ad 20200112]
 	scheduler: Make the scheduler topology aware.  It understands and
 		makes good use of HyperThreading/SMT, spreads the load evenly
 		across different physical CPU packages, and can effectively
@@ -155,3 +153,9 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	terminfo: Support numeric parameters as int [roy 20200313]
 	postfix(1): Import version 3.5.0. [christos 20200318]
 	OpenSSL: Imported 1.1.1e. [christos 20200321]
+	amd64, i386: Significant performance improvements in the pmap module
+		[ad 20200322]
+	namecache: Change the namecache to index names using per directory
+		red-black trees. [ad 20200322]
+	uvm: Process concurrent page faults on individual objects in parallel,
+		where the relevant pages are already in-core.  [ad 20200322]



CVS commit: src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 18:45:28 UTC 2020

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

Log Message:
Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core.  Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/vfs_vnode.c

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



CVS commit: src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 18:45:28 UTC 2020

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

Log Message:
Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core.  Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/vfs_vnode.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/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.115 src/sys/kern/vfs_vnode.c:1.116
--- src/sys/kern/vfs_vnode.c:1.115	Sun Mar 22 16:43:57 2020
+++ src/sys/kern/vfs_vnode.c	Sun Mar 22 18:45:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.115 2020/03/22 16:43:57 ad Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.116 2020/03/22 18:45:28 ad Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.115 2020/03/22 16:43:57 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.116 2020/03/22 18:45:28 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -1676,6 +1676,7 @@ vcache_reclaim(vnode_t *vp)
 		cpu_count(CPU_COUNT_FILEPAGES, vp->v_uobj.uo_npages);
 	}
 	vp->v_iflag &= ~(VI_TEXT|VI_EXECMAP);
+	vp->v_iflag |= VI_DEADCHECK; /* for genfs_getpages() */
 	mutex_exit(vp->v_interlock);
 	rw_exit(vp->v_uobj.vmobjlock);
 



CVS commit: src

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 18:32:42 UTC 2020

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/nfs: nfs_bio.c
src/sys/sys: cpu_data.h vnode.h
src/sys/uvm: uvm_anon.c uvm_aobj.c uvm_extern.h uvm_fault.c uvm_loan.c
uvm_map.c uvm_meter.c uvm_pager.h uvm_vnode.c
src/usr.bin/vmstat: vmstat.c

Log Message:
Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core.  Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.194 -r1.195 src/sys/nfs/nfs_bio.c
cvs rdiff -u -r1.49 -r1.50 src/sys/sys/cpu_data.h
cvs rdiff -u -r1.293 -r1.294 src/sys/sys/vnode.h
cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.138 -r1.139 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.221 -r1.222 src/sys/uvm/uvm_extern.h src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.99 -r1.100 src/sys/uvm/uvm_loan.c
cvs rdiff -u -r1.375 -r1.376 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.75 -r1.76 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.46 -r1.47 src/sys/uvm/uvm_pager.h
cvs rdiff -u -r1.110 -r1.111 src/sys/uvm/uvm_vnode.c
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/vmstat/vmstat.c

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

Modified files:

Index: src/sys/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.94 src/sys/miscfs/genfs/genfs_io.c:1.95
--- src/sys/miscfs/genfs/genfs_io.c:1.94	Tue Mar 17 18:31:38 2020
+++ src/sys/miscfs/genfs/genfs_io.c	Sun Mar 22 18:32:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.94 2020/03/17 18:31:38 ad Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.95 2020/03/22 18:32:41 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.94 2020/03/17 18:31:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.95 2020/03/22 18:32:41 ad Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -103,7 +104,7 @@ genfs_getpages(void *v)
 	} */ * const ap = v;
 
 	off_t diskeof, memeof;
-	int i, error, npages;
+	int i, error, npages, iflag;
 	const int flags = ap->a_flags;
 	struct vnode * const vp = ap->a_vp;
 	struct uvm_object * const uobj = >v_uobj;
@@ -125,18 +126,35 @@ genfs_getpages(void *v)
 	KASSERT(vp->v_type == VREG || vp->v_type == VDIR ||
 	vp->v_type == VLNK || vp->v_type == VBLK);
 
+	/*
+	 * the object must be locked.  it can only be a read lock when
+	 * processing a read fault with PGO_LOCKED | PGO_NOBUSY.
+	 */
+
+	KASSERT(rw_lock_held(uobj->vmobjlock));
+	KASSERT(rw_write_held(uobj->vmobjlock) ||
+	   ((~flags & (PGO_LOCKED | PGO_NOBUSY)) == 0 && !memwrite));
+
 #ifdef DIAGNOSTIC
 	if ((flags & PGO_JOURNALLOCKED) && vp->v_mount->mnt_wapbl)
 WAPBL_JLOCK_ASSERT(vp->v_mount);
 #endif
 
-	mutex_enter(vp->v_interlock);
-	error = vdead_check(vp, VDEAD_NOWAIT);
-	mutex_exit(vp->v_interlock);
-	if (error) {
-		if ((flags & PGO_LOCKED) == 0)
-			rw_exit(uobj->vmobjlock);
-		return error;
+	/*
+	 * check for reclaimed vnode.  v_interlock is not held here, but
+	 * VI_DEADCHECK is set with vmobjlock held.
+	 */
+
+	iflag = atomic_load_relaxed(>v_iflag);
+	if (__predict_false((iflag & VI_DEADCHECK) != 0)) {
+		mutex_enter(vp->v_interlock);
+		error = vdead_check(vp, VDEAD_NOWAIT);
+		mutex_exit(vp->v_interlock);
+		if (error) {
+			if ((flags & PGO_LOCKED) == 0)
+rw_exit(uobj->vmobjlock);
+			return error;
+		}
 	}
 
 startover:
@@ -217,9 +235,11 @@ startover:
 			KASSERT(pg == NULL || pg == PGO_DONTCARE);
 		}
 #endif /* defined(DEBUG) */
-		nfound = uvn_findpages(uobj, origoffset, ,
+ 		nfound = uvn_findpages(uobj, origoffset, ,
 		ap->a_m, NULL,
-		UFP_NOWAIT|UFP_NOALLOC|(memwrite ? UFP_NORDONLY : 0));
+		UFP_NOWAIT | UFP_NOALLOC |
+		(memwrite ? UFP_NORDONLY : 0) |
+		((flags & PGO_NOBUSY) != 0 ? UFP_NOBUSY : 0));
 		KASSERT(npages == *ap->a_count);
 		if (nfound == 0) {
 			error = EBUSY;
@@ -230,7 +250,9 @@ startover:
 		 * the file behind us.
 		 */
 		if (!genfs_node_rdtrylock(vp)) {
-			genfs_rel_pages(ap->a_m, npages);
+			if ((flags & PGO_NOBUSY) == 0) {
+genfs_rel_pages(ap->a_m, npages);
+			}
 
 			/*
 			 * restore the array.

Index: src/sys/nfs/nfs_bio.c
diff -u src/sys/nfs/nfs_bio.c:1.194 src/sys/nfs/nfs_bio.c:1.195
--- src/sys/nfs/nfs_bio.c:1.194	Sun Feb 23 15:46:41 2020
+++ src/sys/nfs/nfs_bio.c	Sun Mar 22 18:32:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_bio.c,v 1.194 2020/02/23 15:46:41 ad Exp $	*/
+/*	$NetBSD: nfs_bio.c,v 1.195 2020/03/22 18:32:42 ad Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, 

CVS commit: src

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 18:32:42 UTC 2020

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/nfs: nfs_bio.c
src/sys/sys: cpu_data.h vnode.h
src/sys/uvm: uvm_anon.c uvm_aobj.c uvm_extern.h uvm_fault.c uvm_loan.c
uvm_map.c uvm_meter.c uvm_pager.h uvm_vnode.c
src/usr.bin/vmstat: vmstat.c

Log Message:
Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core.  Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.194 -r1.195 src/sys/nfs/nfs_bio.c
cvs rdiff -u -r1.49 -r1.50 src/sys/sys/cpu_data.h
cvs rdiff -u -r1.293 -r1.294 src/sys/sys/vnode.h
cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.138 -r1.139 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.221 -r1.222 src/sys/uvm/uvm_extern.h src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.99 -r1.100 src/sys/uvm/uvm_loan.c
cvs rdiff -u -r1.375 -r1.376 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.75 -r1.76 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.46 -r1.47 src/sys/uvm/uvm_pager.h
cvs rdiff -u -r1.110 -r1.111 src/sys/uvm/uvm_vnode.c
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/vmstat/vmstat.c

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 17:35:29 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc: sparccap.c

Log Message:
cryptlib header moved


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparccap.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparccap.c
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparccap.c:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparccap.c:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparccap.c:1.3	Mon Sep 24 16:36:51 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparccap.c	Sun Mar 22 13:35:29 2020
@@ -1,5 +1,5 @@
 #include "e_os.h"
-#include "internal/cryptlib_int.h"
+#include "crypto/cryptlib.h"
 
 uint32_t OPENSSL_rdtsc(void)
 {



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc

2020-03-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 22 17:35:29 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc: sparccap.c

Log Message:
cryptlib header moved


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/sparccap.c

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



CVS commit: src/sys/arch

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 17:33:59 UTC 2020

Modified Files:
src/sys/arch/hppa/include: types.h
src/sys/arch/mips/include: types.h
src/sys/arch/powerpc/include: types.h
src/sys/arch/riscv/include: types.h

Log Message:
Temporarily mark hppa, mips, powerpc and riscv with __HAVE_UNLOCKED_PMAP,
for the benefit of UVM.

These need some pmap changes to support concurrent faults on the same
object.  I have changes to do just that, but they're a work in progress.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/hppa/include/types.h
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/include/types.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/powerpc/include/types.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/riscv/include/types.h

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



CVS commit: src/sys/arch

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 17:33:59 UTC 2020

Modified Files:
src/sys/arch/hppa/include: types.h
src/sys/arch/mips/include: types.h
src/sys/arch/powerpc/include: types.h
src/sys/arch/riscv/include: types.h

Log Message:
Temporarily mark hppa, mips, powerpc and riscv with __HAVE_UNLOCKED_PMAP,
for the benefit of UVM.

These need some pmap changes to support concurrent faults on the same
object.  I have changes to do just that, but they're a work in progress.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/hppa/include/types.h
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/include/types.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/powerpc/include/types.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/riscv/include/types.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/hppa/include/types.h
diff -u src/sys/arch/hppa/include/types.h:1.26 src/sys/arch/hppa/include/types.h:1.27
--- src/sys/arch/hppa/include/types.h:1.26	Sat Jan 23 22:31:19 2016
+++ src/sys/arch/hppa/include/types.h	Sun Mar 22 17:33:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.26 2016/01/23 22:31:19 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.27 2020/03/22 17:33:58 ad Exp $	*/
 
 /*	$OpenBSD: types.h,v 1.6 2001/08/11 01:58:34 art Exp $	*/
 
@@ -103,4 +103,7 @@ extern const char __CONCAT(name,_ras_sta
 #define	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 #define	__HAVE_MM_MD_KERNACC
 
+/* XXX temporary */
+#define	__HAVE_UNLOCKED_PMAP
+
 #endif	/* _HPPA_TYPES_H_ */

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.68 src/sys/arch/mips/include/types.h:1.69
--- src/sys/arch/mips/include/types.h:1.68	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/mips/include/types.h	Sun Mar 22 17:33:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.68 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: types.h,v 1.69 2020/03/22 17:33:58 ad Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -176,4 +176,7 @@ typedef __uint32_t tlb_asid_t;
 #define	__HAVE_MM_MD_KERNACC
 #define	__HAVE_MM_MD_CACHE_ALIASING
 
+/* XXX temporary */
+#define	__HAVE_UNLOCKED_PMAP
+
 #endif	/* _MIPS_TYPES_H_ */

Index: src/sys/arch/powerpc/include/types.h
diff -u src/sys/arch/powerpc/include/types.h:1.60 src/sys/arch/powerpc/include/types.h:1.61
--- src/sys/arch/powerpc/include/types.h:1.60	Fri Dec  6 06:38:39 2019
+++ src/sys/arch/powerpc/include/types.h	Sun Mar 22 17:33:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.60 2019/12/06 06:38:39 mrg Exp $	*/
+/*	$NetBSD: types.h,v 1.61 2020/03/22 17:33:58 ad Exp $	*/
 
 /*-
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -103,4 +103,7 @@ typedef __uint32_t tlb_asid_t;		/* for b
 #define	__HAVE_RAS
 #endif
 
+/* XXX temporary */
+#define	__HAVE_UNLOCKED_PMAP
+
 #endif	/* _POWERPC_TYPES_H_ */

Index: src/sys/arch/riscv/include/types.h
diff -u src/sys/arch/riscv/include/types.h:1.8 src/sys/arch/riscv/include/types.h:1.9
--- src/sys/arch/riscv/include/types.h:1.8	Sat Mar 14 16:12:16 2020
+++ src/sys/arch/riscv/include/types.h	Sun Mar 22 17:33:59 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.8 2020/03/14 16:12:16 skrll Exp $ */
+/* $NetBSD: types.h,v 1.9 2020/03/22 17:33:59 ad Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -107,4 +107,7 @@ typedef __int32_t	__register_t;
 #define PCU_UNIT_COUNT	1
 #endif
 
+/* XXX temporary */
+#define	__HAVE_UNLOCKED_PMAP
+
 #endif	/* _RISCV_TYPES_H_ */



CVS commit: src/sys/dev/usb

2020-03-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Mar 22 17:15:16 UTC 2020

Modified Files:
src/sys/dev/usb: vhci.c

Log Message:
Add internal support for multiple endpoints.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/vhci.c

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



CVS commit: src/sys/dev/usb

2020-03-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Mar 22 17:15:16 UTC 2020

Modified Files:
src/sys/dev/usb: vhci.c

Log Message:
Add internal support for multiple endpoints.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/vhci.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/usb/vhci.c
diff -u src/sys/dev/usb/vhci.c:1.9 src/sys/dev/usb/vhci.c:1.10
--- src/sys/dev/usb/vhci.c:1.9	Sun Mar 22 15:14:03 2020
+++ src/sys/dev/usb/vhci.c	Sun Mar 22 17:15:15 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: vhci.c,v 1.9 2020/03/22 15:14:03 maxv Exp $ */
+/*	$NetBSD: vhci.c,v 1.10 2020/03/22 17:15:15 maxv Exp $ */
 
 /*
- * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.9 2020/03/22 15:14:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.10 2020/03/22 17:15:15 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -180,6 +180,7 @@ typedef struct vhci_packet {
 	TAILQ_ENTRY(vhci_packet) xferlist;
 	struct vhci_xfer *vxfer;
 	bool utoh;
+	uint8_t addr;
 	uint8_t *buf;
 	size_t size;
 	size_t cursor;
@@ -187,6 +188,8 @@ typedef struct vhci_packet {
 
 typedef TAILQ_HEAD(, vhci_packet) vhci_packet_list_t;
 
+#define VHCI_NADDRS	16	/* maximum supported by USB */
+
 typedef struct {
 	kmutex_t lock;
 	int status;
@@ -194,7 +197,7 @@ typedef struct {
 	struct {
 		vhci_packet_list_t usb_to_host;
 		vhci_packet_list_t host_to_usb;
-	} pkts_device_ctrl;
+	} endpoints[VHCI_NADDRS];
 } vhci_port_t;
 
 typedef struct {
@@ -245,6 +248,7 @@ typedef struct {
 
 typedef struct {
 	u_int port;
+	uint8_t addr;
 	vhci_softc_t *softc;
 } vhci_fd_t;
 
@@ -253,7 +257,8 @@ extern struct cfdriver vhci_cd;
 /* -- */
 
 static void
-vhci_pkt_create(vhci_port_t *port, struct usbd_xfer *xfer, bool usb_to_host)
+vhci_pkt_create(vhci_port_t *port, struct usbd_xfer *xfer, bool utoh,
+uint8_t addr)
 {
 	vhci_xfer_t *vxfer = (vhci_xfer_t *)xfer;
 	vhci_packet_list_t *reqlist, *datlist;
@@ -261,10 +266,11 @@ vhci_pkt_create(vhci_port_t *port, struc
 	size_t npkts = 0;
 
 	/* Request packet. */
-	reqlist = >pkts_device_ctrl.host_to_usb;
+	reqlist = >endpoints[addr].host_to_usb;
 	req = kmem_zalloc(sizeof(*req), KM_SLEEP);
 	req->vxfer = vxfer;
 	req->utoh = false;
+	req->addr = addr;
 	req->buf = (uint8_t *)>ux_request;
 	req->size = sizeof(xfer->ux_request);
 	req->cursor = 0;
@@ -272,14 +278,15 @@ vhci_pkt_create(vhci_port_t *port, struc
 
 	/* Data packet. */
 	if (xfer->ux_length > 0) {
-		if (usb_to_host) {
-			datlist = >pkts_device_ctrl.usb_to_host;
+		if (utoh) {
+			datlist = >endpoints[addr].usb_to_host;
 		} else {
-			datlist = >pkts_device_ctrl.host_to_usb;
+			datlist = >endpoints[addr].host_to_usb;
 		}
 		dat = kmem_zalloc(sizeof(*dat), KM_SLEEP);
 		dat->vxfer = vxfer;
-		dat->utoh = usb_to_host;
+		dat->utoh = utoh;
+		dat->addr = addr;
 		dat->buf = xfer->ux_buf;
 		dat->size = xfer->ux_length;
 		dat->cursor = 0;
@@ -312,9 +319,9 @@ vhci_pkt_destroy(vhci_softc_t *sc, vhci_
 
 	/* Remove from the port. */
 	if (pkt->utoh) {
-		pktlist = >pkts_device_ctrl.usb_to_host;
+		pktlist = >endpoints[pkt->addr].usb_to_host;
 	} else {
-		pktlist = >pkts_device_ctrl.host_to_usb;
+		pktlist = >endpoints[pkt->addr].host_to_usb;
 	}
 	TAILQ_REMOVE(pktlist, pkt, portlist);
 
@@ -366,8 +373,8 @@ vhci_open(struct usbd_pipe *pipe)
 		case UE_CONTROL:
 			pipe->up_methods = _device_ctrl_methods;
 			break;
-		case UE_BULK:
 		case UE_INTERRUPT:
+		case UE_BULK:
 		default:
 			goto bad;
 		}
@@ -559,14 +566,17 @@ vhci_device_ctrl_transfer(struct usbd_xf
 static usbd_status
 vhci_device_ctrl_start(struct usbd_xfer *xfer)
 {
+	usb_endpoint_descriptor_t *ed = xfer->ux_pipe->up_endpoint->ue_edesc;
 	usb_device_request_t *req = >ux_request;
 	struct usbd_device *dev = xfer->ux_pipe->up_dev;
 	vhci_softc_t *sc = xfer->ux_bus->ub_hcpriv;
 	vhci_port_t *port;
 	bool polling = sc->sc_bus.ub_usepolling;
 	bool isread = (req->bmRequestType & UT_READ) != 0;
+	uint8_t addr = UE_GET_ADDR(ed->bEndpointAddress);
 	int portno, ret;
 
+	KASSERT(addr == 0);
 	KASSERT(xfer->ux_rqflags & URQ_REQUEST);
 	KASSERT(dev->ud_myhsport != NULL);
 	portno = dev->ud_myhsport->up_portno;
@@ -585,7 +595,7 @@ vhci_device_ctrl_start(struct usbd_xfer 
 	mutex_enter(>lock);
 	if (port->status & UPS_PORT_ENABLED) {
 		xfer->ux_status = USBD_IN_PROGRESS;
-		vhci_pkt_create(port, xfer, isread);
+		vhci_pkt_create(port, xfer, isread, addr);
 		ret = USBD_IN_PROGRESS;
 	} else {
 		ret = USBD_IOERROR;
@@ -761,12 +771,19 @@ struct vhci_ioc_get_info {
 	/* Current port. */
 	u_int port;
 	int status;
+
+	/* Current addr. */
+	uint8_t addr;

CVS commit: src/sys/dev/ic

2020-03-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Mar 22 16:46:30 UTC 2020

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

Log Message:
do not assume that a bus_space_handle_t is simply an offset
now this has a fighting chance of working on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/ic/mvsata.c

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

Modified files:

Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.53 src/sys/dev/ic/mvsata.c:1.54
--- src/sys/dev/ic/mvsata.c:1.53	Wed Feb 19 16:04:39 2020
+++ src/sys/dev/ic/mvsata.c	Sun Mar 22 16:46:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.53 2020/02/19 16:04:39 riastradh Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.54 2020/03/22 16:46:30 macallan Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.53 2020/02/19 16:04:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.54 2020/03/22 16:46:30 macallan Exp $");
 
 #include "opt_mvsata.h"
 
@@ -669,7 +669,8 @@ mvsata_reset_channel(struct ata_channel 
 		const uint32_t val = SControl_IPM_NONE | SControl_SPD_ANY |
 		SControl_DET_DISABLE;
 
-		MVSATA_EDMA_WRITE_4(mvport, mvport->port_sata_scontrol, val);
+		bus_space_write_4(mvport->port_iot,
+		mvport->port_sata_scontrol, 0, val);
 
 		ctrl = MVSATA_EDMA_READ_4(mvport, SATA_SATAICFG);
 		ctrl &= ~(1 << 17);	/* Disable GenII */



CVS commit: src/sys/dev/ic

2020-03-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Mar 22 16:46:30 UTC 2020

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

Log Message:
do not assume that a bus_space_handle_t is simply an offset
now this has a fighting chance of working on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/ic/mvsata.c

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



CVS commit: src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 16:43:57 UTC 2020

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

Log Message:
Fix build failure.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/kern/vfs_vnode.c

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



CVS commit: src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 16:43:57 UTC 2020

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

Log Message:
Fix build failure.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/kern/vfs_vnode.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/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.114 src/sys/kern/vfs_vnode.c:1.115
--- src/sys/kern/vfs_vnode.c:1.114	Sun Mar 22 14:38:37 2020
+++ src/sys/kern/vfs_vnode.c	Sun Mar 22 16:43:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.114 2020/03/22 14:38:37 ad Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.115 2020/03/22 16:43:57 ad Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.114 2020/03/22 14:38:37 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.115 2020/03/22 16:43:57 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -1676,7 +1676,6 @@ vcache_reclaim(vnode_t *vp)
 		cpu_count(CPU_COUNT_FILEPAGES, vp->v_uobj.uo_npages);
 	}
 	vp->v_iflag &= ~(VI_TEXT|VI_EXECMAP);
-	vp->v_iflag |= VI_DEADCHECK; /* for genfs_getpages() */
 	mutex_exit(vp->v_interlock);
 	rw_exit(vp->v_uobj.vmobjlock);
 



CVS commit: src/sys/dev/usb

2020-03-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Mar 22 15:14:03 UTC 2020

Modified Files:
src/sys/dev/usb: vhci.c

Log Message:
clarify and explain


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/usb/vhci.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/usb/vhci.c
diff -u src/sys/dev/usb/vhci.c:1.8 src/sys/dev/usb/vhci.c:1.9
--- src/sys/dev/usb/vhci.c:1.8	Sat Mar 14 02:35:34 2020
+++ src/sys/dev/usb/vhci.c	Sun Mar 22 15:14:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vhci.c,v 1.8 2020/03/14 02:35:34 christos Exp $ */
+/*	$NetBSD: vhci.c,v 1.9 2020/03/22 15:14:03 maxv Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.8 2020/03/14 02:35:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.9 2020/03/22 15:14:03 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -123,10 +123,62 @@ static const struct usbd_pipe_methods vh
 	.upm_done =		vhci_root_intr_done,
 };
 
+/*
+ * There are three structures to understand: vxfers, packets, and ports.
+ *
+ * Each xfer from the point of view of the USB stack is a vxfer from the point
+ * of view of vHCI.
+ *
+ * A vxfer has a linked list containing a maximum of two packets: a request
+ * packet and possibly a data packet. Packets basically contain data exchanged
+ * between the Host and the virtual USB device. A packet is linked to both a
+ * vxfer and a port.
+ *
+ * A port is an abstraction of an actual USB port. Each virtual USB device gets
+ * connected to a port. A port has two lists:
+ *  - The Usb-To-Host list, containing packets to be fetched from the USB
+ *device and provided to the host.
+ *  - The Host-To-Usb list, containing packets to be sent from the Host to the
+ *USB device.
+ * Request packets are always in the H->U direction. Data packets however can
+ * be in both the H->U and U->H directions.
+ *
+ * With read() and write() operations on /dev/vhci, userland respectively
+ * "fetches" and "sends" packets from or to the virtual USB device, which
+ * respectively means reading/inserting packets in the H->U and U->H lists on
+ * the port where the virtual USB device is connected.
+ *
+ * ++
+ * | USB Stack  |
+ * +-^--+
+ *   |
+ * +-V--+
+ * | +++-+  |
+ * | | Request Packet || Data Packet | Xfer |
+ * | +---|++|---^+  |
+ * +-|--|---|---+
+ *   |  |   |
+ *   |   +--+   |
+ *   |   |  |
+ * +-|---|--|---+
+ * | +---V---V---++-|-+ |
+ * | | H->U List || U->H List |   vHCI Port |
+ * | +-|-++-^-+ |
+ * +---||---+
+ * ||
+ * +---||---+
+ * | +-V-++-|-+ |
+ * | |   read()  ||  write()  | vHCI FD |
+ * | +---++---+ |
+ * ++
+ */
+
+struct vhci_xfer;
+
 typedef struct vhci_packet {
 	TAILQ_ENTRY(vhci_packet) portlist;
 	TAILQ_ENTRY(vhci_packet) xferlist;
-	struct usbd_xfer *xfer; /* also vxfer */
+	struct vhci_xfer *vxfer;
 	bool utoh;
 	uint8_t *buf;
 	size_t size;
@@ -153,10 +205,14 @@ typedef struct vhci_xfer {
 	/* General. */
 	struct usbd_xfer xfer;
 
-	/* vHCI-specific. */
-	size_t refcnt;
+	/* Port where the xfer occurs. */
 	vhci_port_t *port;
+
+	/* Packets in the xfer. */
+	size_t npkts;
 	vhci_packet_list_t pkts;
+
+	/* Used for G/C. */
 	TAILQ_ENTRY(vhci_xfer) freelist;
 } vhci_xfer_t;
 
@@ -200,61 +256,61 @@ static void
 vhci_pkt_create(vhci_port_t *port, struct usbd_xfer *xfer, bool usb_to_host)
 {
 	vhci_xfer_t *vxfer = (vhci_xfer_t *)xfer;
-	vhci_packet_list_t *reqlist, *pktlist;
-	vhci_packet_t *req, *pkt = NULL;
-	size_t refcnt = 0;
+	vhci_packet_list_t *reqlist, *datlist;
+	vhci_packet_t *req, *dat = NULL;
+	size_t npkts = 0;
 
-	/* Setup packet. */
+	/* Request packet. */
 	reqlist = >pkts_device_ctrl.host_to_usb;
 	req = kmem_zalloc(sizeof(*req), KM_SLEEP);
-	req->xfer = xfer;
+	req->vxfer = vxfer;
 	req->utoh = false;
 	req->buf = (uint8_t *)>ux_request;
 	req->size = sizeof(xfer->ux_request);
 	

CVS commit: src/sys/dev/usb

2020-03-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Mar 22 15:14:03 UTC 2020

Modified Files:
src/sys/dev/usb: vhci.c

Log Message:
clarify and explain


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/usb/vhci.c

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



CVS commit: src/sys/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:43:05 UTC 2020

Modified Files:
src/sys/sys: param.h

Log Message:
NetBSD 9.99.51 - namecache changes


To generate a diff of this commit:
cvs rdiff -u -r1.653 -r1.654 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/sys/sys/param.h
diff -u src/sys/sys/param.h:1.653 src/sys/sys/param.h:1.654
--- src/sys/sys/param.h:1.653	Sun Mar 15 23:06:02 2020
+++ src/sys/sys/param.h	Sun Mar 22 14:43:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.653 2020/03/15 23:06:02 thorpej Exp $	*/
+/*	$NetBSD: param.h,v 1.654 2020/03/22 14:43:05 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999005000	/* NetBSD 9.99.50 */
+#define	__NetBSD_Version__	999005100	/* NetBSD 9.99.51 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:43:05 UTC 2020

Modified Files:
src/sys/sys: param.h

Log Message:
NetBSD 9.99.51 - namecache changes


To generate a diff of this commit:
cvs rdiff -u -r1.653 -r1.654 src/sys/sys/param.h

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



CVS commit: src/usr.bin/pmap

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:41:32 UTC 2020

Modified Files:
src/usr.bin/pmap: main.c pmap.c pmap.h

Log Message:
- Don't copy the entire namecache only to look up a few names.  Walk the
  data structures like cache_revlookup().

- nchash and mb_map are gone.  module_map replaced lkm_map.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/pmap/main.c
cvs rdiff -u -r1.54 -r1.55 src/usr.bin/pmap/pmap.c
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/pmap/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/usr.bin/pmap/main.c
diff -u src/usr.bin/pmap/main.c:1.27 src/usr.bin/pmap/main.c:1.28
--- src/usr.bin/pmap/main.c:1.27	Fri Sep 13 13:55:24 2019
+++ src/usr.bin/pmap/main.c	Sun Mar 22 14:41:32 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: main.c,v 1.27 2019/09/13 13:55:24 christos Exp $ */
+/*	$NetBSD: main.c,v 1.28 2020/03/22 14:41:32 ad Exp $ */
 
 /*
- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
+ * Copyright (c) 2002, 2003, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.27 2019/09/13 13:55:24 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.28 2020/03/22 14:41:32 ad Exp $");
 #endif
 
 #include 
@@ -54,11 +54,10 @@ __RCSID("$NetBSD: main.c,v 1.27 2019/09/
 #include "main.h"
 
 struct cache_head lcache;
-struct nchashhead *nchashtbl;
 void *uvm_vnodeops, *uvm_deviceops, *aobj_pager, *ubc_pager;
-struct vm_map *kmem_map, *mb_map, *phys_map, *exec_map, *pager_map;
-struct vm_map *st_map, *pt_map, *lkm_map, *buf_map;
-u_long nchash_addr, nchashtbl_addr, kernel_map_addr;
+struct vm_map *kmem_map, *phys_map, *exec_map, *pager_map;
+struct vm_map *st_map, *pt_map, *module_map, *buf_map;
+u_long kernel_map_addr;
 int debug, verbose, recurse, page_size;
 int print_all, print_map, print_maps, print_solaris, print_ddb;
 rlim_t maxssiz;
@@ -76,32 +75,26 @@ struct nlist ksyms[] = {
 #define NL_UBC_PAGER		4
 	{ "_kernel_map", 0, 0, 0, 0 },
 #define NL_KERNEL_MAP		5
-	{ "_nchashtbl", 0, 0, 0, 0 },
-#define NL_NCHASHTBL		6
-	{ "_nchash", 0, 0, 0, 0 },
-#define NL_NCHASH		7
 	{ NULL, 0, 0, 0, 0 }
 };
 
 struct nlist kmaps[] = {
 	{ "_kmem_map", 0, 0, 0, 0 },
 #define NL_kmem_map		0
-	{ "_mb_map", 0, 0, 0, 0 },
-#define NL_mb_map		1
 	{ "_phys_map", 0, 0, 0, 0 },
-#define NL_phys_map		2
+#define NL_phys_map		1
 	{ "_exec_map", 0, 0, 0, 0 },
-#define NL_exec_map		3
+#define NL_exec_map		2
 	{ "_pager_map", 0, 0, 0, 0 },
-#define NL_pager_map		4
+#define NL_pager_map		3
 	{ "_st_map", 0, 0, 0, 0 },
-#define NL_st_map		5
+#define NL_st_map		4
 	{ "_pt_map", 0, 0, 0, 0 },
-#define NL_pt_map		6
-	{ "_lkm_map", 0, 0, 0, 0 },
-#define NL_lkm_map		7
+#define NL_pt_map		5
+	{ "_module_map", 0, 0, 0, 0 },
+#define NL_module_map		6
 	{ "_buf_map", 0, 0, 0, 0 },
-#define NL_buf_map		8
+#define NL_buf_map		7
 	{ NULL, 0, 0, 0, 0 },
 };
 
@@ -398,12 +391,8 @@ load_symbols(kvm_t *kd)
 	aobj_pager =	(void*)ksyms[NL_AOBJ_PAGER].n_value;
 	ubc_pager =	(void*)ksyms[NL_UBC_PAGER].n_value;
 
-	nchash_addr =	ksyms[NL_NCHASH].n_value;
-
 	_KDEREF(kd, ksyms[NL_MAXSSIZ].n_value, ,
 		sizeof(maxssiz));
-	_KDEREF(kd, ksyms[NL_NCHASHTBL].n_value, _addr,
-	   sizeof(nchashtbl_addr));
 	_KDEREF(kd, ksyms[NL_KERNEL_MAP].n_value, _map_addr,
 		sizeof(kernel_map_addr));
 
@@ -420,13 +409,12 @@ load_symbols(kvm_t *kd)
 	} while (0/*CONSTCOND*/)
 
 	get_map_address(kmem_map);
-	get_map_address(mb_map);
 	get_map_address(phys_map);
 	get_map_address(exec_map);
 	get_map_address(pager_map);
 	get_map_address(st_map);
 	get_map_address(pt_map);
-	get_map_address(lkm_map);
+	get_map_address(module_map);
 	get_map_address(buf_map);
 
 	mib[0] = CTL_HW;
@@ -444,8 +432,6 @@ mapname(void *addr)
 		return ("kernel_map");
 	else if (addr == kmem_map)
 		return ("kmem_map");
-	else if (addr == mb_map)
-		return ("mb_map");
 	else if (addr == phys_map)
 		return ("phys_map");
 	else if (addr == exec_map)
@@ -456,83 +442,10 @@ mapname(void *addr)
 		return ("st_map");
 	else if (addr == pt_map)
 		return ("pt_map");
-	else if (addr == lkm_map)
-		return ("lkm_map");
+	else if (addr == module_map)
+		return ("module_map");
 	else if (addr == buf_map)
 		return ("buf_map");
 	else
 		return (NULL);
 }
-
-void
-load_name_cache(kvm_t *kd)
-{
-	struct namecache *ncp, *oncp;
-	union {
-		struct namecache ncp;
-		char buf[sizeof(*ncp) + USHRT_MAX];
-	} _n;
-#define _ncp _n.ncp
-	struct nchashhead _ncpp, *ncpp; 
-	u_long lnchash;
-	size_t nchash, i;
-
-	LIST_INIT();
-
-	_KDEREF(kd, nchash_addr, , sizeof(lnchash));
-	nchash = (size_t)lnchash + 1;
-	nchashtbl = ecalloc(nchash, sizeof(*nchashtbl));
-	_KDEREF(kd, nchashtbl_addr, nchashtbl, sizeof(*nchashtbl) * nchash);
-
-	ncpp = &_ncpp;
-
-	for (i = 0; i < nchash; i++) {
-		ncpp = [i];
-		oncp = NULL;
-		

CVS commit: src/usr.bin/pmap

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:41:32 UTC 2020

Modified Files:
src/usr.bin/pmap: main.c pmap.c pmap.h

Log Message:
- Don't copy the entire namecache only to look up a few names.  Walk the
  data structures like cache_revlookup().

- nchash and mb_map are gone.  module_map replaced lkm_map.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/pmap/main.c
cvs rdiff -u -r1.54 -r1.55 src/usr.bin/pmap/pmap.c
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/pmap/pmap.h

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



CVS commit: src/usr.bin/vmstat

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:39:29 UTC 2020

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
- nchash is gone.
- Report new namecache stats.


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/vmstat/vmstat.c

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



CVS commit: src/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:39:04 UTC 2020

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

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.104 -r1.105 src/sys/sys/namei.h

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



CVS commit: src/usr.bin/vmstat

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:39:29 UTC 2020

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
- nchash is gone.
- Report new namecache stats.


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/vmstat/vmstat.c

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

Modified files:

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.236 src/usr.bin/vmstat/vmstat.c:1.237
--- src/usr.bin/vmstat/vmstat.c:1.236	Sat Jan 25 05:43:32 2020
+++ src/usr.bin/vmstat/vmstat.c	Sun Mar 22 14:39:28 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.236 2020/01/25 05:43:32 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.237 2020/03/22 14:39:28 ad Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.236 2020/01/25 05:43:32 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.237 2020/03/22 14:39:28 ad Exp $");
 #endif
 #endif /* not lint */
 
@@ -227,15 +227,11 @@ struct nlist hashnl[] =
 	{ .n_name = "_in_ifaddrhash" },
 #define	X_IFADDRHASHTBL	9
 	{ .n_name = "_in_ifaddrhashtbl" },
-#define	X_NCHASH	10
-	{ .n_name = "_nchash" },
-#define	X_NCHASHTBL	11
-	{ .n_name = "_nchashtbl" },
-#define	X_NCVCACHEHASH	12
+#define	X_VCACHEHASH	10
 	{ .n_name = "_vcache_hashmask" },
-#define	X_NCVCACHETBL	13
+#define	X_VCACHETBL	11
 	{ .n_name = "_vcache_hashtab" },
-#define X_HASHNL_SIZE	14	/* must be last */
+#define X_HASHNL_SIZE	12	/* must be last */
 	{ .n_name = NULL },
 };
 
@@ -1124,6 +1120,8 @@ dosum(void)
 	(void)printf("%9" PRIu64 " 2passes\n", nch_stats.ncs_2passes);
 	(void)printf("%9" PRIu64 " reverse hits\n", nch_stats.ncs_revhits);
 	(void)printf("%9" PRIu64 " reverse miss\n", nch_stats.ncs_revmiss);
+	(void)printf("%9" PRIu64 " hash collisions\n", nch_stats.ncs_collisions);
+	(void)printf("%9" PRIu64 " access denied\n", nch_stats.ncs_denied);
 	(void)printf(
 	"%9s cache hits (%d%% pos + %d%% neg) system %d%% per-process\n",
 	"", PCT(nch_stats.ncs_goodhits, nchtotal),
@@ -1898,16 +1896,12 @@ struct kernel_hash {
 		X_IFADDRHASH, X_IFADDRHASHTBL,
 		HASH_LIST, offsetof(struct in_ifaddr, ia_hash),
 	}, {
-		"name cache hash",
-		X_NCHASH, X_NCHASHTBL,
-		HASH_LIST, offsetof(struct namecache, nc_hash),
-	}, {
 		"user info (uid -> used processes) hash",
 		X_UIHASH, X_UIHASHTBL,
 		HASH_LIST, offsetof(struct uidinfo, ui_hash),
 	}, {
 		"vnode cache hash",
-		X_NCVCACHEHASH, X_NCVCACHETBL,
+		X_VCACHEHASH, X_VCACHETBL,
 		HASH_SLIST, offsetof(struct vnode_impl, vi_hash),
 	}, {
 		NULL, -1, -1, 0, 0,



CVS commit: src/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:39:04 UTC 2020

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

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.104 -r1.105 src/sys/sys/namei.h

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

Modified files:

Index: src/sys/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.38 src/sys/rump/include/rump/rump_namei.h:1.39
--- src/sys/rump/include/rump/rump_namei.h:1.38	Wed Jan  8 12:06:09 2020
+++ src/sys/rump/include/rump/rump_namei.h	Sun Mar 22 14:39:03 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.38 2020/01/08 12:06:09 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.39 2020/03/22 14:39:03 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.48 2020/01/08 12:04:56 ad Exp 
+ *   from: NetBSD: namei.src,v 1.49 2020/03/22 14:38:37 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.104 src/sys/sys/namei.h:1.105
--- src/sys/sys/namei.h:1.104	Wed Jan  8 12:06:10 2020
+++ src/sys/sys/namei.h	Sun Mar 22 14:39:03 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.104 2020/01/08 12:06:10 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.105 2020/03/22 14:39:03 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.48 2020/01/08 12:04:56 ad Exp 
+ *   from: NetBSD: namei.src,v 1.49 2020/03/22 14:38:37 ad Exp 
  */
 
 /*
@@ -47,6 +47,7 @@
 
 #ifdef _KERNEL
 #include 
+#include 
 
 /*
  * Abstraction for a single pathname.
@@ -196,42 +197,43 @@ struct nameidata {
 #endif
 
 #ifdef __NAMECACHE_PRIVATE
+#include 
+
 /*
  * For simplicity (and economy of storage), names longer than
  * a maximum length of NCHNAMLEN are stored in non-pooled storage.
  */
-#define	NCHNAMLEN	32	/* up to this size gets stored in pool */
+#define	NCHNAMLEN	sizeof(((struct namecache *)NULL)->nc_name)
 
 /*
- * Namecache entry.  
- * This structure describes the elements in the cache of recent
- * names looked up by namei.
+ * Namecache entry.
+ *
+ * This structure describes the elements in the cache of recent names looked
+ * up by namei.  It's carefully sized to take up 128 bytes on _LP64, to make
+ * good use of space and the CPU caches.  Items used during RB tree lookup
+ * (nc_tree, nc_key) are clustered at the start of the structure.
  *
- * Locking rules:
+ * Field markings and their corresponding locks:
  *
- *  -   stable after initialization
- *  L   namecache_lock
- *  C   struct nchcpu::cpu_lock
- *  L/C insert needs L, read needs L or any C,
- *  must hold L and all C after (or during) delete before free
- *  N   struct namecache::nc_lock
+ * -  stable throught the lifetime of the namecache entry
+ * d  protected by nc_dvp->vi_ncdlock
+ * v  protected by nc_dvp->vi_ncvlock
+ * l  protected by cache_lru_lock
+ * u  accesses are unlocked, no serialization applied
  */
+struct nchnode;
 struct namecache {
-	LIST_ENTRY(namecache) nc_hash;	/* L/C hash chain */
-	TAILQ_ENTRY(namecache) nc_lru;	/* L pseudo-lru chain */
-	LIST_ENTRY(namecache) nc_dvlist;/* L dvp's list of cache entries */
-	TAILQ_ENTRY(namecache) nc_vlist;/* L vp's list of cache entries */
-	struct	vnode *nc_dvp;		/* N vnode of parent of name */
-	struct	vnode *nc_vp;		/* N vnode the name refers to */
-	void	*nc_gcqueue;		/* N queue for garbage collection */
-	kmutex_t nc_lock;		/*   lock on this entry */
-	int	nc_hittime;		/* N last time scored a hit */
-	int	nc_flags;		/* - copy of componentname ISWHITEOUT */
-	u_short	nc_nlen;		/* - length of name */
-	char	nc_name[0];		/* - segment name */
+	struct	rb_node nc_tree;	/* d  red-black tree, must be first */
+	int64_t	nc_key;			/* -  hash key */
+	TAILQ_ENTRY(namecache) nc_list;	/* v  vp's list of cache entries */
+	TAILQ_ENTRY(namecache) nc_lru;	/* l  pseudo-lru chain */
+	struct	vnode *nc_dvp;		/* -  vnode of parent of name */
+	struct	vnode *nc_vp;		/* -  vnode the name refers to */
+	int	nc_lrulist;		/* l  which LRU list its on */
+	short	nc_nlen;		/* -  length of the name */
+	char	nc_whiteout;		/* -  true if a whiteout */
+	char	nc_name[41];		/* -  segment name */
 };
-__CTASSERT((sizeof(struct namecache) + NCHNAMLEN)
-% __alignof(struct namecache) == 0);
 #endif
 
 #ifdef _KERNEL
@@ -294,14 +296,22 @@ bool	cache_lookup(struct vnode *, const 
 			int *, struct vnode **);
 bool	cache_lookup_raw(struct vnode *, const char *, size_t, uint32_t,
 			int *, struct vnode **);
-int	cache_revlookup(struct 

CVS commit: src/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:38:37 UTC 2020

Modified Files:
src/sys/kern: init_sysctl.c vfs_cache.c vfs_getcwd.c vfs_vnode.c
src/sys/sys: namei.src vnode_impl.h

Log Message:
Merge vfs_cache.c from the ad-namecache branch.  With this the namecache
index becomes per-directory (initially, a red-black tree).  The remaining
changes on the branch to namei()/getcwd() will be merged in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/kern/init_sysctl.c
cvs rdiff -u -r1.127 -r1.128 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/vfs_getcwd.c
cvs rdiff -u -r1.113 -r1.114 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.48 -r1.49 src/sys/sys/namei.src
cvs rdiff -u -r1.22 -r1.23 src/sys/sys/vnode_impl.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/kern/init_sysctl.c
diff -u src/sys/kern/init_sysctl.c:1.224 src/sys/kern/init_sysctl.c:1.225
--- src/sys/kern/init_sysctl.c:1.224	Sat Jan 18 14:40:03 2020
+++ src/sys/kern/init_sysctl.c	Sun Mar 22 14:38:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_sysctl.c,v 1.224 2020/01/18 14:40:03 skrll Exp $ */
+/*	$NetBSD: init_sysctl.c,v 1.225 2020/03/22 14:38:37 ad Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.224 2020/01/18 14:40:03 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.225 2020/03/22 14:38:37 ad Exp $");
 
 #include "opt_sysv.h"
 #include "opt_compat_netbsd.h"
@@ -732,7 +732,6 @@ sysctl_kern_maxvnodes(SYSCTLFN_ARGS)
 		return (error);
 	}
 	vfs_reinit();
-	nchreinit();
 
 	return (0);
 }

Index: src/sys/kern/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.127 src/sys/kern/vfs_cache.c:1.128
--- src/sys/kern/vfs_cache.c:1.127	Wed Jan  8 12:04:56 2020
+++ src/sys/kern/vfs_cache.c	Sun Mar 22 14:38:37 2020
@@ -1,9 +1,12 @@
-/*	$NetBSD: vfs_cache.c,v 1.127 2020/01/08 12:04:56 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.128 2020/03/22 14:38:37 ad Exp $	*/
 
 /*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -57,8 +60,119 @@
  *	@(#)vfs_cache.c	8.3 (Berkeley) 8/22/94
  */
 
+/*
+ * Name caching:
+ *
+ *	Names found by directory scans are retained in a cache for future
+ *	reference.  It is managed LRU, so frequently used names will hang
+ *	around.  The cache is indexed by hash value obtained from the name.
+ *
+ *	The name cache is the brainchild of Robert Elz and was introduced in
+ *	4.3BSD.  See "Using gprof to Tune the 4.2BSD Kernel", Marshall Kirk
+ *	McKusick, May 21 1984.
+ *
+ * Data structures:
+ *
+ *	Most Unix namecaches very sensibly use a global hash table to index
+ *	names.  The global hash table works well, but can cause concurrency
+ *	headaches for the kernel hacker.  In the NetBSD 10.0 implementation
+ *	we are not sensible, and use a per-directory data structure to index
+ *	names, but the cache otherwise functions the same.
+ *
+ *	The index is a red-black tree.  There are no special concurrency
+ *	requirements placed on it, because it's per-directory and protected
+ *	by the namecache's per-directory locks.  It should therefore not be
+ *	difficult to experiment with other types of index.
+ *
+ *	Each cached name is stored in a struct namecache, along with a
+ *	pointer to the associated vnode (nc_vp).  Names longer than a
+ *	maximum length of NCHNAMLEN are allocated with kmem_alloc(); they
+ *	occur infrequently, and names shorter than this are stored directly
+ *	in struct namecache.  If it is a "negative" entry, (i.e. for a name
+ *	that is known NOT to exist) the vnode pointer will be NULL.
+ *
+ *	For a directory with 3 cached names for 3 distinct vnodes, the
+ *	various vnodes and namecache structs would be connected like this
+ *	(the root is at the bottom of the diagram):
+ *
+ *  ...
+ *   ^
+ *   |- vi_nc_tree
+ *   |   
+ *  +o+   +-+   +-+
+ *  |  VDIR   |   |  VCHR   |   |  VREG   |
+ *  |  vnode  o-+ |  vnode  o-+ |  vnode  o--+
+ *  +-+ | +-+ | +-+  |
+ *   ^  |  ^  |  ^   |
+ *   |- nc_vp   |- vi_nc_list  |- nc_vp   |- vi_nc_list  |- nc_vp|
+ *   |  |  |  |  |   |
+ *  +o+ | 

CVS commit: src/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:38:37 UTC 2020

Modified Files:
src/sys/kern: init_sysctl.c vfs_cache.c vfs_getcwd.c vfs_vnode.c
src/sys/sys: namei.src vnode_impl.h

Log Message:
Merge vfs_cache.c from the ad-namecache branch.  With this the namecache
index becomes per-directory (initially, a red-black tree).  The remaining
changes on the branch to namei()/getcwd() will be merged in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/kern/init_sysctl.c
cvs rdiff -u -r1.127 -r1.128 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/vfs_getcwd.c
cvs rdiff -u -r1.113 -r1.114 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.48 -r1.49 src/sys/sys/namei.src
cvs rdiff -u -r1.22 -r1.23 src/sys/sys/vnode_impl.h

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



CVS commit: src

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:27:33 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/sys: Makefile vnode_impl.h

Log Message:
Wrap vnode_impl.h in defined(_KERNEL) || defined(_KMEMUSER), and install
it for kmem grovellers.


To generate a diff of this commit:
cvs rdiff -u -r1.2312 -r1.2313 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.171 -r1.172 src/sys/sys/Makefile
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/vnode_impl.h

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2312 src/distrib/sets/lists/comp/mi:1.2313
--- src/distrib/sets/lists/comp/mi:1.2312	Tue Mar  3 00:38:12 2020
+++ src/distrib/sets/lists/comp/mi	Sun Mar 22 14:27:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2312 2020/03/03 00:38:12 christos Exp $
+#	$NetBSD: mi,v 1.2313 2020/03/22 14:27:33 ad Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -3216,6 +3216,7 @@
 ./usr/include/sys/vmmeter.h			comp-c-include
 ./usr/include/sys/vnode.h			comp-c-include
 ./usr/include/sys/vnode_if.h			comp-c-include
+./usr/include/sys/vnode_impl.h			comp-c-include
 ./usr/include/sys/vsio.h			comp-obsolete		obsolete
 ./usr/include/sys/wait.h			comp-c-include
 ./usr/include/sys/wapbl.h			comp-c-include

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.171 src/sys/sys/Makefile:1.172
--- src/sys/sys/Makefile:1.171	Sat Dec 14 15:30:37 2019
+++ src/sys/sys/Makefile	Sun Mar 22 14:27:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.171 2019/12/14 15:30:37 ad Exp $
+#	$NetBSD: Makefile,v 1.172 2020/03/22 14:27:33 ad Exp $
 
 .include 
 
@@ -45,7 +45,7 @@ INCS=	acct.h agpio.h aio.h ansi.h aout_m
 	timex.h tls.h trace.h tree.h tty.h ttychars.h ttycom.h \
 	ttydefaults.h ttydev.h types.h \
 	ucontext.h ucred.h uio.h un.h unistd.h unpcb.h utsname.h uuid.h \
-	verified_exec.h videoio.h vmmeter.h vnode.h vnode_if.h \
+	verified_exec.h videoio.h vmmeter.h vnode.h vnode_if.h vnode_impl.h \
 	wait.h wapbl.h wapbl_replay.h wdog.h xattr.h
 
 INCSYMLINKS=\

Index: src/sys/sys/vnode_impl.h
diff -u src/sys/sys/vnode_impl.h:1.21 src/sys/sys/vnode_impl.h:1.22
--- src/sys/sys/vnode_impl.h:1.21	Sun Feb 23 22:14:04 2020
+++ src/sys/sys/vnode_impl.h	Sun Mar 22 14:27:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode_impl.h,v 1.21 2020/02/23 22:14:04 ad Exp $	*/
+/*	$NetBSD: vnode_impl.h,v 1.22 2020/03/22 14:27:33 ad Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2019, 2020 The NetBSD Foundation, Inc.
@@ -28,6 +28,7 @@
 
 #ifndef _SYS_VNODE_IMPL_H_
 #define	_SYS_VNODE_IMPL_H_
+#if defined(_KERNEL) || defined(_KMEMUSER)
 
 #include 
 
@@ -143,4 +144,5 @@ int	vcache_vget(vnode_t *);
 int	vcache_tryvget(vnode_t *);
 int	vfs_drainvnodes(void);
 
-#endif /* !_SYS_VNODE_IMPL_H_ */
+#endif	/* defined(_KERNEL) || defined(_KMEMUSER) */
+#endif	/* !_SYS_VNODE_IMPL_H_ */



CVS commit: src

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:27:33 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/sys: Makefile vnode_impl.h

Log Message:
Wrap vnode_impl.h in defined(_KERNEL) || defined(_KMEMUSER), and install
it for kmem grovellers.


To generate a diff of this commit:
cvs rdiff -u -r1.2312 -r1.2313 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.171 -r1.172 src/sys/sys/Makefile
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/vnode_impl.h

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



CVS commit: [ad-namecache] src/sys/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:23:27 UTC 2020

Modified Files:
src/sys/sys [ad-namecache]: vnode_impl.h

Log Message:
Keeping the namecache lock next to the vnode lock has a repeatable
detrimental effect.  So shuffle some stuff around in vnode_impl to save
a bit of space, and give the namecache locks their own cache line.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.5 -r1.19.2.6 src/sys/sys/vnode_impl.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/sys/vnode_impl.h
diff -u src/sys/sys/vnode_impl.h:1.19.2.5 src/sys/sys/vnode_impl.h:1.19.2.6
--- src/sys/sys/vnode_impl.h:1.19.2.5	Fri Jan 24 16:05:23 2020
+++ src/sys/sys/vnode_impl.h	Sun Mar 22 14:23:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode_impl.h,v 1.19.2.5 2020/01/24 16:05:23 ad Exp $	*/
+/*	$NetBSD: vnode_impl.h,v 1.19.2.6 2020/03/22 14:23:27 ad Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2019, 2020 The NetBSD Foundation, Inc.
@@ -76,6 +76,19 @@ struct vnode_impl {
 	struct vcache_key vi_key;		/* c   vnode cache key */
 
 	/*
+	 * vnode cache, LRU and syncer.  This all changes with some
+	 * regularity so keep it together.
+	 */
+	struct vnodelst	*vi_lrulisthd;		/* d   current lru list head */
+	TAILQ_ENTRY(vnode_impl) vi_lrulist;	/* d   lru list */
+	int 		vi_synclist_slot;	/* s   synclist slot index */
+	int 		vi_lrulisttm;		/* i   time of lru enqueue */
+	TAILQ_ENTRY(vnode_impl) vi_synclist;	/* s   vnodes with dirty bufs */
+	SLIST_ENTRY(vnode_impl) vi_hash;	/* c   vnode cache list */
+	enum vnode_state vi_state;		/* i   current state */
+	TAILQ_ENTRY(vnode_impl) vi_mntvnodes;	/* m   vnodes for mount point */
+
+	/*
 	 * Namecache.  Give it a separate line so activity doesn't impinge
 	 * on the stable stuff.
 	 */
@@ -88,27 +101,14 @@ struct vnode_impl {
 	uint32_t	vi_nc_spare;		/* -   spare (padding) */
 
 	/*
-	 * vnode cache, LRU and syncer.  This all changes with some
-	 * regularity so keep it together.
-	 */
-	struct vnodelst	*vi_lrulisthd		/* d   current lru list head */
-	__aligned(COHERENCY_UNIT);
-	TAILQ_ENTRY(vnode_impl) vi_lrulist;	/* d   lru list */
-	int 		vi_synclist_slot;	/* s   synclist slot index */
-	int 		vi_lrulisttm;		/* i   time of lru enqueue */
-	TAILQ_ENTRY(vnode_impl) vi_synclist;	/* s   vnodes with dirty bufs */
-	SLIST_ENTRY(vnode_impl) vi_hash;	/* c   vnode cache list */
-	enum vnode_state vi_state;		/* i   current state */
-
-	/*
 	 * Locks and expensive to access items which can be expected to
 	 * generate a cache miss.
 	 */
 	krwlock_t	vi_lock			/* -   lock for this vnode */
 	__aligned(COHERENCY_UNIT);
-	krwlock_t	vi_nc_lock;		/* -   lock on node */
+	krwlock_t	vi_nc_lock		/* -   lock on node */
+	__aligned(COHERENCY_UNIT);
 	krwlock_t	vi_nc_listlock;		/* -   lock on nn_list */
-	TAILQ_ENTRY(vnode_impl) vi_mntvnodes;	/* m   vnodes for mount point */
 };
 typedef struct vnode_impl vnode_impl_t;
 



CVS commit: [ad-namecache] src/sys/sys

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:23:27 UTC 2020

Modified Files:
src/sys/sys [ad-namecache]: vnode_impl.h

Log Message:
Keeping the namecache lock next to the vnode lock has a repeatable
detrimental effect.  So shuffle some stuff around in vnode_impl to save
a bit of space, and give the namecache locks their own cache line.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.5 -r1.19.2.6 src/sys/sys/vnode_impl.h

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



CVS commit: [ad-namecache] src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:16:50 UTC 2020

Modified Files:
src/sys/kern [ad-namecache]: vfs_cache.c

Log Message:
Resurrect the counter stuff from HEAD, which tries to deal with 32-bit
counter rollover.  Drive it by sysctl and/or callout every 5 minutes,
since there's no garbage collection kthread any more.


To generate a diff of this commit:
cvs rdiff -u -r1.126.2.16 -r1.126.2.17 src/sys/kern/vfs_cache.c

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



CVS commit: [ad-namecache] src/sys/kern

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 14:16:50 UTC 2020

Modified Files:
src/sys/kern [ad-namecache]: vfs_cache.c

Log Message:
Resurrect the counter stuff from HEAD, which tries to deal with 32-bit
counter rollover.  Drive it by sysctl and/or callout every 5 minutes,
since there's no garbage collection kthread any more.


To generate a diff of this commit:
cvs rdiff -u -r1.126.2.16 -r1.126.2.17 src/sys/kern/vfs_cache.c

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

Modified files:

Index: src/sys/kern/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.126.2.16 src/sys/kern/vfs_cache.c:1.126.2.17
--- src/sys/kern/vfs_cache.c:1.126.2.16	Sun Mar 22 01:58:22 2020
+++ src/sys/kern/vfs_cache.c	Sun Mar 22 14:16:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.126.2.16 2020/03/22 01:58:22 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.126.2.17 2020/03/22 14:16:50 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -153,9 +153,10 @@
  *	and the definition of "struct vnode" for the particulars.
  *
  *	Per-CPU statistics, and LRU list totals are read unlocked, since
- *	an approximate value is OK.  We maintain uintptr_t sized per-CPU
- *	counters and 64-bit global counters under the theory that uintptr_t
- *	sized counters are less likely to be hosed by nonatomic increment.
+ *	an approximate value is OK.  We maintain 32-bit sized per-CPU
+ *	counters and 64-bit global counters under the theory that 32-bit
+ *	sized counters are less likely to be hosed by nonatomic increment
+ *	(on 32-bit platforms).
  *
  *	The lock order is:
  *
@@ -171,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.16 2020/03/22 01:58:22 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.17 2020/03/22 14:16:50 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -180,6 +181,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,
 #endif
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -199,15 +202,13 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,
 #include 
 
 static void	cache_activate(struct namecache *);
+static void	cache_update_stats(void *);
 static int	cache_compare_key(void *, const void *, const void *);
 static int	cache_compare_nodes(void *, const void *, const void *);
 static void	cache_deactivate(void);
 static void	cache_reclaim(void);
 static int	cache_stat_sysctl(SYSCTLFN_ARGS);
 
-/* Per-CPU counters. */
-struct nchstats_percpu _NAMEI_CACHE_STATS(uintptr_t);
-
 /* Global pool cache. */
 static pool_cache_t cache_pool __read_mostly;
 
@@ -225,8 +226,15 @@ static struct {
 
 static kmutex_t cache_lru_lock __cacheline_aligned;
 
-/* Cache effectiveness statistics.  This holds total from per-cpu stats */
-struct nchstats	nchstats __cacheline_aligned;
+/* Cache effectiveness statistics.  nchstats holds system-wide total. */
+struct nchstats	nchstats;
+struct nchstats_percpu _NAMEI_CACHE_STATS(uint32_t);
+struct nchcpu {
+	struct nchstats_percpu cur;
+	struct nchstats_percpu last;
+};
+static callout_t cache_stat_callout;
+static kmutex_t cache_stat_lock __cacheline_aligned;
 
 #define	COUNT(f)	do { \
 	lwp_t *l = curlwp; \
@@ -235,6 +243,12 @@ struct nchstats	nchstats __cacheline_ali
 	KPREEMPT_ENABLE(l); \
 } while (/* CONSTCOND */ 0);
 
+#define	UPDATE(nchcpu, f) do { \
+	uint32_t cur = atomic_load_relaxed(>cur.f); \
+	nchstats.f += cur - nchcpu->last.f; \
+	nchcpu->last.f = cur; \
+} while (/* CONSTCOND */ 0)
+
 /*
  * Tunables.  cache_maxlen replaces the historical doingcache:
  * set it zero to disable caching for debugging purposes.
@@ -242,6 +256,7 @@ struct nchstats	nchstats __cacheline_ali
 int cache_lru_maxdeact __read_mostly = 2;	/* max # to deactivate */
 int cache_lru_maxscan __read_mostly = 64;	/* max # to scan/reclaim */
 int cache_maxlen __read_mostly = USHRT_MAX;	/* max name length to cache */
+int cache_stat_interval __read_mostly = 300;	/* in seconds */
 
 /* sysctl */
 static struct	sysctllog *cache_sysctllog;
@@ -1000,6 +1015,11 @@ nchinit(void)
 	TAILQ_INIT(_lru.list[LRU_ACTIVE]);
 	TAILQ_INIT(_lru.list[LRU_INACTIVE]);
 
+	mutex_init(_stat_lock, MUTEX_DEFAULT, IPL_NONE);
+	callout_init(_stat_callout, CALLOUT_MPSAFE);
+	callout_setfunc(_stat_callout, cache_update_stats, NULL);
+	callout_schedule(_stat_callout, cache_stat_interval * hz);
+
 	KASSERT(cache_sysctllog == NULL);
 	sysctl_createv(_sysctllog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT,
@@ -1362,6 +1382,41 @@ namecache_count_2passes(void)
 }
 
 /*
+ * Sum the stats from all CPUs into nchstats.  This needs to run at least
+ * once within every window where a 32-bit counter could roll over.  It's
+ * called regularly by timer to ensure this.
+ */
+static void
+cache_update_stats(void *cookie)
+{
+	CPU_INFO_ITERATOR cii;
+	struct cpu_info *ci;
+
+	mutex_enter(_stat_lock);
+	for (CPU_INFO_FOREACH(cii, ci)) {
+		struct nchcpu *nchcpu = ci->ci_data.cpu_nch;
+		

CVS commit: src

2020-03-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 22 13:30:11 UTC 2020

Modified Files:
src/lib/librumpuser: rumpuser_dl.c
src/sys/rump/include/rump: rumpuser.h
src/sys/rump/librump/rumpkern: rump.c

Log Message:
Teach rump to process __link_set_evcnts entries.  (Second part of
fix for PR kern/55088)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/librumpuser/rumpuser_dl.c
cvs rdiff -u -r1.115 -r1.116 src/sys/rump/include/rump/rumpuser.h
cvs rdiff -u -r1.342 -r1.343 src/sys/rump/librump/rumpkern/rump.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/librumpuser/rumpuser_dl.c
diff -u src/lib/librumpuser/rumpuser_dl.c:1.32 src/lib/librumpuser/rumpuser_dl.c:1.33
--- src/lib/librumpuser/rumpuser_dl.c:1.32	Sat Mar 21 04:48:37 2020
+++ src/lib/librumpuser/rumpuser_dl.c	Sun Mar 22 13:30:10 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $	*/
+/*  $NetBSD: rumpuser_dl.c,v 1.33 2020/03/22 13:30:10 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -40,15 +40,12 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $");
+__RCSID("$NetBSD: rumpuser_dl.c,v 1.33 2020/03/22 13:30:10 pgoyette Exp $");
 #endif /* !lint */
 
 #include 
 #include 
-
-#ifdef NOTYET
 #include 
-#endif
 
 #include 
 
@@ -353,7 +350,8 @@ getsymbols(struct link_map *map, int ism
 
 static void
 process_object(void *handle,
-	rump_modinit_fn domodinit, rump_compload_fn docompload)
+	rump_modinit_fn domodinit, rump_compload_fn docompload,
+	rump_evcntattach_fn doevcntattach)
 {
 	const struct modinfo *const *mi_start, *const *mi_end;
 	struct rump_component *const *rc, *const *rc_end;
@@ -362,9 +360,7 @@ process_object(void *handle,
 	typedef void sysctl_setup_func(struct sysctllog **);
 	sysctl_setup_func *const *sfp, *const *sfp_end;
 
-#ifdef NOTYET	/* We don't yet handle link_set_evcnts */
 	struct evcnt *const *evp, *const *evp_end;
-#endif
 
 	mi_start = dlsym(handle, "__start_link_set_modules");
 	mi_end = dlsym(handle, "__stop_link_set_modules");
@@ -388,16 +384,14 @@ process_object(void *handle,
 		assert(sfp == sfp_end);
 	}
 
-#ifdef NOTYET
 	/* handle link_set_evcnts */
 	evp = dlsym(handle, "__start_link_set_evcnts");
 	evp_end = dlsym(handle, "__stop_link_set_evcnts");
 	if (evp && evp_end) {
 		for (; evp < evp_end; evp++)
-			evcnt_attach_static(*evp);
+			doevcntattach(*evp);
 		assert(evp == evp_end);
 	}
-#endif
 }
 
 /*
@@ -406,7 +400,8 @@ process_object(void *handle,
  */
 void
 rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
-	rump_symload_fn symload, rump_compload_fn compload)
+	rump_symload_fn symload, rump_compload_fn compload,
+	rump_evcntattach_fn doevcntattach)
 {
 	struct link_map *map, *origmap, *mainmap;
 	void *mainhandle;
@@ -501,7 +496,7 @@ rumpuser_dl_bootstrap(rump_modinit_fn do
 			if (handle == NULL)
 continue;
 		}
-		process_object(handle, domodinit, compload);
+		process_object(handle, domodinit, compload, doevcntattach);
 		if (map != mainmap)
 			dlclose(handle);
 	}
@@ -512,7 +507,8 @@ rumpuser_dl_bootstrap(rump_modinit_fn do
  */
 void
 rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
-	rump_symload_fn symload, rump_compload_fn compload)
+	rump_symload_fn symload, rump_compload_fn compload,
+	rump_evcntattach_fn doevcntattach)
 {
 
 	return;

Index: src/sys/rump/include/rump/rumpuser.h
diff -u src/sys/rump/include/rump/rumpuser.h:1.115 src/sys/rump/include/rump/rumpuser.h:1.116
--- src/sys/rump/include/rump/rumpuser.h:1.115	Wed Dec 27 09:01:53 2017
+++ src/sys/rump/include/rump/rumpuser.h	Sun Mar 22 13:30:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.h,v 1.115 2017/12/27 09:01:53 ozaki-r Exp $	*/
+/*	$NetBSD: rumpuser.h,v 1.116 2020/03/22 13:30:10 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2007-2013 Antti Kantee.  All Rights Reserved.
@@ -224,10 +224,13 @@ void rumpuser_cv_has_waiters(struct rump
 
 struct modinfo;
 struct rump_component;
+struct evcnt;
 typedef void (*rump_modinit_fn)(const struct modinfo *const *, size_t);
 typedef int (*rump_symload_fn)(void *, uint64_t, char *, uint64_t);
 typedef void (*rump_compload_fn)(const struct rump_component *);
-void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn);
+typedef void (*rump_evcntattach_fn)(struct evcnt *);
+void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn,
+rump_evcntattach_fn);
 
 /*
  * misc management

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.342 src/sys/rump/librump/rumpkern/rump.c:1.343
--- src/sys/rump/librump/rumpkern/rump.c:1.342	Sat Feb 22 21:45:34 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Sun Mar 22 13:30:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $	*/
+/*	$NetBSD: 

CVS commit: src

2020-03-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 22 13:30:11 UTC 2020

Modified Files:
src/lib/librumpuser: rumpuser_dl.c
src/sys/rump/include/rump: rumpuser.h
src/sys/rump/librump/rumpkern: rump.c

Log Message:
Teach rump to process __link_set_evcnts entries.  (Second part of
fix for PR kern/55088)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/librumpuser/rumpuser_dl.c
cvs rdiff -u -r1.115 -r1.116 src/sys/rump/include/rump/rumpuser.h
cvs rdiff -u -r1.342 -r1.343 src/sys/rump/librump/rumpkern/rump.c

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



CVS commit: src/sys/arch/xen

2020-03-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Mar 22 11:20:59 UTC 2020

Modified Files:
src/sys/arch/xen/include: xennet_checksum.h
src/sys/arch/xen/xen: if_xennet_xenbus.c xennet_checksum.c
xennetback_xenbus.c

Log Message:
actually in data_validated case, there is no need to inspect the data for Rx,
simply set the supported csum offload flags to skip the software csum
verification


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/xen/include/xennet_checksum.h
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/xen/xennet_checksum.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/xennetback_xenbus.c

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



CVS commit: src/sys/arch/xen

2020-03-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Mar 22 11:20:59 UTC 2020

Modified Files:
src/sys/arch/xen/include: xennet_checksum.h
src/sys/arch/xen/xen: if_xennet_xenbus.c xennet_checksum.c
xennetback_xenbus.c

Log Message:
actually in data_validated case, there is no need to inspect the data for Rx,
simply set the supported csum offload flags to skip the software csum
verification


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/xen/include/xennet_checksum.h
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/xen/xennet_checksum.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/xennetback_xenbus.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/xen/include/xennet_checksum.h
diff -u src/sys/arch/xen/include/xennet_checksum.h:1.3 src/sys/arch/xen/include/xennet_checksum.h:1.4
--- src/sys/arch/xen/include/xennet_checksum.h:1.3	Wed Mar 18 19:23:12 2020
+++ src/sys/arch/xen/include/xennet_checksum.h	Sun Mar 22 11:20:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xennet_checksum.h,v 1.3 2020/03/18 19:23:12 jdolecek Exp $	*/
+/*	$NetBSD: xennet_checksum.h,v 1.4 2020/03/22 11:20:59 jdolecek Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -32,6 +32,6 @@
 struct ifnet;
 struct mbuf;
 
-int xennet_checksum_fill(struct ifnet *, struct mbuf *, bool);
+int xennet_checksum_fill(struct ifnet *, struct mbuf *);
 
 #endif /* !_XEN_XENNET_CHECKSUM_H_ */

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.93 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.94
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.93	Sun Mar 22 00:11:02 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sun Mar 22 11:20:59 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.93 2020/03/22 00:11:02 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.94 2020/03/22 11:20:59 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.93 2020/03/22 00:11:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.94 2020/03/22 11:20:59 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -1128,10 +1128,10 @@ again:
 			m->m_ext.ext_paddr = pa;
 			m->m_flags |= M_EXT_RW; /* we own the buffer */
 		}
-		if ((rx->flags & (NETRXF_csum_blank|NETRXF_data_validated))) {
-			xennet_checksum_fill(ifp, m,
-			((rx->flags & NETRXF_data_validated) != 0));
-		}
+		if (rx->flags & NETRXF_csum_blank)
+			xennet_checksum_fill(ifp, m);
+		else if (rx->flags & NETRXF_data_validated)
+			m->m_pkthdr.csum_flags = XN_M_CSUM_SUPPORTED;
 		/* free req may overwrite *rx, better doing it late */
 		xennet_rx_free_req(req);
 

Index: src/sys/arch/xen/xen/xennet_checksum.c
diff -u src/sys/arch/xen/xen/xennet_checksum.c:1.9 src/sys/arch/xen/xen/xennet_checksum.c:1.10
--- src/sys/arch/xen/xen/xennet_checksum.c:1.9	Sun Mar 22 00:11:02 2020
+++ src/sys/arch/xen/xen/xennet_checksum.c	Sun Mar 22 11:20:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xennet_checksum.c,v 1.9 2020/03/22 00:11:02 jdolecek Exp $	*/
+/*	$NetBSD: xennet_checksum.c,v 1.10 2020/03/22 11:20:59 jdolecek Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.9 2020/03/22 00:11:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.10 2020/03/22 11:20:59 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -56,12 +56,9 @@ static struct evcnt xn_cksum_defer = EVC
 NULL, "xennet", "csum blank");
 static struct evcnt xn_cksum_undefer = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
 NULL, "xennet", "csum undeferred");
-static struct evcnt xn_cksum_valid = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
-NULL, "xennet", "csum data valid");
 
 EVCNT_ATTACH_STATIC(xn_cksum_defer);
 EVCNT_ATTACH_STATIC(xn_cksum_undefer);
-EVCNT_ATTACH_STATIC(xn_cksum_valid);
 
 #ifdef XENNET_DEBUG
 /* ratecheck(9) for checksum validation failures */
@@ -82,7 +79,7 @@ m_extract(struct mbuf *m, int off, int l
  * for hw offload to do it
  */
 int
-xennet_checksum_fill(struct ifnet *ifp, struct mbuf *m, bool data_validated)
+xennet_checksum_fill(struct ifnet *ifp, struct mbuf *m)
 {
 	const struct ether_header *eh;
 	struct ip *iph = NULL;
@@ -193,51 +190,46 @@ xennet_checksum_fill(struct ifnet *ifp, 
 #ifdef XENNET_DEBUG
 		static struct timeval lasttime;
 		if (ratecheck(, _cksum_errintvl))
-			printf("%s: unknown proto %d passed%s\n",
-			ifp->if_xname, nxt,
-			data_validated ? "" : " no checksum");
+			printf("%s: unknown proto %d passed no checksum\n",
+			ifp->if_xname, nxt);
 #endif /* XENNET_DEBUG */
 		error = EINVAL;
 		goto out;
 	}
 	}
 
-	if (!data_validated) {
-		/*
-		 * Only compute the checksum if 

  1   2   >