CVS commit: src/share/man/man4

2020-04-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Apr 12 02:04:13 UTC 2020

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

Log Message:
Add NetBSD CVS tag.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/uxrcom.4

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

Modified files:

Index: src/share/man/man4/uxrcom.4
diff -u src/share/man/man4/uxrcom.4:1.1 src/share/man/man4/uxrcom.4:1.2
--- src/share/man/man4/uxrcom.4:1.1	Sun Apr 12 01:10:54 2020
+++ src/share/man/man4/uxrcom.4	Sun Apr 12 02:04:12 2020
@@ -1,3 +1,4 @@
+.\"	$NetBSD: uxrcom.4,v 1.2 2020/04/12 02:04:12 simonb Exp $
 .\"	$OpenBSD: uxrcom.4,v 1.1 2019/03/27 22:11:21 kettenis Exp $
 .\"
 .\" Copyright (c) 2019 Mark Kettenis 



CVS commit: src/sys/modules/ufs

2020-04-11 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Sun Apr 12 01:39:57 UTC 2020

Modified Files:
src/sys/modules/ufs: Makefile

Log Message:
Remove ufs_wapbl.c from Makefile.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/ufs/Makefile

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

Modified files:

Index: src/sys/modules/ufs/Makefile
diff -u src/sys/modules/ufs/Makefile:1.2 src/sys/modules/ufs/Makefile:1.3
--- src/sys/modules/ufs/Makefile:1.2	Mon Aug 19 09:31:31 2019
+++ src/sys/modules/ufs/Makefile	Sun Apr 12 01:39:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2019/08/19 09:31:31 christos Exp $
+#	$NetBSD: Makefile,v 1.3 2020/04/12 01:39:57 htodd Exp $
 
 .include "../Makefile.inc"
 
@@ -12,7 +12,7 @@ CWARNFLAGS.clang=	-Wno-conversion
 .PATH:	${S}/ufs/ufs
 SRCS=	ufs_bmap.c ufs_dirhash.c ufs_extattr.c ufs_inode.c \
 	ufs_lookup.c ufs_quota.c ufs_quota1.c ufs_quota2.c ufs_rename.c \
-	ufs_vfsops.c ufs_vnops.c ufs_wapbl.c quota1_subr.c quota2_subr.c
+	ufs_vfsops.c ufs_vnops.c quota1_subr.c quota2_subr.c
 
 WARNS=	3
 



CVS commit: src/sys/dev/acpi

2020-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 12 01:11:23 UTC 2020

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

Log Message:
Revert acpi_ec.c 1.77.

We will do this another way.

ok msaitoh


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/acpi/acpi_ec.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_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.77 src/sys/dev/acpi/acpi_ec.c:1.78
--- src/sys/dev/acpi/acpi_ec.c:1.77	Tue Aug  6 01:53:47 2019
+++ src/sys/dev/acpi/acpi_ec.c	Sun Apr 12 01:11:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.77 2019/08/06 01:53:47 msaitoh Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.78 2020/04/12 01:11:23 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.77 2019/08/06 01:53:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.78 2020/04/12 01:11:23 riastradh Exp $");
 
 #include 
 #include 
@@ -679,15 +679,20 @@ acpiec_space_handler(uint32_t func, ACPI
 	if (func == ACPI_READ)
 		*value = 0;
 
-	for (addr = paddr; addr < (paddr + width / 8); addr++, reg++) {
-		if (func == ACPI_READ)
+	do {
+		switch (func) {
+		case ACPI_READ:
 			rv = acpiec_read(dv, addr, reg);
-		else
+			break;
+		case ACPI_WRITE:
 			rv = acpiec_write(dv, addr, *reg);
-
+			break;
+		}
 		if (rv != AE_OK)
 			break;
-	}
+		addr++;
+		reg++;
+	} while (addr < (paddr + width / 8));
 
 	return rv;
 }



CVS commit: src/sys/dev/acpi

2020-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 12 01:12:03 UTC 2020

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

Log Message:
Reject overly large widths, from mlelstv.

We are returning an ACPI_INTEGER (= uint64_t), so it doesn't make
sense to handle more than 64 bits.

Apparently there are some ACPIs out there that ask for unreasonably
large widths here.  Just reject those requests, rather than writing
past the caller's stack buffer.

Previously we attempted to fix this by copying byte by byte as large
as the caller asked, in order to avoid the undefined behaviour of
shifting past the size of ACPI_INTEGER, but that just turned a shift
(which might have been harmless on real machines) into a stack buffer
overflow (!).

ok msaitoh


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/acpi/acpi_ec.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_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.80 src/sys/dev/acpi/acpi_ec.c:1.81
--- src/sys/dev/acpi/acpi_ec.c:1.80	Sun Apr 12 01:11:52 2020
+++ src/sys/dev/acpi/acpi_ec.c	Sun Apr 12 01:12:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.80 2020/04/12 01:11:52 riastradh Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.81 2020/04/12 01:12:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.80 2020/04/12 01:11:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.81 2020/04/12 01:12:03 riastradh Exp $");
 
 #include 
 #include 
@@ -662,8 +662,8 @@ acpiec_space_handler(uint32_t func, ACPI
 	uint8_t addr, reg;
 	unsigned int i;
 
-	if (paddr > 0xff || width % 8 != 0 || value == NULL || arg == NULL ||
-	paddr + width / 8 > 0x100)
+	if (paddr > 0xff || width % 8 != 0 || width > sizeof(ACPI_INTEGER)*8 ||
+	value == NULL || arg == NULL || paddr + width / 8 > 0x100)
 		return AE_BAD_PARAMETER;
 
 	addr = paddr;



CVS commit: src/sys/dev/acpi

2020-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 12 01:11:52 UTC 2020

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

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/acpi/acpi_ec.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_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.79 src/sys/dev/acpi/acpi_ec.c:1.80
--- src/sys/dev/acpi/acpi_ec.c:1.79	Sun Apr 12 01:11:43 2020
+++ src/sys/dev/acpi/acpi_ec.c	Sun Apr 12 01:11:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.79 2020/04/12 01:11:43 riastradh Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.80 2020/04/12 01:11:52 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.79 2020/04/12 01:11:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.80 2020/04/12 01:11:52 riastradh Exp $");
 
 #include 
 #include 
@@ -404,6 +404,7 @@ post_data_map:
 static bool
 acpiec_suspend(device_t dv, const pmf_qual_t *qual)
 {
+
 	acpiec_cold = true;
 
 	return true;
@@ -412,6 +413,7 @@ acpiec_suspend(device_t dv, const pmf_qu
 static bool
 acpiec_resume(device_t dv, const pmf_qual_t *qual)
 {
+
 	acpiec_cold = false;
 
 	return true;
@@ -454,9 +456,10 @@ acpiec_parse_gpe_package(device_t self, 
 		ACPI_FREE(p);
 		return false;
 	}
-	
+
 	if (p->Package.Count != 2) {
-		aprint_error_dev(self, "_GPE package does not contain 2 elements\n");
+		aprint_error_dev(self,
+		"_GPE package does not contain 2 elements\n");
 		ACPI_FREE(p);
 		return false;
 	}
@@ -511,6 +514,7 @@ static ACPI_STATUS
 acpiec_space_setup(ACPI_HANDLE region, uint32_t func, void *arg,
 void **region_arg)
 {
+
 	if (func == ACPI_REGION_DEACTIVATE)
 		*region_arg = NULL;
 	else
@@ -528,9 +532,11 @@ acpiec_lock(device_t dv)
 	mutex_enter(>sc_access_mtx);
 
 	if (sc->sc_need_global_lock) {
-		rv = AcpiAcquireGlobalLock(EC_LOCK_TIMEOUT, >sc_global_lock);
+		rv = AcpiAcquireGlobalLock(EC_LOCK_TIMEOUT,
+		>sc_global_lock);
 		if (rv != AE_OK) {
-			aprint_error_dev(dv, "failed to acquire global lock: %s\n",
+			aprint_error_dev(dv,
+			"failed to acquire global lock: %s\n",
 			AcpiFormatException(rv));
 			return;
 		}
@@ -546,7 +552,8 @@ acpiec_unlock(device_t dv)
 	if (sc->sc_need_global_lock) {
 		rv = AcpiReleaseGlobalLock(sc->sc_global_lock);
 		if (rv != AE_OK) {
-			aprint_error_dev(dv, "failed to release global lock: %s\n",
+			aprint_error_dev(dv,
+			"failed to release global lock: %s\n",
 			AcpiFormatException(rv));
 		}
 	}
@@ -587,7 +594,8 @@ acpiec_read(device_t dv, uint8_t addr, u
 	} else if (cv_timedwait(>sc_cv, >sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(>sc_mtx);
 		acpiec_unlock(dv);
-		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
+		aprint_error_dev(dv,
+		"command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
 	}
 
@@ -634,7 +642,8 @@ acpiec_write(device_t dv, uint8_t addr, 
 	} else if (cv_timedwait(>sc_cv, >sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(>sc_mtx);
 		acpiec_unlock(dv);
-		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
+		aprint_error_dev(dv,
+		"command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
 	}
 
@@ -674,7 +683,7 @@ acpiec_space_handler(uint32_t func, ACPI
 		break;
 	case ACPI_WRITE:
 		for (i = 0; i < width; i += 8, ++addr) {
-			reg = (*value >>i) & 0xff;
+			reg = (*value >> i) & 0xff;
 			rv = acpiec_write(dv, addr, reg);
 			if (rv != AE_OK)
 break;
@@ -867,7 +876,8 @@ acpiec_bus_read(device_t dv, u_int addr,
 ACPI_STATUS
 acpiec_bus_write(device_t dv, u_int addr, ACPI_INTEGER val, int width)
 {
-	return acpiec_space_handler(ACPI_WRITE, addr, width * 8, , dv, NULL);
+	return acpiec_space_handler(ACPI_WRITE, addr, width * 8, , dv,
+	NULL);
 }
 
 ACPI_HANDLE



CVS commit: src/sys/dev/acpi

2020-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 12 01:11:43 UTC 2020

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

Log Message:
Revert acpi_ec.c 1.76.

We will do this another way, and separate KNF fixes from the critical
functional change.

ok msaitoh


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/acpi/acpi_ec.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_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.78 src/sys/dev/acpi/acpi_ec.c:1.79
--- src/sys/dev/acpi/acpi_ec.c:1.78	Sun Apr 12 01:11:23 2020
+++ src/sys/dev/acpi/acpi_ec.c	Sun Apr 12 01:11:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.78 2020/04/12 01:11:23 riastradh Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.79 2020/04/12 01:11:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.78 2020/04/12 01:11:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.79 2020/04/12 01:11:43 riastradh Exp $");
 
 #include 
 #include 
@@ -404,7 +404,6 @@ post_data_map:
 static bool
 acpiec_suspend(device_t dv, const pmf_qual_t *qual)
 {
-
 	acpiec_cold = true;
 
 	return true;
@@ -413,7 +412,6 @@ acpiec_suspend(device_t dv, const pmf_qu
 static bool
 acpiec_resume(device_t dv, const pmf_qual_t *qual)
 {
-
 	acpiec_cold = false;
 
 	return true;
@@ -456,10 +454,9 @@ acpiec_parse_gpe_package(device_t self, 
 		ACPI_FREE(p);
 		return false;
 	}
-
+	
 	if (p->Package.Count != 2) {
-		aprint_error_dev(self,
-		"_GPE package does not contain 2 elements\n");
+		aprint_error_dev(self, "_GPE package does not contain 2 elements\n");
 		ACPI_FREE(p);
 		return false;
 	}
@@ -514,7 +511,6 @@ static ACPI_STATUS
 acpiec_space_setup(ACPI_HANDLE region, uint32_t func, void *arg,
 void **region_arg)
 {
-
 	if (func == ACPI_REGION_DEACTIVATE)
 		*region_arg = NULL;
 	else
@@ -532,11 +528,9 @@ acpiec_lock(device_t dv)
 	mutex_enter(>sc_access_mtx);
 
 	if (sc->sc_need_global_lock) {
-		rv = AcpiAcquireGlobalLock(EC_LOCK_TIMEOUT,
-		>sc_global_lock);
+		rv = AcpiAcquireGlobalLock(EC_LOCK_TIMEOUT, >sc_global_lock);
 		if (rv != AE_OK) {
-			aprint_error_dev(dv,
-			"failed to acquire global lock: %s\n",
+			aprint_error_dev(dv, "failed to acquire global lock: %s\n",
 			AcpiFormatException(rv));
 			return;
 		}
@@ -552,8 +546,7 @@ acpiec_unlock(device_t dv)
 	if (sc->sc_need_global_lock) {
 		rv = AcpiReleaseGlobalLock(sc->sc_global_lock);
 		if (rv != AE_OK) {
-			aprint_error_dev(dv,
-			"failed to release global lock: %s\n",
+			aprint_error_dev(dv, "failed to release global lock: %s\n",
 			AcpiFormatException(rv));
 		}
 	}
@@ -594,8 +587,7 @@ acpiec_read(device_t dv, uint8_t addr, u
 	} else if (cv_timedwait(>sc_cv, >sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(>sc_mtx);
 		acpiec_unlock(dv);
-		aprint_error_dev(dv,
-		"command takes over %d sec...\n", EC_CMD_TIMEOUT);
+		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
 	}
 
@@ -642,8 +634,7 @@ acpiec_write(device_t dv, uint8_t addr, 
 	} else if (cv_timedwait(>sc_cv, >sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(>sc_mtx);
 		acpiec_unlock(dv);
-		aprint_error_dev(dv,
-		"command takes over %d sec...\n", EC_CMD_TIMEOUT);
+		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
 	}
 
@@ -657,42 +648,43 @@ static ACPI_STATUS
 acpiec_space_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS paddr,
 uint32_t width, ACPI_INTEGER *value, void *arg, void *region_arg)
 {
-	device_t dv = arg;
+	device_t dv;
 	ACPI_STATUS rv;
-	uint8_t addr;
-	uint8_t *reg;
+	uint8_t addr, reg;
+	unsigned int i;
 
-	if ((func != ACPI_READ) && (func != ACPI_WRITE)) {
-		aprint_error("%s: invalid Address Space function called: %x\n",
-		device_xname(dv), (unsigned int)func);
-		return AE_BAD_PARAMETER;
-	}
 	if (paddr > 0xff || width % 8 != 0 || value == NULL || arg == NULL ||
 	paddr + width / 8 > 0x100)
 		return AE_BAD_PARAMETER;
 
 	addr = paddr;
-	reg = (uint8_t *)value;
+	dv = arg;
 
 	rv = AE_OK;
 
-	if (func == ACPI_READ)
+	switch (func) {
+	case ACPI_READ:
 		*value = 0;
-
-	do {
-		switch (func) {
-		case ACPI_READ:
-			rv = acpiec_read(dv, addr, reg);
-			break;
-		case ACPI_WRITE:
-			rv = acpiec_write(dv, addr, *reg);
-			break;
+		for (i = 0; i < width; i += 8, ++addr) {
+			rv = acpiec_read(dv, addr, );
+			if (rv != AE_OK)
+break;
+			*value |= (ACPI_INTEGER)reg << i;
+		}
+		break;
+	case ACPI_WRITE:
+		for (i = 0; i < width; i += 8, ++addr) {
+			reg = (*value >>i) & 0xff;
+			rv = acpiec_write(dv, addr, reg);
+			if (rv != AE_OK)
+break;
 		}
-		if (rv != AE_OK)
-			break;
-		addr++;
-		reg++;
-	} while (addr < (paddr + width / 8));
+		break;
+	default:
+		aprint_error("%s: invalid Address Space function called: %x\n",
+		

CVS commit: src

2020-04-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Apr 12 01:10:54 UTC 2020

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile ucom.4
src/sys/dev/usb: files.usb ukyopon.c umodem.c umodem_common.c
usbdevices.config usbdevs
Added Files:
src/share/man/man4: uxrcom.4
src/sys/dev/usb: uxrcom.c

Log Message:
Add uxrcom driver for Exar XR21V141x USB serial adapters.  Based in part
on the OpenBSD single-port XR21V1410 uxrcom driver, but adds support
for multi-port chipsets and uses the common umodem framework instead of
being a standalone driver.

Thanks to skrll@ for much USB clue and mrg@ for financing the
development of this driver.


To generate a diff of this commit:
cvs rdiff -u -r1.1686 -r1.1687 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.703 -r1.704 src/share/man/man4/Makefile
cvs rdiff -u -r1.27 -r1.28 src/share/man/man4/ucom.4
cvs rdiff -u -r0 -r1.1 src/share/man/man4/uxrcom.4
cvs rdiff -u -r1.172 -r1.173 src/sys/dev/usb/files.usb
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/usb/ukyopon.c
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/usb/umodem.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/umodem_common.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/usbdevices.config
cvs rdiff -u -r1.780 -r1.781 src/sys/dev/usb/usbdevs
cvs rdiff -u -r0 -r1.1 src/sys/dev/usb/uxrcom.c

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1686 src/distrib/sets/lists/man/mi:1.1687
--- src/distrib/sets/lists/man/mi:1.1686	Sat Apr  4 15:39:16 2020
+++ src/distrib/sets/lists/man/mi	Sun Apr 12 01:10:53 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1686 2020/04/04 15:39:16 jdolecek Exp $
+# $NetBSD: mi,v 1.1687 2020/04/12 01:10:53 simonb Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1957,6 +1957,7 @@
 ./usr/share/man/cat4/uvideo.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uvisor.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uvscom.0			man-sys-catman		.cat
+./usr/share/man/cat4/uxrcom.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uyap.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uyurex.0			man-obsolete		obsolete
 ./usr/share/man/cat4/vald.0			man-sys-catman		.cat
@@ -5101,6 +5102,7 @@
 ./usr/share/man/html4/uvideo.html		man-sys-htmlman		html
 ./usr/share/man/html4/uvisor.html		man-sys-htmlman		html
 ./usr/share/man/html4/uvscom.html		man-sys-htmlman		html
+./usr/share/man/html4/uxrcom.html		man-sys-htmlman		html
 ./usr/share/man/html4/uyap.html			man-sys-htmlman		html
 ./usr/share/man/html4/uyurex.html		man-obsolete		obsolete
 ./usr/share/man/html4/vald.html			man-sys-htmlman		html
@@ -8169,6 +8171,7 @@
 ./usr/share/man/man4/uvideo.4			man-sys-man		.man
 ./usr/share/man/man4/uvisor.4			man-sys-man		.man
 ./usr/share/man/man4/uvscom.4			man-sys-man		.man
+./usr/share/man/man4/uxrcom.4			man-sys-man		.man
 ./usr/share/man/man4/uyap.4			man-sys-man		.man
 ./usr/share/man/man4/uyurex.4			man-obsolete		obsolete
 ./usr/share/man/man4/vald.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.703 src/share/man/man4/Makefile:1.704
--- src/share/man/man4/Makefile:1.703	Sat Apr  4 15:39:13 2020
+++ src/share/man/man4/Makefile	Sun Apr 12 01:10:54 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.703 2020/04/04 15:39:13 jdolecek Exp $
+#	$NetBSD: Makefile,v 1.704 2020/04/12 01:10:54 simonb Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -87,8 +87,8 @@ MAN+=	atu.4 aubtfwl.4 aue.4 axe.4 axen.4
 	ulpt.4 umass.4 umcs.4 umct.4 umidi.4 umodem.4 ums.4 upgt.4 upl.4 \
 	uplcom.4 ure.4 url.4 urndis.4 urtw.4 urtwn.4 \
 	usb.4 usbnet.4 uscanner.4 uslsa.4 usmsc.4 usscanner.4 \
-	ustir.4 uthum.4 utoppy.4 uts.4 uvideo.4 uvisor.4 uvscom.4 uyap.4 \
-	xhci.4 \
+	ustir.4 uthum.4 utoppy.4 uts.4 uvideo.4 uvisor.4 uvscom.4 uxrcom.4 \
+	uyap.4 xhci.4 \
 
 # Ir devices
 MAN+=	irframe.4 cir.4 irframetty.4 oboe.4

Index: src/share/man/man4/ucom.4
diff -u src/share/man/man4/ucom.4:1.27 src/share/man/man4/ucom.4:1.28
--- src/share/man/man4/ucom.4:1.27	Sun May  5 00:12:34 2019
+++ src/share/man/man4/ucom.4	Sun Apr 12 01:10:54 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: ucom.4,v 1.27 2019/05/05 00:12:34 pgoyette Exp $
+.\" $NetBSD: ucom.4,v 1.28 2020/04/12 01:10:54 simonb Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -50,6 +50,7 @@
 .Cd "ucom* at uslsa?"
 .Cd "ucom* at uvisor? portno ?"
 .Cd "ucom* at uvscom?"
+.Cd "ucom* at uxrcom?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -103,7 +104,8 @@ are used for dial-out.
 .Xr usb 4 ,
 .Xr uslsa 4 ,
 .Xr uvisor 4 ,
-.Xr uvscom 4
+.Xr uvscom 4 ,
+.Xr uxrcom 4
 .Sh HISTORY
 The
 .Nm

Index: src/sys/dev/usb/files.usb
diff -u src/sys/dev/usb/files.usb:1.172 src/sys/dev/usb/files.usb:1.173
--- src/sys/dev/usb/files.usb:1.172	Sun Feb  9 15:46:15 2020

CVS commit: src/sys/rump/fs/lib/libffs

2020-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 00:04:45 UTC 2020

Modified Files:
src/sys/rump/fs/lib/libffs: Makefile

Log Message:
remove removed file


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/rump/fs/lib/libffs/Makefile

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/fs/lib/libffs/Makefile
diff -u src/sys/rump/fs/lib/libffs/Makefile:1.16 src/sys/rump/fs/lib/libffs/Makefile:1.17
--- src/sys/rump/fs/lib/libffs/Makefile:1.16	Mon Oct 19 12:16:35 2015
+++ src/sys/rump/fs/lib/libffs/Makefile	Sat Apr 11 20:04:45 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2015/10/19 16:16:35 pooka Exp $
+#	$NetBSD: Makefile,v 1.17 2020/04/12 00:04:45 christos Exp $
 #
 
 .PATH:  ${.CURDIR}/../../../../ufs/ffs ${.CURDIR}/../../../../ufs/ufs
@@ -11,7 +11,7 @@ SRCS=	ffs_alloc.c ffs_appleufs.c ffs_bal
 	ffs_wapbl.c ffs_quota2.c
 
 SRCS+=	ufs_bmap.c ufs_dirhash.c ufs_extattr.c ufs_inode.c	\
-	ufs_lookup.c ufs_rename.c ufs_vfsops.c ufs_vnops.c ufs_wapbl.c \
+	ufs_lookup.c ufs_rename.c ufs_vfsops.c ufs_vnops.c	\
 	ufs_quota.c ufs_quota2.c quota2_subr.c
 
 CPPFLAGS+=	-DFFS_EI -DUFS_DIRHASH -DWAPBL -DAPPLE_UFS -DUFS_EXTATTR \



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

2020-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 11 22:41:06 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: ppccap.c
src/crypto/external/bsd/openssl/dist/crypto/sha: keccak1600.c
src/crypto/external/bsd/openssl/dist/crypto/sha/asm:
keccak1600-ppc64.pl keccak1600p8-ppc.pl
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc:
keccak1600p8-ppc.S sha.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64:
keccak1600-ppc64.S keccak1600p8-ppc.S

Log Message:
We can only use the SHA3 assembly routines if we have VSX


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/crypto/external/bsd/openssl/dist/crypto/ppccap.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/openssl/dist/crypto/sha/keccak1600.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/openssl/dist/crypto/sha/asm/keccak1600-ppc64.pl \
src/crypto/external/bsd/openssl/dist/crypto/sha/asm/keccak1600p8-ppc.pl
cvs rdiff -u -r1.1 -r1.2 \

src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/keccak1600p8-ppc.S
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha.inc
cvs rdiff -u -r1.1 -r1.2 \

src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/keccak1600-ppc64.S 
\

src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/keccak1600p8-ppc.S

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/ppccap.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/ppccap.c:1.12 src/crypto/external/bsd/openssl/dist/crypto/ppccap.c:1.13
--- src/crypto/external/bsd/openssl/dist/crypto/ppccap.c:1.12	Sat Mar 21 20:53:02 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/ppccap.c	Sat Apr 11 18:41:06 2020
@@ -160,6 +160,37 @@ void ecp_nistz256_from_mont(unsigned lon
 }
 #endif
 
+size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len,
+size_t r);
+void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r);
+
+size_t SHA3_absorb_default(uint64_t A[5][5], const unsigned char *inp,
+size_t len, size_t r);
+void SHA3_squeeze_default(uint64_t A[5][5], unsigned char *out, size_t len,
+size_t r);
+
+size_t SHA3_absorb_vsx(uint64_t A[5][5], const unsigned char *inp,
+size_t len, size_t r);
+void SHA3_squeeze_vsx(uint64_t A[5][5], unsigned char *out, size_t len,
+size_t r);
+
+size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len,
+size_t r)
+{
+return OPENSSL_ppccap_P & PPC_CRYPTO207
+? SHA3_absorb_vsx(A, inp, len, r)
+: SHA3_absorb_default(A, inp, len, r);
+}
+
+void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r)
+{
+OPENSSL_ppccap_P & PPC_CRYPTO207
+? SHA3_absorb_vsx(A, out, len, r)
+: SHA3_squeeze_default(A, out, len, r);
+}
+
+
+
 static sigjmp_buf ill_jmp;
 static void ill_handler(int sig)
 {

Index: src/crypto/external/bsd/openssl/dist/crypto/sha/keccak1600.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/sha/keccak1600.c:1.1.1.2 src/crypto/external/bsd/openssl/dist/crypto/sha/keccak1600.c:1.2
--- src/crypto/external/bsd/openssl/dist/crypto/sha/keccak1600.c:1.1.1.2	Sun Jun  9 13:47:44 2019
+++ src/crypto/external/bsd/openssl/dist/crypto/sha/keccak1600.c	Sat Apr 11 18:41:06 2020
@@ -11,6 +11,12 @@
 #include 
 #include 
 
+#ifdef __powerpc__
+#define SHA3_absorb SHA3_absorb_default
+#define SHA3_squeeze SHA3_squeeze_default
+#undef KECCAK1600_ASM
+#endif
+
 size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len,
size_t r);
 void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r);

Index: src/crypto/external/bsd/openssl/dist/crypto/sha/asm/keccak1600-ppc64.pl
diff -u src/crypto/external/bsd/openssl/dist/crypto/sha/asm/keccak1600-ppc64.pl:1.1.1.2 src/crypto/external/bsd/openssl/dist/crypto/sha/asm/keccak1600-ppc64.pl:1.2
--- src/crypto/external/bsd/openssl/dist/crypto/sha/asm/keccak1600-ppc64.pl:1.1.1.2	Sat Mar 21 20:49:11 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/sha/asm/keccak1600-ppc64.pl	Sat Apr 11 18:41:06 2020
@@ -405,10 +405,10 @@ dword_le_load:
 	.long	0
 .size	dword_le_load,.-dword_le_load
 
-.globl	SHA3_absorb
-.type	SHA3_absorb,\@function
+.globl	SHA3_absorb_vsx
+.type	SHA3_absorb_vsx,\@function
 .align	5
-SHA3_absorb:
+SHA3_absorb_vsx:
 	$STU	$sp,-$FRAME($sp)
 	mflr	r0
 	$PUSH	r14,`$FRAME-$SIZE_T*18`($sp)
@@ -627,15 +627,15 @@ SHA3_absorb:
 	.long	0
 	.byte	0,12,4,1,0x80,18,4,0
 	.long	0
-.size	SHA3_absorb,.-SHA3_absorb
+.size	SHA3_absorb_vsx,.-SHA3_absorb_vsx
 ___
 {
 my ($A_flat,$out,$len,$bsz) = map("r$_",(28..31));
 $code.=<<___;
-.globl	SHA3_squeeze
-.type	SHA3_squeeze,\@function
+.globl	SHA3_squeeze_vsx
+.type	SHA3_squeeze_vsx,\@function
 .align	5
-SHA3_squeeze:

CVS commit: [bouyer-xenpvh] src/sys/arch/x86/x86

2020-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Apr 11 21:21:49 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [bouyer-xenpvh]: mainbus.c

Log Message:
Attach hypervisor earlier, so that ISA/PCI emulated device are disabled
before we probe them.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.12.1 src/sys/arch/x86/x86/mainbus.c

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

Modified files:

Index: src/sys/arch/x86/x86/mainbus.c
diff -u src/sys/arch/x86/x86/mainbus.c:1.3 src/sys/arch/x86/x86/mainbus.c:1.3.12.1
--- src/sys/arch/x86/x86/mainbus.c:1.3	Thu Feb 14 08:18:25 2019
+++ src/sys/arch/x86/x86/mainbus.c	Sat Apr 11 21:21:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $ */
+/* $NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $ */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3.12.1 2020/04/11 21:21:49 bouyer Exp $");
 
 #include 
 #include 
@@ -225,17 +225,17 @@ mainbus_attach(device_t parent, device_t
 #endif /* XENPV */
 		x86_cpubus_attach(self);
 
-#if defined(__i386__) && !defined(XENPV)
-		i386_mainbus_attach(parent, self, aux);
-#elif defined(__x86_64__) && !defined(XENPV)
-		amd64_mainbus_attach(parent, self, aux);
-#endif
 #if defined(XENPV)
 	}
 #endif /* XENPV */
 #if defined(XEN)
 	xen_mainbus_attach(parent, self, aux);
 #endif
+#if defined(__i386__) && !defined(XENPV)
+	i386_mainbus_attach(parent, self, aux);
+#elif defined(__x86_64__) && !defined(XENPV)
+	amd64_mainbus_attach(parent, self, aux);
+#endif
 }
 
 int



CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen

2020-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Apr 11 21:21:16 UTC 2020

Modified Files:
src/sys/arch/xen/xen [bouyer-xenpvh]: hypervisor.c

Log Message:
Use some PIO magic to disable qemu emulated disks and network device
when PVHVM is configured. From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/arch/xen/xen/hypervisor.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/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.73.2.1 src/sys/arch/xen/xen/hypervisor.c:1.73.2.2
--- src/sys/arch/xen/xen/hypervisor.c:1.73.2.1	Wed Apr  8 17:59:17 2020
+++ src/sys/arch/xen/xen/hypervisor.c	Sat Apr 11 21:21:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.73.2.1 2020/04/08 17:59:17 bouyer Exp $ */
+/* $NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.1 2020/04/08 17:59:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $");
 
 #include 
 #include 
@@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -191,6 +192,15 @@ int xen_version;
 static bool hypervisor_suspend(device_t, const pmf_qual_t *);
 static bool hypervisor_resume(device_t, const pmf_qual_t *);
 
+/* from FreeBSD */
+#define XEN_MAGIC_IOPORT 0x10
+enum {
+	XMI_MAGIC= 0x49d2,
+	XMI_UNPLUG_IDE_DISKS = 0x01,
+	XMI_UNPLUG_NICS  = 0x02,
+	XMI_UNPLUG_IDE_EXCEPT_PRI_MASTER = 0x04
+}; 
+
 /*
  * Probe for the hypervisor; always succeeds.
  */
@@ -415,7 +425,7 @@ hypervisor_match(device_t parent, cfdata
 	bi.common.len = sizeof(struct btinfo_rootdevice);
 
 	/* From i386/multiboot.c */
-	/*	$NetBSD: hypervisor.c,v 1.73.2.1 2020/04/08 17:59:17 bouyer Exp $	*/
+	/*	$NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $	*/
 	int i, len;
 	vaddr_t data;
 	extern struct bootinfo	bootinfo;
@@ -434,6 +444,13 @@ hypervisor_match(device_t parent, cfdata
 		bip->bi_nentries++;
 	}
 
+	/* disable emulated devices */
+	if (inw(XEN_MAGIC_IOPORT) == XMI_MAGIC) {
+		outw(XEN_MAGIC_IOPORT, XMI_UNPLUG_IDE_DISKS | XMI_UNPLUG_NICS);
+	} else {
+		aprint_error("%s: Unable to disable emulated devices\n",
+		haa->haa_busname);
+	}
 #endif /* XENPVHVM */
 
 	/* If we got here, it must mean we matched */



CVS commit: src/lib/libc/gdtoa

2020-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 11 20:48:53 UTC 2020

Modified Files:
src/lib/libc/gdtoa: hdtoa.c

Log Message:
fix tyop


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gdtoa/hdtoa.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/libc/gdtoa/hdtoa.c
diff -u src/lib/libc/gdtoa/hdtoa.c:1.10 src/lib/libc/gdtoa/hdtoa.c:1.11
--- src/lib/libc/gdtoa/hdtoa.c:1.10	Sat Apr 11 16:28:28 2020
+++ src/lib/libc/gdtoa/hdtoa.c	Sat Apr 11 16:48:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdtoa.c,v 1.10 2020/04/11 20:28:28 christos Exp $	*/
+/*	$NetBSD: hdtoa.c,v 1.11 2020/04/11 20:48:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 David Schultz 
@@ -30,7 +30,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.4 2007/01/03 04:57:58 das Exp $");
 #else
-__RCSID("$NetBSD: hdtoa.c,v 1.10 2020/04/11 20:28:28 christos Exp $");
+__RCSID("$NetBSD: hdtoa.c,v 1.11 2020/04/11 20:48:53 christos Exp $");
 #endif
 
 #include 
@@ -348,7 +348,7 @@ hldtoa(long double e, const char *xdigs,
 	 * (partial) nibble, which is dealt with by the next
 	 * statement.  We also tack on the implicit normalization bit.
 	 */
-	*s = (u.extu_ext.ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4))) 0xf;
+	*s = (u.extu_ext.ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4))) & 0xf;
 
 	/* If ndigits < 0, we are expected to auto-size the precision. */
 	if (ndigits < 0) {



CVS commit: src/lib/libc/gdtoa

2020-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 11 20:28:28 UTC 2020

Modified Files:
src/lib/libc/gdtoa: hdtoa.c

Log Message:
Via enh at google dot com in tech-userlevel. Fix handling of
EXT_FRAC{H,L}BITS (although we don't need to since we don't have them).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/gdtoa/hdtoa.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/libc/gdtoa/hdtoa.c
diff -u src/lib/libc/gdtoa/hdtoa.c:1.9 src/lib/libc/gdtoa/hdtoa.c:1.10
--- src/lib/libc/gdtoa/hdtoa.c:1.9	Mon Jul  4 07:46:41 2011
+++ src/lib/libc/gdtoa/hdtoa.c	Sat Apr 11 16:28:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdtoa.c,v 1.9 2011/07/04 11:46:41 mrg Exp $	*/
+/*	$NetBSD: hdtoa.c,v 1.10 2020/04/11 20:28:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 David Schultz 
@@ -30,7 +30,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.4 2007/01/03 04:57:58 das Exp $");
 #else
-__RCSID("$NetBSD: hdtoa.c,v 1.9 2011/07/04 11:46:41 mrg Exp $");
+__RCSID("$NetBSD: hdtoa.c,v 1.10 2020/04/11 20:28:28 christos Exp $");
 #endif
 
 #include 
@@ -310,23 +310,34 @@ hldtoa(long double e, const char *xdigs,
 	 */
 	for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
 		*s = 0;
-	for (; s > s0 + sigfigs - (EXT_FRACLBITS / 4) - 1 && s > s0; s--) {
+	for (; s > s0 + sigfigs -
+	(EXT_FRACLBITS / 4) - 1 && s > s0; s--) {
 		*s = u.extu_ext.ext_fracl & 0xf;
 		u.extu_ext.ext_fracl >>= 4;
 	}
 #ifdef EXT_FRACHMBITS
-	for (; s > s0; s--) {
+	for (; s > s0 + sigfigs - 
+	((EXT_FRACLBITS + EXT_FRACHMBITS) / 4) - 1; s--) {
 		*s = u.extu_ext.ext_frachm & 0xf;
 		u.extu_ext.ext_frachm >>= 4;
 	}
+#else
+#define EXT_FRACHMBITS 0
 #endif
+
 #ifdef EXT_FRACLMBITS
-	for (; s > s0; s--) {
+	for (; s > s0 + sigfigs -
+	((EXT_FRACLBITS + EXT_FRACHMBITS + EXT_FRACLMBITS) / 4) - 1; s--) {
+
 		*s = u.extu_ext.ext_fraclm & 0xf;
 		u.extu_ext.ext_fraclm >>= 4;
 	}
+#else
+#define EXT_FRACLMBITS 0
 #endif
-	for (; s > s0; s--) {
+
+	for (; s > s0 + sigfigs -
+	((EXT_FRACLBITS + EXT_FRACHMBITS + EXT_FRACLMBITS + EXT_FRACHBITS) / 4) - 1; s--) {
 		*s = u.extu_ext.ext_frach & 0xf;
 		u.extu_ext.ext_frach >>= 4;
 	}
@@ -337,7 +348,7 @@ hldtoa(long double e, const char *xdigs,
 	 * (partial) nibble, which is dealt with by the next
 	 * statement.  We also tack on the implicit normalization bit.
 	 */
-	*s = u.extu_ext.ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4));
+	*s = (u.extu_ext.ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4))) 0xf;
 
 	/* If ndigits < 0, we are expected to auto-size the precision. */
 	if (ndigits < 0) {



CVS commit: [bouyer-xenpvh] src/sys/arch

2020-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Apr 11 18:26:08 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64 [bouyer-xenpvh]: lock_stubs.S spl.S
src/sys/arch/i386/i386 [bouyer-xenpvh]: spl.S
src/sys/arch/x86/conf [bouyer-xenpvh]: files.x86
src/sys/arch/x86/include [bouyer-xenpvh]: intr.h
src/sys/arch/x86/x86 [bouyer-xenpvh]: intr.c x86_machdep.c
src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen
src/sys/arch/xen/include [bouyer-xenpvh]: intrdefs.h
src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_ipi.c xenfunc.c
src/sys/arch/xen/xen [bouyer-xenpvh]: clock.c
Added Files:
src/sys/arch/x86/x86 [bouyer-xenpvh]: x86_softintr.c

Log Message:
Move softint and preemtion-related functions out of x86/x86/intr.c to
  its own file, x86/x86/x86_softintr.c
Add x86/x86/x86_softintr.c for native and XenPV
Make sure XenPV also check ci_ioending, which is used for softints.
Switch XenPV to fast softints and allow kernel preemption.
kpreempt_disable() before calling pmap_changeprot_local()
run  xen_wallclock_time() and xen_global_systime_ns() at splshed() to
  avoid being interrupted.

XXX amd64 lock stubs are racy for XPENDING


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.43.4.4 -r1.43.4.5 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.50.4.3 -r1.50.4.4 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.107 -r1.107.10.1 src/sys/arch/x86/conf/files.x86
cvs rdiff -u -r1.61.6.1 -r1.61.6.2 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.150 -r1.150.6.1 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.137.2.2 -r1.137.2.3 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/x86/x86/x86_softintr.c
cvs rdiff -u -r1.180 -r1.180.2.1 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.15 -r1.15.2.1 src/sys/arch/xen/include/intrdefs.h
cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.26 -r1.26.8.1 src/sys/arch/xen/x86/xenfunc.c
cvs rdiff -u -r1.80 -r1.80.6.1 src/sys/arch/xen/xen/clock.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/lock_stubs.S
diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.35 src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.1
--- src/sys/arch/amd64/amd64/lock_stubs.S:1.35	Sun Dec  8 20:00:56 2019
+++ src/sys/arch/amd64/amd64/lock_stubs.S	Sat Apr 11 18:26:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.35 2019/12/08 20:00:56 ad Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.35.6.1 2020/04/11 18:26:06 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -126,15 +126,12 @@ ENTRY(mutex_spin_exit)
 	jnz	1f
 	cmpl	CPU_INFO_ILEVEL(%r8), %edi
 	jae	1f
-#if !defined(XENPV)
 	movl	CPU_INFO_IUNMASK(%r8,%rdi,4), %esi
 	CLI(ax)
 	testl	CPU_INFO_IPENDING(%r8), %esi
 	jnz	_C_LABEL(Xspllower)
-#endif
 #if defined(XEN)
 	movl	CPU_INFO_XUNMASK(%r8,%rdi,4), %esi
-	CLI(ax)
 	testl	CPU_INFO_XPENDING(%r8), %esi
 	jnz	_C_LABEL(Xspllower)
 #endif
@@ -155,14 +152,12 @@ ENTRY(mutex_spin_exit)
 	cmpl	%edx,%ecx			/* new level is lower? */
 	jae	2f
 1:
-#if !defined(XENPV)
 	movl	CPU_INFO_IPENDING(%rsi),%eax
 	testl	%eax,CPU_INFO_IUNMASK(%rsi,%rcx,4)/* deferred interrupts? */
 	jnz	3f
 	movl	%eax,%ebx
 	cmpxchg8b CPU_INFO_ISTATE(%rsi)		/* swap in new ilevel */
 	jnz	4f
-#endif
 #if defined(XEN)
 	movl	CPU_INFO_XPENDING(%rsi),%eax
 	testl	%eax,CPU_INFO_XUNMASK(%rsi,%rcx,4)/* deferred interrupts? */

Index: src/sys/arch/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.43.4.4 src/sys/arch/amd64/amd64/spl.S:1.43.4.5
--- src/sys/arch/amd64/amd64/spl.S:1.43.4.4	Sat Apr 11 10:11:30 2020
+++ src/sys/arch/amd64/amd64/spl.S	Sat Apr 11 18:26:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.43.4.4 2020/04/11 10:11:30 bouyer Exp $	*/
+/*	$NetBSD: spl.S,v 1.43.4.5 2020/04/11 18:26:06 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -91,7 +91,6 @@ ENTRY(splraise)
 	ret
 END(splraise)
 
-#ifndef XENPV
 /*
  * Xsoftintr()
  *
@@ -148,11 +147,11 @@ IDTVEC(softintr)
 	movq	PCB_RSP0(%rdx),%rsp
 
 	/* dispatch */
-	sti
+	STI(di)
 	movq	%r15,%rdi		/* interrupted LWP */
 	movl	IS_MAXLEVEL(%rax),%esi	/* ipl to run at */
 	call	_C_LABEL(softint_dispatch)/* run handlers */
-	cli
+	CLI(di)
 
 	/* restore old context */
 	movq	L_PCB(%r15),%rcx
@@ -174,7 +173,7 @@ IDTVEC_END(softintr)
  */
 ENTRY(softintr_ret)
 	incl	CPUVAR(MTX_COUNT)	/* re-adjust after mi_switch */
-	cli
+	CLI(ax)		/* %rax not used by Xspllower/Xdoreti */
 	jmp	*%r13			/* back to Xspllower/Xdoreti */
 END(softintr_ret)
 
@@ -196,11 +195,11 @@ END(softint_trigger)
  */
 IDTVEC(recurse_preempt)
 	movl	$IPL_PREEMPT,CPUVAR(ILEVEL)
-	sti
+	STI(di)
 	xorq	%rdi,%rdi
 	KMSAN_INIT_ARG(8)
 	call	_C_LABEL(kpreempt)
-	cli
+	CLI(di)
 	jmp	*%r13			/* back to Xspllower */
 IDTVEC_END(recurse_preempt)
 
@@ -211,20 +210,19 @@ 

CVS commit: src/sys/arch/xen/xen

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 17:52:01 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
revert previous - physio arranges for tranfer directly to user-provided
buffers, which are generally not DEV_BSIZE-aligned


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/xen/xen/xbd_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/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.102 src/sys/arch/xen/xen/xbd_xenbus.c:1.103
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.102	Sat Apr 11 16:15:34 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Sat Apr 11 17:52:01 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.102 2020/04/11 16:15:34 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.103 2020/04/11 17:52:01 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.102 2020/04/11 16:15:34 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.103 2020/04/11 17:52:01 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -97,8 +97,6 @@ __KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c
 #define XEN_BSHIFT  9   /* log2(XEN_BSIZE) */
 #define XEN_BSIZE   (1 << XEN_BSHIFT) 
 
-__CTASSERT((DEV_BSIZE == XEN_BSIZE));
-
 struct xbd_req {
 	SLIST_ENTRY(xbd_req) req_next;
 	uint16_t req_id; /* ID passed to backend */
@@ -107,6 +105,7 @@ struct xbd_req {
 		grant_ref_t req_gntref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 		int req_nr_segments; /* number of segments in this request */
 		struct buf *req_bp; /* buffer associated with this request */
+		void *req_data; /* pointer to the data buffer */
 	} req_rw;
 	struct {
 		int s_error;
@@ -117,6 +116,7 @@ struct xbd_req {
 #define req_gntref	u.req_rw.req_gntref
 #define req_nr_segments	u.req_rw.req_nr_segments
 #define req_bp		u.req_rw.req_bp
+#define req_data	u.req_rw.req_data
 #define req_sync	u.req_sync
 
 struct xbd_xenbus_softc {
@@ -156,6 +156,7 @@ struct xbd_xenbus_softc {
 #define BLKIF_FEATURE_PERSISTENT	0x4
 #define BLKIF_FEATURE_BITS		\
 	"\20\1CACHE-FLUSH\2BARRIER\3PERSISTENT"
+	struct evcnt sc_cnt_map_unalign;
 };
 
 #if 0
@@ -176,6 +177,9 @@ static int  xbd_diskstart(device_t, stru
 static void xbd_backend_changed(void *, XenbusState);
 static void xbd_connect(struct xbd_xenbus_softc *);
 
+static int  xbd_map_align(struct xbd_req *);
+static void xbd_unmap_align(struct xbd_req *);
+
 static void xbdminphys(struct buf *);
 
 CFATTACH_DECL3_NEW(xbd, sizeof(struct xbd_xenbus_softc),
@@ -281,6 +285,9 @@ xbd_xenbus_attach(device_t parent, devic
 		panic("%s: can't alloc ring", device_xname(self));
 	sc->sc_ring.sring = ring;
 
+	evcnt_attach_dynamic(>sc_cnt_map_unalign, EVCNT_TYPE_MISC,
+	NULL, device_xname(self), "map unaligned");
+
 	/* resume shared structures and tell backend that we are ready */
 	if (xbd_xenbus_resume(self, PMF_Q_NONE) == false) {
 		uvm_km_free(kernel_map, (vaddr_t)ring, PAGE_SIZE,
@@ -364,6 +371,8 @@ xbd_xenbus_detach(device_t dev, int flag
 	uvm_km_free(kernel_map, (vaddr_t)sc->sc_ring.sring,
 	PAGE_SIZE, UVM_KMF_WIRED);
 
+	evcnt_detach(>sc_cnt_map_unalign);
+
 	pmf_device_deregister(dev);
 
 	return 0;
@@ -702,6 +711,9 @@ again:
 			goto next;
 		}
 		/* b_resid was set in dk_start */
+		if (__predict_false(
+		xbdreq->req_data != NULL && bp->b_data != xbdreq->req_data))
+			xbd_unmap_align(xbdreq);
 next:
 		xbdreq->req_bp = NULL;
 		dk_done(>sc_dksc, bp);
@@ -971,13 +983,16 @@ xbd_diskstart(device_t self, struct buf 
 	}
 
 	xbdreq->req_bp = bp;
-
-	/*
-	 * All bufs passed by system are aligned to DEV_BSIZE.
-	 * xbd requires this to be the case, as transfer offsets
-	 * are expressed in multiplies of 512 (XEN_BSIZE).
-	 */
-	KASSERT(((vaddr_t)bp->b_data & (XEN_BSIZE - 1)) == 0);
+	xbdreq->req_data = bp->b_data;
+	if (__predict_false((vaddr_t)bp->b_data & (XEN_BSIZE - 1))) {
+		sc->sc_cnt_map_unalign.ev_count++;
+
+		if (__predict_false(xbd_map_align(xbdreq) != 0)) {
+			DPRINTF(("xbd_diskstart: no align\n"));
+			error = EAGAIN;
+			goto out;
+		}
+	}
 
 	SLIST_REMOVE_HEAD(>sc_xbdreq_head, req_next);
 	req = RING_GET_REQUEST(>sc_ring, sc->sc_ring.req_prod_pvt);
@@ -987,8 +1002,8 @@ xbd_diskstart(device_t self, struct buf 
 	req->sector_number = bp->b_rawblkno;
 	req->handle = sc->sc_handle;
 
-	va = (vaddr_t)bp->b_data & ~PAGE_MASK;
-	off = (vaddr_t)bp->b_data & PAGE_MASK;
+	va = (vaddr_t)xbdreq->req_data & ~PAGE_MASK;
+	off = (vaddr_t)xbdreq->req_data & PAGE_MASK;
 	bcount = bp->b_bcount;
 	bp->b_resid = 0;
 	for (seg = 0; bcount > 0;) {
@@ -1028,3 +1043,33 @@ out:
 err:
 	return error;
 }
+
+static int
+xbd_map_align(struct xbd_req *req)
+{
+	int s = splvm(); /* XXXSMP - bogus? */
+	int rc;
+
+	rc = uvm_km_kmem_alloc(kmem_va_arena,
+	req->req_bp->b_bcount, (VM_NOSLEEP | VM_INSTANTFIT),
+	

CVS commit: src/sys/ufs

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 17:43:54 UTC 2020

Modified Files:
src/sys/ufs: files.ufs
src/sys/ufs/ffs: ffs_wapbl.c
src/sys/ufs/ufs: ufs_wapbl.h
Removed Files:
src/sys/ufs/ufs: ufs_wapbl.c

Log Message:
remove noncompilable WAPBL_DEBUG_INODES

PR kern/49554 by Thomas Klausner


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/ufs/files.ufs
cvs rdiff -u -r1.45 -r1.46 src/sys/ufs/ffs/ffs_wapbl.c
cvs rdiff -u -r1.25 -r0 src/sys/ufs/ufs/ufs_wapbl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/ufs/ufs/ufs_wapbl.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/ufs/files.ufs
diff -u src/sys/ufs/files.ufs:1.45 src/sys/ufs/files.ufs:1.46
--- src/sys/ufs/files.ufs:1.45	Mon Jun 17 03:32:58 2019
+++ src/sys/ufs/files.ufs	Sat Apr 11 17:43:54 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ufs,v 1.45 2019/06/17 03:32:58 christos Exp $
+#	$NetBSD: files.ufs,v 1.46 2020/04/11 17:43:54 jdolecek Exp $
 
 deffs	FFS
 deffs	EXT2FS
@@ -111,4 +111,3 @@ file	ufs/ufs/quota2_subr.c		quota2 & (ff
 file	ufs/ufs/ufs_rename.c		ffs | mfs | chfs
 file	ufs/ufs/ufs_vfsops.c		ufs & (ffs | mfs | ext2fs | chfs)
 file	ufs/ufs/ufs_vnops.c		ufs & (ffs | mfs | ext2fs | chfs)
-file	ufs/ufs/ufs_wapbl.c		ffs & wapbl

Index: src/sys/ufs/ffs/ffs_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.45 src/sys/ufs/ffs/ffs_wapbl.c:1.46
--- src/sys/ufs/ffs/ffs_wapbl.c:1.45	Fri Jan 17 20:08:10 2020
+++ src/sys/ufs/ffs/ffs_wapbl.c	Sat Apr 11 17:43:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_wapbl.c,v 1.45 2020/01/17 20:08:10 ad Exp $	*/
+/*	$NetBSD: ffs_wapbl.c,v 1.46 2020/04/11 17:43:54 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.45 2020/01/17 20:08:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.46 2020/04/11 17:43:54 jdolecek Exp $");
 
 #define WAPBL_INTERNAL
 
@@ -179,10 +179,6 @@ ffs_wapbl_sync_metadata(struct mount *mp
 
 	UFS_WAPBL_JLOCK_ASSERT(ump->um_mountp);
 
-#ifdef WAPBL_DEBUG_INODES
-	ufs_wapbl_verify_inodes(mp, __func__);
-#endif
-
 	for (wd = fdealloc; wd != NULL; wd = TAILQ_NEXT(wd, wd_entries)) {
 		/*
 		 * blkfree errors are unreported, might silently fail

Index: src/sys/ufs/ufs/ufs_wapbl.h
diff -u src/sys/ufs/ufs/ufs_wapbl.h:1.18 src/sys/ufs/ufs/ufs_wapbl.h:1.19
--- src/sys/ufs/ufs/ufs_wapbl.h:1.18	Thu Mar  5 15:18:55 2020
+++ src/sys/ufs/ufs/ufs_wapbl.h	Sat Apr 11 17:43:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_wapbl.h,v 1.18 2020/03/05 15:18:55 riastradh Exp $	*/
+/*	$NetBSD: ufs_wapbl.h,v 1.19 2020/04/11 17:43:54 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -82,18 +82,6 @@
 
 #if defined(WAPBL)
 
-#if defined(WAPBL_DEBUG)
-#define	WAPBL_DEBUG_INODES
-#endif
-
-#ifdef WAPBL_DEBUG_INODES
-#error Undefine WAPBL_DEBUG_INODES or update the code.  Have a nice day.
-#endif
-
-#ifdef WAPBL_DEBUG_INODES
-void	ufs_wapbl_verify_inodes(struct mount *, const char *);
-#endif
-
 static __inline int
 ufs_wapbl_begin(struct mount *mp, const char *file, int line)
 {
@@ -102,10 +90,6 @@ ufs_wapbl_begin(struct mount *mp, const 
 		error = wapbl_begin(mp->mnt_wapbl, file, line);
 		if (error)
 			return error;
-#ifdef WAPBL_DEBUG_INODES
-		if (mp->mnt_wapbl->wl_lock.lk_exclusivecount == 1)
-			ufs_wapbl_verify_inodes(mp, "wapbl_begin");
-#endif
 	}
 	return 0;
 }
@@ -114,10 +98,6 @@ static __inline void
 ufs_wapbl_end(struct mount *mp)
 {
 	if (mp->mnt_wapbl) {
-#ifdef WAPBL_DEBUG_INODES
-		if (mp->mnt_wapbl->wl_lock.lk_exclusivecount == 1)
-			ufs_wapbl_verify_inodes(mp, "wapbl_end");
-#endif
 		wapbl_end(mp->mnt_wapbl);
 	}
 }



CVS commit: src/sbin/dkscan_bsdlabel

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 17:21:16 UTC 2020

Modified Files:
src/sbin/dkscan_bsdlabel: dkscan_bsdlabel.c

Log Message:
adjust to work with updated dkwedge_bsdlabel.c - provide geteblk() and
brelse() which just allocate/free the memory


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c

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

Modified files:

Index: src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c
diff -u src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c:1.4 src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c:1.5
--- src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c:1.4	Thu Jun  8 22:24:29 2017
+++ src/sbin/dkscan_bsdlabel/dkscan_bsdlabel.c	Sat Apr 11 17:21:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dkscan_bsdlabel.c,v 1.4 2017/06/08 22:24:29 chs Exp $ */
+/* $NetBSD: dkscan_bsdlabel.c,v 1.5 2020/04/11 17:21:16 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "dkscan_util.h"
 
@@ -46,6 +47,22 @@ struct disk {
 	int		dk_blkshift;	/* shift to convert DEV_BSIZE to blks */
 };
 
+static struct buf *
+geteblk(int size)
+{
+	struct buf *bp = malloc(sizeof(*bp) + size);
+
+	bp->b_data = (void *)[1];
+
+	return bp;
+}
+
+static void
+brelse(struct buf *bp, int set)
+{
+	free(bp);
+}
+
 #include "dkwedge_bsdlabel.c"
 
 __dead static void usage(void);



CVS commit: src/tests/crypto/libcrypto

2020-04-11 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Apr 11 16:55:33 UTC 2020

Modified Files:
src/tests/crypto/libcrypto: t_libcrypto.sh

Log Message:
Double the timeout for the bn test case; 360 seconds is no longer
sufficient under qemu since the latest openssl update.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/crypto/libcrypto/t_libcrypto.sh

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

Modified files:

Index: src/tests/crypto/libcrypto/t_libcrypto.sh
diff -u src/tests/crypto/libcrypto/t_libcrypto.sh:1.6 src/tests/crypto/libcrypto/t_libcrypto.sh:1.7
--- src/tests/crypto/libcrypto/t_libcrypto.sh:1.6	Mon Sep 24 16:25:24 2018
+++ src/tests/crypto/libcrypto/t_libcrypto.sh	Sat Apr 11 16:55:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_libcrypto.sh,v 1.6 2018/09/24 16:25:24 christos Exp $
+# $NetBSD: t_libcrypto.sh,v 1.7 2020/04/11 16:55:33 gson Exp $
 #
 # Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -39,7 +39,7 @@ atf_test_case bn
 bn_head()
 {
 	atf_set "descr" "Checks BIGNUM library"
-	atf_set "timeout" "360"
+	atf_set "timeout" "720"
 }
 bn_body()
 {



CVS commit: src/sys/arch/xen/xen

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 16:15:34 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
now that getebuf() et.al. always returns DEV_BSIZE-aligned buffers
and rest of kernel code doing disk I/O was also converted over to it,
it's finally safe to remove the code to handle misaligned buffers

leave just KASSERT() in place


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/xen/xen/xbd_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/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.101 src/sys/arch/xen/xen/xbd_xenbus.c:1.102
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.101	Sat Apr 11 16:02:41 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Sat Apr 11 16:15:34 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.101 2020/04/11 16:02:41 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.102 2020/04/11 16:15:34 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.101 2020/04/11 16:02:41 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.102 2020/04/11 16:15:34 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -97,6 +97,8 @@ __KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c
 #define XEN_BSHIFT  9   /* log2(XEN_BSIZE) */
 #define XEN_BSIZE   (1 << XEN_BSHIFT) 
 
+__CTASSERT((DEV_BSIZE == XEN_BSIZE));
+
 struct xbd_req {
 	SLIST_ENTRY(xbd_req) req_next;
 	uint16_t req_id; /* ID passed to backend */
@@ -105,7 +107,6 @@ struct xbd_req {
 		grant_ref_t req_gntref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 		int req_nr_segments; /* number of segments in this request */
 		struct buf *req_bp; /* buffer associated with this request */
-		void *req_data; /* pointer to the data buffer */
 	} req_rw;
 	struct {
 		int s_error;
@@ -116,7 +117,6 @@ struct xbd_req {
 #define req_gntref	u.req_rw.req_gntref
 #define req_nr_segments	u.req_rw.req_nr_segments
 #define req_bp		u.req_rw.req_bp
-#define req_data	u.req_rw.req_data
 #define req_sync	u.req_sync
 
 struct xbd_xenbus_softc {
@@ -156,7 +156,6 @@ struct xbd_xenbus_softc {
 #define BLKIF_FEATURE_PERSISTENT	0x4
 #define BLKIF_FEATURE_BITS		\
 	"\20\1CACHE-FLUSH\2BARRIER\3PERSISTENT"
-	struct evcnt sc_cnt_map_unalign;
 };
 
 #if 0
@@ -177,9 +176,6 @@ static int  xbd_diskstart(device_t, stru
 static void xbd_backend_changed(void *, XenbusState);
 static void xbd_connect(struct xbd_xenbus_softc *);
 
-static int  xbd_map_align(struct xbd_req *);
-static void xbd_unmap_align(struct xbd_req *);
-
 static void xbdminphys(struct buf *);
 
 CFATTACH_DECL3_NEW(xbd, sizeof(struct xbd_xenbus_softc),
@@ -285,9 +281,6 @@ xbd_xenbus_attach(device_t parent, devic
 		panic("%s: can't alloc ring", device_xname(self));
 	sc->sc_ring.sring = ring;
 
-	evcnt_attach_dynamic(>sc_cnt_map_unalign, EVCNT_TYPE_MISC,
-	NULL, device_xname(self), "map unaligned");
-
 	/* resume shared structures and tell backend that we are ready */
 	if (xbd_xenbus_resume(self, PMF_Q_NONE) == false) {
 		uvm_km_free(kernel_map, (vaddr_t)ring, PAGE_SIZE,
@@ -371,8 +364,6 @@ xbd_xenbus_detach(device_t dev, int flag
 	uvm_km_free(kernel_map, (vaddr_t)sc->sc_ring.sring,
 	PAGE_SIZE, UVM_KMF_WIRED);
 
-	evcnt_detach(>sc_cnt_map_unalign);
-
 	pmf_device_deregister(dev);
 
 	return 0;
@@ -711,9 +702,6 @@ again:
 			goto next;
 		}
 		/* b_resid was set in dk_start */
-		if (__predict_false(
-		xbdreq->req_data != NULL && bp->b_data != xbdreq->req_data))
-			xbd_unmap_align(xbdreq);
 next:
 		xbdreq->req_bp = NULL;
 		dk_done(>sc_dksc, bp);
@@ -983,16 +971,13 @@ xbd_diskstart(device_t self, struct buf 
 	}
 
 	xbdreq->req_bp = bp;
-	xbdreq->req_data = bp->b_data;
-	if (__predict_false((vaddr_t)bp->b_data & (XEN_BSIZE - 1))) {
-		sc->sc_cnt_map_unalign.ev_count++;
-
-		if (__predict_false(xbd_map_align(xbdreq) != 0)) {
-			DPRINTF(("xbd_diskstart: no align\n"));
-			error = EAGAIN;
-			goto out;
-		}
-	}
+
+	/*
+	 * All bufs passed by system are aligned to DEV_BSIZE.
+	 * xbd requires this to be the case, as transfer offsets
+	 * are expressed in multiplies of 512 (XEN_BSIZE).
+	 */
+	KASSERT(((vaddr_t)bp->b_data & (XEN_BSIZE - 1)) == 0);
 
 	SLIST_REMOVE_HEAD(>sc_xbdreq_head, req_next);
 	req = RING_GET_REQUEST(>sc_ring, sc->sc_ring.req_prod_pvt);
@@ -1002,8 +987,8 @@ xbd_diskstart(device_t self, struct buf 
 	req->sector_number = bp->b_rawblkno;
 	req->handle = sc->sc_handle;
 
-	va = (vaddr_t)xbdreq->req_data & ~PAGE_MASK;
-	off = (vaddr_t)xbdreq->req_data & PAGE_MASK;
+	va = (vaddr_t)bp->b_data & ~PAGE_MASK;
+	off = (vaddr_t)bp->b_data & PAGE_MASK;
 	bcount = bp->b_bcount;
 	bp->b_resid = 0;
 	for (seg = 0; bcount > 0;) {
@@ -1043,33 +1028,3 @@ out:
 err:
 	return error;
 }
-
-static int
-xbd_map_align(struct xbd_req *req)
-{
-	int s = splvm(); /* XXXSMP - bogus? */
-	int 

CVS commit: src/sys/arch/xen/xen

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 16:02:41 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
print 'backend features' instead of just 'features' for the detected backend
features, so that it's clear it's just capability rather than something
actually used by the frontend driver


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/xen/xen/xbd_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/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.100 src/sys/arch/xen/xen/xbd_xenbus.c:1.101
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.100	Fri Apr 10 11:41:04 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Sat Apr 11 16:02:41 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.100 2020/04/10 11:41:04 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.101 2020/04/11 16:02:41 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.100 2020/04/10 11:41:04 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.101 2020/04/11 16:02:41 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -576,7 +576,8 @@ xbd_backend_changed(void *arg, XenbusSta
 buf, (int)dg->dg_secsize, sc->sc_xbdsize);
 		snprintb(buf, sizeof(buf), BLKIF_FEATURE_BITS,
 		sc->sc_features);
-		aprint_normal_dev(sc->sc_dksc.sc_dev, "features %s\n", buf);
+		aprint_normal_dev(sc->sc_dksc.sc_dev,
+		"backend features %s\n", buf);
 
 		/* Discover wedges on this disk. */
 		dkwedge_discover(>sc_dksc.sc_dkdev);



CVS commit: src/sys/dev/dkwedge

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 16:00:34 UTC 2020

Modified Files:
src/sys/dev/dkwedge: dkwedge_apple.c dkwedge_bsdlabel.c dkwedge_gpt.c
dkwedge_mbr.c dkwedge_rdb.c

Log Message:
allocate buffer for disk I/O via geteblk() instead of malloc(), so they
are properly aligned; e.g. readdisklabel() does the same

also removed the DKW_MALLOC()/DKW_FREE()/DKW_REALLOC() macros as apparently
unnecessary, these files don't seem to be compiled into any userland tools

dkwedge_gpt.c confirmed working, others compile-tested only


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/dkwedge/dkwedge_apple.c \
src/sys/dev/dkwedge/dkwedge_rdb.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dkwedge/dkwedge_bsdlabel.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dkwedge/dkwedge_gpt.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dkwedge/dkwedge_mbr.c

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

Modified files:

Index: src/sys/dev/dkwedge/dkwedge_apple.c
diff -u src/sys/dev/dkwedge/dkwedge_apple.c:1.5 src/sys/dev/dkwedge/dkwedge_apple.c:1.6
--- src/sys/dev/dkwedge/dkwedge_apple.c:1.5	Tue Jul  9 17:06:46 2019
+++ src/sys/dev/dkwedge/dkwedge_apple.c	Sat Apr 11 16:00:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dkwedge_apple.c,v 1.5 2019/07/09 17:06:46 maxv Exp $	*/
+/*	$NetBSD: dkwedge_apple.c,v 1.6 2020/04/11 16:00:34 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dkwedge_apple.c,v 1.5 2019/07/09 17:06:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_apple.c,v 1.6 2020/04/11 16:00:34 jdolecek Exp $");
 
 #include 
 #ifdef _KERNEL
@@ -44,8 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: dkwedge_appl
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include 
 
@@ -123,14 +123,6 @@ swap_apple_blockzeroblock(struct apple_b
 
 #define ASIZE	16384
  
-#ifdef _KERNEL
-#define	DKW_MALLOC(SZ)	malloc((SZ), M_DEVBUF, M_WAITOK)
-#define	DKW_FREE(PTR)	free((PTR), M_DEVBUF)
-#else
-#define	DKW_MALLOC(SZ)	malloc((SZ))
-#define	DKW_FREE(PTR)	free((PTR))
-#endif
-
 static struct {
 	const char *name;
 	const char *type;
@@ -145,20 +137,20 @@ dkwedge_discover_apple(struct disk *pdk,
 {
 	size_t i, n;
 	int error;
-	void *buf;
+	struct buf *bp;
 	uint32_t blocksize, blockcount, offset, rsize;
 	struct apple_drvr_map *am;
 	struct apple_part_map_entry *ae;
 	struct apple_blockzeroblock ab;
 	const char *ptype;
 
-	buf = DKW_MALLOC(ASIZE);
-	if ((error = dkwedge_read(pdk, vp, 0, buf, ASIZE)) != 0) {
+	bp = geteblk(ASIZE);
+	if ((error = dkwedge_read(pdk, vp, 0, bp->b_data, ASIZE)) != 0) {
 		DPRINTF("%s: read @%u %d\n", __func__, 0, error);
 		goto out;
 	}
 
-	am = buf;
+	am = bp->b_data;
 	swap_apple_drvr_map(am);
 
 	error = ESRCH;
@@ -186,12 +178,12 @@ dkwedge_discover_apple(struct disk *pdk,
 		blockcount = 512;
 	}
 
-	ae = buf;
+	ae = bp->b_data;
 	offset = blocksize;
 	for (n = 0; n < blockcount; n++, offset += rsize) {
 		DPRINTF("%s: offset %x rsize %x\n", __func__, offset, rsize);
-		if ((error = dkwedge_read(pdk, vp, offset / DEV_BSIZE, buf,
-		rsize)) != 0) {
+		if ((error = dkwedge_read(pdk, vp, offset / DEV_BSIZE,
+		bp->b_data, rsize)) != 0) {
 			DPRINTF("%s: read @%u %d\n", __func__, offset,
 			error);
 			goto out;
@@ -244,7 +236,7 @@ dkwedge_discover_apple(struct disk *pdk,
 	}
 
 out:
-	DKW_FREE(buf);
+	brelse(bp, 0);
 	DPRINTF("%s: return %d\n", __func__, error);
 	return error;
 }
Index: src/sys/dev/dkwedge/dkwedge_rdb.c
diff -u src/sys/dev/dkwedge/dkwedge_rdb.c:1.5 src/sys/dev/dkwedge/dkwedge_rdb.c:1.6
--- src/sys/dev/dkwedge/dkwedge_rdb.c:1.5	Tue Jul  9 17:06:46 2019
+++ src/sys/dev/dkwedge/dkwedge_rdb.c	Sat Apr 11 16:00:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dkwedge_rdb.c,v 1.5 2019/07/09 17:06:46 maxv Exp $	*/
+/*	$NetBSD: dkwedge_rdb.c,v 1.6 2020/04/11 16:00:34 jdolecek Exp $	*/
 
 /*
  * Adapted from arch/amiga/amiga/disksubr.c:
@@ -68,16 +68,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dkwedge_rdb.c,v 1.5 2019/07/09 17:06:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_rdb.c,v 1.6 2020/04/11 16:00:34 jdolecek Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
-#ifdef _KERNEL
 #include 
-#endif
+#include 
 
 /*
  * In /usr/src/sys/dev/scsipi/sd.c, routine sdstart() adjusts the
@@ -96,16 +94,6 @@ __KERNEL_RCSID(0, "$NetBSD: dkwedge_rdb.
 #define	ADJUST_NR(x)	(x)
 #endif
 
-#ifdef _KERNEL
-#define	DKW_MALLOC(SZ)	malloc((SZ), M_DEVBUF, M_WAITOK)
-#define	DKW_FREE(PTR)	free((PTR), M_DEVBUF)
-#define	DKW_REALLOC(PTR, NEWSZ)	realloc((PTR), (NEWSZ), M_DEVBUF, M_WAITOK)
-#else
-#define	DKW_MALLOC(SZ)	malloc((SZ))
-#define	DKW_FREE(PTR)	free((PTR))
-#define	DKW_REALLOC(PTR, NEWSZ)	realloc((PTR), (NEWSZ))
-#endif
-
 static unsigned rdbchksum(void *);
 static unsigned char getarchtype(unsigned);
 static const char *archtype_to_ptype(unsigned char);
@@ -116,7 

CVS commit: src/sys/kern

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 14:48:19 UTC 2020

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

Log Message:
for bmempools set align, not ioff


To generate a diff of this commit:
cvs rdiff -u -r1.292 -r1.293 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.292 src/sys/kern/vfs_bio.c:1.293
--- src/sys/kern/vfs_bio.c:1.292	Sat Apr 11 14:38:26 2020
+++ src/sys/kern/vfs_bio.c	Sat Apr 11 14:48:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.292 2020/04/11 14:38:26 jdolecek Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.293 2020/04/11 14:48:19 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.292 2020/04/11 14:38:26 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.293 2020/04/11 14:48:19 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -513,7 +513,7 @@ bufinit(void)
 		pa = (size <= PAGE_SIZE && use_std)
 			? _allocator_nointr
 			: _allocator;
-		pool_init(pp, size, 0, DEV_BSIZE, 0, name, pa, IPL_NONE);
+		pool_init(pp, size, DEV_BSIZE, 0, 0, name, pa, IPL_NONE);
 		pool_setlowat(pp, 1);
 		pool_sethiwat(pp, 1);
 	}



CVS commit: src/sys/kern

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 14:38:26 UTC 2020

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

Log Message:
explicitly use DEV_BSIZE align for all bmempools

this is required for Xen xbd(4) in order to not have to use bounce buffers

the alignment is implicitly provided when POOL_REDZONE is not active,
this change makes it also aligned when POOL_REDZONE _is_ active - that is
when (!KMSAN && (DIAGNOSTIC || KASAN))


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.292 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.291 src/sys/kern/vfs_bio.c:1.292
--- src/sys/kern/vfs_bio.c:1.291	Fri Apr 10 17:18:04 2020
+++ src/sys/kern/vfs_bio.c	Sat Apr 11 14:38:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.291 2020/04/10 17:18:04 ad Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.292 2020/04/11 14:38:26 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.291 2020/04/10 17:18:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.292 2020/04/11 14:38:26 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -513,7 +513,7 @@ bufinit(void)
 		pa = (size <= PAGE_SIZE && use_std)
 			? _allocator_nointr
 			: _allocator;
-		pool_init(pp, size, 0, 0, 0, name, pa, IPL_NONE);
+		pool_init(pp, size, 0, DEV_BSIZE, 0, name, pa, IPL_NONE);
 		pool_setlowat(pp, 1);
 		pool_sethiwat(pp, 1);
 	}



CVS commit: [bouyer-xenpvh] src/sys/arch/i386/i386

2020-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Apr 11 12:01:42 UTC 2020

Modified Files:
src/sys/arch/i386/i386 [bouyer-xenpvh]: spl.S vector.S

Log Message:
calling stipending() is only needed in the PV case; in PVHVM
hypervisor_callback() will be called again as soon as we enable interrupts.

Use the PVHVM XENINTRSTUB for PV too; asjust Xdoreti as needed.
merge hypervisor_callback with hypervisor_pvhvm_callback. The reetrancy should
not be an issue, as we're already re-enabling events in
do_hupervisor_callback (that it, outside of the critical section).
We now can call Xdoreti in both cases.


To generate a diff of this commit:
cvs rdiff -u -r1.50.4.2 -r1.50.4.3 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.85.6.1 -r1.85.6.2 src/sys/arch/i386/i386/vector.S

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/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.50.4.2 src/sys/arch/i386/i386/spl.S:1.50.4.3
--- src/sys/arch/i386/i386/spl.S:1.50.4.2	Sat Apr 11 10:11:31 2020
+++ src/sys/arch/i386/i386/spl.S	Sat Apr 11 12:01:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.50.4.2 2020/04/11 10:11:31 bouyer Exp $	*/
+/*	$NetBSD: spl.S,v 1.50.4.3 2020/04/11 12:01:42 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50.4.2 2020/04/11 10:11:31 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50.4.3 2020/04/11 12:01:42 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -236,7 +236,7 @@ IDTVEC(spllower)
 #endif
 3:
 	movl	%ebx,CPUVAR(ILEVEL)
-#ifdef XEN
+#ifdef XENPV
 	STIC(%eax)
 	jz 4f
 	call	_C_LABEL(stipending)
@@ -260,7 +260,7 @@ IDTVEC(spllower)
 IDTVEC_END(spllower)
 
 /*
- * Handle return from interrupt after device handler finishes.
+ * Xdoreti: Handle return from interrupt after device handler finishes.
  *
  * Important registers:
  *   ebx - cpl to restore
@@ -270,10 +270,8 @@ IDTVEC_END(spllower)
  * called with interrupt disabled.
  */
 IDTVEC(doreti)
-#ifndef XENPV
 	IDEPTH_DECR
 	popl	%ebx			/* get previous priority */
-#endif
 .Ldoreti_resume_stic:
 	movl	$.Ldoreti_resume,%esi	/* address to resume loop at */
 .Ldoreti_resume:
@@ -292,7 +290,6 @@ IDTVEC(doreti)
 #endif /* XENPV */
 #endif /* defined(DEBUG) */
 
-#if !defined(XENPV)
 	movl	%ebx,%eax
 	movl	CPUVAR(IUNMASK)(,%eax,4),%eax
 	andl	CPUVAR(IPENDING),%eax
@@ -301,7 +298,6 @@ IDTVEC(doreti)
 	btrl	%eax,CPUVAR(IPENDING)
 	movl	CPUVAR(ISOURCES)(,%eax, 4),%eax
 	jmp	*IS_RESUME(%eax)
-#endif
 2:
 #if defined(XEN)
 	movl	%ebx,%eax
@@ -340,7 +336,7 @@ END(doreti_checkast)
 	jnz	9f
 	HANDLE_DEFERRED_FPU
 6:
-#ifdef XEN
+#ifdef XENPV
 	STIC(%eax)
 	jz	4f
 	call	_C_LABEL(stipending)

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.85.6.1 src/sys/arch/i386/i386/vector.S:1.85.6.2
--- src/sys/arch/i386/i386/vector.S:1.85.6.1	Fri Apr 10 14:42:00 2020
+++ src/sys/arch/i386/i386/vector.S	Sat Apr 11 12:01:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.85.6.1 2020/04/10 14:42:00 bouyer Exp $	*/
+/*	$NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.1 2020/04/10 14:42:00 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -940,38 +940,6 @@ END(x2apic_level_stubs)
 #if defined(XEN)
 #define voidop(num)
 
-#ifdef XENPV
-#define	XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
-IDTVEC(recurse_ ## name ## num)		;\
-	INTR_RECURSE_HWFRAME		;\
-	subl	$4,%esp			;\
-	pushl	$T_ASTFLT		/* trap # for doing ASTs */	;\
-	INTRENTRY			;\
-	movl	$_C_LABEL(Xdoreti), %esi; /* we now have a trap frame, so loop using doreti instead */ ;\
-IDTVEC(resume_ ## name ## num)		\
-	movl	$IREENT_MAGIC,TF_ERR(%esp);\
-	pushl	%ebx			;\
-	movl	CPUVAR(XSOURCES) + (num) * 4,%ebp			;\
-	movl	$num,CPUVAR(ILEVEL)	;\
-	IDEPTH_INCR /* leaves old %esp on stack	*/			;\
-	STI(%eax)			;\
-	movl	IS_HANDLERS(%ebp),%ebx	;\
-6:	\
-	pushl	IH_ARG(%ebx)		;\
-	call	*IH_FUN(%ebx)		/* call it */			;\
-	addl	$4,%esp			/* toss the arg */		;\
-	movl	IH_NEXT(%ebx),%ebx	/* next handler in chain */	;\
-	testl	%ebx,%ebx		;\
-	jnz	6b			;\
-	\
-	CLI(%eax)			;\
-	unmask(num)			/* unmask it in hardware */	;\
-	late_ack(num)			;\
-	IDEPTH_DECR			;\
-	popl	%ebx			;\
-	jmp	*%esi			/* lower spl and do ASTs */	;\
-
-#else /* XENPV */
 #define	XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
 IDTVEC(recurse_ ## name ## num)		;\
 	INTR_RECURSE_HWFRAME		;\
@@ -999,8 +967,6 @@ IDTVEC(resume_ ## name ## num)		\
 	late_ack(num)			;\
 	jmp	

CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/amd64

2020-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Apr 11 11:56:51 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64 [bouyer-xenpvh]: vector.S

Log Message:
Merge back hypervisor_callback and hypervisor_pvhvm_callback, there's no
issues calling Xdoreti in the PV case.


To generate a diff of this commit:
cvs rdiff -u -r1.73.6.1 -r1.73.6.2 src/sys/arch/amd64/amd64/vector.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.73.6.1 src/sys/arch/amd64/amd64/vector.S:1.73.6.2
--- src/sys/arch/amd64/amd64/vector.S:1.73.6.1	Fri Apr 10 14:41:59 2020
+++ src/sys/arch/amd64/amd64/vector.S	Sat Apr 11 11:56:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.73.6.1 2020/04/10 14:41:59 bouyer Exp $	*/
+/*	$NetBSD: vector.S,v 1.73.6.2 2020/04/11 11:56:51 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -811,36 +811,23 @@ END(xenev_stubs)
  */
 
 /* Hypervisor callback */
+
 ENTRY(hypervisor_callback)
 	movq	(%rsp),%rcx
 	movq	8(%rsp),%r11
 	addq	$16,%rsp
-	pushq	$0		/* Dummy error code */
-	pushq	$T_ASTFLT
-	INTRENTRY
-	/* sti?? */
-	movq	%rsp,%rdi
-	subq	$8,%rdi;	/* don't forget if_ppl */
-	call	do_hypervisor_callback
-	testb	$SEL_RPL,TF_CS(%rsp)
-	jnz	doreti_checkast
-1:
-	INTRFASTEXIT
-END(hypervisor_callback)
-
 IDTVEC(hypervisor_pvhvm_callback)
 	pushq	$0		/* Dummy error code */
 	pushq	$T_ASTFLT
 	INTRENTRY
 	movlCPUVAR(ILEVEL),%edi
 	pushq   %rdi /* for Xdoreti */
-	/* sti?? */
 	movq	%rsp,%rdi
-	subq	$8,%rdi;	/* don't forget if_ppl */
 	call	do_hypervisor_callback
 	incl	CPUVAR(IDEPTH)
 	jmp 	_C_LABEL(Xdoreti)
 IDTVEC_END(hypervisor_pvhvm_callback)
+END(hypervisor_callback)
 #endif /* XEN */
 
 #ifdef XENPV



CVS commit: src/sys/arch/xen/xen

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 11:48:21 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xennetback_xenbus.c

Log Message:
convert to bus_dma(9), no explicit xpmap_*() calls any more

as part of this move some global arrays into struct xnetback_instance,
and fix race for xnetif_lookup()


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 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/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.95 src/sys/arch/xen/xen/xennetback_xenbus.c:1.96
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.95	Thu Apr  9 10:57:02 2020
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Sat Apr 11 11:48:20 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.95 2020/04/09 10:57:02 jdolecek Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.96 2020/04/11 11:48:20 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.95 2020/04/09 10:57:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.96 2020/04/11 11:48:20 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -70,13 +70,14 @@ __KERNEL_RCSID(0, "$NetBSD: xennetback_x
 #define XENPRINTF(x)
 #endif
 
-extern pt_entry_t xpmap_pg_nx;
-
 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
 
-/* linux wants at last 16 bytes free in front of the packet */
-#define LINUX_REQUESTED_OFFSET 16
+/*
+ * Number of packets to transmit in one hypercall (= number of pages to
+ * transmit at once).
+ */
+#define NB_XMIT_PAGES_BATCH 64
 
 /* ratecheck(9) for pool allocation failures */
 static const struct timeval xni_pool_errintvl = { 30, 0 };  /* 30s, each */
@@ -88,6 +89,13 @@ typedef enum {
 	DISCONNECTED
 } xnetback_state_t;
 
+struct xnetback_xstate {
+	bus_dmamap_t xs_dmamap;
+	struct mbuf *xs_m;
+	int xs_id;
+	int xs_flags;
+};
+
 /* we keep the xnetback instances in a linked list */
 struct xnetback_instance {
 	SLIST_ENTRY(xnetback_instance) next;
@@ -110,6 +118,10 @@ struct xnetback_instance {
 	grant_handle_t xni_rx_ring_handle;
 	vaddr_t xni_tx_ring_va; /* to unmap the ring */
 	vaddr_t xni_rx_ring_va;
+
+	/* arrays used in xennetback_ifstart(), used for both Rx and Tx */
+	gnttab_copy_t 	xni_gop_copy[NB_XMIT_PAGES_BATCH];
+	struct xnetback_xstate	xni_xstate[NB_XMIT_PAGES_BATCH];
 };
 #define xni_ifxni_ec.ec_if
 #define xni_bpf   xni_if.if_bpf
@@ -128,7 +140,6 @@ static void xennetback_frontend_changed(
 
 static inline void xennetback_tx_response(struct xnetback_instance *,
 int, int);
-static void xennetback_mbuf_addr(struct mbuf *, paddr_t *, int *);
 
 static SLIST_HEAD(, xnetback_instance) xnetback_instances;
 static kmutex_t xnetback_lock;
@@ -141,22 +152,6 @@ static struct xenbus_backend_driver xvif
 	.xbakd_type = "vif"
 };
 
-/*
- * Number of packets to transmit in one hypercall (= number of pages to
- * transmit at once).
- */
-#define NB_XMIT_PAGES_BATCH 64
-
-/* arrays used in xennetback_ifstart(), too large to allocate on stack */
-/* XXXSMP */
-static gnttab_copy_t xstart_gop_copy[NB_XMIT_PAGES_BATCH];
-static struct mbuf *mbufs_sent[NB_XMIT_PAGES_BATCH];
-static struct _req_info {
-	int id;
-	int flags;
-} xstart_req[NB_XMIT_PAGES_BATCH];
-
-
 void
 xvifattach(int n)
 {
@@ -193,14 +188,21 @@ xennetback_xenbus_create(struct xenbus_d
 		return err;
 	}
 
-	if (xnetif_lookup(domid, handle)) {
-		return EEXIST;
-	}
 	xneti = kmem_zalloc(sizeof(*xneti), KM_SLEEP);
 	xneti->xni_domid = domid;
 	xneti->xni_handle = handle;
 	xneti->xni_status = DISCONNECTED;
 
+	/* Need to keep the lock for lookup and the list update */
+	mutex_enter(_lock);
+	if (xnetif_lookup(domid, handle)) {
+		mutex_exit(_lock);
+		kmem_free(xneti, sizeof(*xneti));
+		return EEXIST;
+	}
+	SLIST_INSERT_HEAD(_instances, xneti, next);
+	mutex_exit(_lock);
+
 	xbusd->xbusd_u.b.b_cookie = xneti;
 	xbusd->xbusd_u.b.b_detach = xennetback_xenbus_destroy;
 	xneti->xni_xbusd = xbusd;
@@ -230,6 +232,20 @@ xennetback_xenbus_create(struct xenbus_d
 
 	/* we can't use the same MAC addr as our guest */
 	xneti->xni_enaddr[3]++;
+
+	/* Initialize DMA map, used only for loading PA */
+	for (i = 0; i < __arraycount(xneti->xni_xstate); i++) {
+		if (bus_dmamap_create(xneti->xni_xbusd->xbusd_dmat, PAGE_SIZE,
+		1, PAGE_SIZE, PAGE_SIZE, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
+		>xni_xstate[i].xs_dmamap)
+		!= 0) {
+			aprint_error_ifnet(ifp,
+			"failed to allocate dma map\n");
+			err = ENOMEM;
+			goto fail;
+		}
+	}
+
 	/* create pseudo-interface */
 	aprint_verbose_ifnet(ifp, "Ethernet address %s\n",
 	ether_sprintf(xneti->xni_enaddr));
@@ -258,10 +274,6 @@ xennetback_xenbus_create(struct xenbus_d
 	

CVS commit: src/sys/arch/xen

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 11:01:12 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: if_xennet_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
put xenbus dmat into xenbus_device so it's available also for backend
devices which don't use autoconfig, remove from attach args


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/xen/xenbus/xenbus_probe.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/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.23 src/sys/arch/xen/include/xenbus.h:1.24
--- src/sys/arch/xen/include/xenbus.h:1.23	Fri Apr 10 14:54:34 2020
+++ src/sys/arch/xen/include/xenbus.h	Sat Apr 11 11:01:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.23 2020/04/10 14:54:34 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.24 2020/04/11 11:01:12 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -52,7 +52,6 @@ struct xenbusdev_attach_args {
 	const char		*xa_type;
 	int 			xa_id;
 	struct xenbus_device	*xa_xbusd;
-	bus_dma_tag_t		xa_dmat;
 };
 
 /* Register callback to watch this node. */
@@ -100,6 +99,7 @@ struct xenbus_device {
 	/* for xenbus internal use */
 	struct xenbus_watch xbusd_otherend_watch;
 	size_t xbusd_sz;		/* size of allocated structure */
+	bus_dma_tag_t xbusd_dmat;
 	const char xbusd_path[1]; /* our path */
 };
 

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.111 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.112
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.111	Fri Apr 10 19:08:10 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sat Apr 11 11:01:12 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.111 2020/04/10 19:08:10 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.112 2020/04/11 11:01:12 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.111 2020/04/10 19:08:10 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.112 2020/04/11 11:01:12 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -169,7 +169,6 @@ struct xennet_xenbus_softc {
 	struct ethercom sc_ethercom;
 	uint8_t sc_enaddr[ETHER_ADDR_LEN];
 	struct xenbus_device *sc_xbusd;
-	bus_dma_tag_t sc_dmat;
 
 	netif_tx_front_ring_t sc_tx_ring;
 	netif_rx_front_ring_t sc_rx_ring;
@@ -264,7 +263,6 @@ xennet_xenbus_attach(device_t parent, de
 
 	sc->sc_xbusd = xa->xa_xbusd;
 	sc->sc_xbusd->xbusd_otherend_changed = xennet_backend_changed;
-	sc->sc_dmat = xa->xa_dmat;
 
 	/* xenbus ensure 2 devices can't be probed at the same time */
 	if (if_xennetrxbuf_cache_inited == 0) {
@@ -280,8 +278,8 @@ xennet_xenbus_attach(device_t parent, de
 		struct xennet_txreq *txreq = >sc_txreqs[i];
 	
 		txreq->txreq_id = i;
-		if (bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1, PAGE_SIZE,
-		PAGE_SIZE, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
+		if (bus_dmamap_create(sc->sc_xbusd->xbusd_dmat, PAGE_SIZE, 1,
+		PAGE_SIZE, PAGE_SIZE, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
 		>txreq_dmamap) != 0)
 			break;
 
@@ -294,8 +292,8 @@ xennet_xenbus_attach(device_t parent, de
 	for (i = 0; i < NET_RX_RING_SIZE; i++) {
 		struct xennet_rxreq *rxreq = >sc_rxreqs[i];
 		rxreq->rxreq_id = i;
-		if (bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1, PAGE_SIZE,
-		PAGE_SIZE, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
+		if (bus_dmamap_create(sc->sc_xbusd->xbusd_dmat, PAGE_SIZE, 1,
+		PAGE_SIZE, PAGE_SIZE, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
 		>rxreq_dmamap) != 0)
 			break;
 		rxreq->rxreq_gntref = GRANT_INVALID_REF;
@@ -725,7 +723,8 @@ xennet_alloc_rx_buffer(struct xennet_xen
 
 		/* Set M_EXT_CLUSTER so that load_mbuf uses m_ext.ext_paddr */
 		m->m_flags |= M_EXT_CLUSTER;
-		if (__predict_false(bus_dmamap_load_mbuf(sc->sc_dmat,
+		if (__predict_false(bus_dmamap_load_mbuf(
+		sc->sc_xbusd->xbusd_dmat,
 		req->rxreq_dmamap, m, BUS_DMA_NOWAIT) != 0)) {
 			printf("%s: rx mbuf load failed", ifp->if_xname);
 			m->m_flags &= ~M_EXT_CLUSTER;
@@ -867,7 +866,7 @@ again:
 		else
 			if_statinc(ifp, if_opackets);
 		xengnt_revoke_access(req->txreq_gntref);
-		bus_dmamap_unload(sc->sc_dmat, req->txreq_dmamap);
+		bus_dmamap_unload(sc->sc_xbusd->xbusd_dmat, req->txreq_dmamap);
 		m_freem(req->txreq_m);
 		req->txreq_m = NULL;
 		SLIST_INSERT_HEAD(>sc_txreq_head, req, txreq_next);
@@ -927,7 +926,7 @@ again:
 		req->rxreq_m = NULL;
 
 		m->m_len = m->m_pkthdr.len = rx->status;
-		bus_dmamap_sync(sc->sc_dmat, req->rxreq_dmamap, 0,
+		bus_dmamap_sync(sc->sc_xbusd->xbusd_dmat, req->rxreq_dmamap, 0,
 		 

CVS commit: [is-mlppp] src/sys/net

2020-04-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sat Apr 11 10:47:06 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
trying to ind the right place for MLPPP renegotiation.


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.10 -r1.187.2.11 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.10 src/sys/net/if_spppsubr.c:1.187.2.11
--- src/sys/net/if_spppsubr.c:1.187.2.10	Sat Apr 11 10:06:22 2020
+++ src/sys/net/if_spppsubr.c	Sat Apr 11 10:47:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.10 2020/04/11 10:06:22 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.11 2020/04/11 10:47:06 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.10 2020/04/11 10:06:22 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.11 2020/04/11 10:47:06 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3057,6 +3057,10 @@ sppp_lcp_tld(struct sppp *sp)
 			(cps[i])->Close(sp);
 		}
 	}
+
+	sp->lcp.mrru = sp->pp_if.if_mtu;
+	sp->lcp.opts |= (1 << LCP_OPT_MP_MRRU);
+	sp->lcp.their_mrru = 0;
 }
 
 static void



CVS commit: [bouyer-xenpvh] src/sys/arch

2020-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Apr 11 10:11:31 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64 [bouyer-xenpvh]: genassym.cf spl.S
src/sys/arch/amd64/include [bouyer-xenpvh]: frameasm.h
src/sys/arch/i386/i386 [bouyer-xenpvh]: genassym.cf spl.S
src/sys/arch/i386/include [bouyer-xenpvh]: frameasm.h
src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h
src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c

Log Message:
Include ci_isources[] for XenPV too.
Adjust spllower() to XenPV needs, and switch XenPV to the native spllower().
Remove xen_spllower().


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.1 -r1.82.4.2 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.43.4.3 -r1.43.4.4 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.47 -r1.47.6.1 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.119.4.1 -r1.119.4.2 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.50.4.1 -r1.50.4.2 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.29 -r1.29.6.1 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.117.4.2 -r1.117.4.3 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.21 -r1.21.2.1 src/sys/arch/xen/x86/xen_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/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.82.4.1 src/sys/arch/amd64/amd64/genassym.cf:1.82.4.2
--- src/sys/arch/amd64/amd64/genassym.cf:1.82.4.1	Wed Apr  8 17:59:16 2020
+++ src/sys/arch/amd64/amd64/genassym.cf	Sat Apr 11 10:11:30 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.82.4.1 2020/04/08 17:59:16 bouyer Exp $
+#	$NetBSD: genassym.cf,v 1.82.4.2 2020/04/11 10:11:30 bouyer Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -246,13 +246,11 @@ define	CPU_INFO_CURPRIORITY	offsetof(str
 define	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
 define	CPU_INFO_ILEVEL		offsetof(struct cpu_info, ci_ilevel)
 define	CPU_INFO_IDEPTH		offsetof(struct cpu_info, ci_idepth)
-if !defined(XENPV)
 define	CPU_INFO_IPENDING	offsetof(struct cpu_info, ci_ipending)
 define	CPU_INFO_IMASKED	offsetof(struct cpu_info, ci_imasked)
 define	CPU_INFO_IMASK		offsetof(struct cpu_info, ci_imask)
 define	CPU_INFO_IUNMASK	offsetof(struct cpu_info, ci_iunmask)
 define	CPU_INFO_ISOURCES	offsetof(struct cpu_info, ci_isources)
-endif
 define	CPU_INFO_MTX_COUNT	offsetof(struct cpu_info, ci_mtx_count)
 define	CPU_INFO_MTX_OLDSPL	offsetof(struct cpu_info, ci_mtx_oldspl)
 define  CPU_INFO_CPUID		offsetof(struct cpu_info, ci_cpuid)

Index: src/sys/arch/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.43.4.3 src/sys/arch/amd64/amd64/spl.S:1.43.4.4
--- src/sys/arch/amd64/amd64/spl.S:1.43.4.3	Fri Apr 10 14:41:59 2020
+++ src/sys/arch/amd64/amd64/spl.S	Sat Apr 11 10:11:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.43.4.3 2020/04/10 14:41:59 bouyer Exp $	*/
+/*	$NetBSD: spl.S,v 1.43.4.4 2020/04/11 10:11:30 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -226,7 +226,6 @@ IDTVEC(resume_preempt)
 IDTVEC_END(resume_preempt)
 #endif /* XEN */
 
-#ifndef XENPV
 /*
  * void spllower(int s);
  *
@@ -238,8 +237,8 @@ ENTRY(spllower)
 	cmpl	CPUVAR(ILEVEL),%edi
 	jae	1f
 	movl	CPUVAR(IUNMASK)(,%rdi,4),%edx
-	pushf
-	cli
+	PUSHF(ax)
+	CLI(ax)
 	testl	CPUVAR(IPENDING),%edx
 	jnz	2f
 #if defined(XEN)
@@ -248,12 +247,20 @@ ENTRY(spllower)
 	jnz	2f
 #endif
 	movl	%edi,CPUVAR(ILEVEL)
-	popf
+	POPF	/* clobbers %rdi */
 1:
 	ret
 	ret
 2:
+#ifdef XENPV
+	/*
+	 * no need to call stipending, we're going to CLI again
+	 * just drop the saved value on stack
+	 */
+	addq	$8,%rsp
+#else
 	popf
+#endif
 	jmp	_C_LABEL(Xspllower)
 3:
 	.space 16
@@ -261,6 +268,7 @@ ENTRY(spllower)
 END(spllower)
 LABEL(spllower_end)
 
+#ifndef XENPV
 /*
  * void	cx8_spllower(int s);
  *

Index: src/sys/arch/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.47 src/sys/arch/amd64/include/frameasm.h:1.47.6.1
--- src/sys/arch/amd64/include/frameasm.h:1.47	Sun Nov 17 14:07:00 2019
+++ src/sys/arch/amd64/include/frameasm.h	Sat Apr 11 10:11:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.47 2019/11/17 14:07:00 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.47.6.1 2020/04/11 10:11:30 bouyer Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -31,11 +31,23 @@
  	movq CPUVAR(VCPU),%r ## temp_reg ;			\
 	movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg);
 
+#define PUSHF(temp_reg) \
+ 	movq CPUVAR(VCPU),%r ## temp_reg ;			\
+	movzbl EVTCHN_UPCALL_MASK(%r ## temp_reg), %e ## temp_reg; \
+	pushq %r ## temp_reg
+
+#define POPF \
+	popq %rdi; \
+	call _C_LABEL(xen_write_psl)
+	
+
 #else /* XENPV */
 #define	XEN_ONLY2(x,y)
 #define	NOT_XEN(x)	x
 #define CLI(temp_reg) cli
 #define STI(temp_reg) sti
+#define PUSHF(temp_reg) pushf
+#define POPL popl
 #endif	/* XEN */
 
 #define HP_NAME_CLAC		1

Index: src/sys/arch/i386/i386/genassym.cf
diff -u 

CVS commit: [is-mlppp] src/sys/net

2020-04-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sat Apr 11 10:06:22 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.9 -r1.187.2.10 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.9 src/sys/net/if_spppsubr.c:1.187.2.10
--- src/sys/net/if_spppsubr.c:1.187.2.9	Sat Apr 11 09:40:02 2020
+++ src/sys/net/if_spppsubr.c	Sat Apr 11 10:06:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.9 2020/04/11 09:40:02 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.10 2020/04/11 10:06:22 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.9 2020/04/11 09:40:02 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.10 2020/04/11 10:06:22 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2950,8 +2950,8 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct
 u_int mrru = p[2] * 256 + p[3];
 if (debug)
 	addlog(" %d", mrru);
-if (mrru < PPP_MINMRU || mru > sp->pp_if.if_mtu)
-	mru = sp->pp_if.if_mtu;
+if (mrru < PPP_MINMRU || mrru > sp->pp_if.if_mtu)
+	mrru = sp->pp_if.if_mtu;
 sp->lcp.mrru = mrru;
 sp->lcp.opts |= (1 << LCP_OPT_MP_MRRU);
 			}



CVS commit: [is-mlppp] src/sys/net

2020-04-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sat Apr 11 09:40:02 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
MLPPP mrru negotiation.


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.8 -r1.187.2.9 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.8 src/sys/net/if_spppsubr.c:1.187.2.9
--- src/sys/net/if_spppsubr.c:1.187.2.8	Sat Apr 11 08:11:58 2020
+++ src/sys/net/if_spppsubr.c	Sat Apr 11 09:40:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.8 2020/04/11 08:11:58 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.9 2020/04/11 09:40:02 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.8 2020/04/11 08:11:58 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.9 2020/04/11 09:40:02 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2354,7 +2354,6 @@ sppp_lcp_up(struct sppp *sp)
 	sp->pp_last_receive = sp->pp_last_activity = time_uptime;
 
 	/* Initialize mlppp state */
-	sp->lcp.mrru = sp->lcp.their_mrru = 0;
 	sp->lcp.ml_prefix = NULL;
 	sp->lcp.ml_seq_xpctd = 0;
 
@@ -2434,6 +2433,10 @@ sppp_lcp_open(struct sppp *sp)
 		sp->lcp.mru = PP_MTU;
 	sp->lcp.their_mru = PP_MTU;
 
+	sp->lcp.mrru = sp->pp_if.if_mtu;
+	sp->lcp.opts |= (1 << LCP_OPT_MP_MRRU);
+	sp->lcp.their_mrru = 0;
+
 	/*
 	 * If we are authenticator, negotiate LCP_AUTH
 	 */
@@ -2822,6 +2825,19 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct
 			sp->lcp.opts &= ~(1 << LCP_OPT_MRU);
 			sp->lcp.mru = PP_MTU;
 			break;
+		case LCP_OPT_MP_MRRU:
+			/*
+			 * the peer is rejecting a multilink MRRU.
+			 * give up on MP in the incoming direction.
+			 */
+			if (debug) {
+addlog("%s: warning: peer rejected our MRRU of "
+"%ld bytes. Defaulting to no MLPPP\n",
+ifp->if_xname, sp->lcp.mrru);
+			}
+			sp->lcp.opts &= ~(1 << LCP_OPT_MP_MRRU);
+			sp->lcp.mrru = 0;
+			break;
 		case LCP_OPT_AUTH_PROTO:
 			/*
 			 * Peer doesn't want to authenticate himself,
@@ -2924,6 +2940,22 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct
 sp->lcp.opts |= (1 << LCP_OPT_MRU);
 			}
 			break;
+		case LCP_OPT_MP_MRRU:
+			/*
+			 * Peer wants to advise us to negotiate an multilink MRRU.
+			 * Agree on it if it's reasonable, or use
+			 * default otherwise.
+			 */
+			if (len >= 4 && l == 4) {
+u_int mrru = p[2] * 256 + p[3];
+if (debug)
+	addlog(" %d", mrru);
+if (mrru < PPP_MINMRU || mru > sp->pp_if.if_mtu)
+	mru = sp->pp_if.if_mtu;
+sp->lcp.mrru = mrru;
+sp->lcp.opts |= (1 << LCP_OPT_MP_MRRU);
+			}
+			break;
 		case LCP_OPT_AUTH_PROTO:
 			/*
 			 * Peer doesn't like our authentication method,
@@ -3089,6 +3121,13 @@ sppp_lcp_scr(struct sppp *sp)
 		opt[i++] = sp->lcp.mru;
 	}
 
+	if (sp->lcp.opts & (1 << LCP_OPT_MP_MRRU)) {
+		opt[i++] = LCP_OPT_MP_MRRU;
+		opt[i++] = 4;
+		opt[i++] = sp->lcp.mrru >> 8;
+		opt[i++] = sp->lcp.mrru;
+	}
+
 	if (sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) {
 		authproto = sp->hisauth.proto;
 		opt[i++] = LCP_OPT_AUTH_PROTO;



CVS commit: src

2020-04-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 11 09:15:23 UTC 2020

Modified Files:
src/lib/libpthread/arch/powerpc: pthread_md.h
src/sys/arch/powerpc/powerpc: sig_machdep.c

Log Message:
Revert previous:
http://mail-index.netbsd.org/source-changes/2020/02/20/msg114173.html

Comment turned out to be wrong, and KASSERT fires for oea.

XXX
Need to revisit shortly...


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libpthread/arch/powerpc/pthread_md.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/powerpc/powerpc/sig_machdep.c

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

Modified files:

Index: src/lib/libpthread/arch/powerpc/pthread_md.h
diff -u src/lib/libpthread/arch/powerpc/pthread_md.h:1.8 src/lib/libpthread/arch/powerpc/pthread_md.h:1.9
--- src/lib/libpthread/arch/powerpc/pthread_md.h:1.8	Thu Feb 20 07:07:02 2020
+++ src/lib/libpthread/arch/powerpc/pthread_md.h	Sat Apr 11 09:15:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_md.h,v 1.8 2020/02/20 07:07:02 rin Exp $	*/
+/*	$NetBSD: pthread_md.h,v 1.9 2020/04/11 09:15:23 rin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -53,10 +53,7 @@ pthread__sp(void)
 /*
  * Set initial, sane values for registers whose values aren't just
  * "don't care".
- *
- * XXX
- * "Sane value" for MSR differs between oea/booke/ibm4xx, but no way to
- * obtain from userland. It should be corrected by cpu_setmcontext().
+ * 0xd032 is PSL_USERSET from arch/powerpc/include/psl.h
  */
 #define _INITCONTEXT_U_MD(ucp)		\
 	(ucp)->uc_mcontext.__gregs[_REG_MSR] = 0xd032;

Index: src/sys/arch/powerpc/powerpc/sig_machdep.c
diff -u src/sys/arch/powerpc/powerpc/sig_machdep.c:1.47 src/sys/arch/powerpc/powerpc/sig_machdep.c:1.48
--- src/sys/arch/powerpc/powerpc/sig_machdep.c:1.47	Thu Feb 20 07:07:02 2020
+++ src/sys/arch/powerpc/powerpc/sig_machdep.c	Sat Apr 11 09:15:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.47 2020/02/20 07:07:02 rin Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.48 2020/04/11 09:15:23 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.47 2020/02/20 07:07:02 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.48 2020/04/11 09:15:23 rin Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_altivec.h"
@@ -191,8 +191,6 @@ cpu_getmcontext(struct lwp *l, mcontext_
 int
 cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
 {
-
-	KASSERT(PSL_USEROK_P(mcp->__gregs[_REG_MSR]));
 	return 0;
 }
 



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

2020-04-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 11 09:02:04 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: vectors.S

Log Message:
The vectors allow for up to 0x80 bytes of instructions, but we've reached
this limit already, so implement the handler functions outside, and jump
to them. This allows to add instructions in the future.

Sent to ryo@ and skrll@.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/aarch64/vectors.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/vectors.S
diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.11 src/sys/arch/aarch64/aarch64/vectors.S:1.12
--- src/sys/arch/aarch64/aarch64/vectors.S:1.11	Wed Feb 12 07:02:08 2020
+++ src/sys/arch/aarch64/aarch64/vectors.S	Sat Apr 11 09:02:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.S,v 1.11 2020/02/12 07:02:08 skrll Exp $	*/
+/*	$NetBSD: vectors.S,v 1.12 2020/04/11 09:02:04 maxv Exp $	*/
 
 #include 
 #include "assym.h"
@@ -16,11 +16,12 @@
 #define	TRAP_FRAMESIZE	TF_SIZE
 #endif
 
-	/*
-	 * vector_entry macro must be small enough to fit 0x80 bytes!
-	 */
-	.macro	vector_entry, el, label, tpidr
-	.align 7	/* aligned 0x80 */
+/*
+ * Template for the handler functions.
+ */
+.macro	vector_func, func, el, label, tpidr
+ENTRY_NP(\func)
+	.align 7	/* cacheline-aligned */
 
 	.if \el == 1
 	/* need to allocate stack on el1 */
@@ -88,44 +89,79 @@
 	mov	x29, sp			/* for backtrace */
 #endif
 	b	\label
-	.endm
-
+END(\func)
+.endm
 
-	.align 11	/* vector table must be aligned 2048 */
-ENTRY_NP(el1_vectors)
 /*
- * Exception taken from current Exception Level with SP_EL0.
- * (These shouldn't happen)
+ * The vector_entry macro must be small enough to fit 0x80 bytes! We just jump
+ * into the proper function, so this constraint is always respected.
  */
-	vector_entry	1, trap_el1t_sync
-	vector_entry	1, trap_el1t_irq
-	vector_entry	1, trap_el1t_fiq
-	vector_entry	1, trap_el1t_error
+.macro	vector_entry, func
+	.align 7	/* aligned 0x80 */
+	b	\func
+.endm
 
 /*
- * Exception taken from current Exception Level with SP_EL1.
- * There are entries for exceptions caused in EL1 (kernel exceptions).
+ * The functions.
  */
-	vector_entry	1, trap_el1h_sync
-	vector_entry	1, interrupt
-	vector_entry	1, trap_el1h_fiq
-	vector_entry	1, trap_el1h_error
+vector_func	el1t_sync_handler,  1, trap_el1t_sync
+vector_func	el1t_irq_handler,   1, trap_el1t_irq
+vector_func	el1t_fiq_handler,   1, trap_el1t_fiq
+vector_func	el1t_error_handler, 1, trap_el1t_error
+
+vector_func	el1h_sync_handler,  1, trap_el1h_sync
+vector_func	el1h_intr_handler,  1, interrupt
+vector_func	el1h_fiq_handler,   1, trap_el1h_fiq
+vector_func	el1h_error_handler, 1, trap_el1h_error
+
+vector_func	el0_sync_handler,  0, trap_el0_sync
+vector_func	el0_intr_handler,  0, interrupt
+vector_func	el0_fiq_handler,   0, trap_el0_fiq
+vector_func	el0_error_handler, 0, trap_el0_error
+
+vector_func	el0_32sync_handler,  0, trap_el0_32sync, ro
+vector_func	el0_32intr_handler,  0, interrupt, ro
+vector_func	el0_32fiq_handler,   0, trap_el0_32fiq, ro
+vector_func	el0_32error_handler, 0, trap_el0_32error, ro
 
 /*
- * Exception taken from lower Exception Level which is using AArch64
- * There are entries for exceptions caused in EL0 (native user exceptions).
+ * The vector table. Must be aligned to 2048.
  */
-	vector_entry	0, trap_el0_sync
-	vector_entry	0, interrupt
-	vector_entry	0, trap_el0_fiq
-	vector_entry	0, trap_el0_error
+	.align 11
+ENTRY_NP(el1_vectors)
+	/*
+	 * Exception taken from current Exception Level with SP_EL0.
+	 * (These shouldn't happen)
+	 */
+	vector_entry	el1t_sync_handler
+	vector_entry	el1t_irq_handler
+	vector_entry	el1t_fiq_handler
+	vector_entry	el1t_error_handler
 
-/*
- * Exception taken from lower Exception Level which is using AArch32
- * There are entries for exceptions caused in EL0 (compat user exceptions).
- */
-	vector_entry	0, trap_el0_32sync, ro
-	vector_entry	0, interrupt, ro
-	vector_entry	0, trap_el0_32fiq, ro
-	vector_entry	0, trap_el0_32error, ro
+	/*
+	 * Exception taken from current Exception Level with SP_EL1.
+	 * There are entries for exceptions caused in EL1 (kernel exceptions).
+	 */
+	vector_entry	el1h_sync_handler
+	vector_entry	el1h_intr_handler
+	vector_entry	el1h_fiq_handler
+	vector_entry	el1h_error_handler
+
+	/*
+	 * Exception taken from lower Exception Level which is using AArch64.
+	 * There are entries for exceptions caused in EL0 (native user exceptions).
+	 */
+	vector_entry	el0_sync_handler
+	vector_entry	el0_intr_handler
+	vector_entry	el0_fiq_handler
+	vector_entry	el0_error_handler
+
+	/*
+	 * Exception taken from lower Exception Level which is using AArch32.
+	 * There are entries for exceptions caused in EL0 (compat user exceptions).
+	 */
+	vector_entry	el0_32sync_handler
+	vector_entry	el0_32intr_handler
+	vector_entry	el0_32fiq_handler
+	vector_entry	

CVS commit: [is-mlppp] src/sys/net

2020-04-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sat Apr 11 08:11:58 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
macro error


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.7 -r1.187.2.8 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.7 src/sys/net/if_spppsubr.c:1.187.2.8
--- src/sys/net/if_spppsubr.c:1.187.2.7	Sat Apr 11 07:38:00 2020
+++ src/sys/net/if_spppsubr.c	Sat Apr 11 08:11:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.7 2020/04/11 07:38:00 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.8 2020/04/11 08:11:58 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.7 2020/04/11 07:38:00 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.8 2020/04/11 08:11:58 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -93,7 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.
 #include 
 
 #ifndef _NET_IF_STATS_H_
-#define if_statadd(ifp,member,amount)	do { (ifp)->(member)+=(amount); } while (0)
+#define if_statadd(ifp,member,amount)	do { (ifp)->member+=(amount); } while (0)
 #define if_statadd2(ifp,m1,a1,m2,a2)	do { if_statadd(ifp,m1,a1); if_statadd(ifp,m2,a2);} while(0)
 #define if_statinc(ifp,member)		if_statadd(ifp,member,1)
 #endif



CVS commit: [bouyer-xenpvh] src/sys/arch/x86/x86

2020-04-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Apr 11 08:06:16 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [bouyer-xenpvh]: x86_machdep.c

Log Message:
Remove spaces in machdep.hypervisor, suggested by mlelstv@


To generate a diff of this commit:
cvs rdiff -u -r1.137.2.1 -r1.137.2.2 src/sys/arch/x86/x86/x86_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.137.2.1 src/sys/arch/x86/x86/x86_machdep.c:1.137.2.2
--- src/sys/arch/x86/x86/x86_machdep.c:1.137.2.1	Wed Apr  8 17:59:16 2020
+++ src/sys/arch/x86/x86/x86_machdep.c	Sat Apr 11 08:06:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.137.2.1 2020/04/08 17:59:16 bouyer Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.137.2.2 2020/04/11 08:06:16 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.137.2.1 2020/04/08 17:59:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.137.2.2 2020/04/11 08:06:16 bouyer Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -1255,10 +1255,10 @@ sysctl_machdep_tsc_enable(SYSCTLFN_ARGS)
 static const char * const vm_guest_name[VM_LAST] = {
 	[VM_GUEST_NO] =		"none",
 	[VM_GUEST_VM] =		"generic",
-	[VM_GUEST_XENPV] =	"Xen PV",
-	[VM_GUEST_XENPVH] =	"Xen PVH",
-	[VM_GUEST_XENHVM] =	"Xen HVM",
-	[VM_GUEST_XENPVHVM] =	"Xen PVHVM",
+	[VM_GUEST_XENPV] =	"XenPV",
+	[VM_GUEST_XENPVH] =	"XenPVH",
+	[VM_GUEST_XENHVM] =	"XenHVM",
+	[VM_GUEST_XENPVHVM] =	"XenPVHVM",
 	[VM_GUEST_HV] =		"Hyper-V",
 	[VM_GUEST_VMWARE] =	"VMware",
 	[VM_GUEST_KVM] =	"KVM",



CVS commit: [is-mlppp] src/sys/net

2020-04-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sat Apr 11 07:38:00 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
whitespace error


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.6 -r1.187.2.7 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.6 src/sys/net/if_spppsubr.c:1.187.2.7
--- src/sys/net/if_spppsubr.c:1.187.2.6	Sat Apr 11 07:28:06 2020
+++ src/sys/net/if_spppsubr.c	Sat Apr 11 07:38:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.6 2020/04/11 07:28:06 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.7 2020/04/11 07:38:00 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.6 2020/04/11 07:28:06 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.7 2020/04/11 07:38:00 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -93,9 +93,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.
 #include 
 
 #ifndef _NET_IF_STATS_H_
-#define if_statadd (ifp,member,amount)	do { (ifp)->(member)+=(amount); } while (0)
+#define if_statadd(ifp,member,amount)	do { (ifp)->(member)+=(amount); } while (0)
 #define if_statadd2(ifp,m1,a1,m2,a2)	do { if_statadd(ifp,m1,a1); if_statadd(ifp,m2,a2);} while(0)
-#define if_statinc (ifp,member)		if_statadd(ifp,member,1)
+#define if_statinc(ifp,member)		if_statadd(ifp,member,1)
 #endif
 
 #ifdef NET_MPSAFE



CVS commit: [is-mlppp] src/sys/net

2020-04-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sat Apr 11 07:28:06 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
compat code to make transplanting this to netbsd-8 easier


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.5 -r1.187.2.6 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.5 src/sys/net/if_spppsubr.c:1.187.2.6
--- src/sys/net/if_spppsubr.c:1.187.2.5	Fri Apr 10 19:45:24 2020
+++ src/sys/net/if_spppsubr.c	Sat Apr 11 07:28:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.5 2020/04/10 19:45:24 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.6 2020/04/11 07:28:06 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.5 2020/04/10 19:45:24 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.6 2020/04/11 07:28:06 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -92,6 +92,12 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.
 #include 
 #include 
 
+#ifndef _NET_IF_STATS_H_
+#define if_statadd (ifp,member,amount)	do { (ifp)->(member)+=(amount); } while (0)
+#define if_statadd2(ifp,m1,a1,m2,a2)	do { if_statadd(ifp,m1,a1); if_statadd(ifp,m2,a2);} while(0)
+#define if_statinc (ifp,member)		if_statadd(ifp,member,1)
+#endif
+
 #ifdef NET_MPSAFE
 #define SPPPSUBR_MPSAFE	1
 #endif



CVS commit: src/sys/dev/usb

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 06:57:32 UTC 2020

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

Log Message:
enable the workaround for Microsoft transceiver v8.0 too - PR kern/55161

while here enable also for v7.0, it's likely to have same problem


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/usb/ums.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/ums.c
diff -u src/sys/dev/usb/ums.c:1.96 src/sys/dev/usb/ums.c:1.97
--- src/sys/dev/usb/ums.c:1.96	Fri Jan  3 12:39:39 2020
+++ src/sys/dev/usb/ums.c	Sat Apr 11 06:57:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ums.c,v 1.96 2020/01/03 12:39:39 jmcneill Exp $	*/
+/*	$NetBSD: ums.c,v 1.97 2020/04/11 06:57:32 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.96 2020/01/03 12:39:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.97 2020/04/11 06:57:32 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -173,6 +173,8 @@ ums_attach(device_t parent, device_t sel
 		switch (uha->uiaa->uiaa_product) {
 		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR10:
 		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR20:
+		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR70:
+		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR80:
 		case USB_PRODUCT_MICROSOFT_NATURAL_6000:
 			fixpos = 24;
 			break;



CVS commit: src/sys/dev/usb

2020-04-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Apr 11 06:54:59 UTC 2020

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
add Microsoft 2.4GHz Transceiver V8.0 - PR kern/55161

add also V7.0, found the ID


To generate a diff of this commit:
cvs rdiff -u -r1.779 -r1.780 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.779 src/sys/dev/usb/usbdevs:1.780
--- src/sys/dev/usb/usbdevs:1.779	Sat Apr  4 13:18:11 2020
+++ src/sys/dev/usb/usbdevs	Sat Apr 11 06:54:59 2020
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.779 2020/04/04 13:18:11 mlelstv Exp $
+$NetBSD: usbdevs,v 1.780 2020/04/11 06:54:59 jdolecek Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2328,6 +2328,8 @@ product MICROSOFT XBOX_CONTROLLER_S12	0x
 product MICROSOFT XBOX_360_WIRELESS_RECEIVER 0x0291 Xbox 360 Wireless Receiver
 product MICROSOFT 24GHZ_XCVR10		0x071d	2.4GHz Transceiver V1.0
 product MICROSOFT 24GHZ_XCVR20		0x071f	2.4GHz Transceiver V2.0
+product MICROSOFT 24GHZ_XCVR70		0x0745	2.4GHz Transceiver V7.0
+product MICROSOFT 24GHZ_XCVR80		0x07b2	2.4GHz Transceiver V8.0
 product MICROSOFT CM6000		0x077d	Comfort Mouse 6000