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

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 17:53:50 UTC 2021

Modified Files:
src/sys/arch/hppa/dev [netbsd-8]: sti_sgc.c

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

sys/arch/hppa/dev/sti_sgc.c: revision 1.3

Fix silent freeze on probing sti(4) framebuffer on 712/60.  PR/52162

Ok'ed by skrll@.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.28.1 src/sys/arch/hppa/dev/sti_sgc.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/hppa/dev/sti_sgc.c
diff -u src/sys/arch/hppa/dev/sti_sgc.c:1.1 src/sys/arch/hppa/dev/sti_sgc.c:1.1.28.1
--- src/sys/arch/hppa/dev/sti_sgc.c:1.1	Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/dev/sti_sgc.c	Wed Jul 14 17:53:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti_sgc.c,v 1.1 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: sti_sgc.c,v 1.1.28.1 2021/07/14 17:53:50 martin Exp $	*/
 
 /*	$OpenBSD: sti_sgc.c,v 1.38 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.1 2014/02/24 07:23:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.1.28.1 2021/07/14 17:53:50 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -73,6 +73,16 @@ extern int stidebug;
 #define	STI_ROMSIZE	(sizeof(struct sti_dd) * 4)
 #define	STI_ID_FDDI	0x280b31af	/* Medusa FDDI ROM id */
 
+/*
+ * hpa addresses to check on-board variants
+ * XXX should check via device_register(9)?
+ * 
+ * 0xf400: HPA1991AC19 on 715/33, 715/50
+ * 0xf800: HPA1439A on 735/99, HPA208LCxxx on 715/80, 715/100, 712
+ */
+#define	STI_ONBOARD_HPA0	0xf400
+#define	STI_ONBOARD_HPA1	0xf800
+
 /* gecko optional graphics */
 #define	STI_GOPT1_REV	0x17
 #define	STI_GOPT2_REV	0x70
@@ -118,7 +128,9 @@ sti_sgc_getrom(struct confargs *ca)
 	rom = PAGE0->pd_resv2[1];
 	hppa_pagezero_unmap(pagezero_cookie);
 
-	if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC) {
+	if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC &&
+	ca->ca_hpa != STI_ONBOARD_HPA0 &&
+	ca->ca_hpa != STI_ONBOARD_HPA1) {
 		int i;
 		for (i = sizeof(sti_sgc_opt); i--; )
 			if (sti_sgc_opt[i] == ca->ca_type.iodc_revision)



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

2021-06-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  5 10:37:10 UTC 2021

Modified Files:
src/sys/arch/hp300/conf [netbsd-8]: INSTALL

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

sys/arch/hp300/conf/INSTALL: revision 1.67
sys/arch/hp300/conf/INSTALL: revision 1.68

Add missed 'nhpib at intio' for internal HP-IB.  Found on testing HPDisk.
Also fix comments for HP-IB devices.
Should be pulled up to netbsd-8 and netbsd-9.

Reduce maxusers to 8 as GENERIC.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.12.1 src/sys/arch/hp300/conf/INSTALL

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

Modified files:

Index: src/sys/arch/hp300/conf/INSTALL
diff -u src/sys/arch/hp300/conf/INSTALL:1.60 src/sys/arch/hp300/conf/INSTALL:1.60.12.1
--- src/sys/arch/hp300/conf/INSTALL:1.60	Sat Aug 23 20:26:58 2014
+++ src/sys/arch/hp300/conf/INSTALL	Sat Jun  5 10:37:10 2021
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.60 2014/08/23 20:26:58 dholland Exp $
+# $NetBSD: INSTALL,v 1.60.12.1 2021/06/05 10:37:10 martin Exp $
 #
 # INSTALL machine description file
 #
@@ -39,7 +39,7 @@ options 	HP433
 options 	FPSP		# floating point interface for 68040
 
 # Need to set locally
-maxusers	32
+maxusers	8
 
 # Standard system options
 #options 	COMPAT_43	# compatibility with 4.3BSD interfaces
@@ -202,10 +202,11 @@ dcm*		at dio? scode ?	flags 0xe # DCM 4-
 
 le*		at dio? scode ?		# LANCE ethernet interfaces
 
-nhpib0		at dio? scode 7		# slow internal HP-IB
+nhpib*		at intio?		# internal HP-IB
+nhpib0		at dio? scode 7		# 98624A HP-IB
 nhpib*		at dio? scode ?
 
-fhpib*		at dio? scode ?		# `fast' HP-IB
+fhpib*		at dio? scode ?		# 98625A/98625B HP-IB
 
 hpibbus0	at nhpib0
 hpibbus*	at nhpib?



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

2021-04-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 30 14:22:24 UTC 2021

Modified Files:
src/sys/arch/xen/x86 [netbsd-8]: xen_ipi.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1675):

sys/arch/xen/x86/xen_ipi.c: revision 1.24 (patch)

make compile without DDB
PR port-xen/50282


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.10.1 src/sys/arch/xen/x86/xen_ipi.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/x86/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.20 src/sys/arch/xen/x86/xen_ipi.c:1.20.10.1
--- src/sys/arch/xen/x86/xen_ipi.c:1.20	Thu Jul  7 06:55:40 2016
+++ src/sys/arch/xen/x86/xen_ipi.c	Fri Apr 30 14:22:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.20 2016/07/07 06:55:40 msaitoh Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.20.10.1 2021/04/30 14:22:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,12 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.20 2016/07/07 06:55:40 msaitoh Exp $");
+ * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.20.10.1 2021/04/30 14:22:24 martin Exp $");
  */
 
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.20 2016/07/07 06:55:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.20.10.1 2021/04/30 14:22:24 martin Exp $");
+
+#include "opt_ddb.h"
 
 #include 
 
@@ -59,15 +61,17 @@ __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 
 #include 
 #include 
 
+#ifdef DDB
 #ifdef __x86_64__
 extern void ddb_ipi(struct trapframe);
 #else
 extern void ddb_ipi(int, struct trapframe);
 #endif /* __x86_64__ */
+static void xen_ipi_ddb(struct cpu_info *, struct intrframe *);
+#endif
 
 static void xen_ipi_halt(struct cpu_info *, struct intrframe *);
 static void xen_ipi_synch_fpu(struct cpu_info *, struct intrframe *);
-static void xen_ipi_ddb(struct cpu_info *, struct intrframe *);
 static void xen_ipi_xcall(struct cpu_info *, struct intrframe *);
 static void xen_ipi_hvcb(struct cpu_info *, struct intrframe *);
 static void xen_ipi_generic(struct cpu_info *, struct intrframe *);
@@ -76,7 +80,11 @@ static void (*ipifunc[XEN_NIPIS])(struct
 {	/* In order of priority (see: xen/include/intrdefs.h */
 	xen_ipi_halt,
 	xen_ipi_synch_fpu,
+#ifdef DDB
 	xen_ipi_ddb,
+#else
+	NULL,
+#endif
 	xen_ipi_xcall,
 	xen_ipi_hvcb,
 	xen_ipi_generic,
@@ -226,6 +234,7 @@ xen_ipi_synch_fpu(struct cpu_info *ci, s
 	fpusave_cpu(true);
 }
 
+#ifdef DDB
 static void
 xen_ipi_ddb(struct cpu_info *ci, struct intrframe *intrf)
 {
@@ -264,6 +273,7 @@ xen_ipi_ddb(struct cpu_info *ci, struct 
 	ddb_ipi(SEL_KPL, tf);
 #endif
 }
+#endif /* DDB */
 
 static void
 xen_ipi_xcall(struct cpu_info *ci, struct intrframe *intrf)



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

2021-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 25 09:38:48 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k [netbsd-8]: reenter_syscall.s

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

sys/arch/m68k/m68k/reenter_syscall.s: revision 1.5
sys/arch/m68k/m68k/reenter_syscall.s: revision 1.6
sys/arch/m68k/m68k/reenter_syscall.s: revision 1.7

Replace magic numbers with proper macros prepared in assym.h.

No binary changes.

Note this is a preparation for a possible fix of PR port-m68k/55990.

Consistently use motorola style.  No binary changes.
Seems missed in rev 1.3:
 https://mail-index.netbsd.org/source-changes/2013/08/01/msg046378.html

Plug kernel stack leaks in reenter_syscall() for setcontext(2).
This fixes long standing kernel crashes (MMU fault, address error,
and silent freeze by a double bus fault etc. seen for ~10 years)
caused by kernel stack overflow, especially on x68k and sun3 running
Xorg based servers.  See PR/55990 for more details.

"This change seems perfectly reasonable" from thorpej@ and
jklos@ also reported this also solved freeze of his mac68k system
with 10 megabyes of memory.

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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.22.1 src/sys/arch/m68k/m68k/reenter_syscall.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/m68k/m68k/reenter_syscall.s
diff -u src/sys/arch/m68k/m68k/reenter_syscall.s:1.4 src/sys/arch/m68k/m68k/reenter_syscall.s:1.4.22.1
--- src/sys/arch/m68k/m68k/reenter_syscall.s:1.4	Sat Sep  7 19:06:29 2013
+++ src/sys/arch/m68k/m68k/reenter_syscall.s	Thu Feb 25 09:38:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: reenter_syscall.s,v 1.4 2013/09/07 19:06:29 chs Exp $	*/
+/*	$NetBSD: reenter_syscall.s,v 1.4.22.1 2021/02/25 09:38:48 martin Exp $	*/
 
 /*
  * Written by ITOH Yasufumi.
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include "assym.h"
 
 /*
  * void reenter_syscall(struct frame *fp, int stkadj)
@@ -38,18 +39,31 @@ ENTRY_NOPROFILE(reenter_syscall)
 .Lcpfr:	movel	(%a0)+,(%a1)+
 	dbra	%d0,.Lcpfr
 
-	movew	%d1,%sp@(16*4+2)	| set stack adjust count
+	movew	%d1,FR_ADJ(%sp)		| set stack adjust count
 	movel	(%sp),-(%sp)		| push syscall no (original d0 value)
 	jbsr	_C_LABEL(syscall)	| re-enter syscall()
 	addql	#4,%sp			| pop syscall no
 #ifdef DEBUG
-	tstw	%sp@(16*4+2)		| stack adjust must be zero
+	tstw	FR_ADJ(%sp)		| stack adjust must be zero
 	jeq	.Ladjzero
 	PANIC("reenter_syscall")
 .Ladjzero:
 #endif
-	moveal	%sp@(15*4),%a0		| grab and restore
+	moveal	FR_SP(%sp),%a0		| grab and restore
 	movel	%a0,%usp		|   user SP
+	movw	FR_ADJ(%sp),%d0		| need to adjust stack?
+	jne	.Ladjstk		| yes, go to it
 	moveml	(%sp)+,#0x7FFF		| restore user registers
 	addql	#8,%sp			| pop SP and stack adjust
 	jra	_ASM_LABEL(rei)		| rte
+.Ladjstk:
+	lea	FR_HW(%sp),%a1		| pointer to HW frame
+	addql	#8,%a1			| source pointer
+	movl	%a1,%a0			| source
+	addw	%d0,%a0			|  + hole size = dest pointer
+	movl	-(%a1),-(%a0)		| copy
+	movl	-(%a1),-(%a0)		|  8 bytes
+	movl	%a0,FR_SP(%sp)		| new SSP
+	moveml	(%sp)+,#0x7FFF		| restore user register
+	movl	(%sp),%sp		| and do real RTE
+	jra	_ASM_LABEL(rei)		| rte



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

2021-02-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 19 17:49:19 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: intr.c

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

sys/arch/x86/x86/intr.c: revision 1.154 (via patch)

Fix x86's pci_intr_disestablish clean up routine.  Pointed out by t-kusaba@IIJ, 
thanks.

Fix panic on x86 by the following code.


sc_ih = pci_intr_establish_xname(sc_pc, ...);
pci_intr_disestablish(sc_pc, sc_ih);
sc_ih = pci_intr_establish(sc_pc, ...);


ena(4) do such processing when ifconfig down/up.

XXX pullup-8,9


To generate a diff of this commit:
cvs rdiff -u -r1.101.2.7 -r1.101.2.8 src/sys/arch/x86/x86/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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.101.2.7 src/sys/arch/x86/x86/intr.c:1.101.2.8
--- src/sys/arch/x86/x86/intr.c:1.101.2.7	Thu Nov 14 15:58:06 2019
+++ src/sys/arch/x86/x86/intr.c	Fri Feb 19 17:49:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.101.2.7 2019/11/14 15:58:06 martin Exp $	*/
+/*	$NetBSD: intr.c,v 1.101.2.8 2021/02/19 17:49:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.7 2019/11/14 15:58:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.8 2021/02/19 17:49:19 martin Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -807,6 +807,9 @@ intr_source_free(struct cpu_info *ci, in
 	ci->ci_isources[slot] = NULL;
 	if (pic != _pic)
 		idt_vec_free(idtvec);
+
+	isp->is_recurse = NULL;
+	isp->is_resume = NULL;
 }
 
 #ifdef MULTIPROCESSOR
@@ -1161,12 +1164,12 @@ intr_disestablish_xcall(void *arg1, void
 	else
 		(*pic->pic_hwunmask)(pic, ih->ih_pin);
 
-	/* Re-enable interrupts. */
-	x86_write_psl(psl);
-
 	/* If the source is free we can drop it now. */
 	intr_source_free(ci, ih->ih_slot, pic, idtvec);
 
+	/* Re-enable interrupts. */
+	x86_write_psl(psl);
+
 	DPRINTF(("%s: remove slot %d (pic %s pin %d vec %d)\n",
 	device_xname(ci->ci_dev), ih->ih_slot, pic->pic_name,
 	ih->ih_pin, idtvec));



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

2021-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 11 13:04:01 UTC 2021

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

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

sys/arch/x68k/x68k/machdep.c: revision 1.204

Restore fixes for PR/51663 lost in r1.195 (uvm_hotplug(9) merge).

The kernel crashdump and savecore(8) on NetBSD/x68k have been broken
(even without EXTNEDED_MEMORY) since NetBSD 8.0. Oops.

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


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.196.6.1 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.196 src/sys/arch/x68k/x68k/machdep.c:1.196.6.1
--- src/sys/arch/x68k/x68k/machdep.c:1.196	Mon Apr  3 17:37:29 2017
+++ src/sys/arch/x68k/x68k/machdep.c	Thu Feb 11 13:04:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.196.6.1 2021/02/11 13:04:01 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196.6.1 2021/02/11 13:04:01 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -554,7 +554,10 @@ cpu_init_kcore_hdr(void)
 {
 	cpu_kcore_hdr_t *h = _kcore_hdr;
 	struct m68k_kcore_hdr *m = >un._m68k;
-	uvm_physseg_t i;
+	psize_t size;
+#ifdef EXTENDED_MEMORY
+	int i, seg;
+#endif
 
 	memset(_kcore_hdr, 0, sizeof(cpu_kcore_hdr));
 
@@ -603,25 +606,20 @@ cpu_init_kcore_hdr(void)
 	/*
 	 * X68k has multiple RAM segments on some models.
 	 */
-	m->ram_segs[0].start = lowram;
-	m->ram_segs[0].size = mem_size - lowram;
-
-	i = uvm_physseg_get_first();
-	
-for (uvm_physseg_get_next(i); uvm_physseg_valid_p(i); i = uvm_physseg_get_next(i)) {
-		if (uvm_physseg_valid_p(i) == false)
-			break;
-
-		const paddr_t startpfn = uvm_physseg_get_start(i);
-		const paddr_t endpfn = uvm_physseg_get_end(i);
-
-		KASSERT(startpfn != -1 && endpfn != -1);
-
-		m->ram_segs[i].start = 
-		ctob(startpfn);
-		m->ram_segs[i].size  =			
-		ctob(endpfn - startpfn);
+	size = phys_basemem_seg.end - phys_basemem_seg.start;
+	m->ram_segs[0].start = phys_basemem_seg.start;
+	m->ram_segs[0].size  = size;
+#ifdef EXTENDED_MEMORY
+	seg = 1;
+	for (i = 0; i < EXTMEM_SEGS; i++) {
+		size = phys_extmem_seg[i].end - phys_extmem_seg[i].start;
+		if (size == 0)
+			continue;
+		m->ram_segs[seg].start = phys_extmem_seg[i].start;
+		m->ram_segs[seg].size  = size;
+		seg++;
 	}
+#endif
 }
 
 /*



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

2020-12-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 28 19:52:59 UTC 2020

Modified Files:
src/sys/arch/hp300/dev [netbsd-8]: dnkbd.c hil_intio.c

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

sys/arch/hp300/dev/dnkbd.c: revision 1.11
sys/arch/hp300/dev/hil_intio.c: revision 1.4

Fix a longstanding bug in hilkbd (and dnkbd) console attachment.
cn_tab->cn_dev is initialized in wsdisplay_emul_attach()
(but not in wsdiaplay_cnattach()) so it cannot be used
when hil(4) is attached before wsdisplay(4) is attached.

Instead, use exported wsdisplay_cnputc() that is actually
set in early wsdisplay_cnattach().

Now we can use ddb and RB_ASKNAME via HIL keyboard console.

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


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.6.1 src/sys/arch/hp300/dev/dnkbd.c
cvs rdiff -u -r1.3 -r1.3.52.1 src/sys/arch/hp300/dev/hil_intio.c

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

Modified files:

Index: src/sys/arch/hp300/dev/dnkbd.c
diff -u src/sys/arch/hp300/dev/dnkbd.c:1.10 src/sys/arch/hp300/dev/dnkbd.c:1.10.6.1
--- src/sys/arch/hp300/dev/dnkbd.c:1.10	Sat Apr  8 17:04:56 2017
+++ src/sys/arch/hp300/dev/dnkbd.c	Mon Dec 28 19:52:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dnkbd.c,v 1.10 2017/04/08 17:04:56 tsutsui Exp $	*/
+/*	$NetBSD: dnkbd.c,v 1.10.6.1 2020/12/28 19:52:59 martin Exp $	*/
 /*	$OpenBSD: dnkbd.c,v 1.17 2009/07/23 21:05:56 blambert Exp $	*/
 
 /*
@@ -69,6 +69,9 @@
 
 #include "opt_wsdisplay_compat.h"
 
+#include "wsdisplay.h"
+#include "wsmouse.h"
+
 #include 
 #include 
 #include 
@@ -87,7 +90,9 @@
 #include 
 #include 
 #include 
-#include "wsmouse.h"
+#if NWSDISPLAY > 0
+#include 
+#endif
 #if NWSMOUSE > 0
 #include 
 #endif
@@ -354,7 +359,8 @@ dnkbd_attach_subdevices(struct dnkbd_sof
 	 * plugged), unless the console keyboard has been claimed already
 	 * (i.e. late hotplug with hil keyboard plugged first).
 	 */
-	if (major(cn_tab->cn_dev) == devsw_name2chr("wsdisplay", NULL, 0)) {
+#if NWSDISPLAY > 0
+	if (cn_tab->cn_putc == wsdisplay_cnputc) {
 #if NHILKBD > 0
 		if (hil_is_console == -1) {
 			ka.console = 1;
@@ -365,7 +371,10 @@ dnkbd_attach_subdevices(struct dnkbd_sof
 		ka.console = 1;
 #endif
 	} else
+#endif
+	{
 		ka.console = 0;
+	}
 
 	ka.keymap = _keymapdata;
 	ka.accessops = _accessops;

Index: src/sys/arch/hp300/dev/hil_intio.c
diff -u src/sys/arch/hp300/dev/hil_intio.c:1.3 src/sys/arch/hp300/dev/hil_intio.c:1.3.52.1
--- src/sys/arch/hp300/dev/hil_intio.c:1.3	Sat Feb 19 05:36:49 2011
+++ src/sys/arch/hp300/dev/hil_intio.c	Mon Dec 28 19:52:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hil_intio.c,v 1.3 2011/02/19 05:36:49 tsutsui Exp $	*/
+/*	$NetBSD: hil_intio.c,v 1.3.52.1 2020/12/28 19:52:59 martin Exp $	*/
 /*	$OpenBSD: hil_intio.c,v 1.8 2007/01/06 20:10:57 miod Exp $	*/
 
 /*
@@ -28,6 +28,8 @@
  *
  */
 
+#include "wsdisplay.h"
+
 #include 
 #include 
 #include 
@@ -38,6 +40,9 @@
 #include 
 
 #include 
+#if NWSDISPLAY > 0
+#include 
+#endif
 
 #include 
 
@@ -88,8 +93,12 @@ hil_intio_attach(device_t parent, device
 	/*
 	 * Check that the configured console device is a wsdisplay.
 	 */
-	if (major(cn_tab->cn_dev) != devsw_name2chr("wsdisplay", NULL, 0))
+#if NWSDISPLAY > 0
+	if (cn_tab->cn_putc != wsdisplay_cnputc)
+#endif
+	{
 		hil_is_console = 0;
+	}
 
 	hil_attach(sc, _is_console);
 	intr_establish(hil_intr, sc, ia->ia_ipl, IPL_TTY);



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

2020-08-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 18 09:41:10 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: ipmi.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1597):

sys/dev/ipmi.c: revision 1.5
(applied to sys/arch/x86/x86/ipmi.c)

ipmi(4): Fixed a bug that incorrect condition is notified.

When the value obtained from the sensor is below the lower limit of
the critical threshold, it is notified that the value is below the lower
limit of the warning threshold.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.64.10.1 src/sys/arch/x86/x86/ipmi.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/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.64 src/sys/arch/x86/x86/ipmi.c:1.64.10.1
--- src/sys/arch/x86/x86/ipmi.c:1.64	Thu Jul  7 06:55:40 2016
+++ src/sys/arch/x86/x86/ipmi.c	Tue Aug 18 09:41:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipmi.c,v 1.64 2016/07/07 06:55:40 msaitoh Exp $ */
+/*	$NetBSD: ipmi.c,v 1.64.10.1 2020/08/18 09:41:10 martin Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.64 2016/07/07 06:55:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.64.10.1 2020/08/18 09:41:10 martin Exp $");
 
 #include 
 #include 
@@ -1667,14 +1667,14 @@ ipmi_sensor_status(struct ipmi_softc *sc
 		edata->value_cur > psensor->i_limits.sel_warnmax)
 			return ENVSYS_SWARNOVER;
 
-		if (psensor->i_props & PROP_WARNMIN &&
-		edata->value_cur < psensor->i_limits.sel_warnmin)
-			return ENVSYS_SWARNUNDER;
-
 		if (psensor->i_props & PROP_CRITMIN &&
 		edata->value_cur < psensor->i_limits.sel_critmin)
 			return ENVSYS_SCRITUNDER;
 
+		if (psensor->i_props & PROP_WARNMIN &&
+		edata->value_cur < psensor->i_limits.sel_warnmin)
+			return ENVSYS_SWARNUNDER;
+
 		break;
 
 	case IPMI_SENSOR_TYPE_INTRUSION:



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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 18:26:17 UTC 2020

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h

Log Message:
Accidently not commited for ticket #1595:

sys/arch/x86/include/specialreg.h   1.129 via patch

Add six errata for AMD Family 17h (Ryzen etc).


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.20 -r1.98.2.21 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.20 src/sys/arch/x86/include/specialreg.h:1.98.2.21
--- src/sys/arch/x86/include/specialreg.h:1.98.2.20	Wed Aug  5 16:02:53 2020
+++ src/sys/arch/x86/include/specialreg.h	Wed Aug  5 18:26:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.20 2020/08/05 16:02:53 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.21 2020/08/05 18:26:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -1055,6 +1055,9 @@
 #define 	NB_CFG_INITAPICCPUIDLO	(1ULL << 54)
 
 #define MSR_LS_CFG	0xc0011020
+#define 	LS_CFG_ERRATA_1033	__BIT(4)
+#define 	LS_CFG_ERRATA_793	__BIT(15)
+#define 	LS_CFG_ERRATA_1095	__BIT(57)
 #define 	LS_CFG_DIS_LS2_SQUISH	0x0200
 #define 	LS_CFG_DIS_SSB_F15H	0x0040ULL
 #define 	LS_CFG_DIS_SSB_F16H	0x0002ULL
@@ -1063,6 +1066,7 @@
 #define MSR_IC_CFG	0xc0011021
 #define 	IC_CFG_DIS_SEQ_PREFETCH	0x0800
 #define 	IC_CFG_DIS_IND		0x4000
+#define 	IC_CFG_ERRATA_776	__BIT(26)
 
 #define MSR_DC_CFG	0xc0011022
 #define 	DC_CFG_DIS_CNV_WC_SSO	0x0008
@@ -1077,9 +1081,16 @@
 #define 	BU_CFG_WBPFSMCCHKDIS	0x2000ULL
 #define 	BU_CFG_WBENHWSBDIS	0x0001ULL
 
+#define MSR_FP_CFG	0xc0011028
+#define 	FP_CFG_ERRATA_1049	__BIT(4)
+
 #define MSR_DE_CFG	0xc0011029
 #define 	DE_CFG_ERRATA_721	0x0001
 #define 	DE_CFG_LFENCE_SERIALIZE	__BIT(1)
+#define 	DE_CFG_ERRATA_1021	__BIT(13)
+
+#define MSR_LS_CFG2	0xc001102d
+#define 	LS_CFG2_ERRATA_1091	__BIT(34)
 
 /* AMD Family10h MSRs */
 #define MSR_OSVW_ID_LENGTH		0xc0010140



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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 17:27:48 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: errata.c

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

sys/arch/x86/include/specialreg.h   1.129 via patch
sys/arch/x86/x86/errata.c   1.24-1.26

- Add six errata for AMD Family 17h (Ryzen etc), tested by
  Patrick Welche and mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.10.1 src/sys/arch/x86/x86/errata.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/errata.c
diff -u src/sys/arch/x86/x86/errata.c:1.23 src/sys/arch/x86/x86/errata.c:1.23.10.1
--- src/sys/arch/x86/x86/errata.c:1.23	Tue Jan  5 10:20:22 2016
+++ src/sys/arch/x86/x86/errata.c	Wed Aug  5 17:27:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: errata.c,v 1.23 2016/01/05 10:20:22 hannken Exp $	*/
+/*	$NetBSD: errata.c,v 1.23.10.1 2020/08/05 17:27:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.23 2016/01/05 10:20:22 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.23.10.1 2020/08/05 17:27:48 martin Exp $");
 
 #include 
 #include 
@@ -70,8 +70,8 @@ typedef enum cpurev {
 	BH_E4, CH_CG, CH_D0, DH_CG, DH_D0, DH_E3, DH_E6, JH_E1,
 	JH_E6, SH_B0, SH_B3, SH_C0, SH_CG, SH_D0, SH_E4, SH_E5,
 	DR_BA, DR_B2, DR_B3, RB_C2, RB_C3, BL_C2, BL_C3, DA_C2,
-	DA_C3, HY_D0, HY_D1, HY_D1_G34R1,  PH_E0, LN_B0,
-	OINK
+	DA_C3, HY_D0, HY_D1, HY_D1_G34R1,  PH_E0, LN_B0, KB_A1,
+	ML_A1, ZP_B1, ZP_B2, PiR_B2, OINK
 } cpurev_t;
 
 static const u_int cpurevs[] = {
@@ -89,7 +89,9 @@ static const u_int cpurevs[] = {
 	RB_C2, 0x0100f42, RB_C3, 0x0100f43, BL_C2, 0x0100f52,
 	BL_C3, 0x0100f53, DA_C2, 0x0100f62, DA_C3, 0x0100f63,
 	HY_D0, 0x0100f80, HY_D1, 0x0100f81, HY_D1_G34R1, 0x0100f91,
-	PH_E0, 0x0100fa0, LN_B0, 0x0300f10,
+	PH_E0, 0x0100fa0, LN_B0, 0x0300f10, KB_A1, 0x0700F01,
+	ML_A1, 0x0730F01, ZP_B1, 0x0800F11, ZP_B2, 0x0800F12,
+	PiR_B2, 0x0800F82,
 	OINK
 };
 
@@ -142,6 +144,22 @@ static const uint8_t x86_errata_set11[] 
 	DA_C3, HY_D0, HY_D1, HY_D1_G34R1,  PH_E0, LN_B0, OINK
 };
 
+static const uint8_t x86_errata_set12[] = {
+	KB_A1, OINK
+};
+
+static const uint8_t x86_errata_set13[] = {
+	ZP_B1, ZP_B2, PiR_B2, OINK
+};
+
+static const uint8_t x86_errata_set14[] = {
+	ZP_B1, OINK
+};
+
+static const uint8_t x86_errata_set15[] = {
+	KB_A1, ML_A1, OINK
+};
+
 static bool x86_errata_setmsr(struct cpu_info *, errata_t *);
 static bool x86_errata_testmsr(struct cpu_info *, errata_t *);
 
@@ -285,6 +303,62 @@ static errata_t errata[] = {
 		721, FALSE, MSR_DE_CFG, x86_errata_set11,
 		x86_errata_setmsr, DE_CFG_ERRATA_721
 	},
+	/*
+	 * 776: Incorrect Processor Branch Prediction for Two Consecutive
+	 * Linear Pages
+	 */
+	{
+		776, FALSE, MSR_IC_CFG, x86_errata_set12,
+		x86_errata_setmsr, IC_CFG_ERRATA_776
+	},
+	/*
+	 * 793: Specific Combination of Writes to Write Combined Memory
+	 * Types and Locked Instructions May Cause Core Hang
+	 */
+	{
+		793, FALSE, MSR_LS_CFG, x86_errata_set15,
+		x86_errata_setmsr, LS_CFG_ERRATA_793
+	},
+	/*
+	 * 1021: Load Operation May Receive Stale Data From Older Store
+	 * Operation
+	 */
+	{
+		1021, FALSE, MSR_DE_CFG, x86_errata_set13,
+		x86_errata_setmsr, DE_CFG_ERRATA_1021
+	},
+	/*
+	 * 1033: A Lock Operation May Cause the System to Hang
+	 */
+	{
+		1033, FALSE, MSR_LS_CFG, x86_errata_set14,
+		x86_errata_setmsr, LS_CFG_ERRATA_1033
+	},
+	/*
+	 * 1049: FCMOV Instruction May Not Execute Correctly
+	 */
+	{
+		1049, FALSE, MSR_FP_CFG, x86_errata_set13,
+		x86_errata_setmsr, FP_CFG_ERRATA_1049
+	},
+#if 0	/* Should we apply this errata? The other OSes don't. */
+	/*
+	 * 1091: Address Boundary Crossing Load Operation May Receive
+	 * Stale Data
+	 */
+	{
+		1091, FALSE, MSR_LS_CFG2, x86_errata_set13,
+		x86_errata_setmsr, LS_CFG2_ERRATA_1091
+	},
+#endif
+	/*
+	 * 1095: Potential Violation of Read Ordering In Lock Operation
+	 * In SMT (Simultaneous Multithreading) Mode
+	 */
+	{
+		1095, FALSE, MSR_LS_CFG, x86_errata_set13,
+		x86_errata_setmsr, LS_CFG_ERRATA_1095
+	},
 };
 
 static bool 



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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 16:20:09 UTC 2020

Modified Files:
src/sys/arch/x86/conf [netbsd-8]: files.x86
src/sys/arch/x86/include [netbsd-8]: apicvar.h cpu.h
src/sys/arch/x86/x86 [netbsd-8]: cpu.c hyperv.c tsc.c
src/sys/arch/xen/conf [netbsd-8]: files.xen

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

sys/arch/x86/conf/files.x86 1.108
sys/arch/x86/include/apicvar.h  1.7 via patch
sys/arch/x86/include/cpu.h  1.121
sys/arch/x86/x86/cpu.c  1.185 via patch
sys/arch/x86/x86/hyperv.c   1.7
sys/arch/x86/x86/tsc.c  1.41
sys/arch/xen/conf/files.xen 1.181

Get TSC frequency from CPUID 0x15 and/or x16 if it's available.
This change fixes a problem that newer Intel processors' timer
counts very slowly.


To generate a diff of this commit:
cvs rdiff -u -r1.88.6.2 -r1.88.6.3 src/sys/arch/x86/conf/files.x86
cvs rdiff -u -r1.5 -r1.5.80.1 src/sys/arch/x86/include/apicvar.h
cvs rdiff -u -r1.71.2.8 -r1.71.2.9 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.130.2.9 -r1.130.2.10 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/x86/x86/hyperv.c
cvs rdiff -u -r1.36.22.1 -r1.36.22.2 src/sys/arch/x86/x86/tsc.c
cvs rdiff -u -r1.147.2.3 -r1.147.2.4 src/sys/arch/xen/conf/files.xen

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/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.88.6.2 src/sys/arch/x86/conf/files.x86:1.88.6.3
--- src/sys/arch/x86/conf/files.x86:1.88.6.2	Sat Mar  9 17:10:20 2019
+++ src/sys/arch/x86/conf/files.x86	Wed Aug  5 16:20:08 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.88.6.2 2019/03/09 17:10:20 martin Exp $
+#	$NetBSD: files.x86,v 1.88.6.3 2020/08/05 16:20:08 martin Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -84,6 +84,7 @@ file	arch/x86/x86/efi.c		machdep
 file	arch/x86/x86/errata.c		machdep
 file	arch/x86/x86/genfb_machdep.c	machdep
 file	arch/x86/x86/identcpu.c		machdep
+file	arch/x86/x86/identcpu_subr.c	machdep
 file	arch/x86/x86/i8259.c		machdep
 file	arch/x86/x86/intr.c		machdep
 file	arch/x86/x86/nmi.c		machdep

Index: src/sys/arch/x86/include/apicvar.h
diff -u src/sys/arch/x86/include/apicvar.h:1.5 src/sys/arch/x86/include/apicvar.h:1.5.80.1
--- src/sys/arch/x86/include/apicvar.h:1.5	Mon Apr 28 20:23:40 2008
+++ src/sys/arch/x86/include/apicvar.h	Wed Aug  5 16:20:08 2020
@@ -1,4 +1,4 @@
-/* 	$NetBSD: apicvar.h,v 1.5 2008/04/28 20:23:40 martin Exp $ */
+/* 	$NetBSD: apicvar.h,v 1.5.80.1 2020/08/05 16:20:08 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -46,4 +46,7 @@ struct apic_attach_args {
 
 void apic_format_redir(const char *, const char *, int, u_int32_t, u_int32_t);
 
+/* For lapic.c */
+extern uint32_t lapic_per_second;
+
 #endif /* !_X86_APICVAR_H_ */

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.71.2.8 src/sys/arch/x86/include/cpu.h:1.71.2.9
--- src/sys/arch/x86/include/cpu.h:1.71.2.8	Sat Mar  9 17:10:20 2019
+++ src/sys/arch/x86/include/cpu.h	Wed Aug  5 16:20:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.71.2.8 2019/03/09 17:10:20 martin Exp $	*/
+/*	$NetBSD: cpu.h,v 1.71.2.9 2020/08/05 16:20:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -451,6 +451,9 @@ void 	cpu_probe(struct cpu_info *);
 void	cpu_identify(struct cpu_info *);
 void	identify_hypervisor(void);
 
+/* identcpu_subr.c */
+uint64_t cpu_tsc_freq_cpuid(struct cpu_info *);
+
 typedef enum vm_guest {
 	VM_GUEST_NO = 0,
 	VM_GUEST_VM,

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.130.2.9 src/sys/arch/x86/x86/cpu.c:1.130.2.10
--- src/sys/arch/x86/x86/cpu.c:1.130.2.9	Tue Jan 21 16:47:24 2020
+++ src/sys/arch/x86/x86/cpu.c	Wed Aug  5 16:20:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.130.2.9 2020/01/21 16:47:24 martin Exp $	*/
+/*	$NetBSD: cpu.c,v 1.130.2.10 2020/08/05 16:20:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.130.2.9 2020/01/21 16:47:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.130.2.10 2020/08/05 16:20:08 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -1226,16 +1226,25 @@ cpu_shutdown(device_t dv, int how)
 	return cpu_stop(dv);
 }
 
+/* Get the TSC frequency and set it to ci->ci_data.cpu_cc_freq. */
 void
 cpu_get_tsc_freq(struct cpu_info *ci)
 {
-	uint64_t last_tsc;
+	uint64_t freq = 0, last_tsc;
 
 	if (cpu_hascounter()) {
-		last_tsc = cpu_counter_serializing();
-		x86_delay(10);
-		

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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 16:05:49 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: coretemp.c

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

sys/arch/x86/x86/coretemp.c: revision 1.37

   Add special handling for model 0x0f stepping >=2 or mode 0x0e to get Tjmax.


To generate a diff of this commit:
cvs rdiff -u -r1.35.10.1 -r1.35.10.2 src/sys/arch/x86/x86/coretemp.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/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.35.10.1 src/sys/arch/x86/x86/coretemp.c:1.35.10.2
--- src/sys/arch/x86/x86/coretemp.c:1.35.10.1	Thu Jul 26 23:23:50 2018
+++ src/sys/arch/x86/x86/coretemp.c	Wed Aug  5 16:05:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.35.10.1 2018/07/26 23:23:50 snj Exp $ */
+/* $NetBSD: coretemp.c,v 1.35.10.2 2020/08/05 16:05:49 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35.10.1 2018/07/26 23:23:50 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35.10.2 2020/08/05 16:05:49 martin Exp $");
 
 #include 
 #include 
@@ -271,6 +271,19 @@ coretemp_tjmax(device_t self)
 	sc->sc_tjmax = 100;
 
 	if ((model == 0x0f && stepping >= 2) || (model == 0x0e)) {
+		/*
+		 * Check MSR_IA32_PLATFORM_ID(0x17) bit 28. It's not documented
+		 * in the datasheet, but the following page describes the
+		 * detail:
+		 *   http://software.intel.com/en-us/articles/
+		 * mobile-intel-core2-processor-detection-table/
+		 *   Was: http://softwarecommunity.intel.com/Wiki/Mobility/
+		 * 720.htm
+		 */
+		if (rdmsr_safe(MSR_IA32_PLATFORM_ID, ) != 0)
+			goto notee;
+		if ((model < 0x17) && ((msr & __BIT(28)) == 0))
+			goto notee;
 
 		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, ) == EFAULT)
 			return;
@@ -290,6 +303,7 @@ coretemp_tjmax(device_t self)
 		} else
 			sc->sc_tjmax = 90;
 	} else {
+notee:
 		/*
 		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET,
 		 * but only consider the interval [70, 110] C as valid.



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

2020-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  5 16:02:53 UTC 2020

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h

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

sys/arch/x86/include/specialreg.h   1.162-1.168 via patch

- AMD CPUID Fn8000_000a %edx bit 20 is "SPEC_CTRL".
- Add some bit definitions of AMD's CPUID Fn8000_001f Encrypted Memory
  features.
- Add AMD INVLPGB/TLBSYNC hypervisor enable in VMCB and TLBSYNC
  intercept bit.
- Add AMD MSR_DE_CFG's bit 1 as DE_CFG_LFENCE_SERIALIZE.
- Add some definitions for Intel:
  - Add CPUID leaf 6 %eax bit 19 for HW_FEEDBACK* and
IA32_PACKAGE_TERM* MSRs.
  - Add CPUID leaf 7 %ecx bit 31 for Protection Keys.
  - Add definition of Load only TLB and Store only TLB.
  - Add IF_PSCHANGE_MC_NO bit of IA32_ARCH_CAPABILITIES
  - Fix HWP_IGNIDL.
- Add CPUID 7 %edx bit 9 "SRBDS_CTRL"
- Modify comment. Style and fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.19 -r1.98.2.20 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.19 src/sys/arch/x86/include/specialreg.h:1.98.2.20
--- src/sys/arch/x86/include/specialreg.h:1.98.2.19	Wed Apr 15 14:25:09 2020
+++ src/sys/arch/x86/include/specialreg.h	Wed Aug  5 16:02:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.19 2020/04/15 14:25:09 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.20 2020/08/05 16:02:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -247,10 +247,10 @@
 		? 0 : (CPUID_TO_EXTMODEL(cpuid) << 4)))
 
 /* CPUID Fn0001 %ebx */
-#define	CPUID_BRAND_INDEX	__BITS(7,0)
-#define	CPUID_CLFLUSH_SIZE	__BITS(15,8)
-#define	CPUID_HTT_CORES		__BITS(23,16)
-#define	CPUID_LOCAL_APIC_ID	__BITS(31,24)
+#define CPUID_BRAND_INDEX	__BITS(7,0)
+#define CPUID_CLFLUSH_SIZE	__BITS(15,8)
+#define CPUID_HTT_CORES		__BITS(23,16)
+#define CPUID_LOCAL_APIC_ID	__BITS(31,24)
 
 /*
  * Intel Deterministic Cache Parameter Leaf
@@ -320,6 +320,7 @@
 #define CPUID_DSPM_HWP_PECI   __BIT(16)	/* HWP PECI override */
 #define CPUID_DSPM_HWP_FLEX   __BIT(17)	/* Flexible HWP */
 #define CPUID_DSPM_HWP_FAST   __BIT(18)	/* Fast access for IA32_HWP_REQUEST */
+#define CPUID_DSPM_HW_FEEDBACK __BIT(19) /* HW_FEEDBACK*, IA32_PACKAGE_TERM* */
 #define CPUID_DSPM_HWP_IGNIDL __BIT(20)	/* Ignore Idle Logical Processor HWP */
 
 #define CPUID_DSPM_FLAGS	"\20" \
@@ -327,8 +328,8 @@
 	"\5" "PLN"	"\6" "ECMD"	"\7" "PTM"	"\10" "HWP"	\
 	"\11" "HWP_NOTIFY" "\12" "HWP_ACTWIN" "\13" "HWP_EPP" "\14" "HWP_PLR" \
 			"\16" "HDC"	"\17" "TBM3"	"\20" "HWP_CAP" \
-	"\21" "HWP_PECI" "\22" "HWP_FLEX" "\23" "HWP_FAST"		\
-	"25" "HWP_IGNIDL"
+	"\21" "HWP_PECI" "\22" "HWP_FLEX" "\23" "HWP_FAST" "\24HW_FEEDBACK"   \
+	"\25" "HWP_IGNIDL"
 
 /*
  * Intel/AMD Digital Thermal Sensor and
@@ -341,7 +342,7 @@
 
 /*
  * Intel/AMD Structured Extended Feature leaf Fn_0007
- * %eax == 0: Subleaf 0
+ * %ecx == 0: Subleaf 0
  *	%eax: The Maximum input value for supported subleaf.
  *	%ebx: Feature bits.
  *	%ecx: Feature bits.
@@ -413,6 +414,7 @@
 #define CPUID_SEF_MOVDIRI	__BIT(27) /* MOVDIRI instruction */
 #define CPUID_SEF_MOVDIR64B	__BIT(28) /* MOVDIR64B instruction */
 #define CPUID_SEF_SGXLC		__BIT(30) /* SGX Launch Configuration */
+#define CPUID_SEF_PKS		__BIT(31) /* Protection Keys */
 
 #define CPUID_SEF_FLAGS1	"\177\20" \
 	"b\0PREFETCHWT1\0" "b\1AVX512_VBMI\0" "b\2UMIP\0" "b\3PKU\0"	\
@@ -422,13 +424,14 @@
 	"f\21\5MAWAU\0"			\
 	"b\26RDPID\0"			\
 			"b\31CLDEMOTE\0"		"b\33MOVDIRI\0"	\
-	"b\34MOVDIR64B\0"		"b\36SGXLC\0"
+	"b\34MOVDIR64B\0"		"b\36SGXLC\0"	"b\37PKS\0"
 
 /* %edx */
 #define CPUID_SEF_AVX512_4VNNIW	__BIT(2)
 #define CPUID_SEF_AVX512_4FMAPS	__BIT(3)
 #define CPUID_SEF_FSREP_MOV	__BIT(4)  /* Fast Short REP MOV */
 #define CPUID_SEF_AVX512_VP2INTERSECT __BIT(8)
+#define CPUID_SEF_SRBDS_CTRL	__BIT(9)  /* IA32_MCU_OPT_CTRL */
 #define CPUID_SEF_MD_CLEAR	__BIT(10)
 #define CPUID_SEF_TSX_FORCE_ABORT __BIT(13) /* MSR_TSX_FORCE_ABORT bit 0 */
 #define CPUID_SEF_SERIALIZE	__BIT(14)
@@ -445,7 +448,7 @@
 #define CPUID_SEF_FLAGS2	"\20" \
 "\3" "AVX512_4VNNIW" "\4" "AVX512_4FMAPS" \
 	"\5" "FSREP_MOV"		\
-	"\11" "VP2INTERSECT"	"\13" "MD_CLEAR"			\
+	"\11VP2INTERSECT" "\12SRBDS_CTRL" "\13MD_CLEAR"			\
 			"\16TSX_FORCE_ABORT" "\17SERIALIZE" "\20HYBRID"	\
 	"\21" "TSXLDTRK"		\
 	"\25" "CET_IBT"			\
@@ -561,6 +564,8 @@
 #define CPUID_DATP_TCTYPE_D	1		/*   Data TLB */
 #define CPUID_DATP_TCTYPE_I	2		/*   Instruction TLB */
 #define CPUID_DATP_TCTYPE_U	3		/*   Unified TLB */
+#define CPUID_DATP_TCTYPE_L	4		/*   Load only TLB */
+#define CPUID_DATP_TCTYPE_S	5		/*   Store only TLB */
 #define CPUID_DATP_TCLEVEL	__BITS(7, 5)	/* TLB level (start at 1) */
 #define 

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

2020-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 20 18:40:09 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.37
sys/arch/x86/x86/procfs_machdep.c: revision 1.38

  Add AMD protected processor identification number (PPIN).

  Lowercase ppin.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.10 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.11
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.10	Wed Apr 15 14:25:09 2020
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jul 20 18:40:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.10 2020/04/15 14:25:09 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.11 2020/07/20 18:40:08 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.10 2020/04/15 14:25:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.11 2020/07/20 18:40:08 martin Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ static const char * const x86_features[]
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
 	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */



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

2020-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 20 16:05:06 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: cpu_rng.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1560):

sys/arch/x86/x86/cpu_rng.c: revision 1.16

Use x86_read_psl/x86_disable_intr/x86_read_psl to defer interrupts.

Using x86_disable_intr/x86_enable_intr causes a bit of a snag when we
try it early at boot before we're ready to handle interrupts, because
it has the effect of enabling interrupts!

Fixes instant reset at boot on VIA CPUs.  The instant reset on boot
is new since the entropy rework, which initialized the x86 CPU RNG
earlier than before, but in principle this could also cause other
problems while not early at boot too.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.12.1 src/sys/arch/x86/x86/cpu_rng.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/cpu_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.5 src/sys/arch/x86/x86/cpu_rng.c:1.5.12.1
--- src/sys/arch/x86/x86/cpu_rng.c:1.5	Mon Feb 29 00:17:54 2016
+++ src/sys/arch/x86/x86/cpu_rng.c	Sat Jun 20 16:05:06 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.5 2016/02/29 00:17:54 riastradh Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.5.12.1 2020/06/20 16:05:06 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -136,6 +136,7 @@ exhausted:
 static size_t
 cpu_rng_via(cpu_rng_t *out)
 {
+	u_long psl;
 	uint32_t creg0, rndsts;
 
 	/*
@@ -149,9 +150,9 @@ cpu_rng_via(cpu_rng_t *out)
 	 * even if such a fault is generated.
 	 *
 	 * XXX can this really happen if we don't use "rep xstorrng"?
-	 *
 	 */
 	kpreempt_disable();
+	psl = x86_read_psl();
 	x86_disable_intr();
 	creg0 = rcr0();
 	lcr0(creg0 & ~(CR0_EM|CR0_TS)); /* Permit access to SIMD/FPU path */
@@ -165,7 +166,7 @@ cpu_rng_via(cpu_rng_t *out)
 	: "=a" (rndsts), "+D" (out) : "d" (0) : "memory");
 	/* Put CR0 back how it was */
 	lcr0(creg0);
-	x86_enable_intr();
+	x86_write_psl(psl);
 	kpreempt_enable();
 
 	/*



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

2020-06-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Jun 16 10:23:04 UTC 2020

Modified Files:
src/sys/arch/mac68k/dev [netbsd-8]: ams.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1557):
sys/arch/mac68k/dev/ams.c: revision 1.23
Fix inverted Y-axis value passed to wsmouse_input(9).
Note this is what src/sys/arch/macppc/dev/ams.c does as
"upward (moving the mouse forward) is positive" as noted in wsmouse(9):
 http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/macppc/dev/ams.c#rev1.4
Reported and tested by @NonameInsect on his SE/30 and Xorg server.
Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.22.1 src/sys/arch/mac68k/dev/ams.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/mac68k/dev/ams.c
diff -u src/sys/arch/mac68k/dev/ams.c:1.22 src/sys/arch/mac68k/dev/ams.c:1.22.22.1
--- src/sys/arch/mac68k/dev/ams.c:1.22	Sat Oct 19 16:23:17 2013
+++ src/sys/arch/mac68k/dev/ams.c	Tue Jun 16 10:23:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ams.c,v 1.22 2013/10/19 16:23:17 martin Exp $	*/
+/*	$NetBSD: ams.c,v 1.22.22.1 2020/06/16 10:23:04 bouyer Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ams.c,v 1.22 2013/10/19 16:23:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ams.c,v 1.22.22.1 2020/06/16 10:23:04 bouyer Exp $");
 
 #include 
 #include 
@@ -506,7 +506,7 @@ ms_processevent(adb_event_t *event, stru
 		if (amsc->sc_wsmousedev != NULL) /* wsmouse is attached? */
 			wsmouse_input(amsc->sc_wsmousedev,
 			new_event.u.m.buttons,
-			new_event.u.m.dx, new_event.u.m.dy, 0, 0,
+			new_event.u.m.dx, -new_event.u.m.dy, 0, 0,
 			WSMOUSE_INPUT_DELTA);
 #else
 		/* do nothing */ ;



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

2020-06-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun  7 12:23:43 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea [netbsd-8]: pmap.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1554):

sys/arch/powerpc/oea/pmap.c: revision 1.96

Stop returning while PMAP_LOCK() (= KERNEL_LOCK(1, NULL)) is held.
Kernel freeze with heavy load is significantly mitigated (fixed?),
in which I could not even enter DDB from console.

XXX
There is still inconsistency in usage of two PVO pools.
I will send-pr later.

XXX
pullup to netbsd-[987]


To generate a diff of this commit:
cvs rdiff -u -r1.94.8.1 -r1.94.8.2 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.94.8.1 src/sys/arch/powerpc/oea/pmap.c:1.94.8.2
--- src/sys/arch/powerpc/oea/pmap.c:1.94.8.1	Tue Feb 27 09:07:33 2018
+++ src/sys/arch/powerpc/oea/pmap.c	Sun Jun  7 12:23:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.94.8.1 2018/02/27 09:07:33 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.94.8.2 2020/06/07 12:23:43 martin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.94.8.1 2018/02/27 09:07:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.94.8.2 2020/06/07 12:23:43 martin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -991,6 +991,7 @@ pmap_pte_spill(struct pmap *pm, vaddr_t 
 			}
 			source_pvo = pvo;
 			if (exec && !PVO_EXECUTABLE_P(source_pvo)) {
+PMAP_UNLOCK();
 return 0;
 			}
 			if (victim_pvo != NULL)
@@ -2162,6 +2163,7 @@ pmap_extract(pmap_t pm, vaddr_t va, padd
 return true;
 			}
 		}
+		PMAP_UNLOCK();
 		return false;
 #elif defined (PMAP_OEA64_BRIDGE)
 	if (va >= SEGMENT_LENGTH)



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

2020-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 13 12:39:20 UTC 2020

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: if_vmx.c

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #1547):

sys/arch/x86/pci/if_vmx.c: revision 1.60

Fix the wrong logic about making the number of vmx(4) TX/RX queue
be power of two

reviewed by nonaka@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.19.6.7 -r1.19.6.8 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.19.6.7 src/sys/arch/x86/pci/if_vmx.c:1.19.6.8
--- src/sys/arch/x86/pci/if_vmx.c:1.19.6.7	Thu Dec 26 20:23:39 2019
+++ src/sys/arch/x86/pci/if_vmx.c	Wed May 13 12:39:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.19.6.7 2019/12/26 20:23:39 martin Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.19.6.8 2020/05/13 12:39:20 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,12 +19,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.7 2019/12/26 20:23:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.8 2020/05/13 12:39:20 martin Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -398,23 +399,11 @@ CFATTACH_DECL3_NEW(vmx, sizeof(struct vm
 static int
 vmxnet3_calc_queue_size(int n)
 {
-	int v, q;
 
-	v = n;
-	while (v != 0) {
-		if (powerof2(n) != 0)
-			break;
-		v /= 2;
-		q = rounddown2(n, v);
-		if (q != 0) {
-			n = q;
-			break;
-		}
-	}
-	if (n == 0)
-		n = 1;
+	if (__predict_false(n <= 0))
+		return 1;
 
-	return n;
+	return (1U << (fls32(n) - 1));
 }
 
 static inline void



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

2020-04-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 25 10:54:23 UTC 2020

Modified Files:
src/sys/arch/hppa/hppa [netbsd-8]: trap.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1542):

sys/arch/hppa/hppa/trap.c: revision 1.115

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.107.10.1 src/sys/arch/hppa/hppa/trap.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/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.107 src/sys/arch/hppa/hppa/trap.c:1.107.10.1
--- src/sys/arch/hppa/hppa/trap.c:1.107	Mon Mar  2 11:05:12 2015
+++ src/sys/arch/hppa/hppa/trap.c	Sat Apr 25 10:54:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.107 2015/03/02 11:05:12 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.107.10.1 2020/04/25 10:54:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.107 2015/03/02 11:05:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.107.10.1 2020/04/25 10:54:23 martin Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -850,7 +850,7 @@ do_onfault:
 		}
 
 		/* Never call uvm_fault in interrupt context. */
-		KASSERT(curcpu()->ci_cpl == 0);
+		KASSERT(curcpu()->ci_intr_depth == 0);
 
 		onfault = pcb->pcb_onfault;
 		pcb->pcb_onfault = 0;



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

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

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

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

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

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

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

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


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

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

Modified files:

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



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

2020-04-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 21 16:58:57 UTC 2020

Modified Files:
src/sys/arch/macppc/stand/ofwboot [netbsd-8]: Locore.c
src/sys/arch/powerpc/oea [netbsd-8]: ofw_consinit.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1533):

sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.34 (via patch)
sys/arch/powerpc/oea/ofw_consinit.c: revision 1.18

When boot up with auto-boot? == true, some systems do not provide stdout
if the normal output is screen.

Open screen explicitly as stdout in this case, both for ofwboot and kernel,
which fixes problems with auto-boot? == true for Mac mini G4:
- messages from ofwboot do not appear
- kernel freeze during early boot stage

Taken from OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/macppc/ofw_machdep.c#rev1.3
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/macppc/stand/Locore.c#rev1.3

XXX
pullup to netbsd-9 and -8


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.10.1 src/sys/arch/macppc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.17 -r1.17.10.1 src/sys/arch/powerpc/oea/ofw_consinit.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/macppc/stand/ofwboot/Locore.c
diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.29 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.29.10.1
--- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.29	Fri Apr 22 18:25:41 2016
+++ src/sys/arch/macppc/stand/ofwboot/Locore.c	Tue Apr 21 16:58:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.29 2016/04/22 18:25:41 christos Exp $	*/
+/*	$NetBSD: Locore.c,v 1.29.10.1 2020/04/21 16:58:56 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -621,6 +621,11 @@ setup(void)
 	OF_getprop(chosen, "stdout", , sizeof(stdout)) !=
 	sizeof(stdout))
 		OF_exit();
+
+	if (stdout == 0) {
+		/* screen should be console, but it is not open */
+		stdout = OF_open("screen");
+	}
 }
 
 void

Index: src/sys/arch/powerpc/oea/ofw_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.17 src/sys/arch/powerpc/oea/ofw_consinit.c:1.17.10.1
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.17	Sun Feb 14 18:12:30 2016
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Tue Apr 21 16:58:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.17 2016/02/14 18:12:30 dholland Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.17.10.1 2020/04/21 16:58:57 martin Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.17 2016/02/14 18:12:30 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.17.10.1 2020/04/21 16:58:57 martin Exp $");
 
 #include 
 #include 
@@ -458,6 +458,10 @@ ofwoea_bootstrap_console(void)
 	if (OF_getprop(chosen, "stdin", ,
 	sizeof(stdin)) != sizeof(stdin))
 		goto nocons;
+	if (stdout == 0) {
+		 /* screen should be console, but it is not open */
+		 stdout = OF_open("screen");
+	}
 	node = OF_instance_to_package(stdout);
 	console_node = node;
 	console_instance = stdout;



CVS commit: [netbsd-8] src/sys/arch/i386/stand/misc

2020-03-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 29 11:38:13 UTC 2020

Modified Files:
src/sys/arch/i386/stand/misc [netbsd-8]: Makefile
Removed Files:
src/sys/arch/i386/stand/misc [netbsd-8]: rawr32.exe.uue

Log Message:
Remove outdated Rawrite32 copy


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.52.1 src/sys/arch/i386/stand/misc/Makefile
cvs rdiff -u -r1.7 -r0 src/sys/arch/i386/stand/misc/rawr32.exe.uue

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/stand/misc/Makefile
diff -u src/sys/arch/i386/stand/misc/Makefile:1.7 src/sys/arch/i386/stand/misc/Makefile:1.7.52.1
--- src/sys/arch/i386/stand/misc/Makefile:1.7	Wed Oct 27 18:29:46 2010
+++ src/sys/arch/i386/stand/misc/Makefile	Sun Mar 29 11:38:12 2020
@@ -1,8 +1,7 @@
-#	$NetBSD: Makefile,v 1.7 2010/10/27 18:29:46 martin Exp $
+#	$NetBSD: Makefile,v 1.7.52.1 2020/03/29 11:38:12 martin Exp $
 
 MISC_FILES=	rawrite.c
 UUDECODE_FILES=	pfdisk.doc pfdisk.exe pfdisktc.zip \
-		rawr32.exe \
 		rawrite.doc rawrite.exe
 
 .include 



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

2020-03-16 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Mar 16 12:22:03 UTC 2020

Modified Files:
src/sys/arch/xen/xen [netbsd-8]: xennet_checksum.c

Log Message:
Pull up the following revisions(s) (requested by jdolecek in ticket #1521):
sys/arch/xen/xen/xennet_checksum.c: revision 1.4

Make the packet length check less strict, allow the physical packet longer
than IP payload. This fixes problem where checksum was not recomputed for
short packets coming from Windows domU on same physical host as it seems
Windows does some padding.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.98.1 src/sys/arch/xen/xen/xennet_checksum.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/xennet_checksum.c
diff -u src/sys/arch/xen/xen/xennet_checksum.c:1.3 src/sys/arch/xen/xen/xennet_checksum.c:1.3.98.1
--- src/sys/arch/xen/xen/xennet_checksum.c:1.3	Thu Nov 22 16:17:10 2007
+++ src/sys/arch/xen/xen/xennet_checksum.c	Mon Mar 16 12:22:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xennet_checksum.c,v 1.3 2007/11/22 16:17:10 bouyer Exp $	*/
+/*	$NetBSD: xennet_checksum.c,v 1.3.98.1 2020/03/16 12:22:03 sborrill Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.3 2007/11/22 16:17:10 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.3.98.1 2020/03/16 12:22:03 sborrill Exp $");
 
 #include 
 #include 
@@ -124,7 +124,7 @@ xennet_checksum_fill(struct mbuf **mp)
 	nxt = iph->ip_p;
 	iphlen = iph->ip_hl * 4;
 	iplen = ntohs(iph->ip_len);
-	if (ehlen + iplen != m->m_pkthdr.len) {
+	if (ehlen + iplen > m->m_pkthdr.len) {
 		return EINVAL;
 	}
 	if (nxt == IPPROTO_UDP) {



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2020-03-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  9 09:48:00 UTC 2020

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficons.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1519):

sys/arch/i386/stand/efiboot/eficons.c: revision 1.10
sys/arch/i386/stand/efiboot/eficons.c: revision 1.11

If the default GOP mode is unavailable, fallback to the first mode defined.
PR# port-amd64/55000

Remove check for bestmode==-1 (shouldn't happen)


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.5 -r1.4.2.6 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.5 src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.6
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.5	Tue Feb 11 11:38:33 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Mon Mar  9 09:48:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.4.2.5 2020/02/11 11:38:33 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4.2.6 2020/03/09 09:48:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -37,6 +37,7 @@
 #ifndef DEFAULT_GOP_MODE
 #define DEFAULT_GOP_MODE	"1024x768"
 #endif
+#define FALLBACK_GOP_MODE	0
 
 extern struct x86_boot_params boot_params;
 
@@ -420,7 +421,7 @@ bi_framebuffer(void)
 	EFI_STATUS status;
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
-	INT32 bestmode = -1;
+	INT32 bestmode;
 	UINTN sz;
 
 	if (efi_gop == NULL)
@@ -431,9 +432,9 @@ bi_framebuffer(void)
 	} else {
 		/* If a mode has not been selected, choose a default */
 		bestmode = efi_find_gop_mode(DEFAULT_GOP_MODE);
+		if (bestmode == -1)
+			bestmode = FALLBACK_GOP_MODE;
 	}
-	if (bestmode == -1)
-		goto nofb;
 
 	status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,
 	bestmode);



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

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:01:45 UTC 2020

Modified Files:
src/sys/arch/amigappc/include [netbsd-8]: bus_defs.h

Log Message:
Pull up following revision(s) (requested by is in ticket #1518):

sys/arch/amigappc/include/bus_defs.h: revision 1.8

gayle wants stride_1swap now, so declare the rest of the bus methods since
we already define them anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.22.1 src/sys/arch/amigappc/include/bus_defs.h

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

Modified files:

Index: src/sys/arch/amigappc/include/bus_defs.h
diff -u src/sys/arch/amigappc/include/bus_defs.h:1.6 src/sys/arch/amigappc/include/bus_defs.h:1.6.22.1
--- src/sys/arch/amigappc/include/bus_defs.h:1.6	Wed Jan 22 00:24:53 2014
+++ src/sys/arch/amigappc/include/bus_defs.h	Sun Mar  8 10:01:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.6 2014/01/22 00:24:53 christos Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.6.22.1 2020/03/08 10:01:45 martin Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -171,10 +171,13 @@ struct amiga_bus_space_methods {
 #define __BUS_SPACE_HAS_STREAM_METHODS
 
 extern const struct amiga_bus_space_methods amiga_bus_stride_1;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap_abs;
 extern const struct amiga_bus_space_methods amiga_bus_stride_2;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4swap;
 extern const struct amiga_bus_space_methods amiga_bus_stride_16;
 extern const struct amiga_bus_space_methods amiga_bus_stride_0x1000;
+extern const struct amiga_bus_space_methods amiga_bus_stride_0x4000;
 
 #endif /* _AMIGAPPC_BUS_DEFS_H_ */



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

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:00:24 UTC 2020

Modified Files:
src/sys/arch/amiga/dev [netbsd-8]: gayle_pcmcia.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1517):

sys/arch/amiga/dev/gayle_pcmcia.c: revision 1.32

The Gayle interface uses swapped (little-endian) word accesses, so we
need to use the amiga_bus_stride_1swap methods for the word accesses.

Analyzed and submitted via port-amiga@ by Martin �berg.

Tested on formerly working hardware
- by Jukka Andberg  with Dlink DE-660+  (ne)
- by Frank Willewith D-Link DFE-670TXD  (ne)

Tested on formerly not working hardware:
- by Martin with 3Com 3c589 Etherling III   (ep)
- by Martin and Frank   with CompactFlash cards (wdc)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.10.1 src/sys/arch/amiga/dev/gayle_pcmcia.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/amiga/dev/gayle_pcmcia.c
diff -u src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31 src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31.10.1
--- src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31	Sun Feb  8 09:55:25 2015
+++ src/sys/arch/amiga/dev/gayle_pcmcia.c	Sun Mar  8 10:00:24 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $ */
+/*	$NetBSD: gayle_pcmcia.c,v 1.31.10.1 2020/03/08 10:00:24 martin Exp $ */
 
 /* public domain */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31.10.1 2020/03/08 10:00:24 martin Exp $");
 
 /* PCMCIA front-end driver for A1200's and A600's. */
 
@@ -131,7 +131,7 @@ pccard_attach(device_t parent, device_t 
 	pmap_update(vm_map_pmap(kernel_map));
 
 	/* override the one-byte access methods for I/O space */
-	pcmio_bs_methods = amiga_bus_stride_1;
+	pcmio_bs_methods = amiga_bus_stride_1swap;
 	pcmio_bs_methods.bsr1 = pcmio_bsr1;
 	pcmio_bs_methods.bsw1 = pcmio_bsw1;
 	pcmio_bs_methods.bsrm1 = pcmio_bsrm1;



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

2020-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 25 19:20:43 UTC 2020

Modified Files:
src/sys/arch/arm/arm32 [netbsd-8]: bus_dma.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1510):

sys/arch/arm/arm32/bus_dma.c: revision 1.119
sys/arch/arm/arm32/bus_dma.c: revision 1.120

Make sure to convey a failure to the calling function
Likely fix for PR kern/54999, but that was a one-off panic.
 -
Fix previous for non-_ARM32_NEED_BUS_DMA_BOUNCE builds


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.98.8.1 src/sys/arch/arm/arm32/bus_dma.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/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.98 src/sys/arch/arm/arm32/bus_dma.c:1.98.8.1
--- src/sys/arch/arm/arm32/bus_dma.c:1.98	Thu Jan  5 09:08:45 2017
+++ src/sys/arch/arm/arm32/bus_dma.c	Tue Feb 25 19:20:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.98 2017/01/05 09:08:45 msaitoh Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.98.8.1 2020/02/25 19:20:43 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_arm_bus_space.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.98 2017/01/05 09:08:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.98.8.1 2020/02/25 19:20:43 martin Exp $");
 
 #include 
 #include 
@@ -323,6 +323,7 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct arm32_bus_dmamap *map;
 	void *mapstore;
+	int error = 0;
 
 #ifdef DEBUG_DMA
 	printf("dmamap_create: t=%p size=%lx nseg=%x msegsz=%lx boundary=%lx flags=%x\n",
@@ -365,7 +366,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	struct arm32_bus_dma_cookie *cookie;
 	int cookieflags;
 	void *cookiestore;
-	int error;
 
 	cookieflags = 0;
 
@@ -412,7 +412,7 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 #ifdef DEBUG_DMA
 	printf("dmamap_create:map=%p\n", map);
 #endif	/* DEBUG_DMA */
-	return (0);
+	return error;
 }
 
 /*



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

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:31:46 UTC 2020

Modified Files:
src/sys/arch/hpcmips/hpcmips [netbsd-8]: hpcapm_machdep.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1506):

sys/arch/hpcmips/hpcmips/hpcapm_machdep.c: revision 1.6

spelling


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.48.1 src/sys/arch/hpcmips/hpcmips/hpcapm_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/hpcmips/hpcmips/hpcapm_machdep.c
diff -u src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5 src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5.48.1
--- src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5	Wed Mar 16 13:23:41 2011
+++ src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c	Thu Feb 20 14:31:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcapm_machdep.c,v 1.5 2011/03/16 13:23:41 tsutsui Exp $	*/
+/*	$NetBSD: hpcapm_machdep.c,v 1.5.48.1 2020/02/20 14:31:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 Takemura Shin
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.5 2011/03/16 13:23:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.5.48.1 2020/02/20 14:31:46 martin Exp $");
 
 #include 
 #include 
@@ -67,8 +67,8 @@ machine_standby(void)
 		vrip_splpiu();
 
 		/*
-		 * STANDBY instruction puts the CPU into power saveing
-		 * state until some interrupt occuer.
+		 * STANDBY instruction puts the CPU into power saving
+		 * state until some interrupt occurs.
 		 * It sleeps until you push the power button.
 		 */
 		__asm(".set noreorder");
@@ -99,8 +99,8 @@ machine_sleep(void)
 		vrip_splpiu();
 
 		/*
-		 * SUSPEND instruction puts the CPU into power saveing
-		 * state until some interrupt occuer.
+		 * SUSPEND instruction puts the CPU into power saving
+		 * state until some interrupt occurs.
 		 * It sleeps until you push the power button.
 		 */
 		__asm(".set noreorder");



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2020-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 11 11:38:33 UTC 2020

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficons.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1502):

sys/arch/i386/stand/efiboot/eficons.c: revision 1.9

Use 1024x768 as the default GOP mode. It is the only option available for
Hyper-V Gen.2 VMs and it seems to be the de facto standard and part of
WHQL requirements.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.4 -r1.4.2.5 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.4 src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.5
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.4	Mon Feb 10 16:47:29 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Tue Feb 11 11:38:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.4.2.4 2020/02/10 16:47:29 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4.2.5 2020/02/11 11:38:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -35,7 +35,7 @@
 #include "vbe.h"
 
 #ifndef DEFAULT_GOP_MODE
-#define DEFAULT_GOP_MODE	"800x600"
+#define DEFAULT_GOP_MODE	"1024x768"
 #endif
 
 extern struct x86_boot_params boot_params;



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2020-02-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 10 16:49:48 UTC 2020

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: efiboot.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1499):

sys/arch/i386/stand/efiboot/efiboot.c: revision 1.12

Do not clear the screen before exiting boot services as this may cause an
undesired display mode switch. PR# 54615


To generate a diff of this commit:
cvs rdiff -u -r1.4.10.5 -r1.4.10.6 src/sys/arch/i386/stand/efiboot/efiboot.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/i386/stand/efiboot/efiboot.c
diff -u src/sys/arch/i386/stand/efiboot/efiboot.c:1.4.10.5 src/sys/arch/i386/stand/efiboot/efiboot.c:1.4.10.6
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.4.10.5	Wed Sep 18 17:30:05 2019
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Mon Feb 10 16:49:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.4.10.5 2019/09/18 17:30:05 martin Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.4.10.6 2020/02/10 16:49:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -113,8 +113,6 @@ efi_cleanup(void)
 	UINT32 DescriptorVersion;
 	size_t allocsz;
 
-	clearit();
-
 	memset(_efi, 0, sizeof(btinfo_efi));
 	btinfo_efi.systblpa = (intptr_t)ST;
 #ifdef	__i386__	/* bootia32.efi */



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2020-02-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 10 16:47:30 UTC 2020

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficons.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1498):

sys/arch/i386/stand/efiboot/eficons.c: revision 1.8

Fix a few bugs related to the framebuffer:
 - If a GOP mode wasn't explicitly requested, the bootloader was passing
   fb info to the kernel even if the console was in text mode! This
   results in garbled console output on at least ThinkPad T420 and
   likely many others. If a mode isn't specified, default to 800x600.
 - The "gop" command was incorrectly parsing video modes in the form
   WxHxD as WxWxD.
 - Allow a short form WxH for the "gop" command to select any mode with
   the target dimensions.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.3 src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.4
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.3	Wed Sep 18 17:30:05 2019
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Mon Feb 10 16:47:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.4.2.3 2019/09/18 17:30:05 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4.2.4 2020/02/10 16:47:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -34,6 +34,10 @@
 #include "bootinfo.h"
 #include "vbe.h"
 
+#ifndef DEFAULT_GOP_MODE
+#define DEFAULT_GOP_MODE	"800x600"
+#endif
+
 extern struct x86_boot_params boot_params;
 
 struct btinfo_console btinfo_console;
@@ -71,6 +75,8 @@ static int efi_com_putc(int);
 static int efi_com_status(int);
 static int efi_com_waitforinputevent(uint64_t);
 
+static int efi_find_gop_mode(char *);
+
 static int iodev;
 static int (*internal_getchar)(void) = efi_cons_getc;
 static int (*internal_putchar)(int) = efi_cons_putc;
@@ -415,46 +421,36 @@ bi_framebuffer(void)
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
 	INT32 bestmode = -1;
+	UINTN sz;
 
-	if (efi_gop == NULL) {
-		framebuffer_configure(NULL);
-		return;
-	}
+	if (efi_gop == NULL)
+		goto nofb;
 
 	if (efi_gop_mode >= 0) {
 		bestmode = efi_gop_mode;
 	} else {
-#if 0
-		UINT64 res, bestres = 0;
-		UINTN sz;
-		UINT32 i;
-
-		/* XXX EDID? EFI_EDID_DISCOVERED_PROTOCOL */
-		for (i = 0; i < efi_gop->Mode->MaxMode; i++) {
-			status = uefi_call_wrapper(efi_gop->QueryMode, 4,
-			efi_gop, i, , );
-			if (EFI_ERROR(status))
-continue;
+		/* If a mode has not been selected, choose a default */
+		bestmode = efi_find_gop_mode(DEFAULT_GOP_MODE);
+	}
+	if (bestmode == -1)
+		goto nofb;
 
-			res = (UINT64)info->HorizontalResolution *
-			(UINT64)info->VerticalResolution *
-			(UINT64)getdepth(info);
-			if (res > bestres) {
-bestmode = i;
-bestres = res;
-			}
-		}
-#endif
+	status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,
+	bestmode);
+	if (EFI_ERROR(status) || efi_gop->Mode->Mode != bestmode) {
+		printf("GOP setmode failed: %" PRIxMAX "\n",
+		(uintmax_t)status);
+		goto nofb;
 	}
-	if (bestmode >= 0) {
-		status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,
-		bestmode);
-		if (EFI_ERROR(status) || efi_gop->Mode->Mode != bestmode)
-			printf("GOP setmode failed: %" PRIxMAX "\n",
-			(uintmax_t)status);
+
+	status = uefi_call_wrapper(efi_gop->QueryMode, 4,
+	efi_gop, bestmode, , );
+	if (EFI_ERROR(status)) {
+		printf("GOP querymode failed: %" PRIxMAX "\n",
+		(uintmax_t)status);
+		goto nofb;
 	}
 
-	info = efi_gop->Mode->Info;
 	memset(, 0, sizeof(fb));
 	fb.physaddr = efi_gop->Mode->FrameBufferBase;
 	fb.flags = 0;
@@ -499,6 +495,10 @@ bi_framebuffer(void)
 	}
 
 	framebuffer_configure();
+	return;
+
+nofb:
+	framebuffer_configure(NULL);
 }
 
 int
@@ -658,10 +658,16 @@ efi_find_gop_mode(char *arg)
 
 		snprintf(mode, sizeof(mode), "%lux%lux%u",
 		(long)info->HorizontalResolution,
-		(long)info->HorizontalResolution,
+		(long)info->VerticalResolution,
 		depth);
 		if (strcmp(arg, mode) == 0)
 			return i;
+
+		snprintf(mode, sizeof(mode), "%lux%lu",
+		(long)info->HorizontalResolution,
+		(long)info->VerticalResolution);
+		if (strcmp(arg, mode) == 0)
+			return i;
 	}
 	return -1;
 }



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2020-01-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 21 16:55:04 UTC 2020

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: devopen.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1485):

sys/arch/i386/stand/efiboot/devopen.c: revision 1.10
sys/arch/i386/stand/efiboot/devopen.c: revision 1.11

fix indent.
x86 efiboot: Fixed the problem that /EFI/NetBSD/boot.cfg could not be loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.1.12.7 -r1.1.12.8 src/sys/arch/i386/stand/efiboot/devopen.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/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.7 src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.8
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.7	Tue Dec 17 12:19:49 2019
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Tue Jan 21 16:55:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.1.12.7 2019/12/17 12:19:49 martin Exp $	 */
+/*	$NetBSD: devopen.c,v 1.1.12.8 2020/01/21 16:55:03 martin Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -100,10 +100,10 @@ bios2dev(int biosdev, daddr_t sector, ch
 		*devname = "hd";
 
 	(void)biosdisk_findpartition(biosdev, sector, partition, part_name);
-	if (*part_name != NULL) {
+	if (part_name != NULL && *part_name != NULL) {
 		snprintf(savedevname, sizeof(savedevname),
 		"NAME=%s", *part_name);
-			*devname = savedevname;
+		*devname = savedevname;
 	}
 }
 



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

2020-01-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 21 16:47:24 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: cpu.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1483):

sys/arch/x86/x86/cpu.c: revision 1.181

If "application processors" were skipped/disabled at boot time (due to
RB_MD1 being set), don't try to examine the featurebus info, since it
was never retrieved.  Addresses kern/54815

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.8 -r1.130.2.9 src/sys/arch/x86/x86/cpu.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/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.130.2.8 src/sys/arch/x86/x86/cpu.c:1.130.2.9
--- src/sys/arch/x86/x86/cpu.c:1.130.2.8	Sat Mar  9 17:10:19 2019
+++ src/sys/arch/x86/x86/cpu.c	Tue Jan 21 16:47:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.130.2.8 2019/03/09 17:10:19 martin Exp $	*/
+/*	$NetBSD: cpu.c,v 1.130.2.9 2020/01/21 16:47:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.130.2.8 2019/03/09 17:10:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.130.2.9 2020/01/21 16:47:24 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -535,6 +535,16 @@ cpu_rescan(device_t self, const char *if
 	struct cpufeature_attach_args cfaa;
 	struct cpu_info *ci = sc->sc_info;
 
+	/*
+	 * If we booted with RB_MD1 to disable multiprocessor, the
+	 * auto-configuration data still contains the additional
+	 * CPUs.   But their initialization was mostly bypassed
+	 * during attach, so we have to make sure we don't look at
+	 * their featurebus info, since it wasn't retrieved.
+	 */
+	if (ci == NULL)
+		return 0;
+
 	memset(, 0, sizeof(cfaa));
 	cfaa.ci = ci;
 



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

2019-12-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 26 20:23:40 UTC 2019

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: if_vmx.c

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

sys/arch/x86/pci/if_vmx.c: revision 1.53

Fix missing splnet() for ether_ioctl() caused by if_vmx.c:r1.32.
pointed out by nonaka@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.19.6.6 -r1.19.6.7 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.19.6.6 src/sys/arch/x86/pci/if_vmx.c:1.19.6.7
--- src/sys/arch/x86/pci/if_vmx.c:1.19.6.6	Mon Jul 22 17:47:16 2019
+++ src/sys/arch/x86/pci/if_vmx.c	Thu Dec 26 20:23:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.19.6.6 2019/07/22 17:47:16 martin Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.19.6.7 2019/12/26 20:23:39 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.6 2019/07/22 17:47:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.7 2019/12/26 20:23:39 martin Exp $");
 
 #include 
 #include 
@@ -2887,7 +2887,9 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long 
 			break;
 		}
 		if (ifp->if_mtu != nmtu) {
+			s = splnet();
 			error = ether_ioctl(ifp, cmd, data);
+			splx(s);
 			if (error == ENETRESET)
 error = vmxnet3_init(ifp);
 		}



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

2019-12-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 17 12:21:34 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: efidisk.c
src/sys/arch/i386/stand/lib [netbsd-8]: biosdisk.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1474):

sys/arch/i386/stand/lib/biosdisk.c: revision 1.54
sys/arch/i386/stand/efiboot/efidisk.c: revision 1.9

Do not use NAME=label syntax when label are empty

When booting sysinst from UEFI, it defaults to a GPT installation
where partition have no labels. Bootstrap used the NAME=label partition
anyway, with the result that both EFI and FFS root partition had
the same name "NAME=" and could not be distinguished. The first matching
partition for the name was used, and bootstrap looked for the kernel
in the EFI partition.

We fix that by not using NAME=label names for partition when label
is empty. In that case we revert to old syntax such as hd0b


To generate a diff of this commit:
cvs rdiff -u -r1.1.12.7 -r1.1.12.8 src/sys/arch/i386/stand/efiboot/efidisk.c
cvs rdiff -u -r1.46.6.6 -r1.46.6.7 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/efiboot/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.1.12.7 src/sys/arch/i386/stand/efiboot/efidisk.c:1.1.12.8
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.1.12.7	Tue Sep 17 18:26:53 2019
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Tue Dec 17 12:21:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.1.12.7 2019/09/17 18:26:53 martin Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.1.12.8 2019/12/17 12:21:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -253,7 +253,7 @@ efi_disk_show(void)
 printf(" ");
 first = false;
 			}
-			if (part[i].part_name != NULL)
+			if (part[i].part_name && part[i].part_name[0])
 printf(" NAME=%s(", part[i].part_name);
 			else
 printf(" hd%d%c(", edi->dev & 0x7f, i + 'a');
@@ -308,7 +308,7 @@ efi_disk_show(void)
 printf(" ");
 first = 0;
 			}
-			if (part[j].part_name != NULL)
+			if (part[j].part_name && part[j].part_name[0])
 printf(" NAME=%s(", part[j].part_name);
 			else
 printf(" raid%d%c(",

Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.6 src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.7
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.6	Tue Dec 17 12:19:49 2019
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Dec 17 12:21:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.46.6.6 2019/12/17 12:19:49 martin Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.46.6.7 2019/12/17 12:21:34 martin Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -908,7 +908,8 @@ biosdisk_probe(void)
 first = 0;
 			}
 #ifndef NO_GPT
-			if (d->part[part].part_name != NULL)
+			if (d->part[part].part_name &&
+			d->part[part].part_name[0])
 printf(" NAME=%s(", d->part[part].part_name);
 			else
 #endif
@@ -987,7 +988,8 @@ next_disk:
 first = 0;
 			}
 #ifndef NO_GPT
-			if (d->part[part].part_name != NULL)
+			if (d->part[part].part_name &&
+			d->part[part].part_name[0])
 printf(" NAME=%s(", d->part[part].part_name);
 			else
 #endif
@@ -1095,7 +1097,9 @@ biosdisk_findpartition(int biosdev, dadd
 
 		*partition = boot_part;
 #ifndef NO_GPT
-		if (part_name && d->part[boot_part].part_name) {
+		if (part_name &&
+		d->part[boot_part].part_name &&
+		d->part[boot_part].part_name[0]) {
 			strlcpy(namebuf, d->part[boot_part].part_name,
 BIOSDISK_PART_NAME_LEN);
 			*part_name = namebuf;



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

2019-12-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 17 12:19:49 UTC 2019

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-8]: devopen.c
src/sys/arch/i386/stand/efiboot [netbsd-8]: devopen.c
src/sys/arch/i386/stand/lib [netbsd-8]: biosdisk.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1473):

sys/arch/i386/stand/lib/biosdisk.c: revision 1.53
sys/arch/i386/stand/efiboot/devopen.c: revision 1.9
sys/arch/i386/stand/boot/devopen.c: revision 1.10

In-RAID partitions with no name can be candidate for booting

The code to select boot partition in RAID assumed thet had a name,
which is true when there is a GPT inside the RAID, but not when there
is a disklabel inside the RAID. This caused a regression from behavior
of NetBSD 8.1.

We fix this by allowing nameless partition to be boot candidates.
This fixes PR misc/54748

While there, let raid device be used in the boot specification, like
raid0a:/netbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.8.52.1 -r1.8.52.2 src/sys/arch/i386/stand/boot/devopen.c
cvs rdiff -u -r1.1.12.6 -r1.1.12.7 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.46.6.5 -r1.46.6.6 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/boot/devopen.c
diff -u src/sys/arch/i386/stand/boot/devopen.c:1.8.52.1 src/sys/arch/i386/stand/boot/devopen.c:1.8.52.2
--- src/sys/arch/i386/stand/boot/devopen.c:1.8.52.1	Tue Sep 17 18:26:53 2019
+++ src/sys/arch/i386/stand/boot/devopen.c	Tue Dec 17 12:19:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.8.52.1 2019/09/17 18:26:53 martin Exp $	 */
+/*	$NetBSD: devopen.c,v 1.8.52.2 2019/12/17 12:19:49 martin Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@ devopen(struct open_file *f, const char 
 	if (strstr(devname, "raid") == devname) {
 		f->f_dev = [0];		/* must be biosdisk */
 
-		return biosdisk_open_name(f, devname);
+		return biosdisk_open_name(f, fname);
 	}
 #endif
 

Index: src/sys/arch/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.6 src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.7
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.6	Fri Sep 27 09:40:08 2019
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Tue Dec 17 12:19:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.1.12.6 2019/09/27 09:40:08 martin Exp $	 */
+/*	$NetBSD: devopen.c,v 1.1.12.7 2019/12/17 12:19:49 martin Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -151,6 +151,7 @@ int
 devopen(struct open_file *f, const char *fname, char **file)
 {
 	char *fsname, *devname;
+	const char *xname = NULL;
 	int unit, partition;
 	int biosdev;
 	int i, error;
@@ -172,8 +173,12 @@ devopen(struct open_file *f, const char 
 	nfsys = nfsys_disk;
 
 	/* Search by GPT label or raidframe name */
-	if ((strstr(devname, "NAME=") == devname) ||
-	(strstr(devname, "raid") == devname)) {
+	if (strstr(devname, "NAME=") == devname)
+		xname = devname;
+	if (strstr(devname, "raid") == devname)
+		xname = fname;
+
+	if (xname != NULL) {
 		f->f_dev = [0];		/* must be biosdisk */
 
 		if (!kernel_loaded) {
@@ -181,7 +186,7 @@ devopen(struct open_file *f, const char 
 			BI_ADD(, BTINFO_BOOTPATH, sizeof(bibp));
 		}
 
-		error = biosdisk_open_name(f, devname);
+		error = biosdisk_open_name(f, xname);
 		return error;
 	}
 

Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.5 src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.6
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.5	Wed Sep 18 17:30:05 2019
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Dec 17 12:19:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.46.6.5 2019/09/18 17:30:05 martin Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.46.6.6 2019/12/17 12:19:49 martin Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -1401,9 +1401,9 @@ next_disk:
 continue;
 			if (d->part[part].fstype == FS_UNUSED)
 continue;
-			if (d->part[part].part_name == NULL)
-continue;
-			if (strcmp(d->part[part].part_name, name) == 0) {
+
+			if (d->part[part].part_name != NULL &&
+			strcmp(d->part[part].part_name, name) == 0) {
 *biosdev = raidframe[i].biosdev;
 *offset = raidframe[i].offset
 	+ RF_PROTECTED_SECTORS



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

2019-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec  7 08:46:48 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea [netbsd-8]: ofw_autoconf.c

Log Message:
Build fix for ticket #1465


To generate a diff of this commit:
cvs rdiff -u -r1.20.22.1 -r1.20.22.2 src/sys/arch/powerpc/oea/ofw_autoconf.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/powerpc/oea/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20.22.1 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20.22.2
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20.22.1	Thu Dec  5 16:53:06 2019
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sat Dec  7 08:46:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.20.22.1 2019/12/05 16:53:06 bouyer Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.20.22.2 2019/12/07 08:46:48 martin Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.20.22.1 2019/12/05 16:53:06 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.20.22.2 2019/12/07 08:46:48 martin Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -90,7 +90,7 @@ canonicalize_bootpath(void)
 {
 	int node;
 	char *p, *lastp;
-	char last[32];
+	char last[32], type[32];
 
 	/*
 	 * If the bootpath doesn't start with a / then it isn't



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

2019-12-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Dec  5 16:54:59 UTC 2019

Modified Files:
src/sys/arch/x86/include [netbsd-8]: genfb_machdep.h
src/sys/arch/x86/x86 [netbsd-8]: genfb_machdep.c hyperv.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1466):
sys/arch/x86/x86/hyperv.c: revision 1.5
sys/arch/x86/include/genfb_machdep.h: revision 1.4
sys/arch/x86/x86/genfb_machdep.c: revision 1.15
Prevent panic when attaching genfb if using a serial console with Hyper-V Gen.2.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.48.1 src/sys/arch/x86/include/genfb_machdep.h
cvs rdiff -u -r1.12 -r1.12.6.1 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/x86/x86/hyperv.c

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

Modified files:

Index: src/sys/arch/x86/include/genfb_machdep.h
diff -u src/sys/arch/x86/include/genfb_machdep.h:1.3 src/sys/arch/x86/include/genfb_machdep.h:1.3.48.1
--- src/sys/arch/x86/include/genfb_machdep.h:1.3	Wed Feb  9 13:24:23 2011
+++ src/sys/arch/x86/include/genfb_machdep.h	Thu Dec  5 16:54:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.h,v 1.3 2011/02/09 13:24:23 jmcneill Exp $ */
+/* $NetBSD: genfb_machdep.h,v 1.3.48.1 2019/12/05 16:54:59 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -29,6 +29,7 @@
 #ifndef _X86_GENFB_MACHDEP_H
 #define _X86_GENFB_MACHDEP_H
 
+int	x86_genfb_init(void);
 int	x86_genfb_cnattach(void);
 void	x86_genfb_mtrr_init(uint64_t, uint32_t);
 void	x86_genfb_set_console_dev(device_t);

Index: src/sys/arch/x86/x86/genfb_machdep.c
diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.12 src/sys/arch/x86/x86/genfb_machdep.c:1.12.6.1
--- src/sys/arch/x86/x86/genfb_machdep.c:1.12	Sat Feb 25 01:13:50 2017
+++ src/sys/arch/x86/x86/genfb_machdep.c	Thu Dec  5 16:54:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.12 2017/02/25 01:13:50 nonaka Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.12.6.1 2019/12/05 16:54:59 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.12 2017/02/25 01:13:50 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.12.6.1 2019/12/05 16:54:59 bouyer Exp $");
 
 #include "opt_mtrr.h"
 
@@ -136,23 +136,19 @@ x86_genfb_mtrr_init(uint64_t physaddr, u
 }
 
 int
-x86_genfb_cnattach(void)
+x86_genfb_init(void)
 {
-	static int ncalls = 0;
+	static int inited, attached;
 	struct rasops_info *ri = _genfb_console_screen.scr_ri;
 	const struct btinfo_framebuffer *fbinfo;
 	bus_space_tag_t t = x86_bus_space_mem;
 	bus_space_handle_t h;
 	void *bits;
-	long defattr;
 	int err;
 
-	/* XXX jmcneill
-	 *  Defer console initialization until UVM is initialized
-	 */
-	++ncalls;
-	if (ncalls < 3)
-		return -1;
+	if (inited)
+		return attached;
+	inited = 1;
 
 	memset(_genfb_console_screen, 0, sizeof(x86_genfb_console_screen));
 
@@ -206,6 +202,27 @@ x86_genfb_cnattach(void)
 	x86_genfb_stdscreen.textops = >ri_ops;
 	x86_genfb_stdscreen.capabilities = ri->ri_caps;
 
+	attached = 1;
+	return 1;
+}
+
+int
+x86_genfb_cnattach(void)
+{
+	static int ncalls = 0;
+	struct rasops_info *ri = _genfb_console_screen.scr_ri;
+	long defattr;
+
+	/* XXX jmcneill
+	 *  Defer console initialization until UVM is initialized
+	 */
+	++ncalls;
+	if (ncalls < 3)
+		return -1;
+
+	if (!x86_genfb_init())
+		return 0;
+
 	ri->ri_ops.allocattr(ri, 0, 0, 0, );
 	wsdisplay_preattach(_genfb_stdscreen, ri, 0, 0, defattr);
 
@@ -213,6 +230,12 @@ x86_genfb_cnattach(void)
 }
 #else	/* NWSDISPLAY > 0 && NGENFB > 0 */
 int
+x86_genfb_init(void)
+{
+	return 0;
+}
+
+int
 x86_genfb_cnattach(void)
 {
 	return 0;

Index: src/sys/arch/x86/x86/hyperv.c
diff -u src/sys/arch/x86/x86/hyperv.c:1.1.2.3 src/sys/arch/x86/x86/hyperv.c:1.1.2.4
--- src/sys/arch/x86/x86/hyperv.c:1.1.2.3	Wed Jun 12 10:17:32 2019
+++ src/sys/arch/x86/x86/hyperv.c	Thu Dec  5 16:54:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv.c,v 1.1.2.3 2019/06/12 10:17:32 martin Exp $	*/
+/*	$NetBSD: hyperv.c,v 1.1.2.4 2019/12/05 16:54:59 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
  */
 #include 
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.1.2.3 2019/06/12 10:17:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.1.2.4 2019/12/05 16:54:59 bouyer Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD: head/sys/dev/hyperv/
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -1103,6 +1103,9 @@ device_hyperv_register(device_t dev, voi
 		sizeof(*aa->aa_type)) == 0) {
 			prop_dictionary_t dict = device_properties(dev);
 
+			/* Initialize genfb for serial console */
+			x86_genfb_init();
+
 			/*
 			 * framebuffer drivers other 

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

2019-12-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Dec  5 16:53:06 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea [netbsd-8]: ofw_autoconf.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #1465):
sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.24
Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.22.1 src/sys/arch/powerpc/oea/ofw_autoconf.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/powerpc/oea/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20.22.1
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20	Tue Feb 18 12:27:15 2014
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Thu Dec  5 16:53:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.20.22.1 2019/12/05 16:53:06 bouyer Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.20.22.1 2019/12/05 16:53:06 bouyer Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -137,10 +137,17 @@ canonicalize_bootpath(void)
 	 *   /pci/mac-io/ata-3@2000/disk@0:0/netbsd.new		(OF-3.x)
 	 */
 	strcpy(cbootpath, bootpath);
-	while ((node = OF_finddevice(cbootpath)) == -1) {
-		if ((p = strrchr(cbootpath, '/')) == NULL)
-			break;
-		*p = '\0';
+
+	if ((node = OF_finddevice("/options")) == -1 ||
+	OF_getprop(node, "qemu_boot_hack", type, sizeof(type) - 1) == -1 ||
+	type[0] != 'y') {
+		while ((node = OF_finddevice(cbootpath)) == -1) {
+			if ((p = strrchr(cbootpath, '/')) == NULL)
+break;
+			*p = '\0';
+		}
+	} else {
+		node = -1;
 	}
 
 	printf("bootpath: %s\n", bootpath);



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

2019-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  5 08:34:16 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: copy.S
src/sys/arch/i386/i386 [netbsd-8]: copy.S

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1257):

sys/arch/amd64/amd64/copy.S: revision 1.33
sys/arch/i386/i386/copy.S: revision 1.31

Hum. Fix a potentially catastrophic bug: kcopy() sets DF=1 if the areas
overlap, but doesn't clear it if the copy faults. If this happens, we
return to the caller with DF=1, and each future memory copy will be
backwards.

I wonder if there really are places where kcopy() is called with
overlapping areas.


To generate a diff of this commit:
cvs rdiff -u -r1.20.10.3 -r1.20.10.4 src/sys/arch/amd64/amd64/copy.S
cvs rdiff -u -r1.25.8.1 -r1.25.8.2 src/sys/arch/i386/i386/copy.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/copy.S
diff -u src/sys/arch/amd64/amd64/copy.S:1.20.10.3 src/sys/arch/amd64/amd64/copy.S:1.20.10.4
--- src/sys/arch/amd64/amd64/copy.S:1.20.10.3	Sat Apr 14 10:11:49 2018
+++ src/sys/arch/amd64/amd64/copy.S	Sun May  5 08:34:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.20.10.3 2018/04/14 10:11:49 martin Exp $	*/
+/*	$NetBSD: copy.S,v 1.20.10.4 2019/05/05 08:34:16 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -242,6 +242,7 @@ NENTRY(copy_efault)
 END(copy_efault)
 
 NENTRY(kcopy_fault)
+	cld
 	ret
 END(kcopy_fault)
 

Index: src/sys/arch/i386/i386/copy.S
diff -u src/sys/arch/i386/i386/copy.S:1.25.8.1 src/sys/arch/i386/i386/copy.S:1.25.8.2
--- src/sys/arch/i386/i386/copy.S:1.25.8.1	Sun Feb  4 12:40:31 2018
+++ src/sys/arch/i386/i386/copy.S	Sun May  5 08:34:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.25.8.1 2018/02/04 12:40:31 martin Exp $	*/
+/*	$NetBSD: copy.S,v 1.25.8.2 2019/05/05 08:34:16 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2004, 2008 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.25.8.1 2018/02/04 12:40:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.25.8.2 2019/05/05 08:34:16 martin Exp $");
 
 #include "assym.h"
 
@@ -305,6 +305,7 @@ END(copy_efault)
  */
 
 NENTRY(kcopy_fault)
+	cld
 	popl	%edi
 	popl	%esi
 	ret



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

2019-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 08:45:31 UTC 2019

Modified Files:
src/sys/arch/cats/cats [netbsd-8]: cats_machdep.c

Log Message:
Redo previous, this time actually using the patch requested in the ticket:
pull up following revision(s) (requested by skrl in ticket #1249):

sys/arch/cats/cats/cats_machdep.c: revision 1.87 (via patch)

The free block after the kernel from arm32_bootmem_init doesn't
account for bt_memavail.  Adjust for this.


To generate a diff of this commit:
cvs rdiff -u -r1.83.6.2 -r1.83.6.3 src/sys/arch/cats/cats/cats_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/cats/cats/cats_machdep.c
diff -u src/sys/arch/cats/cats/cats_machdep.c:1.83.6.2 src/sys/arch/cats/cats/cats_machdep.c:1.83.6.3
--- src/sys/arch/cats/cats/cats_machdep.c:1.83.6.2	Fri Apr 26 20:44:07 2019
+++ src/sys/arch/cats/cats/cats_machdep.c	Sun Apr 28 08:45:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $	*/
+/*	$NetBSD: cats_machdep.c,v 1.83.6.3 2019/04/28 08:45:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1997,1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.3 2019/04/28 08:45:31 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -232,6 +232,9 @@ void footbridge_pci_bs_tag_init(void);
  *   Relocating the kernel to the bottom of physical memory
  */
 
+#define KERN_PHYSTOV(bmi, pa) \
+	((vaddr_t)((paddr_t)(pa) - (bmi)->bmi_start + KERNEL_BASE))
+
 u_int
 initarm(void *arm_bootargs)
 {
@@ -335,7 +338,7 @@ initarm(void *arm_bootargs)
 	ebsabootinfo.bt_memstart);
 
 	/*
-	 * The free block after the kernel from arm32_bootmem_init doesn't
+	 * The free blocks after the kernel from arm32_bootmem_init doesn't
 	 * account for bt_memavail.  Adjust for this.
 	 */
 	extern struct bootmem_info bootmem_info;
@@ -346,7 +349,7 @@ initarm(void *arm_bootargs)
 	"pv_pa %#lx kernelend %#lx", pv0->pv_pa, bmi->bmi_kernelend);
 
 	pv0->pv_pa = ebsabootinfo.bt_memavail;
-	pv0->pv_va = KERN_PHYSTOV(pv0->pv_pa);
+	pv0->pv_va = KERN_PHYSTOV(bmi, pv0->pv_pa);
 	pv0->pv_size = bmi->bmi_end - pv0->pv_pa;
 
 	printf("First freeblock adjusted to: %lx -> %lx\n", pv0->pv_pa,



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

2019-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 26 20:44:07 UTC 2019

Modified Files:
src/sys/arch/cats/cats [netbsd-8]: cats_machdep.c

Log Message:
Pull up following revision(s) (requested by skrl in ticket #1249):

sys/arch/cats/cats/cats_machdep.c: revision 1.87

The free block after the kernel from arm32_bootmem_init doesn't
account for bt_memavail.  Adjust for this.


To generate a diff of this commit:
cvs rdiff -u -r1.83.6.1 -r1.83.6.2 src/sys/arch/cats/cats/cats_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/cats/cats/cats_machdep.c
diff -u src/sys/arch/cats/cats/cats_machdep.c:1.83.6.1 src/sys/arch/cats/cats/cats_machdep.c:1.83.6.2
--- src/sys/arch/cats/cats/cats_machdep.c:1.83.6.1	Wed Jul  5 15:48:01 2017
+++ src/sys/arch/cats/cats/cats_machdep.c	Fri Apr 26 20:44:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cats_machdep.c,v 1.83.6.1 2017/07/05 15:48:01 martin Exp $	*/
+/*	$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $	*/
 
 /*
  * Copyright (c) 1997,1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.1 2017/07/05 15:48:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cats_machdep.c,v 1.83.6.2 2019/04/26 20:44:07 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -334,6 +334,24 @@ initarm(void *arm_bootargs)
 	arm32_bootmem_init(ebsabootinfo.bt_memstart, ram_size,
 	ebsabootinfo.bt_memstart);
 
+	/*
+	 * The free block after the kernel from arm32_bootmem_init doesn't
+	 * account for bt_memavail.  Adjust for this.
+	 */
+	extern struct bootmem_info bootmem_info;
+	struct bootmem_info * const bmi = _info;
+
+	pv_addr_t *pv0 = >bmi_freeblocks[0];
+	KASSERTMSG(pv0->pv_pa == bmi->bmi_kernelend,
+	"pv_pa %#lx kernelend %#lx", pv0->pv_pa, bmi->bmi_kernelend);
+
+	pv0->pv_pa = ebsabootinfo.bt_memavail;
+	pv0->pv_va = KERN_PHYSTOV(pv0->pv_pa);
+	pv0->pv_size = bmi->bmi_end - pv0->pv_pa;
+
+	printf("First freeblock adjusted to: %lx -> %lx\n", pv0->pv_pa,
+	pv0->pv_pa + pv0->pv_size - 1);
+
 	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, cats_devmap,
 	mapallmem_p);
 
@@ -365,9 +383,6 @@ initarm(void *arm_bootargs)
 		ebsabootinfo.bt_pargp, VM_PROT_READ, PTE_CACHE);
 	}
 
-	extern struct bootmem_info bootmem_info;
-	struct bootmem_info * const bmi = _info;
-
 	printf("Doing freeblocks: %d\n", bmi->bmi_nfreeblocks);
 
 	for (size_t i = 0; i < bmi->bmi_nfreeblocks; i++) {



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

2019-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 26 19:08:03 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1248):

sys/arch/hppa/hppa/machdep.c: revision 1.9
sys/arch/hppa/hppa/fpu.c: revision 1.25

Some fixes for QEMU/hppa.

Don't call desidhash_l on pcxl2 as it doesn't support it.  QEMU emulates
this cpu and would trap on illegal instruction for the diag in desidhash_l

Allow a FPU to be missing... more fixes are likely here.

QEMU doesn't set C bit properly yet


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.32.1 src/sys/arch/hppa/hppa/fpu.c
cvs rdiff -u -r1.7 -r1.7.6.1 src/sys/arch/hppa/hppa/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/hppa/hppa/fpu.c
diff -u src/sys/arch/hppa/hppa/fpu.c:1.24 src/sys/arch/hppa/hppa/fpu.c:1.24.32.1
--- src/sys/arch/hppa/hppa/fpu.c:1.24	Fri Apr  6 12:21:59 2012
+++ src/sys/arch/hppa/hppa/fpu.c	Fri Apr 26 19:08:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $	*/
+/*	$NetBSD: fpu.c,v 1.24.32.1 2019/04/26 19:08:03 martin Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.24.32.1 2019/04/26 19:08:03 martin Exp $");
 
 #include 
 #include 
@@ -144,6 +144,12 @@ hppa_fpu_bootstrap(u_int ccr_enable)
 
 	/* See if we have a present and functioning hardware FPU. */
 	fpu_present = (ccr_enable & HPPA_FPUS) == HPPA_FPUS;
+	if (!fpu_present) {
+		fpu_csw = 0;
+		curcpu()->ci_fpu_state = 0;
+
+		return;
+	}
 
 	KASSERT(fpu_present);
 	/* Initialize the FPU and get its version. */

Index: src/sys/arch/hppa/hppa/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.7 src/sys/arch/hppa/hppa/machdep.c:1.7.6.1
--- src/sys/arch/hppa/hppa/machdep.c:1.7	Sun Apr  2 08:31:10 2017
+++ src/sys/arch/hppa/hppa/machdep.c	Fri Apr 26 19:08:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.7 2017/04/02 08:31:10 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.7.6.1 2019/04/26 19:08:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7 2017/04/02 08:31:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7.6.1 2019/04/26 19:08:03 martin Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -374,7 +374,7 @@ const struct hppa_cpu_info cpu_types[] =
 	{ "PA7300LC", "Velociraptor", "PCXL2",
 	  hpcxl2, HPPA_CPU_PCXL2,
 	  HPPA_FTRS_TLBU | HPPA_FTRS_BTLBU | HPPA_FTRS_HVT, "1.1e",
-	  desidhash_l, itlb_l, dtlb_l, itlbna_l, dtlbna_l, tlbd_l,
+	  NULL, itlb_l, dtlb_l, itlbna_l, dtlbna_l, tlbd_l,
 	  ibtlb_g, NULL, pbtlb_g, hpti_g },
 #endif
 #ifdef HP8000_CPU
@@ -809,9 +809,6 @@ cpuid(void)
 
 	if (hppa_cpu_info->hci_chip_name == NULL)
 		panic("bad model string for 0x%x", pdc_model.hwmodel);
-	else if (hppa_cpu_info->desidhash == NULL)
-		panic("no kernel support for %s",
-		hppa_cpu_info->hci_chip_name);
 
 	/*
 	 * TODO: HPT on 7200 is not currently supported
@@ -825,7 +822,10 @@ cpuid(void)
 	cpu_hpt_init = hppa_cpu_info->hptinit;
 	cpu_desidhash = hppa_cpu_info->desidhash;
 
-	cpu_revision = (*cpu_desidhash)();
+	if (cpu_desidhash)
+		cpu_revision = (*cpu_desidhash)();
+	else
+		cpu_revision = 0;
 
 	/* force strong ordering for now */
 	if (hppa_cpu_ispa20_p())



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

2019-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 23 18:26:22 UTC 2019

Modified Files:
src/sys/arch/arm/arm32 [netbsd-8]: pmap.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1246):

sys/arch/arm/arm32/pmap.c: revision 1.373 (via patch)

Fix a deadlock between the pool and pmap codes:

- cpu0 grabs the kernel lock (e.g. from a non-MPSAFE interrupt) and
  calls pool_get().
- cpu1 does a pool_get() on the same pool from MPSAFE code, which needs a
  pool_page_alloc(), which ends up in pmap_extract_coherency().

So cpu0 holds the kernel_lock and wants the pool lock. cpu1 holds the pool
lock and wants the kernel_lock in pmap_extract_coherency().

The pmap code should not rely on kernel_lock. Intead make the
pmap_kernel()->pm_obj_lock a IPL_VM lock and use it as pmap lock
(thus dropping the pmap test pmap_{acquire,release}_pmap_lock()).

This needs to be a IPL_VM because unlike user pmaps, this can be locked
from interrupt context.

Add a IPL_NONE lock for pmap_growkernel(). We can't use
pmap_kernel()->pm_obj_lock here because pmap_grow_map() may sleep.

Make pmap_lock (which may be locked with pm_obj_lock held) a IPL_VM
lock in all case.
reorder a few things to not call pool_get()/pool_put() (which may sleep)
with pm_obj_lock held.

Patch initially posted to port-arm@ on April 19, improved patch (per
suggestions from Nick Hudson and Jason Thorpe) on April 21.


To generate a diff of this commit:
cvs rdiff -u -r1.349.2.2 -r1.349.2.3 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.349.2.2 src/sys/arch/arm/arm32/pmap.c:1.349.2.3
--- src/sys/arch/arm/arm32/pmap.c:1.349.2.2	Tue Apr 23 18:22:37 2019
+++ src/sys/arch/arm/arm32/pmap.c	Tue Apr 23 18:26:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.349.2.2 2019/04/23 18:22:37 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.349.2.3 2019/04/23 18:26:22 martin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -221,7 +221,7 @@
 #include 
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.349.2.2 2019/04/23 18:22:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.349.2.3 2019/04/23 18:26:22 martin Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -514,6 +514,7 @@ static size_t cnptes;
 vaddr_t memhook;			/* used by mem.c & others */
 kmutex_t memlock __cacheline_aligned;	/* used by mem.c & others */
 kmutex_t pmap_lock __cacheline_aligned;
+kmutex_t kpm_lock __cacheline_aligned;
 extern void *msgbufaddr;
 int pmap_kmpages;
 /*
@@ -536,33 +537,21 @@ static inline void
 pmap_acquire_pmap_lock(pmap_t pm)
 {
 #if defined(MULTIPROCESSOR) && defined(DDB)
-	if (db_onproc != NULL)
+	if (__predict_false(db_onproc != NULL))
 		return;
 #endif
 	
-	if (pm == pmap_kernel()) {
-#ifdef MULTIPROCESSOR
-		KERNEL_LOCK(1, NULL);
-#endif
-	} else {
-		mutex_enter(pm->pm_lock);
-	}
+	mutex_enter(pm->pm_lock);
 }
 
 static inline void
 pmap_release_pmap_lock(pmap_t pm)
 {
 #if defined(MULTIPROCESSOR) && defined(DDB)
-	if (db_onproc != NULL)
+	if (__predict_false(db_onproc != NULL))
 		return;
 #endif
-	if (pm == pmap_kernel()) {
-#ifdef MULTIPROCESSOR
-		KERNEL_UNLOCK_ONE(NULL);
-#endif
-	} else {
-		mutex_exit(pm->pm_lock);
-	}
+	mutex_exit(pm->pm_lock);
 }
 
 static inline void
@@ -3068,6 +3057,10 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 #else
 	const bool vector_page_p = (va == vector_page);
 #endif
+	struct pmap_page *pp = pmap_pv_tracked(pa);
+	struct pv_entry *new_pv = NULL;
+	struct pv_entry *old_pv = NULL;
+	int error = 0;
 
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
 
@@ -3083,6 +3076,12 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	 * test for a managed page by checking pg != NULL.
 	 */
 	pg = pmap_initialized ? PHYS_TO_VM_PAGE(pa) : NULL;
+	/*
+	 * if we may need a new pv entry allocate if now, as we can't do it
+	 * with the kernel_pmap locked
+	 */
+	if (pg || pp)
+		new_pv = pool_get(_pv_pool, PR_NOWAIT);
 
 	nflags = 0;
 	if (prot & VM_PROT_WRITE)
@@ -3106,7 +3105,8 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	if (l2b == NULL) {
 		if (flags & PMAP_CANFAIL) {
 			pmap_release_pmap_lock(pm);
-			return (ENOMEM);
+			error = ENOMEM;
+			goto free_pv;
 		}
 		panic("pmap_enter: failed to allocate L2 bucket");
 	}
@@ -3129,8 +3129,6 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	} else
 		opg = NULL;
 
-	struct pmap_page *pp = pmap_pv_tracked(pa);
-
 	if (pg || pp) {
 		KASSERT((pg != NULL) != (pp != NULL));
 		struct vm_page_md *md = (pg != NULL) ? VM_PAGE_TO_MD(pg) :
@@ -3239,9 +3237,10 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 }
 #endif
 			} else {
-pmap_release_page_lock(md);
-pv = pool_get(_pv_pool, PR_NOWAIT);
+pv = new_pv;
+new_pv = NULL;
 if (pv == NULL) {
+	pmap_release_page_lock(md);
 	pmap_release_pmap_lock(pm);
 	if ((flags & PMAP_CANFAIL) == 0)
 		

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

2019-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 23 18:22:37 UTC 2019

Modified Files:
src/sys/arch/arm/arm32 [netbsd-8]: pmap.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1245):

sys/arch/arm/arm32/pmap.c: revision 1.372

Don't try to aquire/release the pmap lock when in ddb.

Avoids a deadlock when entering ddb, or on "mach cpu n" ddb command
(the pmap lock may already be held by another CPU, which is halted when
entering ddb).

Posted to port-arm@ on April 19.


To generate a diff of this commit:
cvs rdiff -u -r1.349.2.1 -r1.349.2.2 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.349.2.1 src/sys/arch/arm/arm32/pmap.c:1.349.2.2
--- src/sys/arch/arm/arm32/pmap.c:1.349.2.1	Thu Nov  2 21:29:51 2017
+++ src/sys/arch/arm/arm32/pmap.c	Tue Apr 23 18:22:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.349.2.1 2017/11/02 21:29:51 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.349.2.2 2019/04/23 18:22:37 martin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,11 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.349.2.1 2017/11/02 21:29:51 snj Exp $");
+#ifdef DDB
+#include 
+#endif
+
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.349.2.2 2019/04/23 18:22:37 martin Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -531,6 +535,11 @@ vaddr_t pmap_directlimit;
 static inline void
 pmap_acquire_pmap_lock(pmap_t pm)
 {
+#if defined(MULTIPROCESSOR) && defined(DDB)
+	if (db_onproc != NULL)
+		return;
+#endif
+	
 	if (pm == pmap_kernel()) {
 #ifdef MULTIPROCESSOR
 		KERNEL_LOCK(1, NULL);
@@ -543,6 +552,10 @@ pmap_acquire_pmap_lock(pmap_t pm)
 static inline void
 pmap_release_pmap_lock(pmap_t pm)
 {
+#if defined(MULTIPROCESSOR) && defined(DDB)
+	if (db_onproc != NULL)
+		return;
+#endif
 	if (pm == pmap_kernel()) {
 #ifdef MULTIPROCESSOR
 		KERNEL_UNLOCK_ONE(NULL);



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

2019-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 20 13:57:24 UTC 2019

Modified Files:
src/sys/arch/hppa/conf [netbsd-8]: files.hppa
src/sys/arch/hppa/dev [netbsd-8]: dino.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1235):

sys/arch/hppa/conf/files.hppa: revision 1.20
sys/arch/hppa/dev/dino.c: revision 1.4

dino depends on gedoens

 -

Re-arrange dino_softc members to improve alignment


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.22.1 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r1.3 -r1.3.10.1 src/sys/arch/hppa/dev/dino.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/hppa/conf/files.hppa
diff -u src/sys/arch/hppa/conf/files.hppa:1.18 src/sys/arch/hppa/conf/files.hppa:1.18.22.1
--- src/sys/arch/hppa/conf/files.hppa:1.18	Mon Feb 24 07:23:42 2014
+++ src/sys/arch/hppa/conf/files.hppa	Sat Apr 20 13:57:24 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.hppa,v 1.18 2014/02/24 07:23:42 skrll Exp $
+#	$NetBSD: files.hppa,v 1.18.22.1 2019/04/20 13:57:24 martin Exp $
 #
 #	$OpenBSD: files.hppa,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -157,7 +157,7 @@ file	arch/hppa/dev/mongoose.c	mongoose
 
 # Dino, GSC-PCI bridge. Includes ps/2, serial, and flying toaster interfaces
 # Cujo is a 64-bit data path Dino
-device	dino { }: pcibus
+device	dino { } : pcibus, gedoens
 attach	dino at gedoens
 file	arch/hppa/dev/dino.c		dino
 

Index: src/sys/arch/hppa/dev/dino.c
diff -u src/sys/arch/hppa/dev/dino.c:1.3 src/sys/arch/hppa/dev/dino.c:1.3.10.1
--- src/sys/arch/hppa/dev/dino.c:1.3	Fri Oct  2 05:22:51 2015
+++ src/sys/arch/hppa/dev/dino.c	Sat Apr 20 13:57:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dino.c,v 1.3 2015/10/02 05:22:51 msaitoh Exp $ */
+/*	$NetBSD: dino.c,v 1.3.10.1 2019/04/20 13:57:24 martin Exp $ */
 
 /*	$OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.3 2015/10/02 05:22:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.3.10.1 2019/04/20 13:57:24 martin Exp $");
 
 /* #include "cardbus.h" */
 
@@ -121,15 +121,19 @@ struct dino_softc {
 	bus_space_tag_t sc_bt;
 	bus_space_handle_t sc_bh;
 	bus_dma_tag_t sc_dmat;
+
+	struct hppa_bus_dma_tag sc_dmatag;
+	struct hppa_bus_space_tag sc_memt;
+
 	volatile struct dino_regs *sc_regs;
 
 	struct hppa_pci_chipset_tag sc_pc;
 	struct hppa_bus_space_tag sc_iot;
-	char sc_ioexname[20];
+
 	struct extent *sc_ioex;
-	struct hppa_bus_space_tag sc_memt;
 	int sc_memrefcount[30];
-	struct hppa_bus_dma_tag sc_dmatag;
+
+	char sc_ioexname[20];
 };
 
 int	dinomatch(device_t, struct cfdata *, void *);
@@ -1735,6 +1739,5 @@ dinoattach(device_t parent, device_t sel
 static device_t
 dino_callback(device_t self, struct confargs *ca)
 {
-
-	return config_found_sm_loc(self, "dino", NULL, ca, mbprint, mbsubmatch);
+	return config_found_sm_loc(self, "gedoens", NULL, ca, mbprint, mbsubmatch);
 }



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

2019-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 20 13:51:47 UTC 2019

Modified Files:
src/sys/arch/hppa/hppa [netbsd-8]: disksubr.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1234):

sys/arch/hppa/hppa/disksubr.c: revision 1.4

Get a large enough buffer for the LIF DIR


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.12.1 src/sys/arch/hppa/hppa/disksubr.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/hppa/hppa/disksubr.c
diff -u src/sys/arch/hppa/hppa/disksubr.c:1.2 src/sys/arch/hppa/hppa/disksubr.c:1.2.12.1
--- src/sys/arch/hppa/hppa/disksubr.c:1.2	Sat Oct 18 08:33:25 2014
+++ src/sys/arch/hppa/hppa/disksubr.c	Sat Apr 20 13:51:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.2 2014/10/18 08:33:25 snj Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.2.12.1 2019/04/20 13:51:47 martin Exp $	*/
 
 /*	$OpenBSD: disksubr.c,v 1.6 2000/10/18 21:00:34 mickey Exp $	*/
 
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.2 2014/10/18 08:33:25 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.2.12.1 2019/04/20 13:51:47 martin Exp $");
 
 #include 
 #include 
@@ -228,7 +228,7 @@ readliflabel(struct buf *bp, void (*stra
 		struct buf *dbp;
 		struct hppa_lifdir *p;
 
-		dbp = geteblk(HPPA_LIF_DIRSIZE);
+		dbp = geteblk(lp->d_secsize);
 		dbp->b_dev = bp->b_dev;
 
 		/* read LIF directory */



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2019-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 17 15:55:00 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: efidisk.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1231):

sys/arch/i386/stand/efiboot/efidisk.c: revision 1.7

efiboot: Don't panic when BLOCK_IO_PROTOCOL is not found.

It has been reported that there is a machine where BLOCK_IO_PROTOCOL
can not be found when network boot without disk.


To generate a diff of this commit:
cvs rdiff -u -r1.1.12.5 -r1.1.12.6 src/sys/arch/i386/stand/efiboot/efidisk.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/i386/stand/efiboot/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.1.12.5 src/sys/arch/i386/stand/efiboot/efidisk.c:1.1.12.6
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.1.12.5	Wed Apr 11 14:51:43 2018
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Wed Apr 17 15:55:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.1.12.5 2018/04/11 14:51:43 martin Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.1.12.6 2019/04/17 15:55:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -57,8 +57,7 @@ efi_disk_probe(void)
 	status = LibLocateHandle(ByProtocol, , NULL,
 	, );
 	if (EFI_ERROR(status))
-		panic("LocateHandle(BlockIoProtocol): %" PRIxMAX,
-		(uintmax_t)status);
+		return;
 
 	if (efi_bootdp != NULL)
 		depth = efi_device_path_depth(efi_bootdp, MEDIA_DEVICE_PATH);
@@ -76,8 +75,7 @@ efi_disk_probe(void)
 		status = uefi_call_wrapper(BS->HandleProtocol, 3, handles[i],
 		, (void **));
 		if (EFI_ERROR(status))
-			panic("HandleProtocol(BlockIoProtocol): %" PRIxMAX,
-			(uintmax_t)status);
+			continue;
 
 		media = bio->Media;
 		if (media->LogicalPartition || !media->MediaPresent)



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

2019-03-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 29 19:39:06 UTC 2019

Modified Files:
src/sys/arch/amd64/include [netbsd-8]: param.h

Log Message:
Pull up following revision(s) (requested by rin in ticket #1220):

sys/arch/amd64/include/param.h: revision 1.30

Bump STACK_ALIGNBYTES to (16 - 1) to satisfy requirement by AMD64
System V ABI in kernel level. This is because

(1) for LLDB, we want to bypass libc/csu (and therefore manual stack
 alignment in _start), and
(2) rtld in glibc >= 2.23 for Linux/x86_64 requires it.

Fix SEGV for Linux/x86_64 binaries with glibc >= 2.23, reported as

PR port-amd64/54052.


To generate a diff of this commit:
cvs rdiff -u -r1.21.6.3 -r1.21.6.4 src/sys/arch/amd64/include/param.h

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

Modified files:

Index: src/sys/arch/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.21.6.3 src/sys/arch/amd64/include/param.h:1.21.6.4
--- src/sys/arch/amd64/include/param.h:1.21.6.3	Wed Apr 11 14:43:23 2018
+++ src/sys/arch/amd64/include/param.h	Fri Mar 29 19:39:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.21.6.3 2018/04/11 14:43:23 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.21.6.4 2019/03/29 19:39:06 martin Exp $	*/
 
 #ifdef __x86_64__
 
@@ -19,6 +19,13 @@
 
 #define ALIGNED_POINTER(p,t)	1
 
+/*
+ * Align stack as required by AMD64 System V ABI. This is because
+ * (1) we want to bypass libc/csu in LLDB, and
+ * (2) rtld in glibc >= 2.23 for Linux/x86_64 requires it.
+ */
+#define STACK_ALIGNBYTES	(16 - 1)
+
 #define ALIGNBYTES32		(sizeof(int) - 1)
 #define ALIGN32(p)		(((u_long)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
 



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

2019-03-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 21 14:27:02 UTC 2019

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: if_vmx.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1219):

sys/arch/x86/pci/if_vmx.c: revision 1.27
PR/54058: vmx(4): Fix device enable command failure when the number of vCPUs
is not a power of two.

Make the size of the vmx(4) TX/RX queue a power of two not exceeding
the number of vCPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.19.6.4 -r1.19.6.5 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.19.6.4 src/sys/arch/x86/pci/if_vmx.c:1.19.6.5
--- src/sys/arch/x86/pci/if_vmx.c:1.19.6.4	Mon Apr 16 14:34:43 2018
+++ src/sys/arch/x86/pci/if_vmx.c	Thu Mar 21 14:27:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.19.6.5 2019/03/21 14:27:02 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.5 2019/03/21 14:27:02 martin Exp $");
 
 #include 
 #include 
@@ -395,6 +395,29 @@ void vmxnet3_dma_free(struct vmxnet3_sof
 CFATTACH_DECL3_NEW(vmx, sizeof(struct vmxnet3_softc),
 vmxnet3_match, vmxnet3_attach, vmxnet3_detach, NULL, NULL, NULL, 0);
 
+/* round down to the nearest power of 2 */
+static int
+vmxnet3_calc_queue_size(int n)
+{
+	int v, q;
+
+	v = n;
+	while (v != 0) {
+		if (powerof2(n) != 0)
+			break;
+		v /= 2;
+		q = rounddown2(n, v);
+		if (q != 0) {
+			n = q;
+			break;
+		}
+	}
+	if (n == 0)
+		n = 1;
+
+	return n;
+}
+
 static inline void
 vmxnet3_write_bar0(struct vmxnet3_softc *sc, bus_size_t r, uint32_t v)
 {
@@ -520,8 +543,10 @@ vmxnet3_attach(device_t parent, device_t
 	sc->vmx_mtx = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET);
 	callout_init(>vmx_tick, CALLOUT_MPSAFE);
 
-	sc->vmx_max_ntxqueues = ncpu;
-	sc->vmx_max_nrxqueues = ncpu;
+	sc->vmx_max_ntxqueues =
+	vmxnet3_calc_queue_size(MIN(VMXNET3_MAX_TX_QUEUES, ncpu));
+	sc->vmx_max_nrxqueues =
+	vmxnet3_calc_queue_size(MIN(VMXNET3_MAX_RX_QUEUES, ncpu));
 	sc->vmx_ntxdescs = 512;
 	sc->vmx_nrxdescs = 256;
 	sc->vmx_max_rxsegs = VMXNET3_MAX_RX_SEGS;



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

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 10:51:36 UTC 2019

Modified Files:
src/sys/arch/mvme68k/dev [netbsd-8]: pcctwo_68k.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1213):
sys/arch/mvme68k/dev/pcctwo_68k.c: revision 1.11
Fix small (but fatal) oversight in device/softc split.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.30.1 src/sys/arch/mvme68k/dev/pcctwo_68k.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/mvme68k/dev/pcctwo_68k.c
diff -u src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10 src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10.30.1
--- src/sys/arch/mvme68k/dev/pcctwo_68k.c:1.10	Sat Oct 27 17:18:04 2012
+++ src/sys/arch/mvme68k/dev/pcctwo_68k.c	Wed Mar 13 10:51:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $	*/
+/*	$NetBSD: pcctwo_68k.c,v 1.10.30.1 2019/03/13 10:51:36 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcctwo_68k.c,v 1.10.30.1 2019/03/13 10:51:36 msaitoh Exp $");
 
 #include 
 #include 
@@ -187,6 +187,7 @@ pcctwoattach(device_t parent, device_t s
 	uint8_t cid;
 
 	sc = sys_pcctwo = device_private(self);
+	sc->sc_dev = self;
 	ma = aux;
 
 	/* Get a handle to the PCCChip2's registers */



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

2019-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  7 17:01:18 UTC 2019

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.28

- Add wbnoinvd, virt_ssbd, tme, cldemote, movdiri, movdir64b and pconfig.
- Move AMD 0x8008 ebx's ibpb, ibrs and stibp to x86_features[8] linux
   mapping.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.7 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.8
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.7	Sun Nov 18 11:16:52 2018
+++ src/sys/arch/x86/x86/procfs_machdep.c	Thu Mar  7 17:01:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.7 2018/11/18 11:16:52 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.8 2019/03/07 17:01:18 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.7 2018/11/18 11:16:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.8 2019/03/07 17:01:18 martin Exp $");
 
 #include 
 #include 
@@ -115,14 +115,14 @@ static const char * const x86_features[]
 	"hw_pstate", "proc_feedback", "sme", NULL,
 	NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL},
 
 	{ /* (8) Linux mapping */
 	"tpr_shadow", "vnmi", "flexpriority", "ept",
 	"vpid", "npt", "lbrv", "svm_lock",
 	"nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid",
 	"decodeassists", "pausefilter", "pfthreshold", "vmmcall",
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (9) Intel-defined: 0007 ebx */
@@ -153,9 +153,9 @@ static const char * const x86_features[]
 
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, "ibpb", NULL, "ibrs", "stibp",
+	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */
 	"dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
@@ -176,9 +176,9 @@ static const char * const x86_features[]
 	NULL, "avx512vbmi", "umip", "pku",
 	"ospke", NULL, "avx512_vbmi2", NULL,
 	"gfni", "vaes", "vpclmulqdq", "avx512_vnni",
-	"avx512_bitalg", NULL, "avx512_vpopcntdq", NULL,
+	"avx512_bitalg", "tme", "avx512_vpopcntdq", NULL,
 	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, NULL, NULL},
 
 	{ /* (17) 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
@@ -189,7 +189,7 @@ static const char * const x86_features[]
 	{ /* (18) Intel 0x0007 edx */
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, "pconfig", NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
 };



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

2019-02-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 19 15:11:47 UTC 2019

Modified Files:
src/sys/arch/evbppc/obs405 [netbsd-8]: obs600_autoconf.c

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

sys/arch/evbppc/obs405/obs600_autoconf.c: revision 1.8

Fix compile error reported by Kazuhiro Ito in PR kern/52704.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.22.1 src/sys/arch/evbppc/obs405/obs600_autoconf.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/evbppc/obs405/obs600_autoconf.c
diff -u src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.7 src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.7.22.1
--- src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.7	Thu Nov 21 13:52:27 2013
+++ src/sys/arch/evbppc/obs405/obs600_autoconf.c	Tue Feb 19 15:11:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: obs600_autoconf.c,v 1.7 2013/11/21 13:52:27 kiyohara Exp $	*/
+/*	$NetBSD: obs600_autoconf.c,v 1.7.22.1 2019/02/19 15:11:47 martin Exp $	*/
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,7 +33,7 @@
  * DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.7 2013/11/21 13:52:27 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.7.22.1 2019/02/19 15:11:47 martin Exp $");
 
 #include "dwctwo.h"
 
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: obs600_autoc
 #include 
 
 #include 
+#include 
 #include "dwc2_core.h"
 
 /* This parameters was set from u-boot. */



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

2019-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 12 09:27:17 UTC 2019

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h

Log Message:
Actually pull up rev 1.139 (as claimed, but not done in previous),
requested by msaitoh in ticket #1187:

 Fix bitstring format of Intel CPUID Architectural Performance Monitoring
Fn000a %ebx.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.10 -r1.98.2.11 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.10 src/sys/arch/x86/include/specialreg.h:1.98.2.11
--- src/sys/arch/x86/include/specialreg.h:1.98.2.10	Mon Feb 11 13:23:03 2019
+++ src/sys/arch/x86/include/specialreg.h	Tue Feb 12 09:27:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.10 2019/02/11 13:23:03 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.11 2019/02/12 09:27:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -464,8 +464,8 @@
 #define CPUID_PERF_BRMISPRRETR	__BIT(6)   /* No branch mispredict retry */
 
 #define CPUID_PERF_FLAGS1	"\177\20"  \
-	"b\0\1CORECYCL\0" "b\1\1INSTRETRY\0" "b\2\1REFCYCL\0" "b\3\1LLCREF\0" \
-	"b\4\1LLCMISS\0" "b\5\1BRINSRETR\0" "b\6\1BRMISPRRETR\0"
+	"b\0CORECYCL\0" "b\1INSTRETRY\0" "b\2REFCYCL\0" "b\3LLCREF\0" \
+	"b\4LLCMISS\0" "b\5BRINSRETR\0" "b\6BRMISPRRETR\0"
 
 /* %edx */
 #define CPUID_PERF_NFFPC	__BITS(4, 0)   /* Num of fixed-funct perfcnt */



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

2019-01-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 27 18:46:11 UTC 2019

Modified Files:
src/sys/arch/amd64/include [netbsd-8]: vmparam.h

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1174):

sys/arch/amd64/include/vmparam.h: revision 1.50

Increase VM_PHYSSEG_MAX from 32 to 64. Saw an example on tech-kern@ of a
heavily fragmented memory map.


To generate a diff of this commit:
cvs rdiff -u -r1.39.6.2 -r1.39.6.3 src/sys/arch/amd64/include/vmparam.h

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

Modified files:

Index: src/sys/arch/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.39.6.2 src/sys/arch/amd64/include/vmparam.h:1.39.6.3
--- src/sys/arch/amd64/include/vmparam.h:1.39.6.2	Wed Apr 11 14:37:11 2018
+++ src/sys/arch/amd64/include/vmparam.h	Sun Jan 27 18:46:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.39.6.2 2018/04/11 14:37:11 martin Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.39.6.3 2019/01/27 18:46:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -150,7 +150,7 @@
 /* virtual sizes (bytes) for various kernel submaps */
 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
 
-#define VM_PHYSSEG_MAX		32	/* 1 "hole" + 31 free lists */
+#define VM_PHYSSEG_MAX		64	/* 1 "hole" + 63 free lists */
 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 
 #define	VM_NFREELIST		6



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

2019-01-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 27 18:43:09 UTC 2019

Modified Files:
src/sys/arch/alpha/alpha [netbsd-8]: machdep.c
src/sys/arch/amd64/amd64 [netbsd-8]: netbsd32_machdep.c
src/sys/arch/arm/arm [netbsd-8]: sig_machdep.c
src/sys/arch/hppa/hppa [netbsd-8]: sig_machdep.c
src/sys/arch/i386/i386 [netbsd-8]: machdep.c
src/sys/arch/m68k/m68k [netbsd-8]: sig_machdep.c
src/sys/arch/mips/mips [netbsd-8]: netbsd32_machdep.c sig_machdep.c
src/sys/arch/powerpc/powerpc [netbsd-8]: sig_machdep.c
src/sys/arch/riscv/riscv [netbsd-8]: sig_machdep.c
src/sys/arch/sh3/sh3 [netbsd-8]: sh3_machdep.c
src/sys/arch/sparc64/sparc64 [netbsd-8]: machdep.c netbsd32_machdep.c
src/sys/arch/usermode/target/i386 [netbsd-8]: cpu_i386.c
src/sys/arch/usermode/target/x86_64 [netbsd-8]: cpu_x86_64.c
src/sys/arch/vax/vax [netbsd-8]: sig_machdep.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1173):
sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/riscv/riscv/sig_machdep.c: revision 1.2
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


To generate a diff of this commit:
cvs rdiff -u -r1.350 -r1.350.6.1 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.105.2.1 -r1.105.2.2 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.49 -r1.49.10.1 src/sys/arch/arm/arm/sig_machdep.c
cvs rdiff -u -r1.25 -r1.25.48.1 src/sys/arch/hppa/hppa/sig_machdep.c
cvs rdiff -u -r1.782.6.6 -r1.782.6.7 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.49 -r1.49.32.1 src/sys/arch/m68k/m68k/sig_machdep.c
cvs rdiff -u -r1.14 -r1.14.6.1 src/sys/arch/mips/mips/netbsd32_machdep.c
cvs rdiff -u -r1.23 -r1.23.46.1 src/sys/arch/mips/mips/sig_machdep.c
cvs rdiff -u -r1.45 -r1.45.6.1 src/sys/arch/powerpc/powerpc/sig_machdep.c
cvs rdiff -u -r1.1 -r1.1.12.1 src/sys/arch/riscv/riscv/sig_machdep.c
cvs rdiff -u -r1.105 -r1.105.8.1 src/sys/arch/sh3/sh3/sh3_machdep.c
cvs rdiff -u -r1.287 -r1.287.8.1 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.110 -r1.110.8.1 \
src/sys/arch/sparc64/sparc64/netbsd32_machdep.c
cvs rdiff -u -r1.4 -r1.4.34.1 src/sys/arch/usermode/target/i386/cpu_i386.c
cvs rdiff -u -r1.2 -r1.2.42.1 \
src/sys/arch/usermode/target/x86_64/cpu_x86_64.c
cvs rdiff -u -r1.22 -r1.22.2.1 src/sys/arch/vax/vax/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/sys/arch/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.350 src/sys/arch/alpha/alpha/machdep.c:1.350.6.1
--- src/sys/arch/alpha/alpha/machdep.c:1.350	Thu Mar 16 16:13:20 2017
+++ src/sys/arch/alpha/alpha/machdep.c	Sun Jan 27 18:43:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.350 2017/03/16 16:13:20 chs Exp $ */
+/* $NetBSD: machdep.c,v 1.350.6.1 2019/01/27 18:43:08 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.350 2017/03/16 16:13:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.350.6.1 2019/01/27 18:43:08 martin Exp $");
 
 #include 
 #include 
@@ -1467,12 +1467,11 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 #endif
 
 	/* Build stack frame for signal trampoline. */
-
+	memset(, 0, sizeof(frame));
 	frame.sf_si._info = ksi->ksi_info;
 	frame.sf_uc.uc_flags = _UC_SIGMASK;
 	frame.sf_uc.uc_sigmask = *mask;
 	frame.sf_uc.uc_link = l->l_ctxlink;
-	memset(_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
 	sendsig_reset(l, sig);
 	mutex_exit(p->p_lock);
 	cpu_getmcontext(l, _uc.uc_mcontext, _uc.uc_flags);

Index: 

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

2019-01-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 21 20:12:15 UTC 2019

Modified Files:
src/sys/arch/xen/xen [netbsd-8]: if_xennet_xenbus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1166):

sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.74

Don't call xennet_softstart from hard interrupt; schedule softint.

Fixes panic in bpf_mtap which expects to be called only in softint.


To generate a diff of this commit:
cvs rdiff -u -r1.70.6.1 -r1.70.6.2 src/sys/arch/xen/xen/if_xennet_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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.70.6.1 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.70.6.2
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.70.6.1	Thu Jul 26 23:55:29 2018
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Jan 21 20:12:15 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.70.6.1 2018/07/26 23:55:29 snj Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.70.6.2 2019/01/21 20:12:15 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.70.6.1 2018/07/26 23:55:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.70.6.2 2019/01/21 20:12:15 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -953,7 +953,7 @@ again:
 end:
 	if (ifp->if_flags & IFF_OACTIVE) {
 		ifp->if_flags &= ~IFF_OACTIVE;
-		xennet_softstart(sc);
+		softint_schedule(sc->sc_softintr);
 	}
 }
 



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

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:40:15 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc [netbsd-8]: pmap.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1163):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
  kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
  existing ctx_lock, and push handling of it into ctx_alloc() the
  ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus.  without
this patch i usually hang during boot.  with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.361.8.1 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.361 src/sys/arch/sparc/sparc/pmap.c:1.361.8.1
--- src/sys/arch/sparc/sparc/pmap.c:1.361	Thu Dec 22 14:47:59 2016
+++ src/sys/arch/sparc/sparc/pmap.c	Tue Jan 15 18:40:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.361 2016/12/22 14:47:59 cherry Exp $ */
+/*	$NetBSD: pmap.c,v 1.361.8.1 2019/01/15 18:40:15 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.361 2016/12/22 14:47:59 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.361.8.1 2019/01/15 18:40:15 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -176,8 +176,8 @@ paddr_t	vm_first_phys = (paddr_t)-1;
 paddr_t	vm_last_phys = 0;
 psize_t vm_num_phys;
 
-#define	PMAP_LOCK()	KERNEL_LOCK(1, NULL)
-#define	PMAP_UNLOCK()	KERNEL_UNLOCK_ONE(NULL)
+#define	PMAP_LOCK()	mutex_enter(_lock)
+#define	PMAP_UNLOCK()	mutex_exit(_lock)
 
 /*
  * Flags in pvlist.pv_flags.  Note that PV_MOD must be 1 and PV_REF must be 2
@@ -347,6 +347,7 @@ mmuq_insert_tail(struct mmuentry *head, 
 int	seginval;		/* [4/4c] the invalid segment number */
 int	reginval;		/* [4/3mmu] the invalid region number */
 
+static kmutex_t pmap_lock;
 static kmutex_t demap_lock;
 static bool	lock_available = false;	/* demap_lock has been initialized */
 
@@ -372,15 +373,15 @@ union ctxinfo {
 	struct	pmap *c_pmap;		/* pmap (if busy) */
 };
 
-static kmutex_t	ctx_lock;		/* lock for below */
+static kmutex_t	ctx_lock;		/* lock for below, and {,de}activate */
 union	ctxinfo *ctxinfo;		/* allocated at in pmap_bootstrap */
 union	ctxinfo *ctx_freelist;		/* context free list */
 int	ctx_kick;			/* allocation rover when none free */
 int	ctx_kickdir;			/* ctx_kick roves both directions */
 int	ncontext;			/* sizeof ctx_freelist */
 
-void	ctx_alloc(struct pmap *);
-void	ctx_free(struct pmap *);
+static void	ctx_alloc(struct pmap *);
+static void	ctx_free(struct pmap *);
 
 /*void *	vdumppages;	-* 32KB worth of reserved dump pages */
 
@@ -2121,7 +2122,7 @@ mmu_pagein(struct pmap *pm, vaddr_t va, 
  * This routine is only ever called from locore.s just after it has
  * saved away the previous process, so there are no active user windows.
  */
-void
+static void
 ctx_alloc(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2133,6 +2134,8 @@ ctx_alloc(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 /*XXX-GCC!*/gap_start=gap_end=0;
 #ifdef DEBUG
 	if (pm->pm_ctx)
@@ -2145,7 +2148,6 @@ ctx_alloc(struct pmap *pm)
 		gap_end = pm->pm_gap_end;
 	}
 
-	mutex_spin_enter(_lock);
 	if ((c = ctx_freelist) != NULL) {
 		ctx_freelist = c->c_nextfree;
 		cnum = c - ctxinfo;
@@ -2288,13 +2290,12 @@ ctx_alloc(struct pmap *pm)
 		setcontext4m(cnum);
 #endif /* SUN4M || SUN4D */
 	}
-	mutex_spin_exit(_lock);
 }
 
 /*
  * Give away a context.
  */
-void
+static void
 ctx_free(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2303,6 +2304,8 @@ ctx_free(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 	c = pm->pm_ctx;
 	ctx = pm->pm_ctxnum;
 	pm->pm_ctx = NULL;
@@ -2316,8 +2319,6 @@ ctx_free(struct pmap *pm)
 	}
 #endif /* SUN4 || SUN4C */
 
-	mutex_spin_enter(_lock);
-
 #if defined(SUN4M) || defined(SUN4D)
 	if (CPU_HAS_SRMMU) {
 		CPU_INFO_ITERATOR i;
@@ -2334,7 +2335,6 @@ ctx_free(struct pmap *pm)
 
 	c->c_nextfree = ctx_freelist;
 	ctx_freelist = c;
-	mutex_spin_exit(_lock);
 }
 
 
@@ -3070,6 +3070,7 @@ pmap_bootstrap(int nctx, int nregion, in
 	}
 
 	pmap_page_upload();
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_SCHED);
 	lock_available = true;
@@ -4386,7 +4387,9 @@ pmap_pmap_pool_dtor(void *arg, void *obj
 #endif
 
 	if ((c = pm->pm_ctx) != NULL) {
+		mutex_spin_enter(_lock);
 		ctx_free(pm);
+		mutex_spin_exit(_lock);
 	}
 
 #if defined(SUN4M) || defined(SUN4D)
@@ -4656,7 +4659,7 @@ pmap_remove(struct pmap *pm, vaddr_t 

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

2019-01-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  7 13:46:57 UTC 2019

Modified Files:
src/sys/arch/evbmips/conf [netbsd-8]: ADM5120 ADM5120-NB ADM5120-USB
ALCHEMY AP30 CI20 CPMBR1400 DB120 ERLITE GDIUM LINKITSMART7688
LOONGSON MALTA MERAKI RB153 RB433UAH SBMIPS WGT624V3 XLSATX ZYXELKX

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1156):

sys/arch/evbmips/conf/ERLITE: revision 1.21
sys/arch/evbmips/conf/LOONGSON: revision 1.41
sys/arch/evbmips/conf/SBMIPS: revision 1.8
sys/arch/evbmips/conf/MALTA: revision 1.94
sys/arch/evbmips/conf/WGT624V3: revision 1.29
sys/arch/evbmips/conf/ZYXELKX: revision 1.15
sys/arch/evbmips/conf/XLSATX: revision 1.28
sys/arch/evbmips/conf/ADM5120-NB: revision 1.25
sys/arch/evbmips/conf/ADM5120: revision 1.27
sys/arch/evbmips/conf/MERAKI: revision 1.32
sys/arch/evbmips/conf/LINKITSMART7688: revision 1.10
sys/arch/evbmips/conf/DB120: revision 1.21
sys/arch/evbmips/conf/ADM5120-USB: revision 1.27
sys/arch/evbmips/conf/AP30: revision 1.38
sys/arch/evbmips/conf/ALCHEMY: revision 1.65
sys/arch/evbmips/conf/RB153: revision 1.22
sys/arch/evbmips/conf/RB433UAH: revision 1.18
sys/arch/evbmips/conf/CI20: revision 1.27
sys/arch/evbmips/conf/GDIUM: revision 1.35
sys/arch/evbmips/conf/CPMBR1400: revision 1.30

Enable the per-priority cyclical scan buffer queue strategy on evbmips
kernels.

time results of a Lemote Fuloong 2F extracting the pkgsrc tree
brick$ time tar -jxf pkgsrc.tar.bz2
priocscan + log
612.90 real   103.45 user   194.98 sys
priocscan   nolog
1345.48 real   103.57 user   274.32 sys
fcfs + log
736.02 real   101.71 user   192.95 sys
fcfs   nolog
1475.16 real   103.06 user   271.14 sys


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.6.1 src/sys/arch/evbmips/conf/ADM5120 \
src/sys/arch/evbmips/conf/CPMBR1400
cvs rdiff -u -r1.21 -r1.21.6.1 src/sys/arch/evbmips/conf/ADM5120-NB \
src/sys/arch/evbmips/conf/ADM5120-USB
cvs rdiff -u -r1.60 -r1.60.8.1 src/sys/arch/evbmips/conf/ALCHEMY
cvs rdiff -u -r1.34 -r1.34.10.1 src/sys/arch/evbmips/conf/AP30
cvs rdiff -u -r1.22.6.1 -r1.22.6.2 src/sys/arch/evbmips/conf/CI20
cvs rdiff -u -r1.16 -r1.16.10.1 src/sys/arch/evbmips/conf/DB120
cvs rdiff -u -r1.15 -r1.15.6.1 src/sys/arch/evbmips/conf/ERLITE
cvs rdiff -u -r1.27 -r1.27.6.1 src/sys/arch/evbmips/conf/GDIUM
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/evbmips/conf/LINKITSMART7688
cvs rdiff -u -r1.31.2.1 -r1.31.2.2 src/sys/arch/evbmips/conf/LOONGSON
cvs rdiff -u -r1.85.8.1 -r1.85.8.2 src/sys/arch/evbmips/conf/MALTA
cvs rdiff -u -r1.28 -r1.28.10.1 src/sys/arch/evbmips/conf/MERAKI
cvs rdiff -u -r1.18 -r1.18.6.1 src/sys/arch/evbmips/conf/RB153
cvs rdiff -u -r1.13 -r1.13.10.1 src/sys/arch/evbmips/conf/RB433UAH
cvs rdiff -u -r1.3.4.2 -r1.3.4.3 src/sys/arch/evbmips/conf/SBMIPS
cvs rdiff -u -r1.25 -r1.25.10.1 src/sys/arch/evbmips/conf/WGT624V3
cvs rdiff -u -r1.22 -r1.22.10.1 src/sys/arch/evbmips/conf/XLSATX
cvs rdiff -u -r1.7 -r1.7.6.1 src/sys/arch/evbmips/conf/ZYXELKX

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/evbmips/conf/ADM5120
diff -u src/sys/arch/evbmips/conf/ADM5120:1.22 src/sys/arch/evbmips/conf/ADM5120:1.22.6.1
--- src/sys/arch/evbmips/conf/ADM5120:1.22	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbmips/conf/ADM5120	Mon Jan  7 13:46:57 2019
@@ -1,11 +1,11 @@
-#	$NetBSD: ADM5120,v 1.22 2017/02/19 07:47:00 rin Exp $
+#	$NetBSD: ADM5120,v 1.22.6.1 2019/01/07 13:46:57 martin Exp $
 #
 # Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500,
 # DBAu1000 and DBAu1500 evaluation boards.
 
 include 	"arch/evbmips/conf/std.adm5120"
 
-#ident 		"GENERIC-$Revision: 1.22 $"
+#ident 		"GENERIC-$Revision: 1.22.6.1 $"
 
 maxusers	32
 
@@ -79,6 +79,11 @@ file-system	NFS		# Sun NFS-compatible fi
 #options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
 # immutable) behave as system flags.
 
+# Alternate buffer queue strategies for better responsiveness under high
+# disk I/O load.
+#options 	BUFQ_READPRIO
+options 	BUFQ_PRIOCSCAN
+
 # Networking options
 options 	GATEWAY		# IP packet forwarding
 options 	INET		# Internet protocols
Index: src/sys/arch/evbmips/conf/CPMBR1400
diff -u src/sys/arch/evbmips/conf/CPMBR1400:1.22 src/sys/arch/evbmips/conf/CPMBR1400:1.22.6.1
--- src/sys/arch/evbmips/conf/CPMBR1400:1.22	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbmips/conf/CPMBR1400	Mon Jan  7 13:46:57 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: CPMBR1400,v 1.22 2017/02/19 07:47:00 rin Exp $
+#	$NetBSD: CPMBR1400,v 1.22.6.1 2019/01/07 13:46:57 martin Exp $
 
 include		"arch/evbmips/conf/std.rasoc"
 
@@ -110,6 +110,11 @@ file-system	TMPFS		# Efficient memory fi
 options 	

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

2018-12-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 27 12:17:19 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1148):

sys/arch/x86/x86/identcpu.c: revision 1.81
sys/arch/x86/x86/identcpu.c: revision 1.82
sys/arch/x86/x86/identcpu.c: revision 1.84
sys/arch/x86/include/specialreg.h: revision 1.131

Declare the MSR_VIA_ACE values as macros, and use a consistent naming,
similar to the rest of the file.

I'm wondering if I'm not fixing a huge bug here. The ECX8 value we were
using was wrong: ECX8 is bit 1, not bit 0. Bit 0 is ALTINST, an alternate
ISA, which is now known to be backdoored.

So it looks like we were explicitly enabling the backdoor.

Not tested, because I don't have a VIA cpu.

 -

Merge the VIA detection code into cpu_probe_c3.

 -

Explicitly disable ALTINST on VIA, in case it isn't disabled by default
already (the 'VIA cpu backdoor').


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.8 -r1.98.2.9 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.55.2.5 -r1.55.2.6 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.8 src/sys/arch/x86/include/specialreg.h:1.98.2.9
--- src/sys/arch/x86/include/specialreg.h:1.98.2.8	Tue Dec  4 11:52:57 2018
+++ src/sys/arch/x86/include/specialreg.h	Thu Dec 27 12:17:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.8 2018/12/04 11:52:57 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.9 2018/12/27 12:17:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -871,7 +871,9 @@
 #define MSR_VIA_RNG_NOISE_B	0x0100
 #define MSR_VIA_RNG_2NOISE	0x0300
 #define MSR_VIA_ACE		0x1107
-#define MSR_VIA_ACE_ENABLE	0x1000
+#define 	VIA_ACE_ALTINST	0x0001
+#define 	VIA_ACE_ECX8	0x0002
+#define 	VIA_ACE_ENABLE	0x1000
 
 /*
  * VIA "Eden" MSRs

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.55.2.5 src/sys/arch/x86/x86/identcpu.c:1.55.2.6
--- src/sys/arch/x86/x86/identcpu.c:1.55.2.5	Fri Jul 13 15:51:28 2018
+++ src/sys/arch/x86/x86/identcpu.c	Thu Dec 27 12:17:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.55.2.6 2018/12/27 12:17:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.6 2018/12/27 12:17:19 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -482,32 +482,13 @@ static void
 cpu_probe_winchip(struct cpu_info *ci)
 {
 
-	if (cpu_vendor != CPUVENDOR_IDT)
+	if (cpu_vendor != CPUVENDOR_IDT ||
+	CPUID_TO_FAMILY(ci->ci_signature) != 5)
 		return;
 
-	switch (CPUID_TO_FAMILY(ci->ci_signature)) {
-	case 5:
-		/* WinChip C6 */
-		if (CPUID_TO_MODEL(ci->ci_signature) == 4)
-			ci->ci_feat_val[0] &= ~CPUID_TSC;
-		break;
-	case 6:
-		/*
-		 * VIA Eden ESP 
-		 *
-		 * Quoting from page 3-4 of: "VIA Eden ESP Processor Datasheet"
-		 * http://www.via.com.tw/download/mainboards/6/14/Eden20v115.pdf
-		 * 
-		 * 1. The CMPXCHG8B instruction is provided and always enabled,
-		 *however, it appears disabled in the corresponding CPUID
-		 *function bit 0 to avoid a bug in an early version of
-		 *Windows NT. However, this default can be changed via a
-		 *bit in the FCR MSR.
-		 */
-		ci->ci_feat_val[0] |= CPUID_CX8;
-		wrmsr(MSR_VIA_FCR, rdmsr(MSR_VIA_FCR) | 0x0001);
-		break;
-	}
+	/* WinChip C6 */
+	if (CPUID_TO_MODEL(ci->ci_signature) == 4)
+		ci->ci_feat_val[0] &= ~CPUID_TSC;
 }
 
 static void
@@ -528,8 +509,25 @@ cpu_probe_c3(struct cpu_info *ci)
 	x86_cpuid(0x8000, descs);
 	lfunc = descs[0];
 
+	if (family == 6) {
+		/*
+		 * VIA Eden ESP.
+		 *
+		 * Quoting from page 3-4 of: "VIA Eden ESP Processor Datasheet"
+		 * http://www.via.com.tw/download/mainboards/6/14/Eden20v115.pdf
+		 * 
+		 * 1. The CMPXCHG8B instruction is provided and always enabled,
+		 *however, it appears disabled in the corresponding CPUID
+		 *function bit 0 to avoid a bug in an early version of
+		 *Windows NT. However, this default can be changed via a
+		 *bit in the FCR MSR.
+		 */
+		ci->ci_feat_val[0] |= CPUID_CX8;
+		wrmsr(MSR_VIA_FCR, rdmsr(MSR_VIA_FCR) | VIA_ACE_ECX8);
+	}
+
 	if (family > 6 || model > 0x9 || (model == 0x9 && stepping >= 3)) {
-		/* Nehemiah or Esther */
+		/* VIA Nehemiah or Esther. */
 		x86_cpuid(0xc000, descs);
 		lfunc = descs[0];
 		if (lfunc >= 0xc001) {	/* has ACE, RNG */
@@ -598,12 +596,17 @@ 

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

2018-12-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 25 11:22:43 UTC 2018

Modified Files:
src/sys/arch/mips/mips [netbsd-8]: fp.S

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1143):

sys/arch/mips/mips/fp.S: revision 1.49

Load curlwp into a0 to call fpu_save(curlwp), not fpu_save(garbage).

The lwp argument to fpu_save was added by chuq in revision 1.14 of
mips_fpu.c, but this call was not updated to pass it.  This is the
correct lwp to pass because we are in the middle of executing a
kernel-emulated fp instruction, so curlwp must own the fpu state, and
we are trying to write the fp registers to memory so we can adjust
them there when ctc1 would fail.

Fixes PR port-cobalt/53090, PR port-sgimips/53791.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.6.1 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.48 src/sys/arch/mips/mips/fp.S:1.48.6.1
--- src/sys/arch/mips/mips/fp.S:1.48	Mon Feb 27 06:57:45 2017
+++ src/sys/arch/mips/mips/fp.S	Tue Dec 25 11:22:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.48 2017/02/27 06:57:45 chs Exp $	*/
+/*	$NetBSD: fp.S,v 1.48.6.1 2018/12/25 11:22:43 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -2827,6 +2827,7 @@ fpe_trap:
 	 * ctc1 with fpe bits set causes FPE in kernel mode panic on 5231.
 	 */
 	REG_S	a2, CALLFRAME_SIZ + 3*SZREG(sp)
+	move	a0, MIPS_CURLWP			# get current lwp
 	jal	_C_LABEL(fpu_save)		# on RM5231
 
 	REG_L	a2, CALLFRAME_SIZ + 3*SZREG(sp)



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

2018-12-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 15 13:38:59 UTC 2018

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: amdnb_misc.c amdtemp.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1137):

sys/arch/x86/pci/amdnb_misc.c: revision 1.3
sys/arch/x86/pci/amdtemp.c: revision 1.22

Added support for AMD family 16h cpu sensors - (just like 10h-14h).
(Tested on netbsd-8.0 release.)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.36.1 src/sys/arch/x86/pci/amdnb_misc.c
cvs rdiff -u -r1.20 -r1.20.2.1 src/sys/arch/x86/pci/amdtemp.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/pci/amdnb_misc.c
diff -u src/sys/arch/x86/pci/amdnb_misc.c:1.2 src/sys/arch/x86/pci/amdnb_misc.c:1.2.36.1
--- src/sys/arch/x86/pci/amdnb_misc.c:1.2	Mon Apr 16 16:07:24 2012
+++ src/sys/arch/x86/pci/amdnb_misc.c	Sat Dec 15 13:38:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdnb_misc.c,v 1.2 2012/04/16 16:07:24 cegger Exp $ */
+/*	$NetBSD: amdnb_misc.c,v 1.2.36.1 2018/12/15 13:38:59 martin Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdnb_misc.c,v 1.2 2012/04/16 16:07:24 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdnb_misc.c,v 1.2.36.1 2018/12/15 13:38:59 martin Exp $");
 
 #include 
 #include 
@@ -67,6 +67,8 @@ amdnb_misc_match(device_t parent, cfdata
 	case PCI_PRODUCT_AMD_AMD64_F11_MISC:
 	case PCI_PRODUCT_AMD_F14_NB:		/* Family 12h, too */
 	case PCI_PRODUCT_AMD_F15_MISC:
+	case PCI_PRODUCT_AMD_F16_NB:
+	case PCI_PRODUCT_AMD_F16_30_NB:
 		break;
 	default:
 		return 0;

Index: src/sys/arch/x86/pci/amdtemp.c
diff -u src/sys/arch/x86/pci/amdtemp.c:1.20 src/sys/arch/x86/pci/amdtemp.c:1.20.2.1
--- src/sys/arch/x86/pci/amdtemp.c:1.20	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/x86/pci/amdtemp.c	Sat Dec 15 13:38:59 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdtemp.c,v 1.20 2017/06/01 02:45:08 chs Exp $ */
+/*  $NetBSD: amdtemp.c,v 1.20.2.1 2018/12/15 13:38:59 martin Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.20 2017/06/01 02:45:08 chs Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.20.2.1 2018/12/15 13:38:59 martin Exp $ ");
 
 #include 
 #include 
@@ -212,7 +212,7 @@ amdtemp_match(device_t parent, cfdata_t 
 
 
 	/* Not yet supported CPUs */
-	if (family > 0x15)
+	if (family > 0x16)
 		return 0;
 
 	return 1;
@@ -257,6 +257,7 @@ amdtemp_attach(device_t parent, device_t
 	case 0x12: /* AMD Lynx/Sabine (Llano) */
 	case 0x14: /* AMD Brazos (Ontario/Zacate/Desna) */
 	case 0x15:
+	case 0x16:
 		amdtemp_family10_init(sc);
 		break;
 
@@ -284,6 +285,7 @@ amdtemp_attach(device_t parent, device_t
 	case 0x12:
 	case 0x14:
 	case 0x15:
+	case 0x16:
 		amdtemp_family10_setup_sensors(sc, device_unit(self));
 		break;
 	}
@@ -312,6 +314,7 @@ amdtemp_attach(device_t parent, device_t
 	case 0x12:
 	case 0x14:
 	case 0x15:
+	case 0x16:
 		sc->sc_sme->sme_refresh = amdtemp_family10_refresh;
 		break;
 	}



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

2018-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  7 19:38:54 UTC 2018

Modified Files:
src/sys/arch/amd64/conf [netbsd-8]: XEN3_DOM0
src/sys/arch/i386/conf [netbsd-8]: XEN3_DOM0

Log Message:
Fixup pullups from ticket #1129:

sys/arch/amd64/conf/XEN3_DOM0 rev 1.159
src/sys/arch/i386/conf/XEN3PAE_DOM0 rev 1.8 (via patch)

Add mffii(4)


To generate a diff of this commit:
cvs rdiff -u -r1.135.4.7 -r1.135.4.8 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.112.4.8 -r1.112.4.9 src/sys/arch/i386/conf/XEN3_DOM0

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/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.7 src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.8
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.7	Wed Apr 18 14:45:08 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Fri Dec  7 19:38:53 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.135.4.7 2018/04/18 14:45:08 martin Exp $
+# $NetBSD: XEN3_DOM0,v 1.135.4.8 2018/12/07 19:38:53 martin Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -519,6 +519,7 @@ dpt*	at pci? dev ? function ?	# DPT Smar
 iha*	at pci? dev ? function ?	# Initio INIC-940/950 SCSI
 isp*	at pci? dev ? function ?	# Qlogic ISP [12]0x0 SCSI/FibreChannel
 mfi*	at pci? dev ? function ?	# LSI MegaRAID SAS
+mfii*	at pci? dev ? function ?	# LSI MegaRAID SAS (Fusion and newer)
 mly*	at pci? dev ? function ?	# Mylex AcceleRAID and eXtremeRAID
 mpt*	at pci? dev ? function ?	# LSILogic 9x9 and 53c1030 (Fusion-MPT)
 mpii*	at pci? dev ? function ?	# LSI Logic Fusion-MPT II

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.112.4.8 src/sys/arch/i386/conf/XEN3_DOM0:1.112.4.9
--- src/sys/arch/i386/conf/XEN3_DOM0:1.112.4.8	Wed Apr 18 14:45:08 2018
+++ src/sys/arch/i386/conf/XEN3_DOM0	Fri Dec  7 19:38:53 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.112.4.8 2018/04/18 14:45:08 martin Exp $
+#	$NetBSD: XEN3_DOM0,v 1.112.4.9 2018/12/07 19:38:53 martin Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -492,6 +492,7 @@ dpt*	at pci? dev ? function ?	# DPT Smar
 iha*	at pci? dev ? function ?	# Initio INIC-940/950 SCSI
 isp*	at pci? dev ? function ?	# Qlogic ISP [12]0x0 SCSI/FibreChannel
 mfi*	at pci? dev ? function ?	# LSI MegaRAID SAS
+mfii*	at pci? dev ? function ?	# LSI MegaRAID SAS (Fusion and newer)
 mly*	at pci? dev ? function ?	# Mylex AcceleRAID and eXtremeRAID
 mpt*	at pci? dev ? function ?	# LSILogic 9x9 and 53c1030 (Fusion-MPT)
 mpii*	at pci? dev ? function ?	# LSI Logic Fusion-MPT II



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

2018-11-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 29 08:51:01 UTC 2018

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

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

sys/arch/amd64/amd64/machdep.c: revision 1.321

Fix stack info leak. There is a big padding in struct sigframe_siginfo.

[  224.006287] kleak: Possible leak in copyout: [len=920, leaked=92]
[  224.016977] #0 0x80224d0a in kleak_note 
[  224.026268] #1 0x80224d8a in kleak_copyout 
[  224.026268] #2 0x802224b5 in sendsig_siginfo 
[  224.036261] #3 0x80b51564 in sendsig 
[  224.046475] #4 0x80b51282 in postsig 
[  224.046475] #5 0x80b2fc5d in lwp_userret 
[  224.056273] #6 0x8025a951 in mi_userret 
[  224.066277] #7 0x8025ab89 in syscall 


To generate a diff of this commit:
cvs rdiff -u -r1.255.6.7 -r1.255.6.8 src/sys/arch/amd64/amd64/machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.255.6.7 src/sys/arch/amd64/amd64/machdep.c:1.255.6.8
--- src/sys/arch/amd64/amd64/machdep.c:1.255.6.7	Sat Jun  9 15:12:21 2018
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Nov 29 08:51:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.255.6.7 2018/06/09 15:12:21 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.255.6.8 2018/11/29 08:51:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.7 2018/06/09 15:12:21 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.8 2018/11/29 08:51:01 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -606,6 +606,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	/* Round down the stackpointer to a multiple of 16 for the ABI. */
 	fp = (struct sigframe_siginfo *)(((unsigned long)sp & ~15) - 8);
 
+	memset(, 0, sizeof(frame));
 	frame.sf_ra = (uint64_t)ps->sa_sigdesc[sig].sd_tramp;
 	frame.sf_si._info = ksi->ksi_info;
 	frame.sf_uc.uc_flags = _UC_SIGMASK;
@@ -613,7 +614,6 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	frame.sf_uc.uc_link = l->l_ctxlink;
 	frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
 	? _UC_SETSTACK : _UC_CLRSTACK;
-	memset(_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
 	sendsig_reset(l, sig);
 
 	mutex_exit(p->p_lock);



CVS commit: [netbsd-8] src/sys/arch/macppc/stand/ofwboot

2018-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 18 19:33:44 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/ofwboot [netbsd-8]: ofdev.c version

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

sys/arch/macppc/stand/ofwboot/version: revision 1.14
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.27

Fix boot failure from installation floppies.  PR port-macppc/53727

Also bump version to denote a visible fix.

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


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.32.1 src/sys/arch/macppc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.13 -r1.13.52.1 src/sys/arch/macppc/stand/ofwboot/version

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

Modified files:

Index: src/sys/arch/macppc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26.32.1
--- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26	Sun Feb 19 12:02:55 2012
+++ src/sys/arch/macppc/stand/ofwboot/ofdev.c	Sun Nov 18 19:33:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.26 2012/02/19 12:02:55 tsutsui Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.26.32.1 2018/11/18 19:33:44 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -437,10 +437,11 @@ devopen(struct open_file *of, const char
 		ofdev.type = OFDEV_DISK;
 		ofdev.bsize = DEV_BSIZE;
 		/* First try to find a disklabel without partitions */
-		if (strategy(, F_READ,
-			 LABELSECTOR, DEV_BSIZE, buf, ) != 0
-		|| nread != DEV_BSIZE
-		|| getdisklabel(buf, )) {
+		if (!floppyboot &&
+		(strategy(, F_READ,
+			  LABELSECTOR, DEV_BSIZE, buf, ) != 0
+		 || nread != DEV_BSIZE
+		 || getdisklabel(buf, ))) {
 			/* Else try APM or MBR partitions */
 			struct drvr_map *map = (struct drvr_map *)buf;
 

Index: src/sys/arch/macppc/stand/ofwboot/version
diff -u src/sys/arch/macppc/stand/ofwboot/version:1.13 src/sys/arch/macppc/stand/ofwboot/version:1.13.52.1
--- src/sys/arch/macppc/stand/ofwboot/version:1.13	Sun Oct 17 15:33:04 2010
+++ src/sys/arch/macppc/stand/ofwboot/version	Sun Nov 18 19:33:44 2018
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.13 2010/10/17 15:33:04 phx Exp $
+$NetBSD: version,v 1.13.52.1 2018/11/18 19:33:44 martin Exp $
 
 1.1:		Initial revision from NetBSD/powerpc.
 1.2:		Use MI loadfile().
@@ -14,3 +14,4 @@ $NetBSD: version,v 1.13 2010/10/17 15:33
 1.11:		Check floppyboot and disable LOAD_NOTE to avoid backward seek.
 1.12:		Read Apple Partition Map to find the root partition, when
 		no OF path was specified.
+1.13:		Fix boot failure of installation floppies



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

2018-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 18 11:54:03 UTC 2018

Modified Files:
src/sys/arch/newsmips/apbus [netbsd-8]: apbus.c apbus_subr.c apbusvar.h
src/sys/arch/newsmips/conf [netbsd-8]: std.newsmips

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

sys/arch/newsmips/apbus/apbus.c: revision 1.23
sys/arch/newsmips/apbus/apbus_subr.c: revision 1.10
sys/arch/newsmips/apbus/apbusvar.h: revision 1.10
sys/arch/newsmips/conf/std.newsmips: revision 1.18

Fix news5000 panic during boot on APbus attach. PR port-newsmips/53626

Discussed with ryo@ (the original author of news5000 support).

Should be pulled up to netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.48.1 src/sys/arch/newsmips/apbus/apbus.c
cvs rdiff -u -r1.9 -r1.9.22.1 src/sys/arch/newsmips/apbus/apbus_subr.c
cvs rdiff -u -r1.9 -r1.9.100.1 src/sys/arch/newsmips/apbus/apbusvar.h
cvs rdiff -u -r1.17 -r1.17.158.1 src/sys/arch/newsmips/conf/std.newsmips

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/newsmips/apbus/apbus.c
diff -u src/sys/arch/newsmips/apbus/apbus.c:1.22 src/sys/arch/newsmips/apbus/apbus.c:1.22.48.1
--- src/sys/arch/newsmips/apbus/apbus.c:1.22	Sun Feb 20 07:56:31 2011
+++ src/sys/arch/newsmips/apbus/apbus.c	Sun Nov 18 11:54:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: apbus.c,v 1.22 2011/02/20 07:56:31 matt Exp $	*/
+/*	$NetBSD: apbus.c,v 1.22.48.1 2018/11/18 11:54:02 martin Exp $	*/
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.22 2011/02/20 07:56:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.22.48.1 2018/11/18 11:54:02 martin Exp $");
 
 #define __INTR_PRIVATE
 
@@ -99,6 +99,7 @@ apbusattach(device_t parent, device_t se
 	struct newsmips_intr *ip;
 	int i;
 
+	apbus_map_romwork();
 	mips_set_wbflush(apbus_wbflush);
 
 	*(volatile uint32_t *)(NEWS5000_APBUS_INTST) = 0x;

Index: src/sys/arch/newsmips/apbus/apbus_subr.c
diff -u src/sys/arch/newsmips/apbus/apbus_subr.c:1.9 src/sys/arch/newsmips/apbus/apbus_subr.c:1.9.22.1
--- src/sys/arch/newsmips/apbus/apbus_subr.c:1.9	Mon Mar 24 20:05:20 2014
+++ src/sys/arch/newsmips/apbus/apbus_subr.c	Sun Nov 18 11:54:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: apbus_subr.c,v 1.9 2014/03/24 20:05:20 christos Exp $	*/
+/*	$NetBSD: apbus_subr.c,v 1.9.22.1 2018/11/18 11:54:02 martin Exp $	*/
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -27,15 +27,47 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.9 2014/03/24 20:05:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.9.22.1 2018/11/18 11:54:02 martin Exp $");
 
 #include 
 #include 
 
+#include 
+
+#include 
+#include 
+
+#include 
+
 #include 
 
 static void apctl_dump(struct apbus_ctl *);
 
+#define	APBUS_ROMWORK_VA	0xfff0
+
+void
+apbus_map_romwork(void)
+{
+	static bool mapped = false;
+	vaddr_t apbd_work_va;
+	vsize_t apbd_work_sz;
+	paddr_t apbd_work_pa;
+
+	if (!mapped) {
+		/* map PROM work RAM into VA 0xFFF0 - 0x */
+		apbd_work_va = APBUS_ROMWORK_VA;
+		apbd_work_sz = MIPS3_PG_SIZE_MASK_TO_SIZE(MIPS3_PG_SIZE_1M);
+		apbd_work_pa = ctob(physmem);
+
+		mapped = mips3_wired_enter_page(apbd_work_va, apbd_work_pa,
+		apbd_work_sz);
+		if (!mapped) {
+			printf("%s: cannot allocate APbus PROM work\n",
+			__func__);
+		}
+	}
+}
+
 void *
 apbus_device_to_hwaddr(struct apbus_dev *apbus_dev)
 {

Index: src/sys/arch/newsmips/apbus/apbusvar.h
diff -u src/sys/arch/newsmips/apbus/apbusvar.h:1.9 src/sys/arch/newsmips/apbus/apbusvar.h:1.9.100.1
--- src/sys/arch/newsmips/apbus/apbusvar.h:1.9	Wed Oct 17 19:55:54 2007
+++ src/sys/arch/newsmips/apbus/apbusvar.h	Sun Nov 18 11:54:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: apbusvar.h,v 1.9 2007/10/17 19:55:54 garbled Exp $	*/
+/*	$NetBSD: apbusvar.h,v 1.9.100.1 2018/11/18 11:54:02 martin Exp $	*/
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -39,6 +39,7 @@ struct apbus_attach_args {
 	u_long	apa_hwbase;	/* hardware I/O address */
 };
 
+void apbus_map_romwork(void);
 void *apbus_device_to_hwaddr(struct apbus_dev *);
 struct apbus_dev *apbus_lookupdev(char *);
 void apdevice_dump(struct apbus_dev *);

Index: src/sys/arch/newsmips/conf/std.newsmips
diff -u src/sys/arch/newsmips/conf/std.newsmips:1.17 src/sys/arch/newsmips/conf/std.newsmips:1.17.158.1
--- src/sys/arch/newsmips/conf/std.newsmips:1.17	Sun Dec 11 12:18:24 2005
+++ src/sys/arch/newsmips/conf/std.newsmips	Sun Nov 18 11:54:03 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.newsmips,v 1.17 2005/12/11 12:18:24 christos Exp $
+#	$NetBSD: std.newsmips,v 1.17.158.1 2018/11/18 11:54:03 martin Exp $
 
 machine newsmips mips
 include		"conf/std"	# MI standard options
@@ -7,5 +7,7 @@ makeoptions	MACHINE_ARCH="mipseb"
 options 	EXEC_ELF32	# exec ELF32 

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

2018-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 18 11:16:52 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.25

- I misread ci_acpiid as ci_apicid... LAPIC ID is in ci_cpuid.
   Print it correctly.

- ci_initapicid(Initial APIC ID) is uint32_t, so use %u.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.6 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.7
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.6	Sun Sep 23 17:35:33 2018
+++ src/sys/arch/x86/x86/procfs_machdep.c	Sun Nov 18 11:16:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.6 2018/09/23 17:35:33 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.7 2018/11/18 11:16:52 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.6 2018/09/23 17:35:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.7 2018/11/18 11:16:52 martin Exp $");
 
 #include 
 #include 
@@ -421,9 +421,9 @@ procfs_getonecpu(int xcpu, struct cpu_in
 		left = 0;
 
 	l = snprintf(p, left,
-	"apicid\t\t: %d\n"
-	"initial apicid\t: %d\n",
-	ci->ci_acpiid,
+	"apicid\t\t: %lu\n"
+	"initial apicid\t: %u\n",
+	ci->ci_cpuid,
 	ci->ci_initapicid
 	);
 	size += l;



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

2018-11-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  2 15:31:26 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf [netbsd-8]: RPI_INSTALL

Log Message:
Bump size for ramdisk.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.8.1 src/sys/arch/evbarm/conf/RPI_INSTALL

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/evbarm/conf/RPI_INSTALL
diff -u src/sys/arch/evbarm/conf/RPI_INSTALL:1.9 src/sys/arch/evbarm/conf/RPI_INSTALL:1.9.8.1
--- src/sys/arch/evbarm/conf/RPI_INSTALL:1.9	Thu Dec 29 20:51:26 2016
+++ src/sys/arch/evbarm/conf/RPI_INSTALL	Fri Nov  2 15:31:26 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: RPI_INSTALL,v 1.9 2016/12/29 20:51:26 skrll Exp $
+#	$NetBSD: RPI_INSTALL,v 1.9.8.1 2018/11/02 15:31:26 martin Exp $
 #
 #	RPI_INSTALL -- RPI kernel with installation-sized
 #	ramdisk
@@ -8,7 +8,7 @@ include "arch/evbarm/conf/RPI"
 include "arch/evbarm/conf/INSTALL"
 
 no options	MEMORY_DISK_ROOT_SIZE
-options 	MEMORY_DISK_ROOT_SIZE=49152
+options 	MEMORY_DISK_ROOT_SIZE=56000
 
 makeoptions	RAMDISKNAME=sshramdisk
 no makeoptions	DEBUG



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

2018-10-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 31 10:03:48 UTC 2018

Modified Files:
src/sys/arch/arm/arm [netbsd-8]: disassem.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1076):

sys/arch/arm/arm/disassem.c: revision 1.40

Allow setend be decode


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/arch/arm/arm/disassem.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/arm/disassem.c
diff -u src/sys/arch/arm/arm/disassem.c:1.39 src/sys/arch/arm/arm/disassem.c:1.39.2.1
--- src/sys/arch/arm/arm/disassem.c:1.39	Sat Jun  3 11:51:59 2017
+++ src/sys/arch/arm/arm/disassem.c	Wed Oct 31 10:03:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: disassem.c,v 1.39 2017/06/03 11:51:59 skrll Exp $	*/
+/*	$NetBSD: disassem.c,v 1.39.2.1 2018/10/31 10:03:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe.
@@ -49,7 +49,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: disassem.c,v 1.39 2017/06/03 11:51:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disassem.c,v 1.39.2.1 2018/10/31 10:03:48 martin Exp $");
 
 #include 
 
@@ -134,7 +134,7 @@ static const struct arm32_insn arm32_i[]
  * miscellaneous instructions
  */
 { 0xfff10020, 0xf100, "cps",	"C!c" },
-{ 0xfff100f0, 0xf101, "setend\tle", "" },
+{ 0xfff102f0, 0xf101, "setend\tle", "" },
 { 0xfff102f0, 0xf1010200, "setend\tbe", "" },
 /* pli */
 /* pld */



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

2018-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 13 17:16:12 UTC 2018

Modified Files:
src/sys/arch/xen/include [netbsd-8]: xen.h
src/sys/arch/xen/x86 [netbsd-8]: autoconf.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1057):

sys/arch/xen/x86/autoconf.c: revision 1.20
sys/arch/xen/include/xen.h: revision 1.40

Support bootspec.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.37.10.1 src/sys/arch/xen/include/xen.h
cvs rdiff -u -r1.18 -r1.18.2.1 src/sys/arch/xen/x86/autoconf.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/xen.h
diff -u src/sys/arch/xen/include/xen.h:1.37 src/sys/arch/xen/include/xen.h:1.37.10.1
--- src/sys/arch/xen/include/xen.h:1.37	Thu Jul  7 06:55:40 2016
+++ src/sys/arch/xen/include/xen.h	Sat Oct 13 17:16:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen.h,v 1.37 2016/07/07 06:55:40 msaitoh Exp $	*/
+/*	$NetBSD: xen.h,v 1.37.10.1 2018/10/13 17:16:12 martin Exp $	*/
 
 /*
  *
@@ -44,7 +44,7 @@ struct xen_netinfo {
 };
 
 union xen_cmdline_parseinfo {
-	char			xcp_bootdev[16]; /* sizeof(dv_xname) */
+	char			xcp_bootdev[144];
 	struct xen_netinfo	xcp_netinfo;
 	char			xcp_console[16];
 	char			xcp_pcidevs[64];

Index: src/sys/arch/xen/x86/autoconf.c
diff -u src/sys/arch/xen/x86/autoconf.c:1.18 src/sys/arch/xen/x86/autoconf.c:1.18.2.1
--- src/sys/arch/xen/x86/autoconf.c:1.18	Tue May 23 08:48:35 2017
+++ src/sys/arch/xen/x86/autoconf.c	Sat Oct 13 17:16:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.18 2017/05/23 08:48:35 nonaka Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.18.2.1 2018/10/13 17:16:12 martin Exp $	*/
 /*	NetBSD: autoconf.c,v 1.75 2003/12/30 12:33:22 pk Exp 	*/
 
 /*-
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18 2017/05/23 08:48:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18.2.1 2018/10/13 17:16:12 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_compat_oldboot.h"
@@ -154,7 +154,8 @@ cpu_rootconf(void)
 	cpu_bootconf();
 
 	printf("boot device: %s\n",
-	booted_device ? device_xname(booted_device) : "");
+	booted_device ? device_xname(booted_device) :
+	bootspec ? bootspec : "");
 	rootconf();
 }
 
@@ -168,6 +169,7 @@ cpu_bootconf(void)
 	device_t dv;
 	deviter_t di;
 	union xen_cmdline_parseinfo xcp;
+	static char bootspecbuf[sizeof(xcp.xcp_bootdev)];
 
 	if (booted_device)
 		return;
@@ -204,6 +206,18 @@ cpu_bootconf(void)
 		break;
 	}
 	deviter_release();
+
+	if (booted_device)
+		return;
+
+	/*
+	 * not a boot device name, pass through to MI code
+	 */
+	if (xcp.xcp_bootdev[0] != '\0') {
+		strlcpy(bootspecbuf, xcp.xcp_bootdev, sizeof(bootspecbuf));
+		bootspec = bootspecbuf;
+		return;
+	}
 }
 
 #include "pci.h"



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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 17:58:51 UTC 2018

Modified Files:
src/sys/arch/xen/xen [netbsd-8]: xbdback_xenbus.c

Log Message:
Apply patch, requested by manu in ticket #1034:

Avoid sleeping with a spin lock held (solved differently on HEAD).


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.8.1 src/sys/arch/xen/xen/xbdback_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/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.63 src/sys/arch/xen/xen/xbdback_xenbus.c:1.63.8.1
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.63	Mon Dec 26 08:16:28 2016
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Sun Sep 23 17:58:51 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.63 2016/12/26 08:16:28 skrll Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.63.8.1 2018/09/23 17:58:51 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.63 2016/12/26 08:16:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.63.8.1 2018/09/23 17:58:51 martin Exp $");
 
 #include 
 #include 
@@ -674,15 +674,16 @@ err:
 static void
 xbdback_disconnect(struct xbdback_instance *xbdi)
 {
-	
+
+   hypervisor_mask_event(xbdi->xbdi_evtchn);
+   event_remove_handler(xbdi->xbdi_evtchn, xbdback_evthandler,
+	   xbdi);
+
 	mutex_enter(>xbdi_lock);
 	if (xbdi->xbdi_status == DISCONNECTED) {
 		mutex_exit(>xbdi_lock);
 		return;
 	}
-	hypervisor_mask_event(xbdi->xbdi_evtchn);
-	event_remove_handler(xbdi->xbdi_evtchn, xbdback_evthandler,
-	xbdi);
 
 	/* signal thread that we want to disconnect, then wait for it */
 	xbdi->xbdi_status = DISCONNECTING;



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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 17:51:09 UTC 2018

Modified Files:
src/sys/arch/pmax/pmax [netbsd-8]: dec_3min.c

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

sys/arch/pmax/pmax/dec_3min.c: revision 1.74

Fix hangup after framebuffers are attached on 3MIN.  PR port-pmax/53611

Ok'ed by mrg@.  Should be pulled up to netbsd-7 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.22.1 src/sys/arch/pmax/pmax/dec_3min.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/pmax/pmax/dec_3min.c
diff -u src/sys/arch/pmax/pmax/dec_3min.c:1.73 src/sys/arch/pmax/pmax/dec_3min.c:1.73.22.1
--- src/sys/arch/pmax/pmax/dec_3min.c:1.73	Mon Mar 24 19:31:40 2014
+++ src/sys/arch/pmax/pmax/dec_3min.c	Sun Sep 23 17:51:09 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3min.c,v 1.73 2014/03/24 19:31:40 christos Exp $ */
+/* $NetBSD: dec_3min.c,v 1.73.22.1 2018/09/23 17:51:09 martin Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -70,7 +70,7 @@
 #define	__INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.73 2014/03/24 19:31:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.73.22.1 2018/09/23 17:51:09 martin Exp $");
 
 #include 
 #include 
@@ -292,12 +292,7 @@ dec_3min_intr_establish(device_t dev, vo
 	case SYS_DEV_OPT0:
 	case SYS_DEV_OPT1:
 	case SYS_DEV_OPT2:
-		/* it's an option slot */
-		{
-		int s = splhigh();
-		s |= mask;
-		splx(s);
-		}
+		/* it's an option slot and handled via MIPS_INT_MASK_[012] */
 		break;
 	default:
 		/* it's a baseboard device going via the IOASIC */



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

2018-09-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 23 17:35:33 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.24
sys/arch/x86/include/specialreg.h: revision 1.130

OK'd by maxv:
- Add cpuid 7 edx L1D_FLUSH bit.
- Add IA32_ARCH_SKIP_L1DFL_VMENTRY bit.
- Add IA32_FLUSH_CMD MSR.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.6 -r1.98.2.7 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.15.2.5 -r1.15.2.6 src/sys/arch/x86/x86/procfs_machdep.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.6 src/sys/arch/x86/include/specialreg.h:1.98.2.7
--- src/sys/arch/x86/include/specialreg.h:1.98.2.6	Fri Jul 13 15:51:28 2018
+++ src/sys/arch/x86/include/specialreg.h	Sun Sep 23 17:35:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.6 2018/07/13 15:51:28 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.7 2018/09/23 17:35:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -402,13 +402,14 @@
 #define CPUID_SEF_AVX512_4FMAPS	__BIT(3)
 #define CPUID_SEF_IBRS		__BIT(26) /* IBRS / IBPB Speculation Control */
 #define CPUID_SEF_STIBP		__BIT(27) /* STIBP Speculation Control */
+#define CPUID_SEF_L1D_FLUSH	__BIT(28) /* IA32_FLUSH_CMD MSR */
 #define CPUID_SEF_ARCH_CAP	__BIT(29) /* IA32_ARCH_CAPABILITIES */
 #define CPUID_SEF_SSBD		__BIT(31) /* Speculative Store Bypass Disable */
 
 #define CPUID_SEF_FLAGS2	"\20" \
 "\3" "AVX512_4VNNIW" "\4" "AVX512_4FMAPS" \
 	"\33" "IBRS"	"\34" "STIBP"	\
-			"\36" "ARCH_CAP"		"\40" "SSBD"
+	"\35" "L1D_FLUSH" "\36" "ARCH_CAP"		"\40" "SSBD"
 
 /*
  * CPUID Processor extended state Enumeration Fn000d
@@ -661,7 +662,10 @@
 #define 	IA32_ARCH_RDCL_NO	0x01
 #define 	IA32_ARCH_IBRS_ALL	0x02
 #define 	IA32_ARCH_RSBA		0x04
+#define 	IA32_ARCH_SKIP_L1DFL_VMENTRY 0x08
 #define 	IA32_ARCH_SSB_NO	0x10
+#define MSR_IA32_FLUSH_CMD 0x10b
+#define 	IA32_FLUSH_CMD_L1D_FLUSH 0x01
 #define MSR_BBL_CR_ADDR		0x116	/* PII+ only */
 #define MSR_BBL_CR_DECC		0x118	/* PII+ only */
 #define MSR_BBL_CR_CTL		0x119	/* PII+ only */

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.5 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.6
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.5	Sat Jun  9 15:14:49 2018
+++ src/sys/arch/x86/x86/procfs_machdep.c	Sun Sep 23 17:35:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.5 2018/06/09 15:14:49 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.6 2018/09/23 17:35:33 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.5 2018/06/09 15:14:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.6 2018/09/23 17:35:33 martin Exp $");
 
 #include 
 #include 
@@ -190,7 +190,8 @@ static const char * const x86_features[]
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, "ssbd"},
+	NULL, NULL, NULL, NULL,
+	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
 };
 
 static int	procfs_getonecpu(int, struct cpu_info *, char *, size_t *);



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

2018-08-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Aug 28 16:24:24 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #994):
sys/arch/prep/prep/machdep.c: revision 1.76
sys/arch/prep/prep/mainbus.c: revision 1.34
Fix initialization order so we can boot again on IBM PPS Model 6015
(which needs pci interrupt fixup quirks).
>From Artyom Tarasenko.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.75.22.1 src/sys/arch/prep/prep/machdep.c
cvs rdiff -u -r1.33 -r1.33.40.1 src/sys/arch/prep/prep/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/prep/prep/machdep.c
diff -u src/sys/arch/prep/prep/machdep.c:1.75 src/sys/arch/prep/prep/machdep.c:1.75.22.1
--- src/sys/arch/prep/prep/machdep.c:1.75	Thu Apr  3 23:49:47 2014
+++ src/sys/arch/prep/prep/machdep.c	Tue Aug 28 16:24:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.75 2014/04/03 23:49:47 mrg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.75.22.1 2018/08/28 16:24:24 snj Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.75 2014/04/03 23:49:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.75.22.1 2018/08/28 16:24:24 snj Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_openpic.h"
@@ -207,12 +207,6 @@ cpu_startup(void)
 	 * Now safe for bus space allocation to use malloc.
 	 */
 	bus_space_mallocok();
-
-	/*
-	 * Gather the pci interrupt routings.
- */
-	setup_pciroutinginfo();
-
 }
 
 /*

Index: src/sys/arch/prep/prep/mainbus.c
diff -u src/sys/arch/prep/prep/mainbus.c:1.33 src/sys/arch/prep/prep/mainbus.c:1.33.40.1
--- src/sys/arch/prep/prep/mainbus.c:1.33	Fri Jan 27 18:53:00 2012
+++ src/sys/arch/prep/prep/mainbus.c	Tue Aug 28 16:24:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.33 2012/01/27 18:53:00 para Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.33.40.1 2018/08/28 16:24:24 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.33 2012/01/27 18:53:00 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.33.40.1 2018/08/28 16:24:24 snj Exp $");
 
 #include "opt_pci.h"
 #include "opt_residual.h"
@@ -140,6 +140,9 @@ mainbus_attach(device_t parent, device_t
 	SIMPLEQ_INIT(_pct->pc_pbi);
 	SIMPLEQ_INSERT_TAIL(_pct->pc_pbi, pbi, next);
 
+	/* fix pci interrupt routings on some models */
+	setup_pciroutinginfo();
+
 	/* find the primary host bridge */
 	setup_pciintr_map(pbi, 0, 0, 0);
 



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

2018-08-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 25 14:28:00 UTC 2018

Modified Files:
src/sys/arch/xen/xen [netbsd-8]: xbd_xenbus.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #984):

sys/arch/xen/xen/xbd_xenbus.c: revision 1.83

avoid race condition between I/O submission in xbd_diskstart() and
interrupt handling in xbd_handler() - need to protect it with splbio()

fixes PR port-xen/53506 by Emmanuel Dreyfus, and likely also port-xen/53074
by Brad Spencer


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.76.6.1 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.76 src/sys/arch/xen/xen/xbd_xenbus.c:1.76.6.1
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.76	Sun Mar  5 23:07:12 2017
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Sat Aug 25 14:28:00 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.76 2017/03/05 23:07:12 mlelstv Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.76.6.1 2018/08/25 14:28:00 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.76 2017/03/05 23:07:12 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.76.6.1 2018/08/25 14:28:00 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -916,6 +916,7 @@ xbd_diskstart(device_t self, struct buf 
 	vaddr_t va;
 	int nsects, nbytes, seg;
 	int notify, error = 0;
+	int s;
 
 	DPRINTF(("xbd_diskstart(%p): b_bcount = %ld\n",
 	bp, (long)bp->b_bcount));
@@ -931,6 +932,8 @@ xbd_diskstart(device_t self, struct buf 
 		goto err;
 	}
 
+	s = splbio();	/* XXX SMP */
+
 	if (__predict_false(
 	sc->sc_backend_status == BLKIF_STATE_SUSPENDED)) {
 		/* device is suspended, do not consume buffer */
@@ -1008,6 +1011,7 @@ out:
 	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(>sc_ring, notify);
 	if (notify)
 		hypervisor_notify_via_evtchn(sc->sc_evtchn);
+	splx(s);	/* XXXSMP */
 err:
 	return error;
 }



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

2018-08-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 15 12:04:02 UTC 2018

Modified Files:
src/sys/arch/xen/xen [netbsd-8]: xennetback_xenbus.c

Log Message:
Pull up following revision(s) (requested by dolecek in ticket #973):

sys/arch/xen/xen/xennetback_xenbus.c: revision 1.68 (patch)

disestablish interrupt handler regardless of the state whenever it was
setup, i.e. also when the instance is DISCONNECTING already
fixes PR port-xen/53487 by Bert Kiers; fix found and reported by
Dennis Lindroos

XXX pullup netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.58.8.2 -r1.58.8.3 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.58.8.2 src/sys/arch/xen/xen/xennetback_xenbus.c:1.58.8.3
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.58.8.2	Thu Jul 26 23:55:29 2018
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Wed Aug 15 12:04:02 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.58.8.2 2018/07/26 23:55:29 snj Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.58.8.3 2018/08/15 12:04:02 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.58.8.2 2018/07/26 23:55:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.58.8.3 2018/08/15 12:04:02 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -386,10 +386,12 @@ xennetback_xenbus_destroy(void *arg)
 
 	aprint_verbose_ifnet(>xni_if, "disconnecting\n");
 
-	if (xneti->xni_status == CONNECTED) {
+	if (xneti->xni_evtchn != 0) {
 		hypervisor_mask_event(xneti->xni_evtchn);
 		event_remove_handler(xneti->xni_evtchn, xennetback_evthandler,
 		xneti);
+		xneti->xni_evtchn = 0;
+
 		if (xneti->xni_softintr) {
 			softint_disestablish(xneti->xni_softintr);
 			xneti->xni_softintr = NULL;



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

2018-08-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  7 13:28:59 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: cpu.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #960):

sys/arch/x86/x86/cpu.c: revision 1.159

Oh. Don't call svs_pdir_switch if SVS is disabled, that's not needed.

I was playing around with PMCs, and was wondering why some cache misses
were occurring in svs_pdir_switch while I had SVS disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.6 -r1.130.2.7 src/sys/arch/x86/x86/cpu.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/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.130.2.6 src/sys/arch/x86/x86/cpu.c:1.130.2.7
--- src/sys/arch/x86/x86/cpu.c:1.130.2.6	Sat Apr 14 10:11:49 2018
+++ src/sys/arch/x86/x86/cpu.c	Tue Aug  7 13:28:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.130.2.6 2018/04/14 10:11:49 martin Exp $	*/
+/*	$NetBSD: cpu.c,v 1.130.2.7 2018/08/07 13:28:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.130.2.6 2018/04/14 10:11:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.130.2.7 2018/08/07 13:28:59 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -1265,7 +1265,9 @@ void
 cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap)
 {
 #ifdef SVS
-	svs_pdir_switch(pmap);
+	if (svs_enabled) {
+		svs_pdir_switch(pmap);
+	}
 #endif
 
 #ifdef PAE



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

2018-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 16:05:42 UTC 2018

Modified Files:
src/sys/arch/sun3/dev [netbsd-8]: if_ie.c

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

sys/arch/sun3/dev/if_ie.c: revision 1.64

Remove bpf_tap() in iexmit() because ie_start() does bpf_mtap().


To generate a diff of this commit:
cvs rdiff -u -r1.62.6.1 -r1.62.6.2 src/sys/arch/sun3/dev/if_ie.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/sun3/dev/if_ie.c
diff -u src/sys/arch/sun3/dev/if_ie.c:1.62.6.1 src/sys/arch/sun3/dev/if_ie.c:1.62.6.2
--- src/sys/arch/sun3/dev/if_ie.c:1.62.6.1	Thu Jul 26 23:55:29 2018
+++ src/sys/arch/sun3/dev/if_ie.c	Tue Jul 31 16:05:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie.c,v 1.62.6.1 2018/07/26 23:55:29 snj Exp $ */
+/*	$NetBSD: if_ie.c,v 1.62.6.2 2018/07/31 16:05:42 martin Exp $ */
 
 /*-
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@@ -98,7 +98,7 @@
 */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.62.6.1 2018/07/26 23:55:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.62.6.2 2018/07/31 16:05:42 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -725,13 +725,6 @@ iexmit(struct ie_softc *sc)
 		sc->xctail);
 #endif
 
-	/*
-	 * If BPF is listening on this interface, let it see the packet before
-	 * we push it on the wire.
-	 */
-	bpf_tap(ifp, sc->xmit_cbuffs[sc->xctail],
-	SWAP(sc->xmit_buffs[sc->xctail]->ie_xmit_flags));
-
 	sc->xmit_buffs[sc->xctail]->ie_xmit_flags |= IE_XMIT_LAST;
 	sc->xmit_buffs[sc->xctail]->ie_xmit_next = SWAP(0x);
 	sc->xmit_buffs[sc->xctail]->ie_xmit_buf =



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

2018-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 15:57:11 UTC 2018

Modified Files:
src/sys/arch/i386/i386 [netbsd-8]: trap.c

Log Message:
Pull up following revision(s) (requested by taca in ticket #945):

sys/arch/i386/i386/trap.c: revision 1.290

Don't use a const variable as an array size, because it is not a
constant expression and will cause the array to needlessly become a
variable-size one.  Fixes "error: stack protector not protecting local
variables: variable length buffer [-Werror=stack-protector]" when
building i386 with MKDEBUG=YES -V COPTS="-g".


To generate a diff of this commit:
cvs rdiff -u -r1.287.6.1 -r1.287.6.2 src/sys/arch/i386/i386/trap.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/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.287.6.1 src/sys/arch/i386/i386/trap.c:1.287.6.2
--- src/sys/arch/i386/i386/trap.c:1.287.6.1	Wed Jul  5 19:59:29 2017
+++ src/sys/arch/i386/i386/trap.c	Tue Jul 31 15:57:11 2018
@@ -1,5 +1,5 @@
 
-/*	$NetBSD: trap.c,v 1.287.6.1 2017/07/05 19:59:29 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.287.6.2 2018/07/31 15:57:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.287.6.1 2017/07/05 19:59:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.287.6.2 2018/07/31 15:57:11 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -422,7 +422,7 @@ kernelfault:
 	{
 		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
 		const size_t sz = sizeof(lcall);
-		char tmp[sz];
+		char tmp[sizeof(lcall)];
 
 		/* Check for the osyscall lcall instruction. */
 		if (frame->tf_eip < VM_MAXUSER_ADDRESS - sz &&



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

2018-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 26 23:23:50 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: coretemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #936):
sys/arch/x86/x86/coretemp.c: revision 1.36
- Detect and set Atom's Tj(max) to 90 if it's not the 45nm D400/D500/N400
   series (90 for Diamondville and 100 for Pineview). From FreeBSD r221509.
- Reduce diff a little against FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.10.1 src/sys/arch/x86/x86/coretemp.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/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.35 src/sys/arch/x86/x86/coretemp.c:1.35.10.1
--- src/sys/arch/x86/x86/coretemp.c:1.35	Thu Jul  7 06:55:40 2016
+++ src/sys/arch/x86/x86/coretemp.c	Thu Jul 26 23:23:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.35 2016/07/07 06:55:40 msaitoh Exp $ */
+/* $NetBSD: coretemp.c,v 1.35.10.1 2018/07/26 23:23:50 snj Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35 2016/07/07 06:55:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35.10.1 2018/07/26 23:23:50 snj Exp $");
 
 #include 
 #include 
@@ -265,14 +265,12 @@ coretemp_tjmax(device_t self)
 	model = CPUID_TO_MODEL(ci->ci_signature);
 	stepping = CPUID_TO_STEPPING(ci->ci_signature);
 
-	sc->sc_tjmax = 100;
-
 	/*
-	 * On some Core 2 CPUs, there is an undocumented
-	 * MSR that tells if Tj(max) is 100 or 85. Note
-	 * that MSR_IA32_EXT_CONFIG is not safe on all CPUs.
+	 * Use 100C as the initial value.
 	 */
-	if ((model == 0x0F && stepping >= 2) || (model == 0x0E)) {
+	sc->sc_tjmax = 100;
+
+	if ((model == 0x0f && stepping >= 2) || (model == 0x0e)) {
 
 		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, ) == EFAULT)
 			return;
@@ -285,6 +283,12 @@ coretemp_tjmax(device_t self)
 		/* The mobile Penryn family. */
 		sc->sc_tjmax = 105;
 		return;
+	} else if (model == 0x1c) {
+		if (stepping == 0x0a) {
+			/* 45nm Atom D400, N400 and D500 series */
+			sc->sc_tjmax = 100;
+		} else
+			sc->sc_tjmax = 90;
 	} else {
 		/*
 		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET,



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

2018-07-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 15 10:54:03 UTC 2018

Modified Files:
src/sys/arch/xen/xen [netbsd-8]: xennetback_xenbus.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #909):

sys/arch/xen/xen/xennetback_xenbus.c: revision 1.64 (patch)

Fix panic of DOM0 in xennetback_xenbus_destroy() on xl destroy of
DOMU with created, but non CONNECTED xennet (such as when DOMU
panics during boot); only try to disestablish the intr if it was
actually setup.

While here protect xnetback_instances with mutex, and switch to use
kmem_zalloc() + KM_SLEEP / kmem_free() like xbdback_xenbus.c; add XXXSMP
to the other global variables, and at least mark them static


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.58.8.1 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.58 src/sys/arch/xen/xen/xennetback_xenbus.c:1.58.8.1
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.58	Thu Dec 15 09:28:04 2016
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Sun Jul 15 10:54:03 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.58 2016/12/15 09:28:04 ozaki-r Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.58.8.1 2018/07/15 10:54:03 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.58 2016/12/15 09:28:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.58.8.1 2018/07/15 10:54:03 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -34,6 +34,7 @@ __KERNEL_RCSID(0, "$NetBSD: xennetback_x
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -140,9 +141,10 @@ static inline void xennetback_tx_respons
 int, int);
 static void xennetback_tx_free(struct mbuf * , void *, size_t, void *);
 
-SLIST_HEAD(, xnetback_instance) xnetback_instances;
+static SLIST_HEAD(, xnetback_instance) xnetback_instances;
+static kmutex_t xnetback_lock;
 
-static struct xnetback_instance *xnetif_lookup(domid_t, uint32_t);
+static bool xnetif_lookup(domid_t, uint32_t);
 static int  xennetback_evthandler(void *);
 
 static struct xenbus_backend_driver xvif_backend_driver = {
@@ -176,12 +178,13 @@ pool_cache_t xmit_pages_cache;
 pool_cache_t xmit_pages_cachep;
 
 /* arrays used in xennetback_ifstart(), too large to allocate on stack */
+/* XXXSMP */
 static mmu_update_t xstart_mmu[NB_XMIT_PAGES_BATCH];
 static multicall_entry_t xstart_mcl[NB_XMIT_PAGES_BATCH + 1];
 static gnttab_transfer_t xstart_gop_transfer[NB_XMIT_PAGES_BATCH];
 static gnttab_copy_t xstart_gop_copy[NB_XMIT_PAGES_BATCH];
-struct mbuf *mbufs_sent[NB_XMIT_PAGES_BATCH];
-struct _pages_pool_free {
+static struct mbuf *mbufs_sent[NB_XMIT_PAGES_BATCH];
+static struct _pages_pool_free {
 	vaddr_t va;
 	paddr_t pa;
 } pages_pool_free[NB_XMIT_PAGES_BATCH];
@@ -229,6 +232,8 @@ xvifattach(int n)
 #endif
 
 	SLIST_INIT(_instances);
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
+
 	xenbus_backend_register(_backend_driver);
 }
 
@@ -256,14 +261,10 @@ xennetback_xenbus_create(struct xenbus_d
 		return err;
 	}
 
-	if (xnetif_lookup(domid, handle) != NULL) {
+	if (xnetif_lookup(domid, handle)) {
 		return EEXIST;
 	}
-	xneti = malloc(sizeof(struct xnetback_instance), M_DEVBUF,
-	M_NOWAIT | M_ZERO);
-	if (xneti == NULL) {
-		return ENOMEM;
-	}
+	xneti = kmem_zalloc(sizeof(*xneti), KM_SLEEP);
 	xneti->xni_domid = domid;
 	xneti->xni_handle = handle;
 	xneti->xni_status = DISCONNECTED;
@@ -317,7 +318,9 @@ xennetback_xenbus_create(struct xenbus_d
 	if_attach(ifp);
 	ether_ifattach(>xni_if, xneti->xni_enaddr);
 
+	mutex_enter(_lock);
 	SLIST_INSERT_HEAD(_instances, xneti, next);
+	mutex_exit(_lock);
 
 	xbusd->xbusd_otherend_changed = xennetback_frontend_changed;
 
@@ -371,7 +374,7 @@ xennetback_xenbus_create(struct xenbus_d
 abort_xbt:
 	xenbus_transaction_end(xbt, 1);
 fail:
-	free(xneti, M_DEVBUF);
+	kmem_free(xneti, sizeof(*xneti));
 	return err;
 }
 
@@ -382,21 +385,22 @@ xennetback_xenbus_destroy(void *arg)
 	struct gnttab_unmap_grant_ref op;
 	int err;
 
-#if 0
-	if (xneti->xni_status == CONNECTED) {
-		return EBUSY;
-	}
-#endif
 	aprint_verbose_ifnet(>xni_if, "disconnecting\n");
-	hypervisor_mask_event(xneti->xni_evtchn);
-	event_remove_handler(xneti->xni_evtchn, xennetback_evthandler, xneti);
-	if (xneti->xni_softintr) {
-		softint_disestablish(xneti->xni_softintr);
-		xneti->xni_softintr = NULL;
+
+	if (xneti->xni_status == CONNECTED) {
+		hypervisor_mask_event(xneti->xni_evtchn);
+		event_remove_handler(xneti->xni_evtchn, xennetback_evthandler,
+		xneti);
+		if (xneti->xni_softintr) {
+			softint_disestablish(xneti->xni_softintr);
+			xneti->xni_softintr = NULL;
+		}
 	}
 
+ 	mutex_enter(_lock);
 	SLIST_REMOVE(_instances,
 	xneti, 

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

2018-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul 13 15:51:28 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c

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

sys/arch/x86/x86/identcpu.c: revision 1.79
sys/arch/x86/include/specialreg.h: revision 1.127

Disable MWAIT/MONITOR on Apollo Lake CPUs to workaround APL30 errata.

We use MWAIT/MONITOR to hatch secondary CPUs. The errata means that
the wakeup may not happen, so SMP boot fails.
Use wrmsr to disable it in hardware too, for extra paranoia.

PR port-amd64/53420,
also reported on netbsd-users by joern clausen and ssartor.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.5 -r1.98.2.6 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.55.2.4 -r1.55.2.5 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.5 src/sys/arch/x86/include/specialreg.h:1.98.2.6
--- src/sys/arch/x86/include/specialreg.h:1.98.2.5	Sat Jun  9 15:12:21 2018
+++ src/sys/arch/x86/include/specialreg.h	Fri Jul 13 15:51:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.5 2018/06/09 15:12:21 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.6 2018/07/13 15:51:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -683,6 +683,7 @@
 #define MSR_THERM_STATUS	0x19c
 #define MSR_THERM2_CTL		0x19d	/* Pentium M */
 #define MSR_MISC_ENABLE		0x1a0
+#define 	IA32_MISC_MWAIT_EN	0x4
 #define MSR_TEMPERATURE_TARGET	0x1a2
 #define MSR_DEBUGCTLMSR		0x1d9
 #define MSR_LASTBRANCHFROMIP	0x1db

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.55.2.4 src/sys/arch/x86/x86/identcpu.c:1.55.2.5
--- src/sys/arch/x86/x86/identcpu.c:1.55.2.4	Sat Jun 23 11:39:02 2018
+++ src/sys/arch/x86/x86/identcpu.c	Fri Jul 13 15:51:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.55.2.4 2018/06/23 11:39:02 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.4 2018/06/23 11:39:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -189,6 +189,24 @@ cpu_probe_intel_cache(struct cpu_info *c
 }
 
 static void
+cpu_probe_intel_errata(struct cpu_info *ci)
+{
+	u_int family, model, stepping;
+
+	family = CPUID_TO_FAMILY(ci->ci_signature);
+	model = CPUID_TO_MODEL(ci->ci_signature);
+	stepping = CPUID_TO_STEPPING(ci->ci_signature);
+
+	if (family == 0x6 && model == 0x5C && stepping == 0x9) { /* Apollo Lake */
+		wrmsr(MSR_MISC_ENABLE,
+		rdmsr(MSR_MISC_ENABLE) & ~IA32_MISC_MWAIT_EN);
+
+		cpu_feature[1] &= ~CPUID2_MONITOR;
+		ci->ci_feat_val[1] &= ~CPUID2_MONITOR;
+	}
+}
+
+static void
 cpu_probe_intel(struct cpu_info *ci)
 {
 
@@ -196,6 +214,7 @@ cpu_probe_intel(struct cpu_info *ci)
 		return;
 
 	cpu_probe_intel_cache(ci);
+	cpu_probe_intel_errata(ci);
 }
 
 static void



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

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 15:35:26 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: locore.S
src/sys/arch/i386/i386 [netbsd-8]: locore.S
src/sys/arch/x86/x86 [netbsd-8]: fpu.c

Log Message:
Pull up the following, requested by maxv in ticket #910:

sys/arch/amd64/amd64/locore.S   r1.167 (patch)
sys/arch/i386/i386/locore.S r1.158 (patch)
sys/arch/x86/x86/fpu.c  r1.44 (patch)

Don't switch the FPU when leaving a softint. This fixes
several problems when EagerFPU is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.123.6.7 -r1.123.6.8 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.145.6.4 -r1.145.6.5 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.12.8.2 -r1.12.8.3 src/sys/arch/x86/x86/fpu.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/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.7 src/sys/arch/amd64/amd64/locore.S:1.123.6.8
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.7	Sat Jun 23 11:39:01 2018
+++ src/sys/arch/amd64/amd64/locore.S	Tue Jul 10 15:35:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.7 2018/06/23 11:39:01 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.8 2018/07/10 15:35:26 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1094,20 +1094,6 @@ skip_save:
 	popq	%rdx
 #endif
 
-#ifndef XEN
-	/* RDI/RSI got clobbered. */
-	movq	%r13,%rdi
-	movq	%r12,%rsi
-
-	pushq	%rdx
-	movb	_C_LABEL(x86_fpu_eager),%dl
-	testb	%dl,%dl
-	jz	.Lno_eagerfpu
-	callq	_C_LABEL(fpu_eagerswitch)
-.Lno_eagerfpu:
-	popq	%rdx
-#endif
-
 	/* Switch to newlwp's stack. */
 	movq	L_PCB(%r12),%r14
 	movq	PCB_RSP(%r14),%rsp
@@ -1148,6 +1134,18 @@ skip_save:
 #endif
 .Lring0_switched:
 
+#ifndef XEN
+	pushq	%rdx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	movq	%r13,%rdi
+	movq	%r12,%rsi
+	callq	_C_LABEL(fpu_eagerswitch)
+.Lno_eagerfpu:
+	popq	%rdx
+#endif
+
 	/* Don't bother with the rest if switching to a system process. */
 	testl	$LW_SYSTEM,L_FLAG(%r12)
 	jnz	switch_return

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.145.6.4 src/sys/arch/i386/i386/locore.S:1.145.6.5
--- src/sys/arch/i386/i386/locore.S:1.145.6.4	Sat Jun 23 11:39:02 2018
+++ src/sys/arch/i386/i386/locore.S	Tue Jul 10 15:35:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.145.6.5 2018/07/10 15:35:26 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.5 2018/07/10 15:35:26 martin Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -1089,19 +1089,6 @@ ENTRY(cpu_switchto)
 	movl	%ebp,PCB_EBP(%eax)
 skip_save:
 
-#ifndef XEN
-	pushl	%edx
-	movb	_C_LABEL(x86_fpu_eager),%dl
-	testb	%dl,%dl
-	jz	.Lno_eagerfpu
-	pushl	%edi
-	pushl	%esi
-	call	_C_LABEL(fpu_eagerswitch)
-	addl	$8,%esp
-.Lno_eagerfpu:
-	popl	%edx
-#endif
-
 	/* Switch to newlwp's stack. */
 	movl	L_PCB(%edi),%ebx
 	movl	PCB_EBP(%ebx),%ebp
@@ -1129,6 +1116,19 @@ skip_save:
 	movl	%eax,TSS_ESP0(%ecx)
 #endif
 
+#ifndef XEN
+	pushl	%edx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	pushl	%edi
+	pushl	%esi
+	call	_C_LABEL(fpu_eagerswitch)
+	addl	$8,%esp
+.Lno_eagerfpu:
+	popl	%edx
+#endif
+
 	/* Don't bother with the rest if switching to a system process. */
 	testl	$LW_SYSTEM,L_FLAG(%edi)
 	jnz	switch_return

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.12.8.2 src/sys/arch/x86/x86/fpu.c:1.12.8.3
--- src/sys/arch/x86/x86/fpu.c:1.12.8.2	Sat Jun 23 11:39:02 2018
+++ src/sys/arch/x86/x86/fpu.c	Tue Jul 10 15:35:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.12.8.2 2018/06/23 11:39:02 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.12.8.3 2018/07/10 15:35:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.12.8.2 2018/06/23 11:39:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.12.8.3 2018/07/10 15:35:26 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -306,6 +306,20 @@ fpu_eagerswitch(struct lwp *oldlwp, stru
 	int s;
 
 	s = splhigh();
+#ifdef DIAGNOSTIC
+	if (oldlwp != NULL) {
+		struct pcb *pcb = lwp_getpcb(oldlwp);
+		struct cpu_info *ci = curcpu();
+		if (pcb->pcb_fpcpu == NULL) {
+			KASSERT(ci->ci_fpcurlwp != oldlwp);
+		} else if (pcb->pcb_fpcpu == ci) {
+			KASSERT(ci->ci_fpcurlwp == oldlwp);
+		} else {
+			panic("%s: oldlwp's state installed elsewhere",
+			__func__);
+		}
+	}
+#endif
 	fpusave_cpu(true);
 	if (!(newlwp->l_flag & LW_SYSTEM))
 		fpu_eagerrestore(newlwp);



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

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:39:02 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: locore.S
src/sys/arch/i386/i386 [netbsd-8]: locore.S
src/sys/arch/x86/include [netbsd-8]: cpu.h fpu.h
src/sys/arch/x86/x86 [netbsd-8]: fpu.c identcpu.c vm_machdep.c
x86_machdep.c

Log Message:
Pull up the following, via patch, requested by maxv in ticket #897:

sys/arch/amd64/amd64/locore.S   1.166 (patch)
sys/arch/i386/i386/locore.S 1.157 (patch)
sys/arch/x86/include/cpu.h  1.92 (patch)
sys/arch/x86/include/fpu.h  1.9 (patch)
sys/arch/x86/x86/fpu.c  1.33-1.39 (patch)
sys/arch/x86/x86/identcpu.c 1.72 (patch)
sys/arch/x86/x86/vm_machdep.c   1.34 (patch)
sys/arch/x86/x86/x86_machdep.c  1.116,1.117 (patch)

Support eager fpu switch, to work around INTEL-SA-00145.
Provide a sysctl machdep.fpu_eager, which gets automatically
initialized to 1 on affected CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.123.6.6 -r1.123.6.7 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.145.6.3 -r1.145.6.4 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.71.2.6 -r1.71.2.7 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.6 -r1.6.28.1 src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.12.8.1 -r1.12.8.2 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.55.2.3 -r1.55.2.4 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.28.6.3 -r1.28.6.4 src/sys/arch/x86/x86/vm_machdep.c
cvs rdiff -u -r1.91.4.3 -r1.91.4.4 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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.6 src/sys/arch/amd64/amd64/locore.S:1.123.6.7
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.6	Sat May  5 15:00:29 2018
+++ src/sys/arch/amd64/amd64/locore.S	Sat Jun 23 11:39:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.6 2018/05/05 15:00:29 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.7 2018/06/23 11:39:01 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1094,6 +1094,20 @@ skip_save:
 	popq	%rdx
 #endif
 
+#ifndef XEN
+	/* RDI/RSI got clobbered. */
+	movq	%r13,%rdi
+	movq	%r12,%rsi
+
+	pushq	%rdx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	callq	_C_LABEL(fpu_eagerswitch)
+.Lno_eagerfpu:
+	popq	%rdx
+#endif
+
 	/* Switch to newlwp's stack. */
 	movq	L_PCB(%r12),%r14
 	movq	PCB_RSP(%r14),%rsp

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.145.6.3 src/sys/arch/i386/i386/locore.S:1.145.6.4
--- src/sys/arch/i386/i386/locore.S:1.145.6.3	Tue Mar 13 15:47:44 2018
+++ src/sys/arch/i386/i386/locore.S	Sat Jun 23 11:39:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.145.6.3 2018/03/13 15:47:44 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.3 2018/03/13 15:47:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -1089,6 +1089,19 @@ ENTRY(cpu_switchto)
 	movl	%ebp,PCB_EBP(%eax)
 skip_save:
 
+#ifndef XEN
+	pushl	%edx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	pushl	%edi
+	pushl	%esi
+	call	_C_LABEL(fpu_eagerswitch)
+	addl	$8,%esp
+.Lno_eagerfpu:
+	popl	%edx
+#endif
+
 	/* Switch to newlwp's stack. */
 	movl	L_PCB(%edi),%ebx
 	movl	PCB_EBP(%ebx),%ebp

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.71.2.6 src/sys/arch/x86/include/cpu.h:1.71.2.7
--- src/sys/arch/x86/include/cpu.h:1.71.2.6	Sat Jun  9 15:12:21 2018
+++ src/sys/arch/x86/include/cpu.h	Sat Jun 23 11:39:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.71.2.6 2018/06/09 15:12:21 martin Exp $	*/
+/*	$NetBSD: cpu.h,v 1.71.2.7 2018/06/23 11:39:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -424,6 +424,7 @@ extern int x86_fpu_save;
 #define	FPU_SAVE_XSAVEOPT	3
 extern unsigned int x86_fpu_save_size;
 extern uint64_t x86_xsave_features;
+extern bool x86_fpu_eager;
 
 extern void (*x86_cpu_idle)(void);
 #define	cpu_idle() (*x86_cpu_idle)()

Index: src/sys/arch/x86/include/fpu.h
diff -u src/sys/arch/x86/include/fpu.h:1.6 src/sys/arch/x86/include/fpu.h:1.6.28.1
--- src/sys/arch/x86/include/fpu.h:1.6	Tue Feb 25 22:16:52 2014
+++ src/sys/arch/x86/include/fpu.h	Sat Jun 23 11:39:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.6 2014/02/25 22:16:52 dsl Exp $	*/
+/*	$NetBSD: fpu.h,v 1.6.28.1 2018/06/23 11:39:02 martin Exp $	*/
 
 #ifndef	_X86_FPU_H_
 #define	_X86_FPU_H_
@@ -15,6 +15,8 @@ void fpuinit(struct cpu_info *);
 void fpusave_lwp(struct lwp *, bool);
 void 

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

2018-06-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 18 15:37:46 UTC 2018

Modified Files:
src/sys/arch/powerpc/powerpc [netbsd-8]: trap.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #884):

sys/arch/powerpc/powerpc/trap.c: revision 1.154

In mtmsr emulation ignore PSL_VEC we set in mfmsr emulation just
above, as it freaks out PSL_USEROK_P().  This is also congruent with
how we handle PSL_FP.

PR port-macppc/53360


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.153.6.1 src/sys/arch/powerpc/powerpc/trap.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/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.153 src/sys/arch/powerpc/powerpc/trap.c:1.153.6.1
--- src/sys/arch/powerpc/powerpc/trap.c:1.153	Thu Mar 16 16:13:20 2017
+++ src/sys/arch/powerpc/powerpc/trap.c	Mon Jun 18 15:37:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.153 2017/03/16 16:13:20 chs Exp $	*/
+/*	$NetBSD: trap.c,v 1.153.6.1 2018/06/18 15:37:46 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.153 2017/03/16 16:13:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.153.6.1 2018/06/18 15:37:46 martin Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -1062,6 +1062,9 @@ emulated_opcode(struct lwp *l, struct tr
 		 * user code isn't allowed to change it.
 		 */
 		msr &= ~PSL_FP;
+#ifdef ALTIVEC
+		msr &= ~PSL_VEC;
+#endif
 
 		/*
 		 * Don't let the user muck with bits he's not allowed to.



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

2018-06-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 18 15:34:34 UTC 2018

Modified Files:
src/sys/arch/arm/arm [netbsd-8]: psci.c
src/sys/arch/arm/fdt [netbsd-8]: psci_fdt.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #883):

sys/arch/arm/fdt/psci_fdt.c: revision 1.5
sys/arch/arm/arm/psci.c: revision 1.2

Use correct value for PSCI 0.2+ PSCI_CPU_ON.

Fix PSCI 0.1 detection.


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/arch/arm/arm/psci.c
cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/arch/arm/fdt/psci_fdt.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/arm/psci.c
diff -u src/sys/arch/arm/arm/psci.c:1.1.4.2 src/sys/arch/arm/arm/psci.c:1.1.4.3
--- src/sys/arch/arm/arm/psci.c:1.1.4.2	Tue Jul 18 19:13:08 2017
+++ src/sys/arch/arm/arm/psci.c	Mon Jun 18 15:34:34 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: psci.c,v 1.1.4.2 2017/07/18 19:13:08 snj Exp $ */
+/* $NetBSD: psci.c,v 1.1.4.3 2018/06/18 15:34:34 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_diagnostic.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.1.4.2 2017/07/18 19:13:08 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.1.4.3 2018/06/18 15:34:34 martin Exp $");
 
 #include 
 #include 
@@ -43,9 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.1
 #define	PSCI_SYSTEM_OFF		0x8408
 #define	PSCI_SYSTEM_RESET	0x8409
 #if defined(__aarch64__)
-#define	PSCI_CPU_ON		0xc402
+#define	PSCI_CPU_ON		0xc403
 #else
-#define	PSCI_CPU_ON		0x8402
+#define	PSCI_CPU_ON		0x8403
 #endif
 
 static psci_fn psci_call_fn;

Index: src/sys/arch/arm/fdt/psci_fdt.c
diff -u src/sys/arch/arm/fdt/psci_fdt.c:1.1.4.2 src/sys/arch/arm/fdt/psci_fdt.c:1.1.4.3
--- src/sys/arch/arm/fdt/psci_fdt.c:1.1.4.2	Tue Jul 18 19:13:08 2017
+++ src/sys/arch/arm/fdt/psci_fdt.c	Mon Jun 18 15:34:34 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.1.4.2 2017/07/18 19:13:08 snj Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.1.4.3 2018/06/18 15:34:34 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.1.4.2 2017/07/18 19:13:08 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.1.4.3 2018/06/18 15:34:34 martin Exp $");
 
 #include 
 #include 
@@ -102,8 +102,7 @@ psci_fdt_init(const int phandle)
 		return EINVAL;
 	}
 
-	const char * const compat_0_1[] = { "arm,psci", NULL };
-	if (of_match_compatible(phandle, compat_0_1)) {
+	if (of_match_compatible(phandle, compatible) == 1) {
 		psci_clearfunc();
 		if (of_getprop_uint32(phandle, "cpu_on", ) == 0)
 			psci_setfunc(PSCI_FUNC_CPU_ON, val);



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

2018-06-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 14 20:01:28 UTC 2018

Modified Files:
src/sys/arch/macppc/conf [netbsd-8]: std.macppc

Log Message:
Pull up following revision(s) (requested by macallan in ticket #880):

sys/arch/macppc/conf/std.macppc: revision 1.24

set options ADBKBD_EMUL_USB by default

With this ADB and USB keyboards can coexist on the same mux, as needed by
built-in Bluetooth modules on some *Books

should fix PR53351


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.58.1 src/sys/arch/macppc/conf/std.macppc

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

Modified files:

Index: src/sys/arch/macppc/conf/std.macppc
diff -u src/sys/arch/macppc/conf/std.macppc:1.23 src/sys/arch/macppc/conf/std.macppc:1.23.58.1
--- src/sys/arch/macppc/conf/std.macppc:1.23	Thu Dec 11 05:42:18 2008
+++ src/sys/arch/macppc/conf/std.macppc	Thu Jun 14 20:01:28 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.macppc,v 1.23 2008/12/11 05:42:18 alc Exp $
+#	$NetBSD: std.macppc,v 1.23.58.1 2018/06/14 20:01:28 martin Exp $
 #
 # Standard/required options for NetBSD/macppc.
 
@@ -17,5 +17,10 @@ options 	EXEC_SCRIPT	# shell script supp
 
 options 	INTSTK=0x2000
 
+# some *Books have both ADB keyboards and Bluetooth modules which pose as USB
+# HID devices - for them to coexist on the same mux we tell the adbkbd driver
+# pose as a USB keyboard
+options 	ADBKBD_EMUL_USB
+
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"



CVS commit: [netbsd-8] src/sys/arch/acorn26/stand/lib

2018-06-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 11 08:46:43 UTC 2018

Modified Files:
src/sys/arch/acorn26/stand/lib [netbsd-8]: Makefile.inc

Log Message:
Apply patch, requested by christos on ticket #870:

Use :q (instead of :Q) to quote make variables passed to sub makes here too.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/arch/acorn26/stand/lib/Makefile.inc

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/acorn26/stand/lib/Makefile.inc
diff -u src/sys/arch/acorn26/stand/lib/Makefile.inc:1.4 src/sys/arch/acorn26/stand/lib/Makefile.inc:1.4.10.1
--- src/sys/arch/acorn26/stand/lib/Makefile.inc:1.4	Tue Mar 22 08:25:22 2016
+++ src/sys/arch/acorn26/stand/lib/Makefile.inc	Mon Jun 11 08:46:43 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.4 2016/03/22 08:25:22 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.4.10.1 2018/06/11 08:46:43 martin Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -22,12 +22,12 @@ RISCOSLIB=		${RISCOSDST}/libriscos.a
 RISCOSMAKE= \
 	cd ${RISCOSDIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	  MAKEOBJDIR=${RISCOSDST} ${MAKE} \
-	CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
-	AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
-	LD=${LD:Q} STRIP=${STRIP:Q} \
-	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
-	RISCOSCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q} \
-	RISCOSMISCCPPFLAGS=${RISCOSMISCCPPFLAGS:Q} \
+	CC=${CC:q} CFLAGS=${CFLAGS:q} \
+	AS=${AS:q} AFLAGS=${AFLAGS:q} \
+	LD=${LD:q} STRIP=${STRIP:q} \
+	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
+	RISCOSCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:q} \
+	RISCOSMISCCPPFLAGS=${RISCOSMISCCPPFLAGS:q} \
 	${RISCOSMISCMAKEFLAGS}
 
 ${RISCOSLIB}:		.NOTMAIN .MAKE __always_make_riscoslib



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

2018-06-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  9 15:14:49 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.23

Add SSBD bit for Intel.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.4 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.5
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.4	Fri Mar 16 13:08:14 2018
+++ src/sys/arch/x86/x86/procfs_machdep.c	Sat Jun  9 15:14:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.4 2018/03/16 13:08:14 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.5 2018/06/09 15:14:49 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.4 2018/03/16 13:08:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.5 2018/06/09 15:14:49 martin Exp $");
 
 #include 
 #include 
@@ -190,7 +190,7 @@ static const char * const x86_features[]
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, NULL},
+	NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, "ssbd"},
 };
 
 static int	procfs_getonecpu(int, struct cpu_info *, char *, size_t *);



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

2018-06-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  9 15:12:21 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: machdep.c
src/sys/arch/amd64/conf [netbsd-8]: GENERIC files.amd64
src/sys/arch/i386/conf [netbsd-8]: GENERIC files.i386
src/sys/arch/i386/i386 [netbsd-8]: machdep.c
src/sys/arch/x86/include [netbsd-8]: cpu.h specialreg.h
src/sys/arch/x86/x86 [netbsd-8]: x86_machdep.c
Added Files:
src/sys/arch/x86/x86 [netbsd-8]: spectre.c

Log Message:
Pullup the following revisions, requested by maxv in ticket #865:

sys/arch/amd64/amd64/machdep.c  1.303 (patch)
sys/arch/amd64/conf/GENERIC 1.492 (patch)
sys/arch/amd64/conf/files.amd64 1.103 (patch)
sys/arch/i386/i386/machdep.c1.806 (patch)
sys/arch/i386/conf/GENERIC  1.1179 (patch)
sys/arch/i386/conf/files.i386   1.393 (patch)
sys/arch/x86/include/cpu.h  1.91 (patch)
sys/arch/x86/include/specialreg.h   upto 1.126 (patch)
sys/arch/x86/x86/x86_machdep.c  upto 1.115 (patch, adapted)
sys/arch/x86/x86/spectre.c  upto 1.19 (patch, adapted,
no IBRS,
SpectreV2 mitigations not
enabled by default)

Backport the hardware SpectreV2 and SpectreV4 mitigations.


To generate a diff of this commit:
cvs rdiff -u -r1.255.6.6 -r1.255.6.7 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.459.2.9 -r1.459.2.10 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.88.8.3 -r1.88.8.4 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.1156.2.9 -r1.1156.2.10 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.378.6.2 -r1.378.6.3 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.782.6.5 -r1.782.6.6 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.71.2.5 -r1.71.2.6 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.98.2.4 -r1.98.2.5 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r0 -r1.19.2.2 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.91.4.2 -r1.91.4.3 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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.255.6.6 src/sys/arch/amd64/amd64/machdep.c:1.255.6.7
--- src/sys/arch/amd64/amd64/machdep.c:1.255.6.6	Thu Mar 22 16:59:03 2018
+++ src/sys/arch/amd64/amd64/machdep.c	Sat Jun  9 15:12:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.255.6.6 2018/03/22 16:59:03 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.255.6.7 2018/06/09 15:12:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.6 2018/03/22 16:59:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.7 2018/06/09 15:12:21 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1549,6 +1549,9 @@ init_x86_64(paddr_t first_avail)
 	svs_init();
 #endif
 	cpu_init_msrs(_info_primary, true);
+#ifndef XEN
+	cpu_speculation_init(_info_primary);
+#endif
 
 	use_pae = 1; /* PAE always enabled in long mode */
 

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.459.2.9 src/sys/arch/amd64/conf/GENERIC:1.459.2.10
--- src/sys/arch/amd64/conf/GENERIC:1.459.2.9	Wed Apr 18 14:45:08 2018
+++ src/sys/arch/amd64/conf/GENERIC	Sat Jun  9 15:12:21 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.459.2.9 2018/04/18 14:45:08 martin Exp $
+# $NetBSD: GENERIC,v 1.459.2.10 2018/06/09 15:12:21 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.459.2.9 $"
+#ident		"GENERIC-$Revision: 1.459.2.10 $"
 
 maxusers	64		# estimated number of users
 
@@ -77,6 +77,7 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 options 	SVS		# Separate Virtual Space
 makeoptions	SPECTRE_V2_GCC_MITIGATION=1	# GCC Spectre variant 2
 		# migitation
+options 	SPECTRE_V2_GCC_MITIGATION
 
 # CPU features
 acpicpu*	at cpu?		# ACPI CPU (including frequency scaling)

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.88.8.3 src/sys/arch/amd64/conf/files.amd64:1.88.8.4
--- src/sys/arch/amd64/conf/files.amd64:1.88.8.3	Wed Apr 11 14:23:30 2018
+++ src/sys/arch/amd64/conf/files.amd64	Sat Jun  9 15:12:21 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.88.8.3 2018/04/11 14:23:30 martin Exp $
+#	$NetBSD: files.amd64,v 1.88.8.4 2018/06/09 15:12:21 martin Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -54,6 +54,7 @@ file	arch/amd64/amd64/machdep.c		machdep
 file	arch/amd64/amd64/process_machdep.c	machdep
 file	arch/amd64/amd64/trap.c			

CVS commit: [netbsd-8] src/sys/arch/macppc/stand/fixcoff

2018-06-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  9 14:47:37 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/fixcoff [netbsd-8]: elf32_powerpc_merge.x

Log Message:
Pull up following revision(s) (requested by uwe in ticket #863):

sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x: revision 1.6,1.7 
(patch)

PR port-macppc/52564

  . = (. + 0x0FFF) & 0xF000;

now seems to cause binutils to pad the preceding section, and when
that happens to be .text the powermac ofw is unhappy for whatever
reason.

For now provide .pad section that absorbs the padding as a workaround.
The binutils problem still needs to be looked into.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.4.1 \
src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x

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

Modified files:

Index: src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x
diff -u src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x:1.4 src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x:1.4.4.1
--- src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x:1.4	Thu Apr 20 18:53:12 2017
+++ src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x	Sat Jun  9 14:47:37 2018
@@ -1,3 +1,4 @@
+/*	$NetBSD: elf32_powerpc_merge.x,v 1.4.4.1 2018/06/09 14:47:37 martin Exp $ */
 OUTPUT_ARCH(powerpc)
 SECTIONS
 {
@@ -40,6 +41,7 @@ SECTIONS
   .dtors : { *(.dtors)   }
   _etext = .;
   PROVIDE (etext = .);
+  .pad   : { LONG(0) }
   /* Read-write section, merged into data segment: */
   . = (. + 0x0FFF) & 0xF000;
   .data:



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

2018-06-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Jun  5 08:04:34 UTC 2018

Modified Files:
src/sys/arch/arm/arm [netbsd-8]: syscall.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #859):
sys/arch/arm/arm/syscall.c: revision 1.65
PR kern/53261: handle SYS_syscall indirection in MD code - the generic
version would misalign the argument array.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.12.1 src/sys/arch/arm/arm/syscall.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/arm/syscall.c
diff -u src/sys/arch/arm/arm/syscall.c:1.60 src/sys/arch/arm/arm/syscall.c:1.60.12.1
--- src/sys/arch/arm/arm/syscall.c:1.60	Wed Aug 13 21:41:32 2014
+++ src/sys/arch/arm/arm/syscall.c	Tue Jun  5 08:04:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.60 2014/08/13 21:41:32 matt Exp $	*/
+/*	$NetBSD: syscall.c,v 1.60.12.1 2018/06/05 08:04:34 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.60 2014/08/13 21:41:32 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.60.12.1 2018/06/05 08:04:34 bouyer Exp $");
 
 #include 
 #include 
@@ -202,9 +202,10 @@ syscall(struct trapframe *tf, lwp_t *l, 
 	struct proc * const p = l->l_proc;
 	const struct sysent *callp;
 	int error;
-	u_int nargs;
+	u_int nargs, off = 0;
 	register_t *args;
-	uint64_t copyargs64[sizeof(register_t)*(2+SYS_MAXSYSARGS+1)/sizeof(uint64_t)];
+	uint64_t copyargs64[sizeof(register_t) *
+			(2+SYS_MAXSYSARGS+1)/sizeof(uint64_t)];
 	register_t *copyargs = (register_t *)copyargs64;
 	register_t rval[2];
 	ksiginfo_t ksi;
@@ -237,17 +238,29 @@ syscall(struct trapframe *tf, lwp_t *l, 
 	}
 
 	code &= (SYS_NSYSENT - 1);
+
+	if (__predict_false(code == SYS_syscall)) {
+		off = 1;
+		code = tf->tf_r0;
+		code &= (SYS_NSYSENT - 1);
+		if (__predict_false(code == SYS_syscall)) {
+			error = EINVAL;
+			goto bad;
+		}
+	}
+
 	callp = p->p_emul->e_sysent + code;
 	nargs = callp->sy_narg;
-	if (nargs > 4) {
+
+	if ((nargs+off) > 4) {
 		args = copyargs;
-		memcpy(args, >tf_r0, 4 * sizeof(register_t));
-		error = copyin((void *)tf->tf_usr_sp, args + 4,
-		(nargs - 4) * sizeof(register_t));
+		memcpy(args, >tf_r0+off, (4-off) * sizeof(register_t));
+		error = copyin((void *)tf->tf_usr_sp, args + 4 - off,
+		(nargs - 4 + off) * sizeof(register_t));
 		if (error)
 			goto bad;
 	} else {
-		args = >tf_r0;
+		args = >tf_r0 + off;
 	}
 
 	error = sy_invoke(callp, l, args, rval, code);



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:43:21 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficons.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #831):

sys/arch/i386/stand/efiboot/eficons.c: revision 1.6

During awaitkey(), move the cursor back to the beginning of the
countdown with '\b' only after waiting.

Some UEFI implementations have a destructive/erasing backspace,
and will not show the countdown if we move the cursor back before the
wait.

My ThinkPad T430 w/ Lenovo's UEFI exhibited this whiteout-backspace,
while my Gigabyte Brix GB-BXBT-2807 did not.

Should fix PR #53292.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.1 src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.2
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.1	Mon Apr  2 08:50:33 2018
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Tue May 22 17:43:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.4.2.1 2018/04/02 08:50:33 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4.2.2 2018/05/22 17:43:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -328,10 +328,10 @@ awaitkey(int timeout, int tell)
 	char c = 0;
 
 	for (;;) {
-		if (tell && timeout) {
-			char numbuf[32];
-			int len;
+		char numbuf[32];
+		int len;
 
+		if (tell && timeout) {
 			len = snprintf(numbuf, sizeof(numbuf), "%d seconds. ",
 			timeout);
 			if (len > 0 && len < sizeof(numbuf)) {
@@ -340,7 +340,6 @@ awaitkey(int timeout, int tell)
 printf("%s", numbuf);
 while (*p)
 	*p++ = '\b';
-printf("%s", numbuf);
 			}
 		}
 		if (iskey(1)) {
@@ -355,6 +354,8 @@ awaitkey(int timeout, int tell)
 			internal_waitforinputevent(1000);
 		else
 			break;
+		if (tell)
+			printf("%s", numbuf);
 	}
 
 out:



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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:00:29 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: locore.S

Log Message:
Pull up following revision(s) (requested by maxv in ticket #786):

sys/arch/amd64/amd64/locore.S: revision 1.164,1.165

Adjust Xsyscall_svs to not use movq for 64bit immediates either.

Do not use movq for loading arbitrary 64bit immediates. The ISA
restricts it to 32bit immediates.


To generate a diff of this commit:
cvs rdiff -u -r1.123.6.5 -r1.123.6.6 src/sys/arch/amd64/amd64/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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.5 src/sys/arch/amd64/amd64/locore.S:1.123.6.6
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.5	Thu Mar 22 16:59:03 2018
+++ src/sys/arch/amd64/amd64/locore.S	Sat May  5 15:00:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.5 2018/03/22 16:59:03 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.6 2018/05/05 15:00:29 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1368,8 +1368,8 @@ IDTVEC(\name)
 
 	/* Get the LWP's kernel stack pointer in %rax */
 	.if	\is_svs
-		movq	%rax,SVS_UTLS+UTLS_SCRATCH
-		movq	SVS_UTLS+UTLS_RSP0,%rax
+		movabs	%rax,SVS_UTLS+UTLS_SCRATCH
+		movabs	SVS_UTLS+UTLS_RSP0,%rax
 	.else
 		movq	%rax,CPUVAR(SCRATCH)
 		movq	CPUVAR(CURLWP),%rax
@@ -1387,7 +1387,7 @@ IDTVEC(\name)
 
 	/* Restore %rax */
 	.if	\is_svs
-		movq	SVS_UTLS+UTLS_SCRATCH,%rax
+		movabs	SVS_UTLS+UTLS_SCRATCH,%rax
 	.else
 		movq	CPUVAR(SCRATCH),%rax
 	.endif
@@ -1579,7 +1579,7 @@ END(intrfastexit)
 	.globl	nosvs_leave_altstack, nosvs_leave_altstack_end
 
 LABEL(svs_enter)
-	movq	SVS_UTLS+UTLS_KPDIRPA,%rax
+	movabs	SVS_UTLS+UTLS_KPDIRPA,%rax
 	movq	%rax,%cr3
 	movq	CPUVAR(KRSP0),%rsp
 LABEL(svs_enter_end)
@@ -1587,7 +1587,7 @@ LABEL(svs_enter_end)
 LABEL(svs_enter_altstack)
 	testb	$SEL_UPL,TF_CS(%rsp)
 	jz	1234f
-	movq	SVS_UTLS+UTLS_KPDIRPA,%rax
+	movabs	SVS_UTLS+UTLS_KPDIRPA,%rax
 	movq	%rax,%cr3
 1234:
 LABEL(svs_enter_altstack_end)



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

2018-05-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  4 16:07:59 UTC 2018

Modified Files:
src/sys/arch/x86/acpi [netbsd-8]: acpi_wakeup.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #784):
sys/arch/x86/acpi/acpi_wakeup.c: revision 1.46
Save and restore xcr0 when doing ACPI sleeps. Should fix PR/49174.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.8.1 src/sys/arch/x86/acpi/acpi_wakeup.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/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.45 src/sys/arch/x86/acpi/acpi_wakeup.c:1.45.8.1
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.45	Thu Oct 20 16:05:04 2016
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Fri May  4 16:07:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.45 2016/10/20 16:05:04 maxv Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.45.8.1 2018/05/04 16:07:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.45 2016/10/20 16:05:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.45.8.1 2018/05/04 16:07:59 martin Exp $");
 
 #include 
 #include 
@@ -250,6 +250,7 @@ acpi_md_sleep_enter(int state)
 void
 acpi_cpu_sleep(struct cpu_info *ci)
 {
+	uint64_t xcr0 = 0;
 	int s;
 
 	KASSERT(!CPU_IS_PRIMARY(ci));
@@ -259,12 +260,21 @@ acpi_cpu_sleep(struct cpu_info *ci)
 	fpusave_cpu(true);
 	x86_disable_intr();
 
+	/*
+	 * XXX also need to save the PMCs, the dbregs, and probably a few
+	 * MSRs too.
+	 */
+	if (rcr4() & CR4_OSXSAVE)
+		xcr0 = rdxcr(0);
+
 	if (acpi_md_sleep_prepare(-1))
 		goto out;
 
 	/* Execute Wakeup */
 	cpu_init_msrs(ci, false);
 	fpuinit(ci);
+	if (rcr4() & CR4_OSXSAVE)
+		wrxcr(0, xcr0);
 
 #if NLAPIC > 0
 	lapic_enable();
@@ -285,6 +295,7 @@ out:
 int
 acpi_md_sleep(int state)
 {
+	uint64_t xcr0 = 0;
 	int s, ret = 0;
 #ifdef MULTIPROCESSOR
 	struct cpu_info *ci;
@@ -315,12 +326,21 @@ acpi_md_sleep(int state)
 	}
 #endif
 
+	/*
+	 * XXX also need to save the PMCs, the dbregs, and probably a few
+	 * MSRs too.
+	 */
+	if (rcr4() & CR4_OSXSAVE)
+		xcr0 = rdxcr(0);
+
 	if (acpi_md_sleep_prepare(state))
 		goto out;
 
 	/* Execute Wakeup */
 	cpu_init_msrs(_info_primary, false);
 	fpuinit(_info_primary);
+	if (rcr4() & CR4_OSXSAVE)
+		wrxcr(0, xcr0);
 	i8259_reinit();
 #if NLAPIC > 0
 	lapic_enable();



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

2018-05-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  4 16:03:32 UTC 2018

Modified Files:
src/sys/arch/macppc/conf [netbsd-8]: GENERIC

Log Message:
Apply patch, reqeusted by macallan in ticket #783:

Disable radeonfb since it still fails on some hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.329.2.4 -r1.329.2.5 src/sys/arch/macppc/conf/GENERIC

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

Modified files:

Index: src/sys/arch/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.329.2.4 src/sys/arch/macppc/conf/GENERIC:1.329.2.5
--- src/sys/arch/macppc/conf/GENERIC:1.329.2.4	Mon Feb 26 01:08:26 2018
+++ src/sys/arch/macppc/conf/GENERIC	Fri May  4 16:03:32 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.329.2.4 2018/02/26 01:08:26 snj Exp $
+# $NetBSD: GENERIC,v 1.329.2.5 2018/05/04 16:03:32 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/macppc/conf/std.macppc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.329.2.4 $"
+#ident 		"GENERIC-$Revision: 1.329.2.5 $"
 
 maxusers	32
 
@@ -294,8 +294,8 @@ r128fb*		at pci? function ?	# ATI Rage 1
 voodoofb*	at pci? function ?	# 3Dfx Voodoo3 
 
 # ATI Radeon. Still has problems on some hardware
-radeonfb*	at pci? function ?
-options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
+#radeonfb*	at pci? function ?
+#options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
 
 # generic PCI framebuffer, should work with everything supported by OF
 genfb*		at pci? function ?



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

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:45:09 UTC 2018

Modified Files:
src/sys/arch/amd64/conf [netbsd-8]: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/cobalt/conf [netbsd-8]: GENERIC
src/sys/arch/evbarm/conf [netbsd-8]: BEAGLEBOARD BEAGLEBOARDXM
BEAGLEBONE GENERIC.common
src/sys/arch/i386/conf [netbsd-8]: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/mvmeppc/conf [netbsd-8]: GENERIC
src/sys/arch/shark/conf [netbsd-8]: GENERIC
src/sys/arch/sparc64/conf [netbsd-8]: GENERIC
src/sys/arch/zaurus/conf [netbsd-8]: GENERIC

Log Message:
Requested by skrll in ticket #60:
sys/arch/amd64/conf/GENERIC
sys/arch/amd64/conf/XEN3_DOM0
sys/arch/amd64/conf/XEN3_DOMU
sys/arch/cobalt/conf/GENERIC
sys/arch/evbarm/conf/BEAGLEBONE
sys/arch/evbarm/conf/BEAGLEBOARD
sys/arch/evbarm/conf/BEAGLEBOARDXM
sys/arch/evbarm/conf/GENERIC.common
sys/arch/i386/conf/GENERIC
sys/arch/i386/conf/XEN3_DOM0
sys/arch/i386/conf/XEN3_DOMU
sys/arch/mvmeppc/conf/GENERIC
sys/arch/shark/conf/GENERIC
sys/arch/sparc64/conf/GENERIC
sys/arch/zaurus/conf/GENERIC

Remove option DIAGNOSTIC.


To generate a diff of this commit:
cvs rdiff -u -r1.459.2.8 -r1.459.2.9 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.135.4.6 -r1.135.4.7 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.75.2.3 -r1.75.2.4 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.151.8.3 -r1.151.8.4 src/sys/arch/cobalt/conf/GENERIC
cvs rdiff -u -r1.61.6.2 -r1.61.6.3 src/sys/arch/evbarm/conf/BEAGLEBOARD
cvs rdiff -u -r1.23.6.3 -r1.23.6.4 src/sys/arch/evbarm/conf/BEAGLEBOARDXM
cvs rdiff -u -r1.42.2.3 -r1.42.2.4 src/sys/arch/evbarm/conf/BEAGLEBONE
cvs rdiff -u -r1.18.6.3 -r1.18.6.4 src/sys/arch/evbarm/conf/GENERIC.common
cvs rdiff -u -r1.1156.2.8 -r1.1156.2.9 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.112.4.7 -r1.112.4.8 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.77.2.5 -r1.77.2.6 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.27.6.2 -r1.27.6.3 src/sys/arch/mvmeppc/conf/GENERIC
cvs rdiff -u -r1.127.6.2 -r1.127.6.3 src/sys/arch/shark/conf/GENERIC
cvs rdiff -u -r1.198.6.4 -r1.198.6.5 src/sys/arch/sparc64/conf/GENERIC
cvs rdiff -u -r1.73.6.2 -r1.73.6.3 src/sys/arch/zaurus/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.459.2.8 src/sys/arch/amd64/conf/GENERIC:1.459.2.9
--- src/sys/arch/amd64/conf/GENERIC:1.459.2.8	Wed Apr 11 14:23:30 2018
+++ src/sys/arch/amd64/conf/GENERIC	Wed Apr 18 14:45:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.459.2.8 2018/04/11 14:23:30 martin Exp $
+# $NetBSD: GENERIC,v 1.459.2.9 2018/04/18 14:45:08 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.459.2.8 $"
+#ident		"GENERIC-$Revision: 1.459.2.9 $"
 
 maxusers	64		# estimated number of users
 
@@ -94,7 +94,7 @@ options 	PMC		# performance-monitoring c
 options 	BUFQ_PRIOCSCAN
 
 # Diagnostic/debugging support options
-options 	DIAGNOSTIC	# inexpensive kernel consistency checks
+#options 	DIAGNOSTIC	# inexpensive kernel consistency checks
 # XXX to be commented out on release branch
 #options 	DEBUG		# expensive debugging checks/support
 #options 	LOCKDEBUG	# expensive locking checks/support

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.6 src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.7
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.6	Mon Feb  5 15:14:00 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Wed Apr 18 14:45:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.135.4.6 2018/02/05 15:14:00 martin Exp $
+# $NetBSD: XEN3_DOM0,v 1.135.4.7 2018/04/18 14:45:08 martin Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -52,7 +52,7 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 options 	BUFQ_PRIOCSCAN
 
 # Diagnostic/debugging support options
-options 	DIAGNOSTIC	# inexpensive kernel consistency checks
+#options 	DIAGNOSTIC	# inexpensive kernel consistency checks
 #options 	DEBUG		# expensive debugging checks/support
 options 	DDB		# in-kernel debugger
 options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.75.2.3 src/sys/arch/amd64/conf/XEN3_DOMU:1.75.2.4
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.75.2.3	Fri Jan 26 14:28:15 2018
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Wed Apr 18 14:45:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.75.2.3 2018/01/26 14:28:15 martin Exp $
+# $NetBSD: XEN3_DOMU,v 1.75.2.4 2018/04/18 14:45:08 martin Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -44,7 +44,7 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 

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

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:14:17 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h

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

sys/arch/x86/include/specialreg.h: revision 1.118,1.119

 From the latest Intel SDM:
- Add Intel Fn_0006 %eax new bit 14-20 (HWP stuff).
- Intel Fn_0007 %ecx bit 22 is for both RDPID and IA32_TSC_AUX.

Add Some bit definitions of AMD Fn8001 %edx:
  - MMX
  - FXSR


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.3 -r1.98.2.4 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.3 src/sys/arch/x86/include/specialreg.h:1.98.2.4
--- src/sys/arch/x86/include/specialreg.h:1.98.2.3	Sat Mar 31 10:51:05 2018
+++ src/sys/arch/x86/include/specialreg.h	Wed Apr 18 14:14:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.3 2018/03/31 10:51:05 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.4 2018/04/18 14:14:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -300,12 +300,19 @@
 #define CPUID_DSPM_HWP_PLR __BIT(11)	/* HWP Package Level Request */
 #define CPUID_DSPM_HDC	__BIT(13)	/* Hardware Duty Cycling */
 #define CPUID_DSPM_TBMT3 __BIT(14)	/* Turbo Boost Max Technology 3.0 */
+#define CPUID_DSPM_HWP_CAP__BIT(15)	/* HWP Capabilities */
+#define CPUID_DSPM_HWP_PECI   __BIT(16)	/* HWP PECI override */
+#define CPUID_DSPM_HWP_FLEX   __BIT(17)	/* Flexible HWP */
+#define CPUID_DSPM_HWP_FAST   __BIT(18)	/* Fast access for IA32_HWP_REQUEST */
+#define CPUID_DSPM_HWP_IGNIDL __BIT(20)	/* Ignore Idle Logical Processor HWP */
 
 #define CPUID_DSPM_FLAGS	"\20" \
 	"\1" "DTS"	"\2" "IDA"	"\3" "ARAT" 			\
 	"\5" "PLN"	"\6" "ECMD"	"\7" "PTM"	"\10" "HWP"	\
 	"\11" "HWP_NOTIFY" "\12" "HWP_ACTWIN" "\13" "HWP_EPP" "\14" "HWP_PLR" \
-			"\16" "HDC"	"\17" "TBM3"
+			"\16" "HDC"	"\17" "TBM3"	"\20" "HWP_CAP" \
+	"\21" "HWP_PECI" "\22" "HWP_FLEX" "\23" "HWP_FAST"		\
+	"25" "HWP_IGNIDL"
 
 /*
  * Intel Digital Thermal Sensor and
@@ -381,7 +388,7 @@
 #define CPUID_SEF_AVX512_VNNI	__BIT(11) /* Vector neural Network Instruction */
 #define CPUID_SEF_AVX512_BITALG	__BIT(12)
 #define CPUID_SEF_AVX512_VPOPCNTDQ __BIT(14)
-#define CPUID_SEF_RDPID		__BIT(22) /* ReaD Processor ID */
+#define CPUID_SEF_RDPID		__BIT(22) /* RDPID and IA32_TSC_AUX */
 #define CPUID_SEF_SGXLC		__BIT(30) /* SGX Launch Configuration */
 
 #define CPUID_SEF_FLAGS1	"\20" \
@@ -491,6 +498,8 @@
 #define CPUID_MPC	0x0008	/* Multiprocessing Capable */
 #define CPUID_NOX	0x0010	/* No Execute Page Protection */
 #define CPUID_MMXX	0x0040	/* AMD MMX Extensions */
+/*	CPUID_MMX			   MMX supported */
+/*	CPUID_FXSR			   fast FP/MMX save/restore */
 #define CPUID_FFXSR	0x0200	/* FXSAVE/FXSTOR Extensions */
 /*	CPUID_P1GB			   1GB Large Page Support */
 /*	CPUID_RDTSCP			   Read TSC Pair Instruction */
@@ -499,9 +508,11 @@
 #define CPUID_3DNOW	0x8000	/* 3DNow! Instructions */
 
 #define CPUID_EXT_FLAGS	"\20" \
-	"\14" "SYSCALL/SYSRET"		"\24" "MPC"	"\25" "NOX" \
-	"\27" "MMXX"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP" \
-	"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
+		"\14" "SYSCALL/SYSRET"	\
+			"\24" "MPC"	\
+	"\25" "NOX"			"\27" "MMXX"	"\30" "MMX"	\
+	"\31" "FXSR"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP"	\
+			"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
 
 /* AMD Fn8001 extended features - %ecx */
 /* 	CPUID_LAHF			   LAHF/SAHF instruction */



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

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:34:43 UTC 2018

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: if_vmx.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #767):

sys/arch/x86/pci/if_vmx.c: revision 1.23,1.24

vmx(4): handled SIOCZIFDATA.

vmx(4): compute if_ibytes using rxq->vxrxq_stats.vmrxs_ibytes.


To generate a diff of this commit:
cvs rdiff -u -r1.19.6.3 -r1.19.6.4 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.19.6.3 src/sys/arch/x86/pci/if_vmx.c:1.19.6.4
--- src/sys/arch/x86/pci/if_vmx.c:1.19.6.3	Mon Apr 16 14:18:53 2018
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Apr 16 14:34:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin Exp $");
 
 #include 
 #include 
@@ -2892,27 +2892,40 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long 
 		splx(s);
 		break;
 	case SIOCGIFDATA:
+	case SIOCZIFDATA:
 		ifp->if_ipackets = 0;
+		ifp->if_ibytes = 0;
 		ifp->if_iqdrops = 0;
 		ifp->if_ierrors = 0;
 		for (int i = 0; i < sc->vmx_nrxqueues; i++) {
-			ifp->if_ipackets +=
-			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ipackets;
-			ifp->if_iqdrops +=
-			sc->vmx_rxq[i].vxrxq_stats.vmrxs_iqdrops;
-			ifp->if_ierrors +=
-			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ierrors;
+			struct vmxnet3_rxqueue *rxq = >vmx_rxq[i];
+
+			VMXNET3_RXQ_LOCK(rxq);
+			ifp->if_ipackets += rxq->vxrxq_stats.vmrxs_ipackets;
+			ifp->if_ibytes += rxq->vxrxq_stats.vmrxs_ibytes;
+			ifp->if_iqdrops += rxq->vxrxq_stats.vmrxs_iqdrops;
+			ifp->if_ierrors += rxq->vxrxq_stats.vmrxs_ierrors;
+			if (cmd == SIOCZIFDATA) {
+memset(>vxrxq_stats, 0,
+sizeof(rxq->vxrxq_stats));
+			}
+			VMXNET3_RXQ_UNLOCK(rxq);
 		}
 		ifp->if_opackets = 0;
 		ifp->if_obytes = 0;
 		ifp->if_omcasts = 0;
 		for (int i = 0; i < sc->vmx_ntxqueues; i++) {
-			ifp->if_opackets +=
-			sc->vmx_txq[i].vxtxq_stats.vmtxs_opackets;
-			ifp->if_obytes +=
-			sc->vmx_txq[i].vxtxq_stats.vmtxs_obytes;
-			ifp->if_omcasts +=
-			sc->vmx_txq[i].vxtxq_stats.vmtxs_omcasts;
+			struct vmxnet3_txqueue *txq = >vmx_txq[i];
+
+			VMXNET3_TXQ_LOCK(txq);
+			ifp->if_opackets += txq->vxtxq_stats.vmtxs_opackets;
+			ifp->if_obytes += txq->vxtxq_stats.vmtxs_obytes;
+			ifp->if_omcasts += txq->vxtxq_stats.vmtxs_omcasts;
+			if (cmd == SIOCZIFDATA) {
+memset(>vxtxq_stats, 0,
+sizeof(txq->vxtxq_stats));
+			}
+			VMXNET3_TXQ_UNLOCK(txq);
 		}
 		/* FALLTHROUGH */
 	default:



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

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:18:53 UTC 2018

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: if_vmx.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #762):

sys/arch/x86/pci/if_vmx.c: revision 1.22

vmx(4): Fix calculation of interface statistics counter.


To generate a diff of this commit:
cvs rdiff -u -r1.19.6.2 -r1.19.6.3 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.19.6.2 src/sys/arch/x86/pci/if_vmx.c:1.19.6.3
--- src/sys/arch/x86/pci/if_vmx.c:1.19.6.2	Mon Feb 26 01:01:41 2018
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Apr 16 14:18:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.19.6.2 2018/02/26 01:01:41 snj Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.2 2018/02/26 01:01:41 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $");
 
 #include 
 #include 
@@ -2892,20 +2892,26 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long 
 		splx(s);
 		break;
 	case SIOCGIFDATA:
+		ifp->if_ipackets = 0;
+		ifp->if_iqdrops = 0;
+		ifp->if_ierrors = 0;
 		for (int i = 0; i < sc->vmx_nrxqueues; i++) {
-			ifp->if_ipackets =
+			ifp->if_ipackets +=
 			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ipackets;
-			ifp->if_iqdrops =
+			ifp->if_iqdrops +=
 			sc->vmx_rxq[i].vxrxq_stats.vmrxs_iqdrops;
-			ifp->if_ierrors =
+			ifp->if_ierrors +=
 			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ierrors;
 		}
+		ifp->if_opackets = 0;
+		ifp->if_obytes = 0;
+		ifp->if_omcasts = 0;
 		for (int i = 0; i < sc->vmx_ntxqueues; i++) {
-			ifp->if_opackets =
+			ifp->if_opackets +=
 			sc->vmx_txq[i].vxtxq_stats.vmtxs_opackets;
-			ifp->if_obytes =
+			ifp->if_obytes +=
 			sc->vmx_txq[i].vxtxq_stats.vmtxs_obytes;
-			ifp->if_omcasts =
+			ifp->if_omcasts +=
 			sc->vmx_txq[i].vxtxq_stats.vmtxs_omcasts;
 		}
 		/* FALLTHROUGH */



  1   2   3   >