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

2020-05-27 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu May 28 04:51:44 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: genassym.cf locore.S

Log Message:
- make AP{IB,DA,DB}Key are also enabled when ARMV83_PAC.
- If no ARMV83_PAC, clearly disable SCTLR_En{IA,IB,DA,DB}


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/aarch64/aarch64/locore.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/genassym.cf
diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.25 src/sys/arch/aarch64/aarch64/genassym.cf:1.26
--- src/sys/arch/aarch64/aarch64/genassym.cf:1.25	Sat May 23 18:08:59 2020
+++ src/sys/arch/aarch64/aarch64/genassym.cf	Thu May 28 04:51:44 2020
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.25 2020/05/23 18:08:59 ryo Exp $
+# $NetBSD: genassym.cf,v 1.26 2020/05/28 04:51:44 ryo Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -368,6 +368,9 @@ define	SCTLR_UCI		SCTLR_UCI
 define	SCTLR_nTLSMD		SCTLR_nTLSMD
 define	SCTLR_LSMAOE		SCTLR_LSMAOE
 define	SCTLR_EnIA		SCTLR_EnIA
+define	SCTLR_EnIB		SCTLR_EnIB
+define	SCTLR_EnDA		SCTLR_EnDA
+define	SCTLR_EnDB		SCTLR_EnDB
 
 define	ICC_SRE_EL2_EN		ICC_SRE_EL2_EN
 define	ICC_SRE_EL2_SRE		ICC_SRE_EL2_SRE

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.63 src/sys/arch/aarch64/aarch64/locore.S:1.64
--- src/sys/arch/aarch64/aarch64/locore.S:1.63	Wed May 27 19:49:37 2020
+++ src/sys/arch/aarch64/aarch64/locore.S	Thu May 28 04:51:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.63 2020/05/27 19:49:37 ryo Exp $	*/
+/*	$NetBSD: locore.S,v 1.64 2020/05/28 04:51:44 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.63 2020/05/27 19:49:37 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.64 2020/05/28 04:51:44 ryo Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -183,7 +183,8 @@ vstart:
 	bl	aarch64_pac_init
 	cbnz	w0, 1f			/* if (aarch64_pac_init() == 0) */
 	mrs	x0, sctlr_el1
-	orr	x0, x0, #SCTLR_EnIA	/*  enable PAC */
+	ldr	x1, sctlr_pac
+	orr	x0, x0, x1		/*  enable PAC */
 	msr	sctlr_el1, x0
 1:
 
@@ -517,7 +518,8 @@ mp_vstart:
 	bl	aarch64_pac_init
 	cbnz	w0, 1f			/* if (aarch64_pac_init() == 0) */
 	mrs	x0, sctlr_el1
-	orr	x0, x0, #SCTLR_EnIA	/*  enable PAC */
+	ldr	x1, sctlr_pac
+	orr	x0, x0, x1		/*  enable PAC */
 	msr	sctlr_el1, x0
 1:
 
@@ -956,6 +958,8 @@ mmu_enable:
 	mrs	x0, sctlr_el1
 	ldr	x1, sctlr_clear
 	bic	x0, x0, x1
+	ldr	x1, sctlr_pac	/* disable PAC */
+	bic	x0, x0, x1
 	ldr	x1, sctlr_set
 	orr	x0, x0, x1
 
@@ -1051,6 +1055,13 @@ sctlr_clear:
 	SCTLR_SA |  /* Enable SP alignment check */ \
 	SCTLR_A |   /* Alignment check enable */ \
 	0)
+sctlr_pac:
+	.quad ( \
+	SCTLR_EnIA |/* PACIA (APIAKey_EL1) instruction enable */ \
+	SCTLR_EnIB |/* PACIB (APIBKey_EL1) instruction enable */ \
+	SCTLR_EnDA |/* PACDA (APDAKey_EL1) instruction enable */ \
+	SCTLR_EnDB |/* PACDB (APDBKey_EL1) instruction enable */ \
+	0)
 
 mdscr_setting:
 	.quad ( \



CVS commit: src/external/bsd/ntp/dist

2020-05-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 27 23:52:20 UTC 2020

Modified Files:
src/external/bsd/ntp/dist/ntpd: ntp_config.c refclock_neoclock4x.c
src/external/bsd/ntp/dist/ntpq: ntpq.c
src/external/bsd/ntp/dist/util: ntp-keygen.c

Log Message:
Adjustments to our patches requested by upstream


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/ntp/dist/ntpd/ntp_config.c
cvs rdiff -u -r1.11 -r1.12 \
src/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/ntp/dist/ntpq/ntpq.c
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/ntp/dist/util/ntp-keygen.c

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

Modified files:

Index: src/external/bsd/ntp/dist/ntpd/ntp_config.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.22 src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.23
--- src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.22	Mon May 25 16:47:25 2020
+++ src/external/bsd/ntp/dist/ntpd/ntp_config.c	Wed May 27 19:52:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_config.c,v 1.22 2020/05/25 20:47:25 christos Exp $	*/
+/*	$NetBSD: ntp_config.c,v 1.23 2020/05/27 23:52:19 christos Exp $	*/
 
 /* ntp_config.c
  *
@@ -3892,7 +3892,7 @@ config_fudge(
 
 			case T_Refid:
 clock_stat.haveflags |= CLK_HAVEVAL2;
-/* strncpy() does exactly what we want here: */
+/* avoid using strncpy because gcc warns */
 len = strlen(curr_opt->value.s);
 if (len > sizeof(clock_stat.fudgeval2))
 	len = sizeof(clock_stat.fudgeval2);

Index: src/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c
diff -u src/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c:1.11 src/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c:1.12
--- src/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c:1.11	Mon May 25 16:47:25 2020
+++ src/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c	Wed May 27 19:52:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: refclock_neoclock4x.c,v 1.11 2020/05/25 20:47:25 christos Exp $	*/
+/*	$NetBSD: refclock_neoclock4x.c,v 1.12 2020/05/27 23:52:19 christos Exp $	*/
 
 /*
  *
@@ -727,6 +727,7 @@ neoclock4x_control(int unit,
   if(NULL != out)
 {
   char *tt;
+  /* the 199 here is almost 2x the max string */
   char tmpbuf[199];
 
   out->kv_list = (struct ctl_var *)0;
@@ -767,6 +768,7 @@ neoclock4x_control(int unit,
 snprintf(tt, 39, "dststatus=\"winter\"");
   else
 snprintf(tt, 39, "dststatus=\"unknown\"");
+  /* the 99 below is greater than 80 the max string */
   tt = add_var(>kv_list, 80, RO|DEF);
   snprintf(tt, 99, "firmware=\"%s\"", up->firmware);
   tt = add_var(>kv_list, 40, RO|DEF);

Index: src/external/bsd/ntp/dist/ntpq/ntpq.c
diff -u src/external/bsd/ntp/dist/ntpq/ntpq.c:1.21 src/external/bsd/ntp/dist/ntpq/ntpq.c:1.22
--- src/external/bsd/ntp/dist/ntpq/ntpq.c:1.21	Mon May 25 16:47:26 2020
+++ src/external/bsd/ntp/dist/ntpq/ntpq.c	Wed May 27 19:52:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntpq.c,v 1.21 2020/05/25 20:47:26 christos Exp $	*/
+/*	$NetBSD: ntpq.c,v 1.22 2020/05/27 23:52:19 christos Exp $	*/
 
 /*
  * ntpq - query an NTP server using mode 6 commands
@@ -3738,7 +3738,7 @@ cookedprint(
 		case SN:
 			if (!value)
 output_raw = '?';
-			else if (isdigit((unsigned char)*value)) {	/* number without sign */
+			else if (isdigit(*(const unsigned char *)value)) {	/* number without sign */
 bv[0] = '+';
 atoascii (value, MAXVALLEN, bv+1, sizeof(bv)-1);
 output(fp, name, bv);

Index: src/external/bsd/ntp/dist/util/ntp-keygen.c
diff -u src/external/bsd/ntp/dist/util/ntp-keygen.c:1.13 src/external/bsd/ntp/dist/util/ntp-keygen.c:1.14
--- src/external/bsd/ntp/dist/util/ntp-keygen.c:1.13	Mon May 25 16:47:37 2020
+++ src/external/bsd/ntp/dist/util/ntp-keygen.c	Wed May 27 19:52:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp-keygen.c,v 1.13 2020/05/25 20:47:37 christos Exp $	*/
+/*	$NetBSD: ntp-keygen.c,v 1.14 2020/05/27 23:52:20 christos Exp $	*/
 
 /*
  * Program to generate cryptographic keys for ntp clients and servers
@@ -281,7 +281,7 @@ followlink(
 
 	REQUIRE(bufsiz > 0);
 
-	len = readlink(fname, result, bufsiz);
+	len = readlink(fname, result, sizeof(result));
 	if (len < 0) {
 		fname[0] = '\0';
 		return;



CVS commit: src/distrib/amd64

2020-05-27 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed May 27 22:27:58 UTC 2020

Modified Files:
src/distrib/amd64: Makefile
src/distrib/amd64/installimage: Makefile
Removed Files:
src/distrib/amd64/uefi-installimage: Makefile Makefile.bootimage
Makefile.installimage boot.cfg.in etc.rc etc.ttys install.sh
spec.inst

Log Message:
rename amd64 uefi-installimage to be just installimage.

Works for both purposes, no confusing name.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/distrib/amd64/Makefile
cvs rdiff -u -r1.10 -r1.11 src/distrib/amd64/installimage/Makefile
cvs rdiff -u -r1.7 -r0 src/distrib/amd64/uefi-installimage/Makefile
cvs rdiff -u -r1.13 -r0 \
src/distrib/amd64/uefi-installimage/Makefile.bootimage
cvs rdiff -u -r1.3 -r0 \
src/distrib/amd64/uefi-installimage/Makefile.installimage
cvs rdiff -u -r1.2 -r0 src/distrib/amd64/uefi-installimage/boot.cfg.in \
src/distrib/amd64/uefi-installimage/etc.rc
cvs rdiff -u -r1.1 -r0 src/distrib/amd64/uefi-installimage/etc.ttys \
src/distrib/amd64/uefi-installimage/install.sh \
src/distrib/amd64/uefi-installimage/spec.inst

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

Modified files:

Index: src/distrib/amd64/Makefile
diff -u src/distrib/amd64/Makefile:1.13 src/distrib/amd64/Makefile:1.14
--- src/distrib/amd64/Makefile:1.13	Sun May 21 15:28:37 2017
+++ src/distrib/amd64/Makefile	Wed May 27 22:27:58 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2017/05/21 15:28:37 riastradh Exp $
+#	$NetBSD: Makefile,v 1.14 2020/05/27 22:27:58 maya Exp $
 
 .include 
 
@@ -14,7 +14,6 @@ SUBDIR+=	.WAIT
 SUBDIR+=	cdroms
 SUBDIR+=	liveimage
 SUBDIR+=	installimage
-SUBDIR+=	uefi-installimage
 TARGETS+=	release 
 
 iso_image:
@@ -25,6 +24,5 @@ live_image:
 
 install_image:
 	${MAKEDIRTARGET} installimage install_image
-	${MAKEDIRTARGET} uefi-installimage install_image
 
 .include 

Index: src/distrib/amd64/installimage/Makefile
diff -u src/distrib/amd64/installimage/Makefile:1.10 src/distrib/amd64/installimage/Makefile:1.11
--- src/distrib/amd64/installimage/Makefile:1.10	Sat Dec 15 18:03:16 2018
+++ src/distrib/amd64/installimage/Makefile	Wed May 27 22:27:58 2020
@@ -1,16 +1,21 @@
-#	$NetBSD: Makefile,v 1.10 2018/12/15 18:03:16 gson Exp $
+#	$NetBSD: Makefile,v 1.11 2020/05/27 22:27:58 maya Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-amd64-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	1450			# for all installation binaries
+INSTIMAGEMB?=	1550			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot
 SECONDARY_BOOT_ARG=	# unnecessary
+EFIBOOT=		${WORKDIR}/usr/mdec/bootx64.efi
+EFIBOOT+=		${WORKDIR}/usr/mdec/bootia32.efi
+#EFIBOOT=		${.OBJDIR}/../../../sys/arch/i386/stand/efiboot/bootx64/bootx64.efi
+#EFIBOOT+=		${.OBJDIR}/../../../sys/arch/i386/stand/efiboot/bootia32/bootia32.efi
 
 USE_MBR=		yes
+USE_GPT=		yes
 
 CLEANFILES+=	boot.cfg
 
@@ -35,4 +40,4 @@ IMGFILE_EXTRA=\
 	${SYSINSTDIR}/sysinstmsgs.pl	.\
 	${SYSINSTDIR}/sysinst		.
 
-.include "${DISTRIBDIR}/common/bootimage/Makefile.installimage"
+.include "${NETBSDSRCDIR}/distrib/common/bootimage//Makefile.installimage"



CVS commit: src/distrib/utils/embedded/conf

2020-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed May 27 21:53:04 UTC 2020

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf

Log Message:
Move back to MBR based images for armv7 because Amlogic's bootloader (for
Amlogic S805 based boards) needs to be installed to sector 1, which
conflicts with the GPT header.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/distrib/utils/embedded/conf/armv7.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.43 src/distrib/utils/embedded/conf/armv7.conf:1.44
--- src/distrib/utils/embedded/conf/armv7.conf:1.43	Mon May 25 11:11:52 2020
+++ src/distrib/utils/embedded/conf/armv7.conf	Wed May 27 21:53:04 2020
@@ -1,14 +1,9 @@
-# $NetBSD: armv7.conf,v 1.43 2020/05/25 11:11:52 jmcneill Exp $
+# $NetBSD: armv7.conf,v 1.44 2020/05/27 21:53:04 jmcneill Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
 console=fb
 resize=true
-gpt=true
-gpt_hybrid=true
-gpt_create_flags="-p 16"
-gpt_label_efi="EFI"
-gpt_label_ffs="netbsd-root"
 
 . ${DIR}/conf/evbarm.conf
 
@@ -59,7 +54,7 @@ populate_rpi() {
 	# The GENERIC .img kernel img is used for RPI2
 	if [ -f "${mnt}/boot/netbsd-GENERIC.img" ]; then
 		cat > "${mnt}/boot/cmdline.txt" << EOF
-root=NAME=${gpt_label_ffs} console=${console}
+root=ld0a console=${console}
 #fb=1280x1024		# to select a mode, otherwise try EDID
 #fb=disable		# to disable fb completely
 EOF



CVS commit: src/sys/arch/i386/i386

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 20:49:14 UTC 2020

Modified Files:
src/sys/arch/i386/i386: cpufunc.S

Log Message:
mismatched END pointed out by maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/i386/cpufunc.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/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.43 src/sys/arch/i386/i386/cpufunc.S:1.44
--- src/sys/arch/i386/i386/cpufunc.S:1.43	Wed May 27 19:33:40 2020
+++ src/sys/arch/i386/i386/cpufunc.S	Wed May 27 20:49:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.43 2020/05/27 19:33:40 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.44 2020/05/27 20:49:14 ad Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.43 2020/05/27 19:33:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.44 2020/05/27 20:49:14 ad Exp $");
 
 #include "opt_xen.h"
 
@@ -341,4 +341,4 @@ ENTRY(x86_movs)
 	movsl
 	leave
 	ret
-END(x86_stos)
+END(x86_movs)



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

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 20:48:43 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S

Log Message:
- mismatched END pointed out by maxv@
- ditch the frame, tracer should be able to deal without it in leaf on x86_64


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amd64/amd64/cpufunc.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/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.57 src/sys/arch/amd64/amd64/cpufunc.S:1.58
--- src/sys/arch/amd64/amd64/cpufunc.S:1.57	Wed May 27 19:33:40 2020
+++ src/sys/arch/amd64/amd64/cpufunc.S	Wed May 27 20:48:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.57 2020/05/27 19:33:40 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.58 2020/05/27 20:48:42 ad Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -422,22 +422,16 @@ ENTRY(outl)
 END(outl)
 
 ENTRY(x86_stos)
-	pushq	%rbp
-	movq	%rsp,%rbp
 	movq	%rsi,%rax
 	movq	%rdx,%rcx
 	rep
 	stosq
-	leave
 	ret
 END(x86_stos)
 
 ENTRY(x86_movs)
-	pushq	%rbp
-	movq	%rsp,%rbp
 	movq	%rdx,%rcx
 	rep
 	movsq
-	leave
 	ret
-END(x86_stos)
+END(x86_movs)



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

2020-05-27 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed May 27 19:49:37 UTC 2020

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

Log Message:
don't use x8 (caller-saved register) across functions

fix llvm+EARLYCONS kernel doesn't boot. it was working luckily with gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/aarch64/aarch64/locore.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/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.62 src/sys/arch/aarch64/aarch64/locore.S:1.63
--- src/sys/arch/aarch64/aarch64/locore.S:1.62	Tue May 26 09:16:33 2020
+++ src/sys/arch/aarch64/aarch64/locore.S	Wed May 27 19:49:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.62 2020/05/26 09:16:33 ryo Exp $	*/
+/*	$NetBSD: locore.S,v 1.63 2020/05/27 19:49:37 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.62 2020/05/26 09:16:33 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.63 2020/05/27 19:49:37 ryo Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -845,10 +845,10 @@ init_mmutable:
 	cbnz	x0, init_mmutable_error
 
 #ifdef FDT
+	VPRINT("Creating VA=PA tables for FDT\n")
 	adrl	x8, _C_LABEL(fdt_addr_r)
 	ldr	x8, [x8]
 
-	VPRINT("Creating VA=PA tables for FDT\n")
 	mov	x7, x26/* pr func */
 	adr	x6, bootpage_alloc		/* allocator */
 	mov	x5, xzr/* flags = 0 */



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

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 19:40:30 UTC 2020

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

Log Message:
svs_pdir_switch(): Use MOVS to copy the PTES.


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

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

Modified files:

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.36 src/sys/arch/x86/x86/svs.c:1.37
--- src/sys/arch/x86/x86/svs.c:1.36	Wed May 27 19:15:08 2020
+++ src/sys/arch/x86/x86/svs.c	Wed May 27 19:40:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $	*/
+/*	$NetBSD: svs.c,v 1.37 2020/05/27 19:40:29 ad Exp $	*/
 
 /*
  * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.37 2020/05/27 19:40:29 ad Exp $");
 
 #include "opt_svs.h"
 #include "opt_user_ldt.h"
@@ -682,28 +682,16 @@ svs_lwp_switch(struct lwp *oldlwp, struc
 	}
 }
 
-static inline pt_entry_t
-svs_pte_atomic_read(struct pmap *pmap, size_t idx)
-{
-	/*
-	 * XXX: We don't have a basic atomic_fetch_64 function?
-	 */
-	return atomic_cas_64(>pm_pdir[idx], 666, 666);
-}
-
 /*
- * We may come here with the pmap unlocked. So read its PTEs atomically. If
- * a remote CPU is updating them at the same time, it's not a problem: the
- * remote CPU will call svs_pmap_sync afterwards, and our updirpa will be
- * synchronized properly.
+ * We may come here with the pmap unlocked.  If a remote CPU is updating
+ * them at the same time, it's not a problem: the remote CPU will call
+ * svs_pmap_sync afterwards, and our updirpa will be synchronized properly.
  */
 void
 svs_pdir_switch(struct pmap *pmap)
 {
 	struct cpu_info *ci = curcpu();
 	struct svs_utls *utls;
-	pt_entry_t pte;
-	size_t i;
 
 	KASSERT(kpreempt_disabled());
 	KASSERT(pmap != pmap_kernel());
@@ -712,14 +700,9 @@ svs_pdir_switch(struct pmap *pmap)
 	utls = (struct svs_utls *)ci->ci_svs_utls;
 	utls->kpdirpa = pmap_pdirpa(pmap, 0) | svs_pcid_kcr3;
 
+	/* Copy user slots. */
 	mutex_enter(>ci_svs_mtx);
-
-	/* User slots. */
-	for (i = 0; i < PDIR_SLOT_USERLIM; i++) {
-		pte = svs_pte_atomic_read(pmap, i);
-		ci->ci_svs_updir[i] = pte;
-	}
-
+	x86_movs(ci->ci_svs_updir, pmap->pm_pdir, PDIR_SLOT_USERLIM);
 	mutex_exit(>ci_svs_mtx);
 
 	if (svs_pcid) {



CVS commit: src/sys/arch

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 19:33:40 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S locore.S
src/sys/arch/i386/i386: cpufunc.S locore.S
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c

Log Message:
- Add a couple of wrapper functions around STOS and MOVS and use them to zero
  and copy PTEs in preference to memset()/memcpy().

- Remove related SSE / pageidlezero stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.208 -r1.209 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.184 -r1.185 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.395 -r1.396 src/sys/arch/x86/x86/pmap.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/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.56 src/sys/arch/amd64/amd64/cpufunc.S:1.57
--- src/sys/arch/amd64/amd64/cpufunc.S:1.56	Wed May 20 18:52:48 2020
+++ src/sys/arch/amd64/amd64/cpufunc.S	Wed May 27 19:33:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.56 2020/05/20 18:52:48 maxv Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.57 2020/05/27 19:33:40 ad Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -420,3 +420,24 @@ ENTRY(outl)
 	outl	%eax, %dx
 	ret
 END(outl)
+
+ENTRY(x86_stos)
+	pushq	%rbp
+	movq	%rsp,%rbp
+	movq	%rsi,%rax
+	movq	%rdx,%rcx
+	rep
+	stosq
+	leave
+	ret
+END(x86_stos)
+
+ENTRY(x86_movs)
+	pushq	%rbp
+	movq	%rsp,%rbp
+	movq	%rdx,%rcx
+	rep
+	movsq
+	leave
+	ret
+END(x86_stos)

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.208 src/sys/arch/amd64/amd64/locore.S:1.209
--- src/sys/arch/amd64/amd64/locore.S:1.208	Tue May  5 06:32:43 2020
+++ src/sys/arch/amd64/amd64/locore.S	Wed May 27 19:33:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.208 2020/05/05 06:32:43 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.209 2020/05/27 19:33:40 ad Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1560,61 +1560,6 @@ LABEL(syscall_sysret)
 END(syscall_sysret)
 	TEXT_USER_END
 
-/*
- * bool sse2_idlezero_page(void *pg)
- *
- * Zero a page without polluting the cache.  Preemption must be
- * disabled by the caller. Abort if a preemption is pending.
- * Returns true if the page is zeroed, false if not.
- */
-ENTRY(sse2_idlezero_page)
-	pushq	%rbp
-	movq	%rsp,%rbp
-	movl	$(PAGE_SIZE/64), %ecx
-	xorq	%rax, %rax
-	.align	16
-1:
-	cmpl	$0, CPUVAR(RESCHED)
-	jnz	2f
-	movnti	%rax, 0(%rdi)
-	movnti	%rax, 8(%rdi)
-	movnti	%rax, 16(%rdi)
-	movnti	%rax, 24(%rdi)
-	movnti	%rax, 32(%rdi)
-	movnti	%rax, 40(%rdi)
-	movnti	%rax, 48(%rdi)
-	movnti	%rax, 56(%rdi)
-	addq	$64, %rdi
-	decl	%ecx
-	jnz	1b
-	sfence
-	incl	%eax
-	popq	%rbp
-	KMSAN_INIT_RET(1)
-	ret
-2:
-	sfence
-	popq	%rbp
-	KMSAN_INIT_RET(1)
-	ret
-END(sse2_idlezero_page)
-
-/*
- * void pagezero(vaddr_t va)
- *
- * Zero a page.
- */
-ENTRY(pagezero)
-	pushq	%rbp
-	movq	%rsp,%rbp
-	movq	$(PAGE_SIZE / 8),%rcx
-	xorq	%rax,%rax
-	rep
-	stosq
-	leave
-	ret
-END(pagezero)
-
 	TEXT_USER_BEGIN
 
 /*

Index: src/sys/arch/i386/i386/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.42 src/sys/arch/i386/i386/cpufunc.S:1.43
--- src/sys/arch/i386/i386/cpufunc.S:1.42	Wed May 27 18:47:13 2020
+++ src/sys/arch/i386/i386/cpufunc.S	Wed May 27 19:33:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.42 2020/05/27 18:47:13 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.43 2020/05/27 19:33:40 ad Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.42 2020/05/27 18:47:13 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.43 2020/05/27 19:33:40 ad Exp $");
 
 #include "opt_xen.h"
 
@@ -318,3 +318,27 @@ ENTRY(outl)
 	outl	%eax, %dx
 	ret
 END(outl)
+
+ENTRY(x86_stos)
+	pushl	%ebp
+	movl	%esp,%ebp
+	movl	8(%ebp),%edi
+	movl	12(%ebp),%eax
+	movl	16(%ebp),%ecx
+	rep
+	stosl
+	leave
+	ret
+END(x86_stos)
+
+ENTRY(x86_movs)
+	pushl	%ebp
+	movl	%esp,%ebp
+	movl	8(%ebp),%edi
+	movl	12(%ebp),%esi
+	movl	16(%ebp),%ecx
+	rep
+	movsl
+	leave
+	ret
+END(x86_stos)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.184 src/sys/arch/i386/i386/locore.S:1.185
--- src/sys/arch/i386/i386/locore.S:1.184	Tue May  5 09:07:35 2020
+++ src/sys/arch/i386/i386/locore.S	Wed May 27 19:33:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.184 2020/05/05 09:07:35 bouyer Exp $	*/
+/*	$NetBSD: locore.S,v 1.185 2020/05/27 19:33:40 ad Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.184 2020/05/05 09:07:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.185 2020/05/27 19:33:40 ad Exp $");
 
 #include "opt_copy_symtab.h"
 

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

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 19:26:43 UTC 2020

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

Log Message:
Reported-by: syzbot+c1770938bb3fa7c08...@syzkaller.appspotmail.com
Reported-by: syzbot+ae26209c7d7f06e0b...@syzkaller.appspotmail.com

Can't defer freeing PV entries for the kernel's pmap until pmap_update(),
as that means taking locks and potentially recursing, and pmap_update()
for the kernel is used in all sorts of sensitive places.


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/sys/arch/x86/x86/pmap.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/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.394 src/sys/arch/x86/x86/pmap.c:1.395
--- src/sys/arch/x86/x86/pmap.c:1.394	Tue May 26 10:10:31 2020
+++ src/sys/arch/x86/x86/pmap.c	Wed May 27 19:26:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.394 2020/05/26 10:10:31 bouyer Exp $	*/
+/*	$NetBSD: pmap.c,v 1.395 2020/05/27 19:26:43 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.394 2020/05/26 10:10:31 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.395 2020/05/27 19:26:43 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -494,6 +494,7 @@ static int pmap_pvp_ctor(void *, void *,
 static void pmap_pvp_dtor(void *, void *);
 static struct pv_entry *pmap_alloc_pv(struct pmap *);
 static void pmap_free_pv(struct pmap *, struct pv_entry *);
+static void pmap_drain_pv(struct pmap *);
 
 static void pmap_alloc_level(struct pmap *, vaddr_t, long *);
 
@@ -2073,6 +2074,25 @@ pmap_free_pv(struct pmap *pmap, struct p
 }
 
 /*
+ * pmap_drain_pv: free full PV pages.
+ */
+static void
+pmap_drain_pv(struct pmap *pmap)
+{
+	struct pv_page *pvp;
+
+	KASSERT(mutex_owned(>pm_lock));
+
+	while ((pvp = LIST_FIRST(>pm_pvp_full)) != NULL) {
+		LIST_REMOVE(pvp, pvp_list);
+		KASSERT(pvp->pvp_pmap == pmap);
+		KASSERT(pvp->pvp_nfree == PVE_PER_PVP);
+		pvp->pvp_pmap = NULL;
+		pool_cache_put(_pvp_cache, pvp);
+	}
+}
+
+/*
  * pmap_check_pv: verify {VA, PTP} pair is either tracked/untracked by page
  */
 static void
@@ -2940,12 +2960,13 @@ pmap_destroy(struct pmap *pmap)
 	 * handle any deferred frees.
 	 */
 
+	mutex_enter(>pm_lock);
 	if (pmap->pm_pve != NULL) {
-		mutex_enter(>pm_lock);
 		pmap_free_pv(pmap, pmap->pm_pve);
-		mutex_exit(>pm_lock);
 		pmap->pm_pve = NULL;
 	}
+	pmap_drain_pv(pmap);
+	mutex_exit(>pm_lock);
 	pmap_update(pmap);
 
 	/*
@@ -3088,7 +3109,7 @@ pmap_zap_ptp(struct pmap *pmap, struct v
 			mutex_spin_exit(>pp_lock);
 
 			/*
-			 * pve won't be touched again until pmap_update(),
+			 * pve won't be touched again until pmap_drain_pv(),
 			 * so it's still safe to traverse the tree.
 			 */
 			pmap_free_pv(pmap, pve);
@@ -3123,6 +3144,7 @@ pmap_zap_ptp(struct pmap *pmap, struct v
 #ifdef DIAGNOSTIC
 	rb_tree_init(tree, _rbtree_ops);
 #endif
+	pmap_drain_pv(pmap);
 #else	/* !XENPV */
 	/*
 	 * XXXAD For XEN, it's not clear to me that we can do this, because
@@ -4187,6 +4209,7 @@ pmap_remove_locked(struct pmap *pmap, va
 		}
 	}
 	pmap_unmap_ptes(pmap, pmap2);
+	pmap_drain_pv(pmap);
 }
 
 /*
@@ -4432,6 +4455,7 @@ pmap_pp_remove(struct pmap_page *pp, pad
 			pmap_stats_update_bypte(pmap, 0, opte);
 		}
 		pmap_tlb_shootnow();
+		pmap_drain_pv(pmap);
 		mutex_exit(>pm_lock);
 		if (ptp != NULL) {
 			pmap_destroy(pmap);
@@ -5076,6 +5100,7 @@ same_pa:
 	((opte ^ npte) & (PTE_FRAME | PTE_W)) != 0) {
 		pmap_tlb_shootdown(pmap, va, opte, TLBSHOOT_ENTER);
 	}
+	pmap_drain_pv(pmap);
 	mutex_exit(>pm_lock);
 	return 0;
 }
@@ -5322,6 +5347,7 @@ pmap_enter_gnt(struct pmap *pmap, vaddr_
 		KASSERT(pmap_treelookup_pv(pmap, ptp, tree, va) == NULL);
 	}
 
+	pmap_drain_pv(pmap);
 	mutex_exit(>pm_lock);
 	return op->status;
 }
@@ -5716,10 +5742,8 @@ pmap_dump(struct pmap *pmap, vaddr_t sva
 void
 pmap_update(struct pmap *pmap)
 {
-	struct pv_page *pvp;
 	struct pmap_page *pp;
 	struct vm_page *ptp;
-	uintptr_t sum;
 
 	/*
 	 * Initiate any pending TLB shootdowns.  Wait for them to
@@ -5733,18 +5757,12 @@ pmap_update(struct pmap *pmap)
 	 * Now that shootdowns are complete, process deferred frees.  This
 	 * is an unlocked check, but is safe as we're only interested in
 	 * work done in this LWP - we won't get a false negative.
-	 *
-	 * If pmap_kernel(), this can be called from interrupt context or
-	 * while holding a spinlock so we can't wait on the pmap lock.  No
-	 * big deal as we'll catch up eventually (even for user pmaps, in
-	 * pmap_destroy() when there's never contention on the lock).
-	 */
-	sum = (uintptr_t)atomic_load_relaxed(>pm_gc_ptp.lh_first);
-	sum |= (uintptr_t)atomic_load_relaxed(>pm_pvp_full.lh_first);
-	if (__predict_true(sum == 0 || cpu_intr_p() ||
-	!mutex_tryenter(>pm_lock))) {
+	 */
+	if 

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

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 19:15:08 UTC 2020

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

Log Message:
svs_pmap_sync(): Fast-path the curcpu case.  Could be improved further
with a kcpuset iterator thing.


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

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

Modified files:

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.35 src/sys/arch/x86/x86/svs.c:1.36
--- src/sys/arch/x86/x86/svs.c:1.35	Sat May  2 11:37:17 2020
+++ src/sys/arch/x86/x86/svs.c	Wed May 27 19:15:08 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: svs.c,v 1.35 2020/05/02 11:37:17 maxv Exp $	*/
+/*	$NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $	*/
 
 /*
- * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.35 2020/05/02 11:37:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $");
 
 #include "opt_svs.h"
 #include "opt_user_ldt.h"
@@ -575,6 +575,18 @@ svs_pmap_sync(struct pmap *pmap, int ind
 	KASSERT(kpreempt_disabled());
 	KASSERT(index < PDIR_SLOT_USERLIM);
 
+	ci = curcpu();
+	cid = cpu_index(ci);
+
+	mutex_enter(>ci_svs_mtx);
+	KASSERT(kcpuset_isset(pmap->pm_kernel_cpus, cid));
+	ci->ci_svs_updir[index] = pmap->pm_pdir[index];
+	mutex_exit(>ci_svs_mtx);
+
+	if (!kcpuset_isotherset(pmap->pm_kernel_cpus, cid)) {
+		return;
+	}
+
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		cid = cpu_index(ci);
 



CVS commit: src/lib/librumphijack

2020-05-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 27 18:55:36 UTC 2020

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
Add pathconf and lpathconf (fixes lib/librumphijack/nfs test which uses ls
which now uses lpathconf)


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/lib/librumphijack/hijack.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/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.130 src/lib/librumphijack/hijack.c:1.131
--- src/lib/librumphijack/hijack.c:1.130	Mon Feb 10 18:21:42 2020
+++ src/lib/librumphijack/hijack.c	Wed May 27 14:55:36 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.130 2020/02/10 23:21:42 kamil Exp $	*/
+/*  $NetBSD: hijack.c,v 1.131 2020/05/27 18:55:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -34,7 +34,7 @@
 #include 
 
 #if !defined(lint)
-__RCSID("$NetBSD: hijack.c,v 1.130 2020/02/10 23:21:42 kamil Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.131 2020/05/27 18:55:36 christos Exp $");
 #endif
 
 #include 
@@ -170,6 +170,9 @@ enum dualcall {
 #ifdef __NetBSD__
 	DUALCALL_LINKAT,
 #endif
+	DUALCALL_PATHCONF,
+	DUALCALL_LPATHCONF,
+
 	DUALCALL__NUM
 };
 
@@ -405,6 +408,8 @@ struct sysnames {
 #ifdef __NetBSD__
 	{ DUALCALL_LINKAT,	"linkat",	RSYS_NAME(LINKAT)	},
 #endif
+	{ DUALCALL_PATHCONF,	"pathconf",	RSYS_NAME(PATHCONF)	},
+	{ DUALCALL_LPATHCONF,	"lpathconf",	RSYS_NAME(LPATHCONF)	},
 };
 #undef S
 
@@ -1335,6 +1340,39 @@ linkat(int fromfd, const char *from, int
 }
 #endif
 
+static long
+do_pathconf(const char *path, int name, int link)
+{
+	long (*op_pathconf)(const char *, int);
+	enum pathtype pt;
+
+	if ((pt = path_isrump(path)) != PATH_HOST) {
+		op_pathconf = link ?
+		GETSYSCALL(rump, LPATHCONF) :
+		GETSYSCALL(rump, PATHCONF);
+		if (pt == PATH_RUMP)
+			path = path_host2rump(path);
+	} else {
+		op_pathconf = link ? 
+		GETSYSCALL(host, LPATHCONF) :
+		GETSYSCALL(host, PATHCONF);
+	}
+
+	return op_pathconf(path, name);
+}
+
+long
+lpathconf(const char *path, int name)
+{
+	return do_pathconf(path, name, 1);
+}
+
+long
+pathconf(const char *path, int name)
+{
+	return do_pathconf(path, name, 0);
+}
+
 int
 link(const char *from, const char *to)
 {



CVS commit: src/sys/arch/i386/i386

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 18:47:13 UTC 2020

Modified Files:
src/sys/arch/i386/i386: cpufunc.S

Log Message:
tsc_get_timecount(): fix 64-bit return


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/i386/cpufunc.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/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.41 src/sys/arch/i386/i386/cpufunc.S:1.42
--- src/sys/arch/i386/i386/cpufunc.S:1.41	Tue May 19 21:40:55 2020
+++ src/sys/arch/i386/i386/cpufunc.S	Wed May 27 18:47:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.41 2020/05/19 21:40:55 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.42 2020/05/27 18:47:13 ad Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.41 2020/05/19 21:40:55 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.42 2020/05/27 18:47:13 ad Exp $");
 
 #include "opt_xen.h"
 
@@ -164,19 +164,19 @@ ENTRY(msr_onfault)
 END(msr_onfault)
 
 ENTRY(tsc_get_timecount)
+	pushl	%ebx
 	movl	CPUVAR(CURLWP), %ecx
 1:
-	pushl	L_NCSW(%ecx)
+	movl	L_NCSW(%ecx), %ebx
 	rdtsc
 	addl	CPUVAR(CC_SKEW), %eax
 	adcl	CPUVAR(CC_SKEW+4), %edx
-	popl	%edx
-	cmpl	%edx, L_NCSW(%ecx)
+	cmpl	%ebx, L_NCSW(%ecx)
 	jne	2f
+	popl	%ebx
 	ret
 2:
 	jmp	1b
-	ret
 END(tsc_get_timecount)
 
 STRONG_ALIAS(cpu_counter, tsc_get_timecount)



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

2020-05-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed May 27 18:46:15 UTC 2020

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

Log Message:
tsc_delay(): use tsc_freq in preference to cpu_frequency().


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/x86/tsc.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/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.47 src/sys/arch/x86/x86/tsc.c:1.48
--- src/sys/arch/x86/x86/tsc.c:1.47	Wed May 20 20:19:02 2020
+++ src/sys/arch/x86/x86/tsc.c	Wed May 27 18:46:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsc.c,v 1.47 2020/05/20 20:19:02 ad Exp $	*/
+/*	$NetBSD: tsc.c,v 1.48 2020/05/27 18:46:15 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.47 2020/05/20 20:19:02 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.48 2020/05/27 18:46:15 ad Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ u_int	tsc_get_timecount(struct timecount
 static void	tsc_delay(unsigned int);
 
 static uint64_t	tsc_dummy_cacheline __cacheline_aligned;
-uint64_t	tsc_freq; /* exported for sysctl */
+uint64_t	tsc_freq __read_mostly;	/* exported for sysctl */
 static int64_t	tsc_drift_max = 1000;	/* max cycles */
 static int64_t	tsc_drift_observed;
 
@@ -346,7 +346,7 @@ tsc_delay(unsigned int us)
 	uint64_t start, delta;
 
 	start = cpu_counter();
-	delta = (uint64_t)us * cpu_frequency(_info_primary) / 100;
+	delta = (uint64_t)us * tsc_freq / 100;
 
 	while ((cpu_counter() - start) < delta) {
 		x86_pause();



CVS commit: src/sys/rump/librump

2020-05-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 27 18:26:29 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: rumpkern_syscalls.c
src/sys/rump/librump/rumpnet: rumpnet_syscalls.c
src/sys/rump/librump/rumpvfs: rumpvfs_syscalls.c

Log Message:
regen for lpathconf.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpkern/rumpkern_syscalls.c
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpnet/rumpnet_syscalls.c
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rumpkern_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rumpkern_syscalls.c:1.5 src/sys/rump/librump/rumpkern/rumpkern_syscalls.c:1.6
--- src/sys/rump/librump/rumpkern/rumpkern_syscalls.c:1.5	Sun Sep 22 19:03:21 2019
+++ src/sys/rump/librump/rumpkern/rumpkern_syscalls.c	Wed May 27 14:26:29 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpkern_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $	*/
+/*	$NetBSD: rumpkern_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $	*/
 
 /* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpkern_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpkern_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $");
 
 #include 
 

Index: src/sys/rump/librump/rumpnet/rumpnet_syscalls.c
diff -u src/sys/rump/librump/rumpnet/rumpnet_syscalls.c:1.5 src/sys/rump/librump/rumpnet/rumpnet_syscalls.c:1.6
--- src/sys/rump/librump/rumpnet/rumpnet_syscalls.c:1.5	Sun Sep 22 19:03:21 2019
+++ src/sys/rump/librump/rumpnet/rumpnet_syscalls.c	Wed May 27 14:26:29 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpnet_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $	*/
+/*	$NetBSD: rumpnet_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $	*/
 
 /* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpnet_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpnet_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $");
 
 #include 
 

Index: src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c
diff -u src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c:1.7 src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c:1.8
--- src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c:1.7	Wed Sep 25 12:44:42 2019
+++ src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c	Wed May 27 14:26:29 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpvfs_syscalls.c,v 1.7 2019/09/25 16:44:42 christos Exp $	*/
+/*	$NetBSD: rumpvfs_syscalls.c,v 1.8 2020/05/27 18:26:29 christos Exp $	*/
 
 /* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpvfs_syscalls.c,v 1.7 2019/09/25 16:44:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpvfs_syscalls.c,v 1.8 2020/05/27 18:26:29 christos Exp $");
 
 #include 
 
@@ -111,6 +111,7 @@ extern sy_call_t sys___getvfsstat90;
 extern sy_call_t sys___statvfs190;
 extern sy_call_t sys___fstatvfs190;
 extern sy_call_t sys___fhstatvfs190;
+extern sy_call_t sys_lpathconf;
 
 static const struct rump_onesyscall mysys[] = {
 	{ 5,	sys_open },
@@ -215,6 +216,7 @@ static const struct rump_onesyscall mysy
 	{ 484,	sys___statvfs190 },
 	{ 485,	sys___fstatvfs190 },
 	{ 486,	sys___fhstatvfs190 },
+	{ 499,	sys_lpathconf },
 };
 
 RUMP_COMPONENT(RUMP_COMPONENT_SYSCALL)



CVS commit: src/distrib/notes/evbarm

2020-05-27 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed May 27 13:51:05 UTC 2020

Modified Files:
src/distrib/notes/evbarm: install

Log Message:
Briefly explain how to pkgsrc u-boot. Pointed out by maya.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/distrib/notes/evbarm/install

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

Modified files:

Index: src/distrib/notes/evbarm/install
diff -u src/distrib/notes/evbarm/install:1.12 src/distrib/notes/evbarm/install:1.13
--- src/distrib/notes/evbarm/install:1.12	Wed May 27 12:47:47 2020
+++ src/distrib/notes/evbarm/install	Wed May 27 13:51:05 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: install,v 1.12 2020/05/27 12:47:47 nia Exp $
+.\"	$NetBSD: install,v 1.13 2020/05/27 13:51:05 nia Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -34,7 +34,18 @@ Write the image to disk:
 # dd if=armv7.img of=/dev/rld0d bs=1m conv=sync
 .Ed
 .It
-Install a board-specific U-Boot from pkgsrc to the SD card (the u-boot-sunxi-with-spl.bin-s are provided by sysutils/u-boot- packages):
+Obtain a board-specific U-Boot image. Bootloaders are provided by
+the
+.Pa sysutils/u-boot-*
+packages in
+.Lk https://www.pkgsrc.org/ "pkgsrc" .
+.Pp
+If you're using pkgsrc on an UNIX-like operating system that isn't NetBSD,
+you must bootstrap first (see the 
+.Pa README
+file in the root directory of pkgsrc).
+.Pp
+Install the board-specific U-Boot to the SD card:
 .Bd -literal
 # dd if=/usr/pkg/share/u-boot/[boardname]/u-boot-sunxi-with-spl.bin of=/dev/rld0d bs=1k seek=8 conv=sync
 .Ed
@@ -53,7 +64,18 @@ Write the image to disk:
 # dd if=arm64.img of=/dev/rld0d bs=1m conv=sync
 .Ed
 .It
-Install a board-specific U-Boot from pkgsrc to the SD card:
+Obtain a board-specific U-Boot image. Bootloaders are provided by
+the
+.Pa sysutils/u-boot-*
+packages in
+.Lk https://www.pkgsrc.org/ "pkgsrc" .
+.Pp
+If you're using pkgsrc on an UNIX-like operating system that isn't NetBSD,
+you must bootstrap first (see the 
+.Pa README
+file in the root directory of pkgsrc).
+.Pp
+Install the board-specific U-Boot to the SD card:
 .Bd -literal
 # dd if=/usr/pkg/share/u-boot/[boardname]/rksd_loader.img of=/dev/rld0d seek=64 conv=sync
 .Ed



CVS commit: src/share/man/man4/man4.evbarm

2020-05-27 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed May 27 13:49:16 UTC 2020

Modified Files:
src/share/man/man4/man4.evbarm: intro.4

Log Message:
Remove extremely outdated list of supported devices.

Since this man page will likely be read on a running system, I don't
think providing a list of very old devices that might work is
necessarily useful.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/man4.evbarm/intro.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/man4.evbarm/intro.4
diff -u src/share/man/man4/man4.evbarm/intro.4:1.5 src/share/man/man4/man4.evbarm/intro.4:1.6
--- src/share/man/man4/man4.evbarm/intro.4:1.5	Fri Feb 27 10:38:25 2009
+++ src/share/man/man4/man4.evbarm/intro.4	Wed May 27 13:49:16 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: intro.4,v 1.5 2009/02/27 10:38:25 wiz Exp $
+.\" $NetBSD: intro.4,v 1.6 2020/05/27 13:49:16 nia Exp $
 .\"
 .\" Copyright (c) 2003 ARM Ltd
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 27, 2009
+.Dd May 27, 2020
 .Dt INTRO 4 evbarm
 .Os
 .Sh NAME
@@ -62,43 +62,6 @@ which may be configured into the system
 and network related information.
 The networking support is introduced in
 .Xr netintro 4 .
-.Sh SUPPORTED BOARDS
-Each supported board requires a custom kernel for that board.
-.Pp
-The following boards are currently supported by the evbarm configuration:
-.Pp
-.Bl -tag -width Integrator -offset indent -compact
-.It Integrator
-The Integrator/AP development system from ARM Ltd.
-Supported processor boards
-include the CM10200E and CM920T.
-.It IQ80310
-The reference platform for the XScale-based IOP310 I/O processor from Intel.
-.It IQ80321
-The reference platform for the XScale-based IOP321 I/O processor from Intel.
-.It Npwr
-The Npwr board, from Team ASA, is based on the IOP310 processor from Intel and
-targetted at the network-attached storage space.
-.It IXM1200
-The reference platform for the XScale-based IXP1200 Network processor from
-Intel.
-.It SMDK2410
-The reference platform for the ARM920T-based S3C2410 processor from Samsung.
-.It SMDK2800
-The reference platform for the ARM920T-based S3C2800 processor from Samsung.
-.It BRH
-The BRH (Big Red Head) is an evaluation and development platform from ADI
-Engineering, based on the XScale-based I80200 processor
-.It NTNP425B
-An evaluation and development platform from NOVATEC, using the XScale-based
-IXP425 processor.
-.It DBPXA250
-An evaluation and development platfrom from Intel, using the XScale-based
-PXA250 processor.
-.It TS7200
-The TS-7200 is a single-board computer from Technologic Systems,
-and is based on the Cirrus Logic EP9302.
-.El
 .Sh DEVICE SUPPORT
 This section describes some of the hardware supported on the various boards.
 Software support for these devices comes in two forms.
@@ -127,126 +90,6 @@ the system must be rebooted.
 .Pp
 The autoconfiguration system is described in
 .Xr autoconf 4 .
-A list of the supported devices is given below.
-.Sh LIST OF DEVICES
-The devices listed below are supported in this incarnation of
-the system.
-Devices are indicated by their functional interface.
-Not all supported devices are listed.
-.Pp
-On the Integrator:
-.Pp
-.Bl -tag -width speaker -offset indent -compact
-.It plcom
-The PrimeCell PL010 UART.
-.It plrtc
-The PrimeCell PL030 Real-time Clock
-.It fxp
-Intel i82559 Ethernet PCI card.
-.It ahc
-Adaptec aic7880 SCSI controller.
-.El
-Other PCI based cards may also work, but have not been tested.
-.Pp
-On the IQ80310:
-.Pp
-.Bl -tag -width speaker -offset indent -compact
-.It fxp
-On-board Intel i82559 Ethernet
-.It com
-On-board NS16550-compatible serial ports
-.El
-Other PCI devices in the PCI expansion slots.
-On the IQ80321:
-.Pp
-.Bl -tag -width speaker -offset indent -compact
-.It wm
-On-board Intel i82544EI Gigabit Ethernet
-.It com
-On-board NS16550-compatible serial port
-.It iopaau
-On-chip Application Accelerator Unit
-.It iopwdog
-On-chip watchdog timer.
-.El
-Other devices in the PCI expansion slots.
-.Pp
-On Npwr:
-.Pp
-.Bl -tag -width speaker -offset indent -compact
-.It wm
-On-board Intel i82544EI Gigabit Ethernet
-.It siop
-On-board LSI Logic 53c1010 Ultra160 SCSI
-.It com
-On-board NS16550-compatible serial port
-.El
-.Pp
-On the IXM1200:
-.Pp
-.Bl -tag -width speaker -offset indent -compact
-.It fxp
-On-board Intel i82559 Ethernet
-.It nppb
-On-board Intel i21555 Non-Transparent PCI-PCI Bridge
-.It ixpcom
-On-chip serial port
-.El
-.Pp
-On the SMDK2410:
-.Pp
-.Bl -tag -width speaker -offset indent -compact
-.It sscom
-On-chip serial ports
-.It ohci
-On-chip USB host controller
-.El
-.Pp
-On the SMDK2800:
-.Pp
-.Bl -tag -width speaker -offset indent -compact
-.It sscom
-On-chip serial ports
-.It sspci
-On-chip Host-PCI bridge
-.El
-Other 

CVS commit: src/distrib/notes/evbarm

2020-05-27 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed May 27 12:47:47 UTC 2020

Modified Files:
src/distrib/notes/evbarm: install

Log Message:
s/boards/devices/


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/distrib/notes/evbarm/install

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

Modified files:

Index: src/distrib/notes/evbarm/install
diff -u src/distrib/notes/evbarm/install:1.11 src/distrib/notes/evbarm/install:1.12
--- src/distrib/notes/evbarm/install:1.11	Wed May 27 12:45:07 2020
+++ src/distrib/notes/evbarm/install	Wed May 27 12:47:47 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: install,v 1.11 2020/05/27 12:45:07 nia Exp $
+.\"	$NetBSD: install,v 1.12 2020/05/27 12:47:47 nia Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Ss2 Installation for ARMv7 and AArch64 boards using U-Boot (example: Allwinner SoCs)
+.Ss2 Installation for ARMv7 and AArch64 devices with U-Boot (example: Allwinner SoCs)
 .Bl -bullet -offset indent -compact
 .It
 Download or build armv7.img (32-bit) or arm64.img (64-bit)
@@ -43,7 +43,7 @@ Install a board-specific U-Boot from pkg
 If you do not want to prepare a SD card image manually, NetBSD developer
 Jared McNeill provides pre-prepared images on his website
 .Lk http://www.armbsd.org/arm/ "armbsd.org" .
-.Ss2 Installation for AArch64 boards using U-Boot (example: Rockchip SoCs)
+.Ss2 Installation for AArch64 devices with U-Boot (example: Rockchip SoCs)
 .Bl -bullet -offset indent -compact
 .It
 Download or build arm64.img (64-bit)



CVS commit: src/distrib/notes/evbarm

2020-05-27 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed May 27 12:45:07 UTC 2020

Modified Files:
src/distrib/notes/evbarm: hardware install

Log Message:
First attempt at modernising the evbarm install guide and hardware lists

- Install instructions mostly based on wiki pages
- Supported hardware lists mostly based on GENERIC and GENERIC64 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/notes/evbarm/hardware \
src/distrib/notes/evbarm/install

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

Modified files:

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.10 src/distrib/notes/evbarm/hardware:1.11
--- src/distrib/notes/evbarm/hardware:1.10	Wed Apr 30 13:10:48 2008
+++ src/distrib/notes/evbarm/hardware	Wed May 27 12:45:07 2020
@@ -1,6 +1,6 @@
-.\"	$NetBSD: hardware,v 1.10 2008/04/30 13:10:48 martin Exp $
+.\"	$NetBSD: hardware,v 1.11 2020/05/27 12:45:07 nia Exp $
 .\"
-.\" Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -25,8 +25,23 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .Nx \*V
-runs on the following ARM architecture evaluation boards:
-.(bullet -offset indent
+runs on the following ARM architecture devices:
+.Bl -bullet -offset indent -compact
+.It
+ARM ServerReady (SBSA) devices
+.It
+Allwinner Technology SoCs (e.g. PINE64, Orange Pi...)
+.It
+RockChip RK3328, RK3399 (e.g. RockPro64, Pinebook Pro)
+.It
+BeagleBoard, BeagleBoard-xM, BeagleBone, BeagleBone Black
+.It
+ODROID C1 and C1+
+.It
+Raspberry Pi 1, 2, 3
+.It
+NVIDIA Tegra K1, X1
+.It
 Technologic Systems TS-7200
 .It
 ARM, Ltd. Integrator
@@ -44,33 +59,114 @@ Samsung SMDK2800
 ADI Engineering, Inc. BRH ("Big Red Head")
 .It
 Arcom Viper
-.bullet)
+.El
+.
+.Ss2 Supported devices (Allwinner Systems-on-a-Chip)
+The following Allwinner SoCs are known to be supported by GENERIC
+kernels (ARMv7-A):
+A10, A13, A20, A32, A80, A83T, H3
+.Pp
+The following Allwinner SoCs are known to be supported by GENERIC64
+kernels (AArch64):
+H5, H6, A64
+.Pp
+This is not an exhaustive list and only includes on-chip devices:
+.Bl -bullet -offset indent -compact
+.It
+Allwinner DRM framebuffer
+.It
+Allwinner audio codec
+.It
+Allwinner GPIO controller
+.It
+Allwinner SPI controller
+.It
+Allwinner RSB/TWI I2C controllers
+.It
+Allwinner SD/MMC
+.It
+Synopsys DesignWare SATA
+.It
+Synopsys DesignWare Ethernet MAC 10/100/1000 Universal
+.It
+USB 2.0/3.0 host controller
+.El
+.
+.Ss2 Supported devices (RockChip Systems-on-a-Chip)
+The following RockChip SoCs are known to be supported by GENERIC64
+kernels (AArch64): RK3328, RK3328
+.Pp
+Other systems may work, but they have not been tested.
+.Pp
+This is not an exhaustive list and only includes on-chip devices:
+.Bl -bullet -offset indent -compact
+.It
+RockChip DRM framebuffer
+.It
+RockChip I2S/PCM audio
+.It
+RockChip GPIO controller
+.It
+RockChip SPI controller
+.It
+RockChip I2C controller
+.It
+RockChip AXI PCI-E
+.It
+RockChip Power Management IC
+.It
+RockChip eMMC PHY
+.It
+Synopsys DesignWare Ethernet MAC 10/100/1000 Universal
+.It
+USB 2.0/3.0 host controller
+.El
+.
+.Ss2 Supported devices (Broadcom Systems-on-a-Chip)
+The following Broadcom SoCs are known to be supported by GENERIC
+kernels (ARMv7-A): BCM2836 (Raspberry Pi 2)
+.Pp
+The following Broadcom SoCs are known to be supported by GENERIC64
+kernels (AArch64): BCM2837 (Raspberry Pi 3)
+.Pp
+This is not an exhaustive list and only includes on-chip devices:
+.Bl -bullet -offset indent -compact
+.It
+Broadcom BCM283x ICU controller
+.It
+Broadcom VideoCore IV mailbox
+.It
+Broadcom BCM283x GPIO controller
+.It
+Broadcom GENET v5 ethernet
+.It
+Broadcom BCM283x SD Host Interface
+.It
+Broadcom BCM43xxx WiFi Interface
+.It
+Broadcom BCM283x SPI controller
+.It
+Synopsys DesignWare USB DRD controller
+.El
 .
 .Ss2 Supported devices (Technologic Systems TS-7200)
 For devices that have machine-independent drivers,
 this is not an exhaustive list, but merely reflects the
 devices that have been tested on this platform.
-.(bullet -offset indent
-.Te 2 "TS-5620 Real Time Clock"
+.Bl -bullet -offset indent -compact
+.It
+TS-5620 Real Time Clock
 .It
-.Te 2 "Serial ports"
-.(bullet -compact
 On-chip EP9302 UARTs
 .It
 TS-SER1, TS-SER2, TS-SER4 PC/104 serial adapters
 .It
 TS-MODEM, TS-MODEM2 PC/104 land-line/cellular modems
-.bullet)
 .It
-.Te 2 "Ethernet adapters"
-.(bullet -compact
 On-chip EP9302 10/100 ethernet
 .It
 TS-ETH10 PC/104 expansion ethernet adapters
-.bullet)
 .It
-.Te 2 "Other on-board functions"
-.(bullet -compact
 CompactFlash socket
 .It
 USB OHCI host
@@ -80,24 +176,19 @@ Text-mode HD44780 LCD display header
 Matrix keypad/GPIO header
 .It
 Board temperature sensor and watchdog timer
-.bullet)
-.bullet)
+.El
 .
 .Ss2 Supported 

CVS commit: src/sys/dev/pci

2020-05-27 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed May 27 11:24:31 UTC 2020

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

Log Message:
Fix to allocate resources actuall used around interrupts


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/virtio_pci.c

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

Modified files:

Index: src/sys/dev/pci/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.10 src/sys/dev/pci/virtio_pci.c:1.11
--- src/sys/dev/pci/virtio_pci.c:1.10	Mon May 25 07:52:16 2020
+++ src/sys/dev/pci/virtio_pci.c	Wed May 27 11:24:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.10 2020/05/25 07:52:16 yamaguchi Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.11 2020/05/27 11:24:31 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.10 2020/05/25 07:52:16 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.11 2020/05/27 11:24:31 yamaguchi Exp $");
 
 #include 
 #include 
@@ -677,12 +677,16 @@ virtio_pci_setup_interrupts(struct virti
 		counts[PCI_INTR_TYPE_INTX] = 1;
 	} else {
 		/* Try MSI-X first and INTx second */
-		if (sc->sc_child_mq &&
-		sc->sc_nvqs > (nmsix - VIRTIO_MSIX_QUEUE_VECTOR_INDEX)) {
-			nmsix = 2;
+		if (sc->sc_nvqs + VIRTIO_MSIX_QUEUE_VECTOR_INDEX <= nmsix) {
+			nmsix = sc->sc_nvqs + VIRTIO_MSIX_QUEUE_VECTOR_INDEX;
+		} else {
 			sc->sc_child_mq = false;
 		}
 
+		if (sc->sc_child_mq == false) {
+			nmsix = 2;
+		}
+
 		max_type = PCI_INTR_TYPE_MSIX;
 		counts[PCI_INTR_TYPE_MSIX] = nmsix;
 		counts[PCI_INTR_TYPE_MSI] = 0;



CVS commit: src/distrib/utils/embedded/conf

2020-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed May 27 11:02:52 UTC 2020

Modified Files:
src/distrib/utils/embedded/conf: rpi.conf

Log Message:
Fix kernel= order, add pi0w conditional and comments


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/embedded/conf/rpi.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/rpi.conf
diff -u src/distrib/utils/embedded/conf/rpi.conf:1.37 src/distrib/utils/embedded/conf/rpi.conf:1.38
--- src/distrib/utils/embedded/conf/rpi.conf:1.37	Wed May 27 10:56:59 2020
+++ src/distrib/utils/embedded/conf/rpi.conf	Wed May 27 11:02:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.37 2020/05/27 10:56:59 jmcneill Exp $
+# $NetBSD: rpi.conf,v 1.38 2020/05/27 11:02:52 jmcneill Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -63,12 +63,17 @@ cmdline=../cmdline.txt
 # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
 enable_uart=1
 force_turbo=0
+# Default kernel for BCM2836 and later
+kernel=/kernel7.img
+# Override kernel for BCM2835 based boards
 [pi0]
 kernel=/kernel.img
+[pi0w]
+kernel=/kernel.img
 [pi1]
 kernel=/kernel.img
 [all]
-kernel=/kernel7.img
+#
 EOF
 
 	echo "${bar} kernel ${kernel} ${bar}"



CVS commit: src/distrib/utils/embedded/conf

2020-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed May 27 10:56:59 UTC 2020

Modified Files:
src/distrib/utils/embedded/conf: rpi.conf

Log Message:
Conditionally boot kernel.img or kernel7.img depending on board


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/distrib/utils/embedded/conf/rpi.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/rpi.conf
diff -u src/distrib/utils/embedded/conf/rpi.conf:1.36 src/distrib/utils/embedded/conf/rpi.conf:1.37
--- src/distrib/utils/embedded/conf/rpi.conf:1.36	Mon May 18 21:19:34 2020
+++ src/distrib/utils/embedded/conf/rpi.conf	Wed May 27 10:56:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.36 2020/05/18 21:19:34 jmcneill Exp $
+# $NetBSD: rpi.conf,v 1.37 2020/05/27 10:56:59 jmcneill Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -60,10 +60,15 @@ EOF
 upstream_kernel=1
 os_prefix=dtb/
 cmdline=../cmdline.txt
-kernel=/kernel.img
 # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
 enable_uart=1
 force_turbo=0
+[pi0]
+kernel=/kernel.img
+[pi1]
+kernel=/kernel.img
+[all]
+kernel=/kernel7.img
 EOF
 
 	echo "${bar} kernel ${kernel} ${bar}"



CVS commit: src/share/mk

2020-05-27 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed May 27 10:53:18 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Set MKDTB=yes for armv6


To generate a diff of this commit:
cvs rdiff -u -r1.1194 -r1.1195 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1194 src/share/mk/bsd.own.mk:1.1195
--- src/share/mk/bsd.own.mk:1.1194	Wed May 27 06:06:37 2020
+++ src/share/mk/bsd.own.mk	Wed May 27 10:53:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1194 2020/05/27 06:06:37 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.1195 2020/05/27 10:53:18 jmcneill Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1195,8 +1195,12 @@ MKRADEONFIRMWARE.aarch64=	yes
 # Only install the tegra firmware on evbarm.
 MKTEGRAFIRMWARE.evbarm=		yes
 
-# Only build devicetree (dtb) files on armv7 and aarch64.
+# Only build devicetree (dtb) files on armv6, armv7, and aarch64.
 MKDTB.aarch64=			yes
+MKDTB.earmv6=			yes
+MKDTB.earmv6hf=			yes
+MKDTB.earmv6eb=			yes
+MKDTB.earmv6hfeb=		yes
 MKDTB.earmv7=			yes
 MKDTB.earmv7hf=			yes
 MKDTB.earmv7eb=			yes



CVS commit: src/sys/kern

2020-05-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 27 09:09:50 UTC 2020

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

Log Message:
- remove #ifdef __FreeBSD__
- return (x) --> return x

No binary changes this time, trust me ;).


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/kern/kern_tc.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/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.58 src/sys/kern/kern_tc.c:1.59
--- src/sys/kern/kern_tc.c:1.58	Wed May 27 08:55:18 2020
+++ src/sys/kern/kern_tc.c	Wed May 27 09:09:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.58 2020/05/27 08:55:18 rin Exp $ */
+/* $NetBSD: kern_tc.c,v 1.59 2020/05/27 09:09:50 rin Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.58 2020/05/27 08:55:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.59 2020/05/27 09:09:50 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -80,7 +80,7 @@ dummy_get_timecount(struct timecounter *
 {
 	static u_int now;
 
-	return (++now);
+	return ++now;
 }
 
 static struct timecounter dummy_timecounter = {
@@ -143,11 +143,6 @@ static u_int timecounter_mods;
 static volatile int timecounter_removals = 1;
 static u_int timecounter_bad;
 
-#ifdef __FreeBSD__
-SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW,
-, 0, "");
-#endif /* __FreeBSD__ */
-
 /*
  * sysctl helper routine for kern.timercounter.hardware
  */
@@ -177,7 +172,7 @@ sysctl_kern_timecounter_hardware(SYSCTLF
 	if (l != NULL && (error = kauth_authorize_system(l->l_cred, 
 	KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_TIMECOUNTERS, newname,
 	NULL, NULL)) != 0)
-		return (error);
+		return error;
 
 	if (!cold)
 		mutex_spin_enter(_lock);
@@ -208,9 +203,9 @@ sysctl_kern_timecounter_choice(SYSCTLFN_
 	int error, mods;
 
 	if (newp != NULL)
-		return (EPERM);
+		return EPERM;
 	if (namelen != 0)
-		return (EINVAL);
+		return EINVAL;
 
 	mutex_spin_enter(_lock);
  retry:
@@ -244,7 +239,7 @@ sysctl_kern_timecounter_choice(SYSCTLFN_
 	mutex_spin_exit(_lock);
 
 	*oldlenp = needed;
-	return (error);
+	return error;
 }
 
 SYSCTL_SETUP(sysctl_timecounter_setup, "sysctl timecounter setup")
@@ -310,8 +305,8 @@ tc_delta(struct timehands *th)
 	struct timecounter *tc;
 
 	tc = th->th_counter;
-	return ((tc->tc_get_timecount(tc) - 
-		 th->th_offset_count) & tc->tc_counter_mask);
+	return (tc->tc_get_timecount(tc) -
+		 th->th_offset_count) & tc->tc_counter_mask;
 }
 
 /*
@@ -711,7 +706,7 @@ uint64_t
 tc_getfrequency(void)
 {
 
-	return (timehands->th_counter->tc_frequency);
+	return timehands->th_counter->tc_frequency;
 }
 
 /*
@@ -912,41 +907,41 @@ pps_ioctl(u_long cmd, void *data, struct
 
 	switch (cmd) {
 	case PPS_IOC_CREATE:
-		return (0);
+		return 0;
 	case PPS_IOC_DESTROY:
-		return (0);
+		return 0;
 	case PPS_IOC_SETPARAMS:
 		app = (pps_params_t *)data;
 		if (app->mode & ~pps->ppscap)
-			return (EINVAL);
+			return EINVAL;
 		pps->ppsparam = *app;
-		return (0);
+		return 0;
 	case PPS_IOC_GETPARAMS:
 		app = (pps_params_t *)data;
 		*app = pps->ppsparam;
 		app->api_version = PPS_API_VERS_1;
-		return (0);
+		return 0;
 	case PPS_IOC_GETCAP:
 		*(int*)data = pps->ppscap;
-		return (0);
+		return 0;
 	case PPS_IOC_FETCH:
 		pipi = (pps_info_t *)data;
 		pps->ppsinfo.current_mode = pps->ppsparam.mode;
 		*pipi = pps->ppsinfo;
-		return (0);
+		return 0;
 	case PPS_IOC_KCBIND:
 #ifdef PPS_SYNC
 		epi = (int *)data;
 		/* XXX Only root should be able to do this */
 		if (*epi & ~pps->ppscap)
-			return (EINVAL);
+			return EINVAL;
 		pps->kcmode = *epi;
-		return (0);
+		return 0;
 #else
-		return (EOPNOTSUPP);
+		return EOPNOTSUPP;
 #endif
 	default:
-		return (EPASSTHROUGH);
+		return EPASSTHROUGH;
 	}
 }
 



CVS commit: src/sys/kern

2020-05-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 27 08:55:18 UTC 2020

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

Log Message:
Oops, put back opt_ntp.h for options PPS_{SYNC,DEBUG}.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_tc.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/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.57 src/sys/kern/kern_tc.c:1.58
--- src/sys/kern/kern_tc.c:1.57	Wed May 27 08:51:03 2020
+++ src/sys/kern/kern_tc.c	Wed May 27 08:55:18 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.57 2020/05/27 08:51:03 rin Exp $ */
+/* $NetBSD: kern_tc.c,v 1.58 2020/05/27 08:55:18 rin Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,11 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.57 2020/05/27 08:51:03 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.58 2020/05/27 08:55:18 rin Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_ntp.h"
+#endif
 
 #include 
 #include 



CVS commit: src/sys/kern

2020-05-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 27 08:51:03 UTC 2020

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

Log Message:
- kern_tc.c does not depend on "options NTP"
- u_int64_t --> uint64_t

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/kern/kern_tc.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/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.56 src/sys/kern/kern_tc.c:1.57
--- src/sys/kern/kern_tc.c:1.56	Wed May 27 08:47:15 2020
+++ src/sys/kern/kern_tc.c	Wed May 27 08:51:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.56 2020/05/27 08:47:15 rin Exp $ */
+/* $NetBSD: kern_tc.c,v 1.57 2020/05/27 08:51:03 rin Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,11 +40,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.56 2020/05/27 08:47:15 rin Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_ntp.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.57 2020/05/27 08:51:03 rin Exp $");
 
 #include 
 #include 
@@ -97,9 +93,9 @@ struct timehands {
 	struct timecounter	*th_counter; /* active timecounter */
 	int64_t			th_adjustment;   /* frequency adjustment */
 		 /* (NTP/adjtime) */
-	u_int64_t		th_scale;/* scale factor (counter */
+	uint64_t		th_scale;/* scale factor (counter */
 		 /* tick->time) */
-	u_int64_t 		th_offset_count; /* offset at last time */
+	uint64_t 		th_offset_count; /* offset at last time */
 		 /* update (tc_windup()) */
 	struct bintime		th_offset;   /* bin (up)time at windup */
 	struct timeval		th_microtime;/* cached microtime */
@@ -707,7 +703,7 @@ tc_detach(struct timecounter *target)
 }
 
 /* Report the frequency of the current timecounter. */
-u_int64_t
+uint64_t
 tc_getfrequency(void)
 {
 
@@ -753,7 +749,7 @@ tc_windup(void)
 {
 	struct bintime bt;
 	struct timehands *th, *tho;
-	u_int64_t scale;
+	uint64_t scale;
 	u_int delta, ncount, ogen;
 	int i, s_update;
 	time_t t;
@@ -858,7 +854,7 @@ tc_windup(void)
 	 *
 	 */
 	if (s_update) {
-		scale = (u_int64_t)1 << 63;
+		scale = (uint64_t)1 << 63;
 		scale += (th->th_adjustment / 1024) * 2199;
 		scale /= th->th_counter->tc_frequency;
 		th->th_scale = scale * 2;
@@ -977,7 +973,7 @@ pps_capture(struct pps_state *pps)
 	th = timehands;
 	pps->capgen = th->th_generation;
 	pps->capth = th;
-	pps->capcount = (u_int64_t)tc_delta(th) + th->th_offset_count;
+	pps->capcount = (uint64_t)tc_delta(th) + th->th_offset_count;
 	if (pps->capgen != th->th_generation)
 		pps->capgen = 0;
 }
@@ -1039,7 +1035,7 @@ pps_ref_event(struct pps_state *pps,
 	struct bintime bt_ref;	/* reference time */
 	struct timespec ts, *tsp, *osp;
 	struct timehands *th;
-	u_int64_t tcount, acount, dcount, *pcount;
+	uint64_t tcount, acount, dcount, *pcount;
 	int foff, gen;
 #ifdef PPS_SYNC
 	int fhard;
@@ -1055,7 +1051,7 @@ pps_ref_event(struct pps_state *pps,
 		/* pick up current time stamp */
 		th = timehands;
 		gen = th->th_generation;
-		tcount = (u_int64_t)tc_delta(th) + th->th_offset_count;
+		tcount = (uint64_t)tc_delta(th) + th->th_offset_count;
 		if (gen != th->th_generation)
 			gen = 0;
 



CVS commit: src/sys/kern

2020-05-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 27 08:47:15 UTC 2020

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

Log Message:
Tiny optimization; timecounters should not go bad ~ every ticktock.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/kern_tc.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/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.55 src/sys/kern/kern_tc.c:1.56
--- src/sys/kern/kern_tc.c:1.55	Sat May 23 23:42:43 2020
+++ src/sys/kern/kern_tc.c	Wed May 27 08:47:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.55 2020/05/23 23:42:43 ad Exp $ */
+/* $NetBSD: kern_tc.c,v 1.56 2020/05/27 08:47:15 rin Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.55 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.56 2020/05/27 08:47:15 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -1336,7 +1336,7 @@ tc_ticktock(void)
 		return;
 	count = 0;
 	mutex_spin_enter(_lock);
-	if (timecounter_bad != 0) {
+	if (__predict_false(timecounter_bad != 0)) {
 		/* An existing timecounter has gone bad, pick a new one. */
 		(void)atomic_swap_uint(_bad, 0);
 		if (timecounter->tc_quality < 0) {



CVS commit: src/sys/dev/usb

2020-05-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed May 27 07:17:45 UTC 2020

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

Log Message:
Don't allow open of /dev/usb if there are no attached busses.

PR kern/55303 mutex_vector_enter,512: uninitialized lock


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/dev/usb/usb.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/usb.c
diff -u src/sys/dev/usb/usb.c:1.186 src/sys/dev/usb/usb.c:1.187
--- src/sys/dev/usb/usb.c:1.186	Tue May 26 19:55:43 2020
+++ src/sys/dev/usb/usb.c	Wed May 27 07:17:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.186 2020/05/26 19:55:43 skrll Exp $	*/
+/*	$NetBSD: usb.c,v 1.187 2020/05/27 07:17:45 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.186 2020/05/26 19:55:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.187 2020/05/27 07:17:45 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -232,6 +232,11 @@ Static void	usb_create_event_thread(devi
 Static void	usb_event_thread(void *);
 Static void	usb_task_thread(void *);
 
+/*
+ * Count of USB busses
+ */
+int nusbbusses = 0;
+
 #define USB_MAX_EVENTS 100
 struct usb_event_q {
 	struct usb_event ue;
@@ -378,6 +383,9 @@ usb_doattach(device_t self)
 
 	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
+	/* Protected by KERNEL_LOCK */
+	nusbbusses++;
+
 	sc->sc_bus->ub_usbctl = self;
 	sc->sc_port.up_power = USB_MAX_POWER;
 
@@ -719,6 +727,9 @@ usbopen(dev_t dev, int flag, int mode, s
 	int unit = minor(dev);
 	struct usb_softc *sc;
 
+	if (nusbbusses == 0)
+		return ENXIO;
+
 	if (unit == USB_DEV_MINOR) {
 		if (usb_dev_open)
 			return EBUSY;



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

2020-05-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed May 27 06:43:22 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.413 -r1.414 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.413 src/sys/arch/arm/arm32/pmap.c:1.414
--- src/sys/arch/arm/arm32/pmap.c:1.413	Wed May 27 06:41:58 2020
+++ src/sys/arch/arm/arm32/pmap.c	Wed May 27 06:43:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.413 2020/05/27 06:41:58 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.414 2020/05/27 06:43:22 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,11 +192,12 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.413 2020/05/27 06:41:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.414 2020/05/27 06:43:22 skrll Exp $");
 
-#include 
 #include 
 #include 
+
+#include 
 #include 
 #include 
 #include 



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

2020-05-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed May 27 06:41:58 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Remove duplicate #include


To generate a diff of this commit:
cvs rdiff -u -r1.412 -r1.413 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.412 src/sys/arch/arm/arm32/pmap.c:1.413
--- src/sys/arch/arm/arm32/pmap.c:1.412	Tue Apr 21 06:45:16 2020
+++ src/sys/arch/arm/arm32/pmap.c	Wed May 27 06:41:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.412 2020/04/21 06:45:16 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.413 2020/05/27 06:41:58 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,12 +192,11 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.412 2020/04/21 06:45:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.413 2020/05/27 06:41:58 skrll Exp $");
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/doc

2020-05-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed May 27 06:17:45 UTC 2020

Modified Files:
src/doc: 3RDPARTY

Log Message:
openssh 8.3 out.


To generate a diff of this commit:
cvs rdiff -u -r1.1721 -r1.1722 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1721 src/doc/3RDPARTY:1.1722
--- src/doc/3RDPARTY:1.1721	Mon May 25 23:48:26 2020
+++ src/doc/3RDPARTY	Wed May 27 06:17:45 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1721 2020/05/25 23:48:26 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1722 2020/05/27 06:17:45 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1058,7 +1058,7 @@ Patch applied after OpenSSH import.
 
 Package:	OpenSSH
 Version:	8.2
-Current Vers:	8.2 / portable 8.2p1
+Current Vers:	8.3 / portable 8.3p1
 Maintainer:	OpenSSH
 Archive Site:	http://www.openssh.com/ftp.html
 Home Page:	http://www.openssh.com/portable.html



CVS commit: src/share/mk

2020-05-27 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed May 27 06:06:38 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
switch alpha to GCC 8.  tested by rin@, same atf result as with GCC 7.

thanks rin!  only vax, sh3 and m68k left.


To generate a diff of this commit:
cvs rdiff -u -r1.1193 -r1.1194 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1193 src/share/mk/bsd.own.mk:1.1194
--- src/share/mk/bsd.own.mk:1.1193	Tue May 26 19:29:59 2020
+++ src/share/mk/bsd.own.mk	Wed May 27 06:06:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1193 2020/05/26 19:29:59 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1194 2020/05/27 06:06:37 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -63,8 +63,7 @@ TOOLCHAIN_MISSING?=	no
 #
 # What GCC is used?
 #
-.if ${MACHINE} == "alpha" || \
-${MACHINE} == "vax" || \
+.if ${MACHINE} == "vax" || \
 ${MACHINE_ARCH} == "sh3" || \
 ${MACHINE_CPU} == "m68k"
 HAVE_GCC?=	7



CVS commit: src/usr.bin/netstat

2020-05-27 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed May 27 05:59:16 UTC 2020

Modified Files:
src/usr.bin/netstat: route.c

Log Message:
Update sysctl key in netstat(1)


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/netstat/route.c

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

Modified files:

Index: src/usr.bin/netstat/route.c
diff -u src/usr.bin/netstat/route.c:1.85 src/usr.bin/netstat/route.c:1.86
--- src/usr.bin/netstat/route.c:1.85	Mon Apr  4 07:37:08 2016
+++ src/usr.bin/netstat/route.c	Wed May 27 05:59:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.85 2016/04/04 07:37:08 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.86 2020/05/27 05:59:16 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)route.c	8.3 (Berkeley) 3/9/94";
 #else
-__RCSID("$NetBSD: route.c,v 1.85 2016/04/04 07:37:08 ozaki-r Exp $");
+__RCSID("$NetBSD: route.c,v 1.86 2020/05/27 05:59:16 yamaguchi Exp $");
 #endif
 #endif /* not lint */
 
@@ -303,7 +303,7 @@ rt_stats(u_long off)
 	if (use_sysctl) {
 		size_t rtsize = sizeof(rtstats);
 
-		if (sysctlbyname("net.route.stats", , ,
+		if (sysctlbyname("net.rtable.stats", , ,
 		NULL, 0) == -1)
 			err(1, "rt_stats: sysctl");
 	} else 	if (off == 0) {