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

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

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

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

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.92 -r1.92.2.1 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.92 src/sys/arch/powerpc/oea/pmap.c:1.92.2.1
--- src/sys/arch/powerpc/oea/pmap.c:1.92	Sun Aug 10 17:49:04 2014
+++ src/sys/arch/powerpc/oea/pmap.c	Sun Jun  7 12:26:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.92 2014/08/10 17:49:04 joerg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.92.2.1 2020/06/07 12:26:22 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.92 2014/08/10 17:49:04 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92.2.1 2020/06/07 12:26:22 martin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -990,6 +990,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)
@@ -2153,6 +2154,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-7] src/sys/arch/xen/xen

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

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

Log Message:
Pull up the following revisions(s) (requested by jdolecek in ticket #1726):
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.80.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.80.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:08:37 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.80.1 2020/03/16 12:08:37 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.80.1 2020/03/16 12:08:37 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-7] src/sys/arch/amigappc/include

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:19:55 UTC 2020

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

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

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.4.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.4.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 09:19:55 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.4.1 2020/03/08 09:19:55 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-7] src/sys/arch/amiga/dev

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:18:34 UTC 2020

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

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

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.29.4.2 -r1.29.4.3 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.29.4.2 src/sys/arch/amiga/dev/gayle_pcmcia.c:1.29.4.3
--- src/sys/arch/amiga/dev/gayle_pcmcia.c:1.29.4.2	Mon Feb 16 12:48:32 2015
+++ src/sys/arch/amiga/dev/gayle_pcmcia.c	Sun Mar  8 09:18:34 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: gayle_pcmcia.c,v 1.29.4.2 2015/02/16 12:48:32 martin Exp $ */
+/*	$NetBSD: gayle_pcmcia.c,v 1.29.4.3 2020/03/08 09:18:34 martin Exp $ */
 
 /* public domain */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.29.4.2 2015/02/16 12:48:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.29.4.3 2020/03/08 09:18:34 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-7] src/sys/arch/mac68k/nubus

2020-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 12 20:17:14 UTC 2020

Modified Files:
src/sys/arch/mac68k/nubus [netbsd-7]: grf_nubus.c

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

sys/arch/mac68k/nubus/grf_nubus.c: revision 1.78

Set sc_dev field of softc.
Should pullup to 7.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.77.4.1 src/sys/arch/mac68k/nubus/grf_nubus.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/nubus/grf_nubus.c
diff -u src/sys/arch/mac68k/nubus/grf_nubus.c:1.77 src/sys/arch/mac68k/nubus/grf_nubus.c:1.77.4.1
--- src/sys/arch/mac68k/nubus/grf_nubus.c:1.77	Fri Oct 25 21:42:30 2013
+++ src/sys/arch/mac68k/nubus/grf_nubus.c	Wed Feb 12 20:17:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_nubus.c,v 1.77 2013/10/25 21:42:30 martin Exp $	*/
+/*	$NetBSD: grf_nubus.c,v 1.77.4.1 2020/02/12 20:17:14 martin Exp $	*/
 
 /*
  * Copyright (c) 1995 Allen Briggs.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: grf_nubus.c,v 1.77 2013/10/25 21:42:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_nubus.c,v 1.77.4.1 2020/02/12 20:17:14 martin Exp $");
 
 #include 
 
@@ -143,6 +143,7 @@ grfmv_attach(device_t parent, device_t s
 
 	memcpy(>sc_slot, na->fmt, sizeof(nubus_slot));
 
+	sc->sc_dev = self;
 	sc->sc_tag = na->na_tag;
 	sc->card_id = na->drhw;
 	sc->sc_basepa = (bus_addr_t)NUBUS_SLOT2PA(na->slot);



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

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

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

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

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.18.34.1 -r1.18.34.2 src/sys/arch/amd64/amd64/copy.S
cvs rdiff -u -r1.23 -r1.23.4.1 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.18.34.1 src/sys/arch/amd64/amd64/copy.S:1.18.34.2
--- src/sys/arch/amd64/amd64/copy.S:1.18.34.1	Sat Dec 24 04:07:25 2016
+++ src/sys/arch/amd64/amd64/copy.S	Sun May  5 08:48:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.18.34.1 2016/12/24 04:07:25 snj Exp $	*/
+/*	$NetBSD: copy.S,v 1.18.34.2 2019/05/05 08:48:13 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -233,6 +233,7 @@ NENTRY(copy_efault)
  */
 
 NENTRY(kcopy_fault)
+	cld
 	ret
 
 NENTRY(copy_fault)

Index: src/sys/arch/i386/i386/copy.S
diff -u src/sys/arch/i386/i386/copy.S:1.23 src/sys/arch/i386/i386/copy.S:1.23.4.1
--- src/sys/arch/i386/i386/copy.S:1.23	Fri Jan 10 16:47:07 2014
+++ src/sys/arch/i386/i386/copy.S	Sun May  5 08:48:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.23 2014/01/10 16:47:07 pedro Exp $	*/
+/*	$NetBSD: copy.S,v 1.23.4.1 2019/05/05 08:48:13 martin Exp $	*/
 /*	NetBSD: locore.S,v 1.34 2005/04/01 11:59:31 yamt Exp $	*/
 
 /*-
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.23 2014/01/10 16:47:07 pedro Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.23.4.1 2019/05/05 08:48:13 martin Exp $");
 
 #include "assym.h"
 
@@ -308,6 +308,7 @@ NENTRY(copy_efault)
  */
 /* LINTSTUB: Ignore */
 NENTRY(kcopy_fault)
+	cld
 	popl	%edi
 	popl	%esi
 	ret



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

2019-03-30 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Mar 30 18:47:15 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by rin in ticket #1687):
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.18.14.1 -r1.18.14.2 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.18.14.1 src/sys/arch/amd64/include/param.h:1.18.14.2
--- src/sys/arch/amd64/include/param.h:1.18.14.1	Sun Mar 26 16:05:40 2017
+++ src/sys/arch/amd64/include/param.h	Sat Mar 30 18:47:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.18.14.1 2017/03/26 16:05:40 snj Exp $	*/
+/*	$NetBSD: param.h,v 1.18.14.2 2019/03/30 18:47:15 bouyer 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-7] src/sys/arch/mvme68k/dev

2019-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 13 11:47:40 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #1685):
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.12.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.12.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 11:47:40 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.12.1 2019/03/13 11:47:40 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.12.1 2019/03/13 11:47:40 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-7] src/sys/arch

2019-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 30 13:27:28 UTC 2019

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

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

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/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.345.2.1 -r1.345.2.2 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.92 -r1.92.4.1 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.47 -r1.47.4.1 src/sys/arch/arm/arm/sig_machdep.c
cvs rdiff -u -r1.25 -r1.25.30.1 src/sys/arch/hppa/hppa/sig_machdep.c
cvs rdiff -u -r1.752.4.2 -r1.752.4.3 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.49 -r1.49.14.1 src/sys/arch/m68k/m68k/sig_machdep.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/mips/mips/netbsd32_machdep.c
cvs rdiff -u -r1.23 -r1.23.28.1 src/sys/arch/mips/mips/sig_machdep.c
cvs rdiff -u -r1.43.14.1 -r1.43.14.2 \
src/sys/arch/powerpc/powerpc/sig_machdep.c
cvs rdiff -u -r1.102.4.1 -r1.102.4.2 src/sys/arch/sh3/sh3/sh3_machdep.c
cvs rdiff -u -r1.278.2.3 -r1.278.2.4 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.103.4.1 -r1.103.4.2 \
src/sys/arch/sparc64/sparc64/netbsd32_machdep.c
cvs rdiff -u -r1.4 -r1.4.16.1 src/sys/arch/usermode/target/i386/cpu_i386.c
cvs rdiff -u -r1.2 -r1.2.24.1 \
src/sys/arch/usermode/target/x86_64/cpu_x86_64.c
cvs rdiff -u -r1.21 -r1.21.28.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.345.2.1 src/sys/arch/alpha/alpha/machdep.c:1.345.2.2
--- src/sys/arch/alpha/alpha/machdep.c:1.345.2.1	Tue Nov  1 20:28:32 2016
+++ src/sys/arch/alpha/alpha/machdep.c	Wed Jan 30 13:27:27 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.345.2.1 2016/11/01 20:28:32 snj Exp $ */
+/* $NetBSD: machdep.c,v 1.345.2.2 2019/01/30 13:27:27 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.345.2.1 2016/11/01 20:28:32 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.345.2.2 2019/01/30 13:27:27 martin Exp $");
 
 #include 
 #include 
@@ -1465,12 +1465,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: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.92 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.92.4.1
--- 

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

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

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

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

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.358 -r1.358.2.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.358 src/sys/arch/sparc/sparc/pmap.c:1.358.2.1
--- src/sys/arch/sparc/sparc/pmap.c:1.358	Sat May  3 11:17:06 2014
+++ src/sys/arch/sparc/sparc/pmap.c	Tue Jan 15 18:43:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $ */
+/*	$NetBSD: pmap.c,v 1.358.2.1 2019/01/15 18:43:27 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358.2.1 2019/01/15 18:43:27 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, 

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

2018-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  4 19:16:27 UTC 2018

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

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

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.211.2.2 -r1.211.2.3 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.211.2.2 src/sys/arch/amd64/amd64/machdep.c:1.211.2.3
--- src/sys/arch/amd64/amd64/machdep.c:1.211.2.2	Mon Jan 22 19:41:08 2018
+++ src/sys/arch/amd64/amd64/machdep.c	Tue Dec  4 19:16:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.211.2.2 2018/01/22 19:41:08 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.211.2.3 2018/12/04 19:16:27 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.211.2.2 2018/01/22 19:41:08 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.2.3 2018/12/04 19:16:27 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -570,6 +570,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;
@@ -577,7 +578,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-7] src/sys/arch/macppc/stand/ofwboot

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

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

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

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.14.1 src/sys/arch/macppc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.13 -r1.13.34.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.14.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:41:37 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.14.1 2018/11/18 19:41:37 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.34.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:41:37 2018
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.13 2010/10/17 15:33:04 phx Exp $
+$NetBSD: version,v 1.13.34.1 2018/11/18 19:41:37 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-7] src/sys/arch/x86/x86

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

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

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

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.6.4.3 -r1.6.4.4 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.6.4.3 src/sys/arch/x86/x86/procfs_machdep.c:1.6.4.4
--- src/sys/arch/x86/x86/procfs_machdep.c:1.6.4.3	Mon Sep 11 05:50:12 2017
+++ src/sys/arch/x86/x86/procfs_machdep.c	Sun Nov 18 19:39:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.6.4.3 2017/09/11 05:50:12 snj Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.6.4.4 2018/11/18 19:39:49 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.3 2017/09/11 05:50:12 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.4 2018/11/18 19:39:49 martin Exp $");
 
 #include 
 #include 
@@ -359,9 +359,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-7] src/sys/arch/pmax/pmax

2018-10-30 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Oct 30 10:17:23 UTC 2018

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

Log Message:
Pull up the following revisions(s) (requested by tsutsui in ticket #1641):
sys/arch/pmax/pmax/dec_3min.c:  revision 1.74

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


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.4.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.4.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	Tue Oct 30 10:17:23 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.4.1 2018/10/30 10:17:23 sborrill 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.4.1 2018/10/30 10:17:23 sborrill 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-7] src/sys/arch/i386/stand/misc

2018-08-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  7 15:51:29 UTC 2018

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

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

sys/arch/i386/stand/misc/rawr32.exe.uue: file removal
sys/arch/i386/stand/misc/Makefile: revision 1.9

Remove Rawrite32 installer - no point having an outdated version on
some install media, the windows machine it needs to run on will
have internet and can easily download it.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.34.1 src/sys/arch/i386/stand/misc/Makefile
cvs rdiff -u -r1.4.24.2 -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.34.1
--- src/sys/arch/i386/stand/misc/Makefile:1.7	Wed Oct 27 18:29:46 2010
+++ src/sys/arch/i386/stand/misc/Makefile	Tue Aug  7 15:51:28 2018
@@ -1,8 +1,7 @@
-#	$NetBSD: Makefile,v 1.7 2010/10/27 18:29:46 martin Exp $
+#	$NetBSD: Makefile,v 1.7.34.1 2018/08/07 15:51:28 martin Exp $
 
 MISC_FILES=	rawrite.c
 UUDECODE_FILES=	pfdisk.doc pfdisk.exe pfdisktc.zip \
-		rawr32.exe \
 		rawrite.doc rawrite.exe
 
 .include 



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

2018-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  9 13:27:41 UTC 2018

Modified Files:
src/sys/arch/amiga/amiga [netbsd-7]: cc.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1597):
sys/arch/amiga/amiga/cc.c: revision 1.27
spl leak, found by mootja


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/arch/amiga/amiga/cc.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/amiga/cc.c
diff -u src/sys/arch/amiga/amiga/cc.c:1.26 src/sys/arch/amiga/amiga/cc.c:1.26.4.1
--- src/sys/arch/amiga/amiga/cc.c:1.26	Wed Jan 22 00:25:16 2014
+++ src/sys/arch/amiga/amiga/cc.c	Mon Apr  9 13:27:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cc.c,v 1.26 2014/01/22 00:25:16 christos Exp $	*/
+/*	$NetBSD: cc.c,v 1.26.4.1 2018/04/09 13:27:41 martin Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.26 2014/01/22 00:25:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.26.4.1 2018/04/09 13:27:41 martin Exp $");
 
 #include 
 #include 
@@ -503,8 +503,10 @@ alloc_chipmem(u_long size)
 		if (size <= mn->size)
 			break;
 
-	if (mn == NULL)
+	if (mn == NULL) {
+		splx(s);
 		return NULL;
+	}
 
 	if ((mn->size - size) <= sizeof (*mn)) {
 		/*



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

2018-03-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Mar 21 11:54:47 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7]: cpuvar.h

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

sys/arch/sparc/include/cpu.h: revision 1.99 (patch -> cpuvar.h)

- return early in xcall() if the function is sparc_noop() instead of triggering
  the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
  IPI
- add event counters for IPIs being caught with the mutex not held, and for
  messages that are already marked as completed

With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.

Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...

[file accidently missed in previous commit]


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.92.4.1 src/sys/arch/sparc/sparc/cpuvar.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/sparc/sparc/cpuvar.h
diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.92 src/sys/arch/sparc/sparc/cpuvar.h:1.92.4.1
--- src/sys/arch/sparc/sparc/cpuvar.h:1.92	Sat Nov 16 23:54:01 2013
+++ src/sys/arch/sparc/sparc/cpuvar.h	Wed Mar 21 11:54:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.92 2013/11/16 23:54:01 mrg Exp $ */
+/*	$NetBSD: cpuvar.h,v 1.92.4.1 2018/03/21 11:54:47 martin Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@ struct cpu_info {
 	 * the pending register to avoid a hardware bug.
 	 */
 #define raise_ipi(cpi,lvl)	do {			\
-	int x;		\
+	volatile int x;	\
 	(cpi)->intreg_4m->pi_set = PINTR_SINTRLEV(lvl);	\
 	x = (cpi)->intreg_4m->pi_pend; __USE(x);	\
 } while (0)
@@ -340,6 +340,8 @@ struct cpu_info {
 	struct evcnt ci_savefpstate_null;
 	struct evcnt ci_xpmsg_mutex_fail;
 	struct evcnt ci_xpmsg_mutex_fail_call;
+	struct evcnt ci_xpmsg_mutex_not_held;
+	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
 };



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

2018-03-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Mar 21 11:52:50 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7]: cpu.c intr.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1585):
sys/arch/sparc/sparc/cpu.c: revision 1.250 (patch)
sys/arch/sparc/include/cpu.h: revision 1.99 (patch -> cpuvar.h)
sys/arch/sparc/sparc/intr.c: revision 1.119 (patch)

- return early in xcall() if the function is sparc_noop() instead of triggering
  the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
  IPI
- add event counters for IPIs being caught with the mutex not held, and for
  messages that are already marked as completed

With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.

Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.248.2.1 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/sparc/sparc/intr.c

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

Modified files:

Index: src/sys/arch/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.248 src/sys/arch/sparc/sparc/cpu.c:1.248.2.1
--- src/sys/arch/sparc/sparc/cpu.c:1.248	Fri Jul 25 17:21:32 2014
+++ src/sys/arch/sparc/sparc/cpu.c	Wed Mar 21 11:52:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.248 2014/07/25 17:21:32 nakayama Exp $ */
+/*	$NetBSD: cpu.c,v 1.248.2.1 2018/03/21 11:52:49 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.248 2014/07/25 17:21:32 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.248.2.1 2018/03/21 11:52:49 martin Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -183,7 +183,7 @@ int go_smp_cpus = 0;	/* non-primary CPUs
  * This must be locked around all message transactions to ensure only
  * one CPU is generating them.
  */
-static kmutex_t xpmsg_mutex;
+kmutex_t xpmsg_mutex;
 
 #endif /* MULTIPROCESSOR */
 
@@ -367,6 +367,10 @@ cpu_init_evcnt(struct cpu_info *cpi)
 			 NULL, cpu_name(cpi), "IPI mutex_trylock fail");
 	evcnt_attach_dynamic(>ci_xpmsg_mutex_fail_call, EVCNT_TYPE_MISC,
 			 NULL, cpu_name(cpi), "IPI mutex_trylock fail/call");
+	evcnt_attach_dynamic(>ci_xpmsg_mutex_not_held, EVCNT_TYPE_MISC,
+			 NULL, cpu_name(cpi), "IPI with mutex not held");
+	evcnt_attach_dynamic(>ci_xpmsg_bogus, EVCNT_TYPE_MISC,
+			 NULL, cpu_name(cpi), "bogus IPI");
 
 	/*
 	 * These are the per-cpu per-IPL hard & soft interrupt counters.
@@ -653,6 +657,8 @@ xcall(xcall_func_t func, xcall_trap_t tr
 	char *bufp = errbuf;
 	size_t bufsz = sizeof errbuf, wrsz;
 
+	if (is_noop) return;
+
 	mybit = (1 << cpuinfo.ci_cpuid);
 	callself = func && (cpuset & mybit) != 0;
 	cpuset &= ~mybit;
@@ -714,7 +720,10 @@ xcall(xcall_func_t func, xcall_trap_t tr
 		if ((cpuset & (1 << n)) == 0)
 			continue;
 
-		cpi->msg.tag = XPMSG_FUNC;
+		/*
+		 * Write msg.tag last - if another CPU is polling above it may
+		 * end up seeing an incomplete message. Not likely but still.
+		 */ 
 		cpi->msg.complete = 0;
 		p = >msg.u.xpmsg_func;
 		p->func = func;
@@ -722,6 +731,9 @@ xcall(xcall_func_t func, xcall_trap_t tr
 		p->arg0 = arg0;
 		p->arg1 = arg1;
 		p->arg2 = arg2;
+		__insn_barrier();
+		cpi->msg.tag = XPMSG_FUNC;
+		__insn_barrier();
 		/* Fast cross calls use interrupt level 14 */
 		raise_ipi(cpi,13+fasttrap);/*xcall_cookie->pil*/
 	}
@@ -737,7 +749,7 @@ xcall(xcall_func_t func, xcall_trap_t tr
 	 * have completed (bailing if it takes "too long", being loud about
 	 * this in the process).
 	 */
-	done = is_noop;
+	done = 0;
 	i = 100;	/* time-out, not too long, but still an _AGE_ */
 	while (!done) {
 		if (--i < 0) {
@@ -774,7 +786,7 @@ xcall(xcall_func_t func, xcall_trap_t tr
 
 	if (i >= 0 || debug_xcall == 0) {
 		if (i < 0)
-			printf_nolog("%s\n", errbuf);
+			aprint_error("%s\n", errbuf);
 		mutex_spin_exit(_mutex);
 		return;
 	}

Index: src/sys/arch/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.118 src/sys/arch/sparc/sparc/intr.c:1.118.4.1
--- src/sys/arch/sparc/sparc/intr.c:1.118	Sat Nov 16 23:54:01 2013
+++ src/sys/arch/sparc/sparc/intr.c	Wed Mar 21 11:52:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.118 2013/11/16 23:54:01 mrg Exp $ */
+/*	$NetBSD: intr.c,v 1.118.4.1 2018/03/21 11:52:49 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.118 2013/11/16 23:54:01 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.118.4.1 2018/03/21 11:52:49 martin Exp $");
 
 #include 

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

2018-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  6 15:04:49 UTC 2018

Modified Files:
src/sys/arch/mips/mips [netbsd-7]: cache.c

Log Message:
Pull up following revision(s) (requested by flxd in ticket #1578):
sys/arch/mips/mips/cache.c: revision 1.59
Add missing call to mips_dcache_compute_align() affecting "modern" MIPS
(MIPS32{,R2}/MIPS64{,R2}). Thanks jmcneill@; OK skrll@.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.24.1 src/sys/arch/mips/mips/cache.c

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

Modified files:

Index: src/sys/arch/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.48 src/sys/arch/mips/mips/cache.c:1.48.24.1
--- src/sys/arch/mips/mips/cache.c:1.48	Thu Nov 24 04:17:11 2011
+++ src/sys/arch/mips/mips/cache.c	Tue Mar  6 15:04:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.48 2011/11/24 04:17:11 matt Exp $	*/
+/*	$NetBSD: cache.c,v 1.48.24.1 2018/03/06 15:04:49 martin Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.48 2011/11/24 04:17:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.48.24.1 2018/03/06 15:04:49 martin Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -1231,5 +1231,7 @@ mips_config_cache_modern(uint32_t cpu_id
 		mco->mco_intern_pdcache_wb_range =
 		(void (*)(vaddr_t, vsize_t))cache_noop;
 	}
+
+	mips_dcache_compute_align();
 }
 #endif /* MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2 > 0 */



CVS commit: [netbsd-7] src/sys/arch/macppc/dev

2018-02-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 19 19:41:43 UTC 2018

Modified Files:
src/sys/arch/macppc/dev [netbsd-7]: snapper.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1559):
sys/arch/macppc/dev/snapper.c: 1.42
Fix issue with audio being downpitched, thanks to 
"it seems that snapper_init should be called before audio_attach_mi, as
snapper
init is setting the rate to 44100 after the hardware format has been
configured
by audio_attach_mi.
audio_attach_mi should be the last thing called during an attach of an audio
device so the audio device is ready to be configured when audio_attach_mi is
called."
Resolves PR port-macppc/52949


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/macppc/dev/snapper.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/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.39 src/sys/arch/macppc/dev/snapper.c:1.39.4.1
--- src/sys/arch/macppc/dev/snapper.c:1.39	Fri Mar 14 21:59:41 2014
+++ src/sys/arch/macppc/dev/snapper.c	Mon Feb 19 19:41:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.39 2014/03/14 21:59:41 mrg Exp $	*/
+/*	$NetBSD: snapper.c,v 1.39.4.1 2018/02/19 19:41:43 snj Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.39 2014/03/14 21:59:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.39.4.1 2018/02/19 19:41:43 snj Exp $");
 
 #include 
 #include 
@@ -839,10 +839,10 @@ snapper_defer(device_t dev)
 		break;
 	}
 
-	audio_attach_mi(_hw_if, sc, sc->sc_dev);
-
 	/* ki2c_setmode(sc->sc_i2c, I2C_STDSUBMODE); */
 	snapper_init(sc, sc->sc_node);
+
+	audio_attach_mi(_hw_if, sc, sc->sc_dev);
 }
 
 static int



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

2018-02-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 19 19:24:43 UTC 2018

Modified Files:
src/sys/arch/arm/arm [netbsd-7]: cpufunc_asm_arm11x6.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1555):
sys/arch/arm/arm/cpufunc_asm_arm11x6.S: 1.10
PR/52934: Yasushi Oshima: Apply the erratum fix that was applied to wbinv_range
to isync_range so that we don't hang when we try to sync from execcmd_readvn().


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.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/arm/arm/cpufunc_asm_arm11x6.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7.2.1 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7.2.2
--- src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7.2.1	Sun Jul 23 06:14:03 2017
+++ src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S	Mon Feb 19 19:24:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.2.1 2017/07/23 06:14:03 snj Exp $	*/
+/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.2.2 2018/02/19 19:24:43 snj Exp $	*/
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -63,7 +63,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.2.1 2017/07/23 06:14:03 snj Exp $")
+RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.2.2 2018/02/19 19:24:43 snj Exp $")
 
 #if 0
 #define Invalidate_I_cache(Rtmp1, Rtmp2) \
@@ -137,6 +137,11 @@ ENTRY_NP(arm11x6_flush_prefetchbuf)
 END(arm11x6_flush_prefetchbuf)
 
 ENTRY_NP(arm11x6_icache_sync_range)
+	ldr	r2, .Larm_pcache
+	ldr	r2, [r2, #DCACHE_SIZE]
+	cmp	r1, r2
+	bge	arm11x6_icache_sync_all
+
 	add	r1, r1, r0
 	sub	r1, r1, #1
 	/* Erratum ARM1136 371025, workaround #2 */



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

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:42:20 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.140.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.32 src/sys/arch/sparc/sparc/timer.c:1.32.4.1
--- src/sys/arch/sparc/sparc/timer.c:1.32	Sun Jan 19 00:22:33 2014
+++ src/sys/arch/sparc/sparc/timer.c	Mon Feb 12 18:42:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.32.4.1 2018/02/12 18:42:19 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32.4.1 2018/02/12 18:42:19 snj Exp $");
 
 #include 
 #include 
@@ -85,55 +85,92 @@ void *sched_cookie;
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offset due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
-
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the limit so that we avoid
+	 * time going backwards.
+	 */
+	if (cnt != res) {
+		fixup = 

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

2018-01-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jan 22 19:41:08 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7]: machdep.c
src/sys/arch/amd64/include [netbsd-7]: segments.h
src/sys/arch/i386/i386 [netbsd-7]: machdep.c
src/sys/arch/i386/include [netbsd-7]: segments.h
src/sys/arch/x86/x86 [netbsd-7]: vm_machdep.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1550):
sys/arch/amd64/amd64/machdep.c: revision 1.280 via patch
sys/arch/amd64/include/segments.h: revision 1.34 via patch
sys/arch/i386/i386/machdep.c: revision 1.800 via patch
sys/arch/i386/include/segments.h: revision 1.64 via patch
sys/arch/x86/x86/vm_machdep.c: revision 1.30 via patch
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.


To generate a diff of this commit:
cvs rdiff -u -r1.211.2.1 -r1.211.2.2 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.24 -r1.24.12.1 src/sys/arch/amd64/include/segments.h
cvs rdiff -u -r1.752.4.1 -r1.752.4.2 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.54 -r1.54.30.1 src/sys/arch/i386/include/segments.h
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/arch/x86/x86/vm_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.211.2.1 src/sys/arch/amd64/amd64/machdep.c:1.211.2.2
--- src/sys/arch/amd64/amd64/machdep.c:1.211.2.1	Wed Apr 26 14:52:50 2017
+++ src/sys/arch/amd64/amd64/machdep.c	Mon Jan 22 19:41:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.211.2.2 2018/01/22 19:41:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.2.2 2018/01/22 19:41:08 snj Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -468,7 +468,7 @@ x86_64_proc0_tss_ldt_init(void)
 	pcb->pcb_fs = 0;
 	pcb->pcb_gs = 0;
 	pcb->pcb_rsp0 = (uvm_lwp_getuarea(l) + USPACE - 16) & ~0xf;
-	pcb->pcb_iopl = SEL_KPL;
+	pcb->pcb_iopl = IOPL_KPL;
 
 	pmap_kernel()->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL);
 	pcb->pcb_cr0 = rcr0() & ~CR0_TS;

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.24 src/sys/arch/amd64/include/segments.h:1.24.12.1
--- src/sys/arch/amd64/include/segments.h:1.24	Mon Jan  7 17:03:06 2013
+++ src/sys/arch/amd64/include/segments.h	Mon Jan 22 19:41:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.24 2013/01/07 17:03:06 chs Exp $	*/
+/*	$NetBSD: segments.h,v 1.24.12.1 2018/01/22 19:41:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -107,6 +107,12 @@
 #define	ISLDT(s)	((s) & SEL_LDT)	/* is it local or global */
 #define	SEL_LDT		4		/* local descriptor table */	
 
+#ifdef XEN
+#define IOPL_KPL	1
+#else
+#define IOPL_KPL	SEL_KPL
+#endif
+
 /* Dynamically allocated TSSs and LDTs start (byte offset) */
 #define SYSSEL_START	(NGDT_MEM << 3)
 #define DYNSEL_START	(SYSSEL_START + (NGDT_SYS << 4))

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.752.4.1 src/sys/arch/i386/i386/machdep.c:1.752.4.2
--- src/sys/arch/i386/i386/machdep.c:1.752.4.1	Thu Jul 20 01:43:40 2017
+++ src/sys/arch/i386/i386/machdep.c	Mon Jan 22 19:41:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.752.4.1 2017/07/20 01:43:40 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.752.4.2 2018/01/22 19:41:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.752.4.1 2017/07/20 01:43:40 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.752.4.2 2018/01/22 19:41:08 snj Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -502,7 +502,7 @@ i386_proc0_tss_ldt_init(void)
 	pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
 	pcb->pcb_cr0 = rcr0() & ~CR0_TS;
 	pcb->pcb_esp0 = uvm_lwp_getuarea(l) + USPACE - 16;
-	pcb->pcb_iopl = SEL_KPL;
+	pcb->pcb_iopl = IOPL_KPL;
 	l->l_md.md_regs = (struct trapframe *)pcb->pcb_esp0 - 1;
 	

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

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 21:30:59 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1546):
sys/arch/macppc/conf/GENERIC: revision 1.337 via patch
Without RADEONFB_ALWAYS_ACCEL_PUTCHAR, there are display issues on the
PowerBook5,2 (G4 FW-800)
Radeon 9600, where console is garbled.
Thanks to  for the pointer.
Closes PR port-macppc/52712


To generate a diff of this commit:
cvs rdiff -u -r1.312.4.3 -r1.312.4.4 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.312.4.3 src/sys/arch/macppc/conf/GENERIC:1.312.4.4
--- src/sys/arch/macppc/conf/GENERIC:1.312.4.3	Fri May 15 03:44:18 2015
+++ src/sys/arch/macppc/conf/GENERIC	Wed Jan  3 21:30:59 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.312.4.3 2015/05/15 03:44:18 snj Exp $
+# $NetBSD: GENERIC,v 1.312.4.4 2018/01/03 21:30:59 snj 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.312.4.3 $"
+#ident 		"GENERIC-$Revision: 1.312.4.4 $"
 
 maxusers	32
 
@@ -297,6 +297,7 @@ voodoofb*	at pci? function ?	# 3Dfx Vood
 # ATI Radeon. Still has problems on some hardware
 radeonfb*	at pci? function ?
 options 	RADEONFB_MMAP_BARS	# allow mmap()ing BARs - needed for X
+options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
 
 # generic PCI framebuffer, should work with everything supported by OF
 genfb*		at pci? function ?



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

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 21:26:39 UTC 2018

Modified Files:
src/sys/arch/i386/conf [netbsd-7]: INSTALL

Log Message:
Pull up following revision(s) (requested by rin in ticket #1544):
sys/arch/i386/conf/INSTALL: revision 1.332
install/52845: Enable vga@isa and pcdisplay for INSTALL. Otherwise, install
media do not boot on pre-PCI machines.


To generate a diff of this commit:
cvs rdiff -u -r1.330.30.2 -r1.330.30.3 src/sys/arch/i386/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/i386/conf/INSTALL
diff -u src/sys/arch/i386/conf/INSTALL:1.330.30.2 src/sys/arch/i386/conf/INSTALL:1.330.30.3
--- src/sys/arch/i386/conf/INSTALL:1.330.30.2	Wed Mar 18 03:57:15 2015
+++ src/sys/arch/i386/conf/INSTALL	Wed Jan  3 21:26:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.330.30.2 2015/03/18 03:57:15 snj Exp $
+# $NetBSD: INSTALL,v 1.330.30.3 2018/01/03 21:26:39 snj Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -7,7 +7,7 @@
 
 include	"arch/i386/conf/MONOLITHIC"
 
-#ident 		"INSTALL-$Revision: 1.330.30.2 $"
+#ident 		"INSTALL-$Revision: 1.330.30.3 $"
 
 no options	MEMORY_DISK_DYNAMIC
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -19,3 +19,8 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 no i915drmkms* at pci?
 no radeon* at pci?
 #no nouveau*	   at pci?
+
+# pre-PCI graphics drivers, not enabled in GENERIC
+vga0		at isa?
+pcdisplay0	at isa?			# CGA, MDA, EGA, HGA
+wsdisplay*	at pcdisplay? console ?



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

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 20:23:43 UTC 2018

Modified Files:
src/sys/arch/arm/broadcom [netbsd-7]: bcm2835_space.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1532):
sys/arch/arm/broadcom/bcm2835_space.c: 1.12-1.13
KNF
--
Sync with armv7_generic_space.c
- BE support (probably not needed)
- a4x subreagion/mmap support
- fix some a4x stream methods
- add UVM_KMF_COLORMATCH in bs_map when allocating KVA
- support BUS_SPACE_MAP_PREFETCHABLE


To generate a diff of this commit:
cvs rdiff -u -r1.6.10.3 -r1.6.10.4 src/sys/arch/arm/broadcom/bcm2835_space.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/broadcom/bcm2835_space.c
diff -u src/sys/arch/arm/broadcom/bcm2835_space.c:1.6.10.3 src/sys/arch/arm/broadcom/bcm2835_space.c:1.6.10.4
--- src/sys/arch/arm/broadcom/bcm2835_space.c:1.6.10.3	Fri Feb 26 22:52:53 2016
+++ src/sys/arch/arm/broadcom/bcm2835_space.c	Wed Jan  3 20:23:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_space.c,v 1.6.10.3 2016/02/26 22:52:53 snj Exp $	*/
+/*	$NetBSD: bcm2835_space.c,v 1.6.10.4 2018/01/03 20:23:43 snj Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.6.10.3 2016/02/26 22:52:53 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.6.10.4 2018/01/03 20:23:43 snj Exp $");
 
 #include 
 #include 
@@ -51,6 +51,12 @@ bs_protos(generic_armv4);
 bs_protos(a4x);
 bs_protos(bs_notimpl);
 
+#if __ARMEB__
+#define NSWAP(n)	n ## _swap
+#else
+#define NSWAP(n)	n
+#endif
+
 struct bus_space bcm2835_bs_tag = {
 	/* cookie */
 	(void *) 0,
@@ -75,38 +81,38 @@ struct bus_space bcm2835_bs_tag = {
 
 	/* read (single) */
 	generic_bs_r_1,
-	generic_armv4_bs_r_2,
-	generic_bs_r_4,
+	NSWAP(generic_armv4_bs_r_2),
+	NSWAP(generic_bs_r_4),
 	bs_notimpl_bs_r_8,
 
 	/* read multiple */
 	generic_bs_rm_1,
-	generic_armv4_bs_rm_2,
-	generic_bs_rm_4,
+	NSWAP(generic_armv4_bs_rm_2),
+	NSWAP(generic_bs_rm_4),
 	bs_notimpl_bs_rm_8,
 
 	/* read region */
 	generic_bs_rr_1,
-	generic_armv4_bs_rr_2,
-	generic_bs_rr_4,
+	NSWAP(generic_armv4_bs_rr_2),
+	NSWAP(generic_bs_rr_4),
 	bs_notimpl_bs_rr_8,
 
 	/* write (single) */
 	generic_bs_w_1,
-	generic_armv4_bs_w_2,
-	generic_bs_w_4,
+	NSWAP(generic_armv4_bs_w_2),
+	NSWAP(generic_bs_w_4),
 	bs_notimpl_bs_w_8,
 
 	/* write multiple */
 	generic_bs_wm_1,
-	generic_armv4_bs_wm_2,
-	generic_bs_wm_4,
+	NSWAP(generic_armv4_bs_wm_2),
+	NSWAP(generic_bs_wm_4),
 	bs_notimpl_bs_wm_8,
 
 	/* write region */
 	generic_bs_wr_1,
-	generic_armv4_bs_wr_2,
-	generic_bs_wr_4,
+	NSWAP(generic_armv4_bs_wr_2),
+	NSWAP(generic_bs_wr_4),
 	bs_notimpl_bs_wr_8,
 
 	/* set multiple */
@@ -117,8 +123,8 @@ struct bus_space bcm2835_bs_tag = {
 
 	/* set region */
 	generic_bs_sr_1,
-	generic_armv4_bs_sr_2,
-	bs_notimpl_bs_sr_4,
+	NSWAP(generic_armv4_bs_sr_2),
+	NSWAP(generic_bs_sr_4),
 	bs_notimpl_bs_sr_8,
 
 	/* copy */
@@ -130,38 +136,38 @@ struct bus_space bcm2835_bs_tag = {
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
 	/* read (single) */
 	generic_bs_r_1,
-	generic_armv4_bs_r_2,
-	generic_bs_r_4,
+	NSWAP(generic_armv4_bs_r_2),
+	NSWAP(generic_bs_r_4),
 	bs_notimpl_bs_r_8,
 
 	/* read multiple */
 	generic_bs_rm_1,
-	generic_armv4_bs_rm_2,
-	generic_bs_rm_4,
+	NSWAP(generic_armv4_bs_rm_2),
+	NSWAP(generic_bs_rm_4),
 	bs_notimpl_bs_rm_8,
 
 	/* read region */
 	generic_bs_rr_1,
-	generic_armv4_bs_rr_2,
-	generic_bs_rr_4,
+	NSWAP(generic_armv4_bs_rr_2),
+	NSWAP(generic_bs_rr_4),
 	bs_notimpl_bs_rr_8,
 
 	/* write (single) */
 	generic_bs_w_1,
-	generic_armv4_bs_w_2,
-	generic_bs_w_4,
+	NSWAP(generic_armv4_bs_w_2),
+	NSWAP(generic_bs_w_4),
 	bs_notimpl_bs_w_8,
 
 	/* write multiple */
 	generic_bs_wm_1,
-	generic_armv4_bs_wm_2,
-	generic_bs_wm_4,
+	NSWAP(generic_armv4_bs_wm_2),
+	NSWAP(generic_bs_wm_4),
 	bs_notimpl_bs_wm_8,
 
 	/* write region */
 	generic_bs_wr_1,
-	generic_armv4_bs_wr_2,
-	generic_bs_wr_4,
+	NSWAP(generic_armv4_bs_wr_2),
+	NSWAP(generic_bs_wr_4),
 	bs_notimpl_bs_wr_8,
 #endif
 };
@@ -173,7 +179,7 @@ struct bus_space bcm2835_a4x_bs_tag = {
 	/* mapping/unmapping */
 	bcm2835_bs_map,
 	bcm2835_bs_unmap,
-	bcm2835_bs_subregion,
+	bcm2835_a4x_bs_subregion,
 
 	/* allocation/deallocation */
 	bcm2835_bs_alloc,	/* not implemented */
@@ -183,21 +189,21 @@ struct bus_space bcm2835_a4x_bs_tag = {
 	bcm2835_bs_vaddr,
 
 	/* mmap */
-	bs_notimpl_bs_mmap,
+	bcm2835_a4x_bs_mmap,
 
 	/* barrier */
 	bcm2835_bs_barrier,
 
 	/* read (single) */
 	a4x_bs_r_1,
-	a4x_bs_r_2,
-	a4x_bs_r_4,
+	NSWAP(a4x_bs_r_2),
+	NSWAP(a4x_bs_r_4),
 	bs_notimpl_bs_r_8,
 
 	/* read multiple */
 	a4x_bs_rm_1,
-	a4x_bs_rm_2,
-	a4x_bs_rm_4,
+	NSWAP(a4x_bs_rm_2),
+	NSWAP(a4x_bs_rm_4),
 	bs_notimpl_bs_rm_8,
 
 	/* read region */
@@ -208,15 +214,16 @@ struct bus_space bcm2835_a4x_bs_tag = {
 
 	/* write (single) */
 	a4x_bs_w_1,
-	

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

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 20:17:40 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [netbsd-7]: pmap.c

Log Message:
Apply patch (requested by maxv in ticket #1531):
amd64: Make the direct map non executable.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.6 -r1.183.2.7 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.183.2.6 src/sys/arch/x86/x86/pmap.c:1.183.2.7
--- src/sys/arch/x86/x86/pmap.c:1.183.2.6	Mon Mar  6 03:27:19 2017
+++ src/sys/arch/x86/x86/pmap.c	Wed Jan  3 20:17:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.183.2.6 2017/03/06 03:27:19 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.183.2.7 2018/01/03 20:17:40 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.6 2017/03/06 03:27:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.7 2018/01/03 20:17:40 snj Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1523,7 +1523,7 @@ pmap_bootstrap(vaddr_t kva_start)
 		}
 	}
 
-	kpm->pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | PG_V | PG_U;
+	kpm->pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | PG_V | PG_U | pg_nx;
 
 	tlbflush();
 



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

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 20:06:06 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7]: locore.s

Log Message:
Pull up following revision(s) (requested by maya in ticket #1530):
sys/arch/sparc/sparc/locore.s: revision 1.269
Avoid an instruction requiring a higher alignment than we are guaranteed
Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.268.12.1 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.268 src/sys/arch/sparc/sparc/locore.s:1.268.12.1
--- src/sys/arch/sparc/sparc/locore.s:1.268	Sun Nov  4 00:32:47 2012
+++ src/sys/arch/sparc/sparc/locore.s	Wed Jan  3 20:06:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.268 2012/11/04 00:32:47 chs Exp $	*/
+/*	$NetBSD: locore.s,v 1.268.12.1 2018/01/03 20:06:06 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -6288,8 +6288,9 @@ ENTRY(longjmp)
 	cmp	%fp, %g7	! compare against desired frame
 	bl,a	1b		! if below,
 	 restore		!pop frame and loop
-	be,a	2f		! if there,
-	 ldd	[%g1+0], %o2	!fetch return %sp and pc, and get out
+	ld	[%g1+0], %o2	! fetch return %sp
+	be,a	2f		! we're there, get out
+	 ld	[%g1+4], %o3	! fetch return pc
 
 Llongjmpbotch:
 ! otherwise, went too far; bomb out



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

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 19:58:14 UTC 2018

Modified Files:
src/sys/arch/amd64/include [netbsd-7]: i82093reg.h
src/sys/arch/i386/include [netbsd-7]: i82093reg.h
src/sys/arch/x86/x86 [netbsd-7]: ioapic.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1527):
sys/arch/amd64/include/i82093reg.h: revision 1.9
sys/arch/i386/include/i82093reg.h: revision 1.11
sys/arch/x86/x86/ioapic.c: revision 1.54
Don't write a 1 to the read only RIRR bit in the IOAPIC redirection
register to fix "tlp0: filter setup and transmit timeout" observed
on Hyper-V VMs with the Legacy Network Adapter.
>From OpenBSD via PR kern/49323:
 https://marc.info/?l=openbsd-cvs=146718035432599=2


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.58.1 src/sys/arch/amd64/include/i82093reg.h
cvs rdiff -u -r1.8 -r1.8.58.1 src/sys/arch/i386/include/i82093reg.h
cvs rdiff -u -r1.48 -r1.48.8.1 src/sys/arch/x86/x86/ioapic.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/include/i82093reg.h
diff -u src/sys/arch/amd64/include/i82093reg.h:1.5 src/sys/arch/amd64/include/i82093reg.h:1.5.58.1
--- src/sys/arch/amd64/include/i82093reg.h:1.5	Thu Jul  3 14:02:25 2008
+++ src/sys/arch/amd64/include/i82093reg.h	Wed Jan  3 19:58:14 2018
@@ -1,4 +1,4 @@
-/*	 $NetBSD: i82093reg.h,v 1.5 2008/07/03 14:02:25 drochner Exp $ */
+/*	 $NetBSD: i82093reg.h,v 1.5.58.1 2018/01/03 19:58:14 snj Exp $ */
 
 #include 
 
@@ -50,6 +50,7 @@
 	movq	IOAPIC_SC_DATA(%rdi),%r15			;\
 	movl	(%r15),%esi	;\
 	orl	$IOAPIC_REDLO_MASK,%esi;\
+	andl	$~IOAPIC_REDLO_RIRR,%esi			;\
 	movl	%esi,(%r15)	;\
 	movq	IS_PIC(%r14),%rdi;\
 	ioapic_asm_unlock(num)
@@ -66,7 +67,7 @@
 	movq	IOAPIC_SC_DATA(%rdi),%r13			;\
 	movl	%esi, (%r15)	;\
 	movl	(%r13),%r12d	;\
-	andl	$~IOAPIC_REDLO_MASK,%r12d			;\
+	andl	$~(IOAPIC_REDLO_MASK|IOAPIC_REDLO_RIRR),%r12d	;\
 	movl	%esi,(%r15)	;\
 	movl	%r12d,(%r13)	;\
 	movq	IS_PIC(%r14),%rdi;\

Index: src/sys/arch/i386/include/i82093reg.h
diff -u src/sys/arch/i386/include/i82093reg.h:1.8 src/sys/arch/i386/include/i82093reg.h:1.8.58.1
--- src/sys/arch/i386/include/i82093reg.h:1.8	Thu Jul  3 14:02:25 2008
+++ src/sys/arch/i386/include/i82093reg.h	Wed Jan  3 19:58:14 2018
@@ -1,4 +1,4 @@
-/*	 $NetBSD: i82093reg.h,v 1.8 2008/07/03 14:02:25 drochner Exp $ */
+/*	 $NetBSD: i82093reg.h,v 1.8.58.1 2018/01/03 19:58:14 snj Exp $ */
 
 #include 
 
@@ -41,6 +41,7 @@
 	movl	IOAPIC_SC_DATA(%edi),%ebx			;\
 	movl	(%ebx),%esi	;\
 	orl	$IOAPIC_REDLO_MASK,%esi;\
+	andl	$~IOAPIC_REDLO_RIRR,%esi			;\
 	movl	%esi,(%ebx)	;\
 	movl	IS_PIC(%ebp),%edi;\
 	ioapic_asm_unlock(num)
@@ -64,7 +65,7 @@
 	movl	IOAPIC_SC_DATA(%edi),%eax			;\
 	movl	%esi, (%ebx)	;\
 	movl	(%eax),%edx	;\
-	andl	$~IOAPIC_REDLO_MASK,%edx			;\
+	andl	$~(IOAPIC_REDLO_MASK|IOAPIC_REDLO_RIRR),%edx	;\
 	movl	%esi, (%ebx)	;\
 	movl	%edx,(%eax)	;\
 	movl	IS_PIC(%ebp),%edi;\

Index: src/sys/arch/x86/x86/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.48 src/sys/arch/x86/x86/ioapic.c:1.48.8.1
--- src/sys/arch/x86/x86/ioapic.c:1.48	Fri Jun 28 14:31:49 2013
+++ src/sys/arch/x86/x86/ioapic.c	Wed Jan  3 19:58:14 2018
@@ -1,4 +1,4 @@
-/* 	$NetBSD: ioapic.c,v 1.48 2013/06/28 14:31:49 jakllsch Exp $	*/
+/* 	$NetBSD: ioapic.c,v 1.48.8.1 2018/01/03 19:58:14 snj Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.48 2013/06/28 14:31:49 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.48.8.1 2018/01/03 19:58:14 snj Exp $");
 
 #include "opt_ddb.h"
 
@@ -506,6 +506,7 @@ ioapic_hwmask(struct pic *pic, int pin)
 	flags = ioapic_lock(sc);
 	redlo = ioapic_read_ul(sc, IOAPIC_REDLO(pin));
 	redlo |= IOAPIC_REDLO_MASK;
+	redlo &= ~IOAPIC_REDLO_RIRR;
 	ioapic_write_ul(sc, IOAPIC_REDLO(pin), redlo);
 	ioapic_unlock(sc, flags);
 }
@@ -546,7 +547,7 @@ ioapic_hwunmask(struct pic *pic, int pin
 
 	flags = ioapic_lock(sc);
 	redlo = ioapic_read_ul(sc, IOAPIC_REDLO(pin));
-	redlo &= ~IOAPIC_REDLO_MASK;
+	redlo &= ~(IOAPIC_REDLO_MASK | IOAPIC_REDLO_RIRR);
 	ioapic_write_ul(sc, IOAPIC_REDLO(pin), redlo);
 	ioapic_unlock(sc, flags);
 }



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

2017-12-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 12 09:12:57 UTC 2017

Modified Files:
src/sys/arch/x86/x86 [netbsd-7]: fpu.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1540):
sys/arch/x86/x86/fpu.c: 1.19 via patch
Mask mxcsr, otherwise userland could set reserved bits to 1 and make
xrstor fault.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.8.1 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/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.9 src/sys/arch/x86/x86/fpu.c:1.9.8.1
--- src/sys/arch/x86/x86/fpu.c:1.9	Tue Feb 25 22:16:52 2014
+++ src/sys/arch/x86/x86/fpu.c	Tue Dec 12 09:12:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.9 2014/02/25 22:16:52 dsl Exp $	*/
+/*	$NetBSD: fpu.c,v 1.9.8.1 2017/12/12 09:12:57 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.9 2014/02/25 22:16:52 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.9.8.1 2017/12/12 09:12:57 snj Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -617,6 +617,7 @@ process_write_fpregs_xmm(struct lwp *lwp
 		sizeof fpu_save->sv_xmm);
 		/* Invalid bits in the mxcsr_mask will cause faults */
 		fpu_save->sv_xmm.fx_mxcsr_mask &= __INITIAL_MXCSR_MASK__;
+		fpu_save->sv_xmm.fx_mxcsr &= fpu_save->sv_xmm.fx_mxcsr_mask;
 	} else {
 		process_xmm_to_s87(fpregs, _save->sv_87);
 	}



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

2017-12-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec  3 10:29:12 UTC 2017

Modified Files:
src/sys/arch/arm/cortex [netbsd-7]: a9_mpsubr.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1524):
sys/arch/arm/cortex/a9_mpsubr.S: revision 1.52
Ensure CNTVOFF is 0 before dropping out of Hyp mode


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.5 -r1.18.2.6 src/sys/arch/arm/cortex/a9_mpsubr.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/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.18.2.5 src/sys/arch/arm/cortex/a9_mpsubr.S:1.18.2.6
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.18.2.5	Sat Jul  8 17:01:52 2017
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Sun Dec  3 10:29:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.18.2.5 2017/07/08 17:01:52 snj Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.18.2.6 2017/12/03 10:29:12 snj Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -338,6 +338,10 @@ cortex_init:
 	teq	r0, #(PSR_HYP32_MODE)	/* Hyp Mode? */
 	bne	1f
 
+	/* Set CNTVOFF to 0 */
+	mov	r0, #0
+	mcrr	p15, 4, r0, r0, c14
+
 	/* Ensure that IRQ, and FIQ will be disabled after eret */
 	mrs	r0, cpsr
 	bic	r0, r0, #(PSR_MODE)



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

2017-10-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  1 17:01:47 UTC 2017

Modified Files:
src/sys/arch/i386/i386 [netbsd-7]: i386_trap.S

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1512):
sys/arch/i386/i386/i386_trap.S: revision 1.12
Pfff, use %ss and not %ds. The latter is controlled by userland, the former
contains the kernel value (flat); FreeBSD fixed this too a few weeks ago.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.6.1 src/sys/arch/i386/i386/i386_trap.S

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

Modified files:

Index: src/sys/arch/i386/i386/i386_trap.S
diff -u src/sys/arch/i386/i386/i386_trap.S:1.5 src/sys/arch/i386/i386/i386_trap.S:1.5.6.1
--- src/sys/arch/i386/i386/i386_trap.S:1.5	Wed Feb 12 23:24:09 2014
+++ src/sys/arch/i386/i386/i386_trap.S	Sun Oct  1 17:01:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap.S,v 1.5 2014/02/12 23:24:09 dsl Exp $	*/
+/*	$NetBSD: i386_trap.S,v 1.5.6.1 2017/10/01 17:01:47 snj Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.5 2014/02/12 23:24:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.5.6.1 2017/10/01 17:01:47 snj Exp $");
 #endif
 
 /*
@@ -119,7 +119,7 @@ IDTVEC_END(trap05)
 	SUPERALIGN_TEXT
 IDTVEC(trap06)
 	/* Check if there is no DTrace hook registered. */
-	cmpl	$0,dtrace_invop_jump_addr
+	cmpl	$0,%ss:dtrace_invop_jump_addr
 	je	norm_ill
 
 	/* Check if this is a user fault. */



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

2017-09-24 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Sep 24 20:12:57 UTC 2017

Modified Files:
src/sys/arch/evbmips/conf [netbsd-7]: MALTA MALTA32 MALTA64
src/sys/arch/mips/mips [netbsd-7]: bds_emul.S

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1500):
sys/arch/evbmips/conf/MALTA64: revision 1.8
sys/arch/evbmips/conf/MALTA32: revision 1.4
sys/arch/mips/mips/bds_emul.S: revision 1.9
sys/arch/evbmips/conf/MALTA: revision 1.88
Re-enable the NOFPU and (renamed) FPEMUL options.  None of the Malta
CPU daughter cards currently supported by NetBSD have an FPU.
Detected on real hardware.  gxemul wrongly supports an FPU on the
4Kc and 5Kc CPUs.
--
Remove the NOFPU option.  The main MALTA config file has this now.
--
mips_emul_daddi and mips_emul_daddiu don't exist, but there are
bcemul_daddi and bcemul_daddiu here that should be used.  however,
bcemul_daddi needed to be changed to use dadd not daddui.
fixes FPEMUL and N64 kernels.  ok simonb.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/arch/evbmips/conf/MALTA
cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/arch/evbmips/conf/MALTA32
cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/arch/evbmips/conf/MALTA64
cvs rdiff -u -r1.6 -r1.6.22.1 src/sys/arch/mips/mips/bds_emul.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/evbmips/conf/MALTA
diff -u src/sys/arch/evbmips/conf/MALTA:1.78 src/sys/arch/evbmips/conf/MALTA:1.78.2.1
--- src/sys/arch/evbmips/conf/MALTA:1.78	Sun Jul 20 10:06:11 2014
+++ src/sys/arch/evbmips/conf/MALTA	Sun Sep 24 20:12:57 2017
@@ -1,17 +1,18 @@
-#	$NetBSD: MALTA,v 1.78 2014/07/20 10:06:11 alnsn Exp $
+#	$NetBSD: MALTA,v 1.78.2.1 2017/09/24 20:12:57 snj Exp $
 
 include 	"arch/evbmips/conf/std.malta"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"MALTA-$Revision: 1.78 $"
+#ident 		"MALTA-$Revision: 1.78.2.1 $"
 
 maxusers	32
 
 options 	MIPS32
 options 	MIPS64
-#options 	NOFPU		# No FPU
-#options 	FPEMUL		# emulate FPU insn
+
+options 	NOFPU		# No FPU
+options 	FPEMUL		# emulate FPU insn
 
 # Options for necessary to use MD
 # options 	MEMORY_DISK_HOOKS

Index: src/sys/arch/evbmips/conf/MALTA32
diff -u src/sys/arch/evbmips/conf/MALTA32:1.3 src/sys/arch/evbmips/conf/MALTA32:1.3.22.1
--- src/sys/arch/evbmips/conf/MALTA32:1.3	Thu Feb  9 18:58:44 2012
+++ src/sys/arch/evbmips/conf/MALTA32	Sun Sep 24 20:12:57 2017
@@ -1,11 +1,10 @@
-# $NetBSD: MALTA32,v 1.3 2012/02/09 18:58:44 matt Exp $
+# $NetBSD: MALTA32,v 1.3.22.1 2017/09/24 20:12:57 snj Exp $
 #
 include "arch/evbmips/conf/MALTA"
 
 makeoptions	LP64="no"
 
 no options	MIPS32
-options 	NOFPU		# No FPU
 #options 	EXEC_ELF64
 
 no ath*

Index: src/sys/arch/evbmips/conf/MALTA64
diff -u src/sys/arch/evbmips/conf/MALTA64:1.6 src/sys/arch/evbmips/conf/MALTA64:1.6.12.1
--- src/sys/arch/evbmips/conf/MALTA64:1.6	Sat Oct 13 06:08:11 2012
+++ src/sys/arch/evbmips/conf/MALTA64	Sun Sep 24 20:12:57 2017
@@ -1,11 +1,10 @@
-# $NetBSD: MALTA64,v 1.6 2012/10/13 06:08:11 riz Exp $
+# $NetBSD: MALTA64,v 1.6.12.1 2017/09/24 20:12:57 snj Exp $
 #
 include "arch/evbmips/conf/MALTA"
 
 makeoptions	LP64="yes"
 
 no options 	MIPS32
-options 	NOFPU			# No FPU
 options 	EXEC_ELF64
 options 	COMPAT_NETBSD32
 no options 	SYMTAB_SPACE

Index: src/sys/arch/mips/mips/bds_emul.S
diff -u src/sys/arch/mips/mips/bds_emul.S:1.6 src/sys/arch/mips/mips/bds_emul.S:1.6.22.1
--- src/sys/arch/mips/mips/bds_emul.S:1.6	Sun Dec 25 11:51:15 2011
+++ src/sys/arch/mips/mips/bds_emul.S	Sun Sep 24 20:12:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bds_emul.S,v 1.6 2011/12/25 11:51:15 kiyohara Exp $	*/
+/*	$NetBSD: bds_emul.S,v 1.6.22.1 2017/09/24 20:12:57 snj Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -101,8 +101,8 @@ bcemul_optbl:
 	PTR_WORD bcemul_sigill			# 030 LDL (*)
 	PTR_WORD bcemul_sigill			# 031 LDR (*)
 #else
-	PTR_WORD _C_LABEL(mips_emul_daddi)	# 030 DADDI (*)
-	PTR_WORD _C_LABEL(mips_emul_daddiu)	# 031 DADDIU (*)
+	PTR_WORD bcemul_daddi			# 030 DADDI (*)
+	PTR_WORD bcemul_daddiu			# 031 DADDIU (*)
 	PTR_WORD _C_LABEL(mips_emul_ldl)	# 032 LDL (*)
 	PTR_WORD _C_LABEL(mips_emul_ldr)	# 033 LDR (*)
 #endif
@@ -191,7 +191,7 @@ bcemul_uimmed_prologue:
 #ifndef __mips_o32
 bcemul_daddi:
 	bal	bcemul_immed_prologue
-	daddiu	t0, v0, v1
+	dadd	t0, v0, v1
 	b	bcemul_check_add_overflow
 #endif
 



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

2017-09-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Sep 11 05:50:12 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1505):
sys/arch/x86/x86/procfs_machdep.c: 1.15-1.16
- Print 0x0007:0 ecx leaf bits.
- Don't print fdiv_bug on amd64.
- Print APIC ID, Initial APIC ID and clflush size.
--
Check buffer length correctly to not to print a garbage character.
Fixes PR#52352 reported by Yasushi Oshima.


To generate a diff of this commit:
cvs rdiff -u -r1.6.4.2 -r1.6.4.3 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.6.4.2 src/sys/arch/x86/x86/procfs_machdep.c:1.6.4.3
--- src/sys/arch/x86/x86/procfs_machdep.c:1.6.4.2	Thu Dec  8 08:06:38 2016
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Sep 11 05:50:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.6.4.2 2016/12/08 08:06:38 snj Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.6.4.3 2017/09/11 05:50:12 snj Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.2 2016/12/08 08:06:38 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.3 2017/09/11 05:50:12 snj Exp $");
 
 #include 
 #include 
@@ -131,7 +131,7 @@ static const char * const x86_features[]
 	"clwb", NULL, "avx512pf", "avx512er",
 	"avx512cd", "sha_ni", "avx512bw", "avx512vl"},
 
-	{ /* (10) 000d eax */
+	{ /* (10) 0x000d eax */
 	"xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -148,6 +148,38 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (13) 0x8008 ebx */
+	"clzero", "irperf", 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, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (14) 0x0006 eax */
+	"dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
+	"hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req",
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (15) 0x800a edx */
+	"npt", "lbrv", "svm_lock", "nrip_save",
+	"tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
+	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (16) 0x0007:0 ecx */
+	NULL, "avx512vbmi", NULL, "pku", "ospke", NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, "avx512_vpopcntdq", NULL,
+	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (17) 0x8007 ebx */
+	"overflow_recov", "succor", "smca", 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, NULL, NULL, NULL, NULL},
 };
 
 static int	procfs_getonecpu(int, struct cpu_info *, char *, size_t *);
@@ -171,7 +203,7 @@ procfs_getcpuinfstr(char *bf, size_t *le
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		procfs_getonecpu(i++, ci, bf, );
 		total += used + 1;
-		if (used + 1 < size) {
+		if (used + 1 <= size) {
 			bf += used;
 			*bf++ = '\n';
 			size -= used + 1;
@@ -246,9 +278,18 @@ procfs_getonecpufeatures(struct cpu_info
 	left);
 	diff = last - *left;
 
-	/* (10) 000d eax */
+	/* (10) 0x000d eax */
 	/* (11) 0x000f(ecx=0) edx */
 	/* (12) 0x000f(ecx=1) edx */
+	/* (13) 0x8008 ebx */
+	/* (14) 0x0006 eax */
+	/* (15) 0x800a edx */
+
+	procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff,
+	left);
+	diff = last - *left;
+
+	/* (17) 0x8007 ebx */
 
 	return 0; /* XXX */
 }
@@ -318,17 +359,36 @@ 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,
+	ci->ci_initapicid
+	);
+	size += l;
+	if (l < left) {
+		left -= l;
+		p += l;
+	} else
+		left = 0;
+
+	l = snprintf(p, left,
+#ifdef __i386__
 	"fdiv_bug\t: %s\n"
+#endif
 	"fpu\t\t: %s\n"
 	"fpu_exception\t: yes\n"
 	"cpuid level\t: %d\n"
 	"wp\t\t: %s\n"
-	"flags\t\t: %s\n",
+	"flags\t\t: %s\n"
+	"clflush size\t: %d\n",
+#ifdef __i386__
 	i386_fpu_fdivbug ? "yes" : "no",	/* an old pentium */
+#endif
 	i386_fpu_present ? "yes" : "no",	/* not a 486SX */
 	cpuid_level,
 	(rcr0() & CR0_WP) ? "yes" : 

CVS commit: [netbsd-7] src/sys/arch/sparc64/sparc64

2017-09-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Sep  4 16:09:12 UTC 2017

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-7]: compat_13_machdep.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1504):
sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.
ok martin


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.38.1 \
src/sys/arch/sparc64/sparc64/compat_13_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/sparc64/sparc64/compat_13_machdep.c
diff -u src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23 src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23.38.1
--- src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23	Sat Nov 21 04:16:52 2009
+++ src/sys/arch/sparc64/sparc64/compat_13_machdep.c	Mon Sep  4 16:09:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $	*/
+/*	$NetBSD: compat_13_machdep.c,v 1.23.38.1 2017/09/04 16:09:12 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23.38.1 2017/09/04 16:09:12 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -129,7 +129,7 @@ compat_13_sys_sigreturn(struct lwp *l, c
 		return (EINVAL);
 	/* take only psr ICC field */
 #ifdef __arch64__
-	tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | scp->sc_tstate;
+	tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | (scp->sc_tstate & TSTATE_CCR);
 #else
 	tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(scp->sc_psr);
 #endif



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

2017-08-24 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Aug 24 06:52:07 UTC 2017

Modified Files:
src/sys/arch/i386/conf [netbsd-7]: GENERIC

Log Message:
Apply patch (requested by maxv in ticket #1463):
i386 GENERIC: disable VM86 by default.


To generate a diff of this commit:
cvs rdiff -u -r1.1107.2.11 -r1.1107.2.12 src/sys/arch/i386/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/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1107.2.11 src/sys/arch/i386/conf/GENERIC:1.1107.2.12
--- src/sys/arch/i386/conf/GENERIC:1.1107.2.11	Tue Jul 25 19:43:03 2017
+++ src/sys/arch/i386/conf/GENERIC	Thu Aug 24 06:52:06 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1107.2.11 2017/07/25 19:43:03 snj Exp $
+# $NetBSD: GENERIC,v 1.1107.2.12 2017/08/24 06:52:06 snj Exp $
 #
 # GENERIC machine description file
 #
@@ -22,12 +22,12 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.1107.2.11 $"
+#ident 		"GENERIC-$Revision: 1.1107.2.12 $"
 
 maxusers	64		# estimated number of users
 
 # CPU-related options.
-options 	VM86		# virtual 8086 emulation
+#options 	VM86		# virtual 8086 emulation
 options 	USER_LDT	# user-settable LDT; used by WINE
 #options 	PAE		# PAE mode (36 bits physical addressing)
 



CVS commit: [netbsd-7] src/sys/arch/mac68k/nubus

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug 11 15:33:01 UTC 2017

Modified Files:
src/sys/arch/mac68k/nubus [netbsd-7]: if_netdock_nubus.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1468):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.12.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.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/nubus/if_netdock_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.22 src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.22.12.1
--- src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.22	Sat Oct 27 17:17:59 2012
+++ src/sys/arch/mac68k/nubus/if_netdock_nubus.c	Fri Aug 11 15:33:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_netdock_nubus.c,v 1.22 2012/10/27 17:17:59 chs Exp $	*/
+/*	$NetBSD: if_netdock_nubus.c,v 1.22.12.1 2017/08/11 15:33:01 snj Exp $	*/
 
 /*
  * Copyright (C) 2000,2002 Daishi Kato 
@@ -43,7 +43,7 @@
 /***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.22 2012/10/27 17:17:59 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.22.12.1 2017/08/11 15:33:01 snj Exp $");
 
 #include 
 #include 
@@ -804,6 +804,8 @@ netdock_get(struct netdock_softc *sc, in
 			if ((m->m_flags & M_EXT) == 0) {
 if (top)
 	m_freem(top);
+else
+	m_freem(m);
 return (NULL);
 			}
 			len = MCLBYTES;



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

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug 11 15:21:38 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus [netbsd-7]: if_sn.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1467):
sys/arch/newsmips/apbus/if_sn.c: revision 1.39
Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.12.1 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.34 src/sys/arch/newsmips/apbus/if_sn.c:1.34.12.1
--- src/sys/arch/newsmips/apbus/if_sn.c:1.34	Sat Oct 13 06:24:15 2012
+++ src/sys/arch/newsmips/apbus/if_sn.c	Fri Aug 11 15:21:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.34 2012/10/13 06:24:15 tsutsui Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.34.12.1 2017/08/11 15:21:38 snj Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.34 2012/10/13 06:24:15 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.34.12.1 2017/08/11 15:21:38 snj Exp $");
 
 #include "opt_inet.h"
 
@@ -1093,7 +1093,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 		if (datalen >= MINCLSIZE) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-if (top) m_freem(top);
+if (top)
+	m_freem(top);
+else
+	m_freem(m);
 return 0;
 			}
 			len = MCLBYTES;



CVS commit: [netbsd-7] src/sys/arch/hpcsh/dev

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:56:02 UTC 2017

Modified Files:
src/sys/arch/hpcsh/dev [netbsd-7]: pfckbd.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1466):
sys/arch/hpcsh/dev/pfckbd.c: revision 1.30
Don't reschedule the callout in the scanning function itself, as that
conflicts with using the same function for polled console.
Makes early ddb work with wscons console again on my Jornada 690.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.22.1 src/sys/arch/hpcsh/dev/pfckbd.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/hpcsh/dev/pfckbd.c
diff -u src/sys/arch/hpcsh/dev/pfckbd.c:1.29 src/sys/arch/hpcsh/dev/pfckbd.c:1.29.22.1
--- src/sys/arch/hpcsh/dev/pfckbd.c:1.29	Sun Feb 12 16:34:08 2012
+++ src/sys/arch/hpcsh/dev/pfckbd.c	Wed Aug  9 06:56:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfckbd.c,v 1.29 2012/02/12 16:34:08 matt Exp $	*/
+/*	$NetBSD: pfckbd.c,v 1.29.22.1 2017/08/09 06:56:02 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  * currently, HP Jornada 680/690, HITACHI PERSONA HPW-50PAD only.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pfckbd.c,v 1.29 2012/02/12 16:34:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfckbd.c,v 1.29.22.1 2017/08/09 06:56:02 snj Exp $");
 
 #include "debug_hpcsh.h"
 
@@ -66,7 +66,7 @@ static struct pfckbd_core {
 	struct hpckbd_ic_if pc_if;
 	struct hpckbd_if *pc_hpckbd;
 	uint16_t pc_column[8];
-	void (*pc_callout)(void *);
+	void (*pc_callout)(struct pfckbd_core *);
 } pfckbd_core;
 
 static int pfckbd_match(device_t, cfdata_t, void *);
@@ -83,17 +83,17 @@ static int pfckbd_poll(void *);
 
 static void pfckbd_input(struct pfckbd_core *, int, uint16_t);
 
-static void (*pfckbd_callout_lookup(void))(void *);
-static void pfckbd_callout_unknown(void *);
-static void pfckbd_callout_hp(void *);
-static void pfckbd_callout_hitachi(void *);
+static void (*pfckbd_callout_lookup(void))(struct pfckbd_core *);
+static void pfckbd_callout(void *);
+static void pfckbd_callout_hp(struct pfckbd_core *);
+static void pfckbd_callout_hitachi(struct pfckbd_core *);
 void pfckbd_poll_hitachi_power(void);
 
 
 /* callout function table. this function is platfrom specific. */
 static const struct {
 	platid_mask_t *platform;
-	void (*func)(void *);
+	void (*func)(struct pfckbd_core *);
 } pfckbd_calloutfunc_table[] = {
 	{ _mask_MACH_HP		, pfckbd_callout_hp },
 	{ _mask_MACH_HITACHI	, pfckbd_callout_hitachi }
@@ -144,9 +144,13 @@ pfckbd_attach(device_t parent, device_t 
 	config_found(self, , hpckbd_print);
 
 	/* install callout handler */
-	callout_init(_core.pc_soft_ch, 0);
-	callout_reset(_core.pc_soft_ch, 1,
-		  pfckbd_core.pc_callout, _core);
+	if (pfckbd_core.pc_callout != NULL) {
+		callout_init(_core.pc_soft_ch, 0);
+		callout_reset(_core.pc_soft_ch, 1,
+			  pfckbd_callout, _core);
+	}
+	else
+		aprint_error_dev(self, "unsupported platform\n");
 
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "unable to establish power handler\n");
@@ -191,12 +195,22 @@ pfckbd_poll(void *ic)
 {
 	struct pfckbd_core *pc = ic;
 
-	if (pc->pc_enabled)
+	if (pc->pc_enabled && pc->pc_callout != NULL)
 		(*pc->pc_callout)(pc);
 
 	return 0;
 }
 
+static void
+pfckbd_callout(void *arg)
+{
+	struct pfckbd_core *pc = arg;
+
+	(*pc->pc_callout)(pc);
+	callout_schedule(>pc_soft_ch, 1);
+}
+
+
 /*
  * Called by platform specific scan routines to report key events to hpckbd
  */
@@ -230,7 +244,7 @@ pfckbd_input(struct pfckbd_core *pc, int
 
 /* Look up appropriate callback handler */
 static void
-(*pfckbd_callout_lookup(void))(void *)
+(*pfckbd_callout_lookup(void))(struct pfckbd_core *)
 {
 	int i, n;
 
@@ -242,22 +256,14 @@ static void
  pfckbd_calloutfunc_table[i].platform))
 			return pfckbd_calloutfunc_table[i].func;
 
-	return pfckbd_callout_unknown;
-}
-
-/* Placeholder for unknown platform */
-static void
-pfckbd_callout_unknown(void *arg)
-{
-
-	printf("%s: unknown keyboard switch\n", __func__);
+	return NULL;
 }
 
 /*
  * HP Jornada680/690, HP620LX
  */
 static void
-pfckbd_callout_hp(void *arg)
+pfckbd_callout_hp(struct pfckbd_core *pc)
 {
 #define PFCKBD_HP_PDCR_MASK 0xcc0c
 #define PFCKBD_HP_PECR_MASK 0xf0cf
@@ -288,13 +294,12 @@ pfckbd_callout_hp(void *arg)
 #undef PD
 #undef PE
 
-	struct pfckbd_core *pc = arg;
 	uint16_t dc, ec;
 	int column;
 	uint16_t data;
 
 	if (!pc->pc_enabled)
-		goto reinstall;
+		return;
 
 	/* bits in D/E control regs we do not touch (XXX: can they change?) */
 	dc = _reg_read_2(SH7709_PDCR) & ~PFCKBD_HP_PDCR_MASK;
@@ -330,16 +335,13 @@ pfckbd_callout_hp(void *arg)
 	/* (ignore) extra keys/events (recorder buttons, lid, cable ) */
 	data = _reg_read_1(SH7709_PGDR) | (_reg_read_1(SH7709_PHDR) << 8);
 #endif
-
- reinstall:
-	callout_schedule(>pc_soft_ch, 1);
 }
 
 /*
  * HITACH PERSONA 

CVS commit: [netbsd-7] src/sys/arch/evbarm/rpi

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:40:25 UTC 2017

Modified Files:
src/sys/arch/evbarm/rpi [netbsd-7]: rpi_machdep.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1464):
sys/arch/evbarm/rpi/rpi_machdep.c: 1.71 via patch
Disable BSC0 on Raspberry Pi 3 and Zero W boards.


To generate a diff of this commit:
cvs rdiff -u -r1.43.2.7 -r1.43.2.8 src/sys/arch/evbarm/rpi/rpi_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/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.43.2.7 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.43.2.8
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.43.2.7	Wed Jul 26 15:22:37 2017
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Wed Aug  9 06:40:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.43.2.7 2017/07/26 15:22:37 snj Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.43.2.8 2017/08/09 06:40:25 snj Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.43.2.7 2017/07/26 15:22:37 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.43.2.8 2017/08/09 06:40:25 snj Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1033,6 +1034,21 @@ rpi_device_register(device_t dev, void *
 		}
 	}
 #endif
+
+	/* BSC0 is used internally on some boards */
+	if (device_is_a(dev, "bsciic") &&
+	((struct amba_attach_args *)aux)->aaa_addr == BCM2835_BSC0_BASE) {
+		const uint32_t rev = vb.vbt_boardrev.rev;
+
+		if ((rev & VCPROP_REV_ENCFLAG) != 0) {
+			switch (__SHIFTOUT(rev, VCPROP_REV_MODEL)) {
+			case RPI_MODEL_B_PI3:
+			case RPI_MODEL_ZERO_W:
+prop_dictionary_set_bool(dict, "disable", true);
+break;
+			}
+		}
+	}
 }
 
 SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl machdep subtree setup (rpi)")



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

2017-07-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jul 23 06:14:04 UTC 2017

Modified Files:
src/sys/arch/arm/arm [netbsd-7]: cpufunc_asm_arm11x6.S
src/sys/arch/arm/arm32 [netbsd-7]: genassym.cf

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1452):
sys/arch/arm/arm32/genassym.cf: revision 1.75
sys/arch/arm/arm/cpufunc_asm_arm11x6.S: revision 1.8
In idcache_wbinv_range if the range size is bigger than the dcache size
then call idcache_wbinv_all
Avoids a problem with large ranges as seen in
port-evbarm/52169: setting dtrace module to load cause Pi to hang on boot


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S
cvs rdiff -u -r1.69.2.1 -r1.69.2.2 src/sys/arch/arm/arm32/genassym.cf

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/cpufunc_asm_arm11x6.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7.2.1
--- src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7	Wed Jul 30 13:31:17 2014
+++ src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S	Sun Jul 23 06:14:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.7 2014/07/30 13:31:17 skrll Exp $	*/
+/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.2.1 2017/07/23 06:14:03 snj Exp $	*/
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -63,7 +63,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.7 2014/07/30 13:31:17 skrll Exp $")
+RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.2.1 2017/07/23 06:14:03 snj Exp $")
 
 #if 0
 #define Invalidate_I_cache(Rtmp1, Rtmp2) \
@@ -164,6 +164,11 @@ ENTRY_NP(arm11x6_icache_sync_range)
 END(arm11x6_icache_sync_range)
 
 ENTRY_NP(arm11x6_idcache_wbinv_range)
+	ldr	r2, .Larm_pcache
+	ldr	r2, [r2, #DCACHE_SIZE]
+	cmp	r1, r2
+	bge	arm11x6_idcache_wbinv_all
+
 	add	r1, r1, r0
 	sub	r1, r1, #1
 	/* Erratum ARM1136 371025, workaround #2 */
@@ -212,3 +217,6 @@ ENTRY_NP(arm11x6_sleep)
 	bne	1b
 	RET
 END(arm11x6_sleep)
+
+.Larm_pcache:
+	.word arm_pcache

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.69.2.1 src/sys/arch/arm/arm32/genassym.cf:1.69.2.2
--- src/sys/arch/arm/arm32/genassym.cf:1.69.2.1	Fri Mar 27 11:27:39 2015
+++ src/sys/arch/arm/arm32/genassym.cf	Sun Jul 23 06:14:04 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.69.2.1 2015/03/27 11:27:39 martin Exp $
+#	$NetBSD: genassym.cf,v 1.69.2.2 2017/07/23 06:14:04 snj Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -248,3 +248,6 @@ define	M_DATAoffsetof(struct mbuf, m
 define	M_NEXToffsetof(struct mbuf, m_next)
 define	IP_SRCoffsetof(struct ip, ip_src)
 define	IP_DSToffsetof(struct ip, ip_dst)
+
+# Cache information
+define	DCACHE_SIZE		offsetof(struct arm_cache_info, dcache_size)



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

2017-07-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 20 01:43:41 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7]: locore.S
src/sys/arch/i386/i386 [netbsd-7]: locore.S machdep.c trap.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1441):
sys/arch/i386/i386/trap.c: revision 1.288 via patch
sys/arch/i386/i386/machdep.c: revision 1.783 via patch
sys/arch/i386/i386/locore.S: revision 1.146 via patch
sys/arch/amd64/amd64/locore.S: revision 1.124 via patch
Remove the osyscall call gate on i386, and emulate it. There is a one-
instruction race in it that could panic the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.76.2.1 -r1.76.2.2 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.112 -r1.112.4.1 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.752 -r1.752.4.1 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.272.4.1 -r1.272.4.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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.76.2.1 src/sys/arch/amd64/amd64/locore.S:1.76.2.2
--- src/sys/arch/amd64/amd64/locore.S:1.76.2.1	Wed Apr 26 14:52:50 2017
+++ src/sys/arch/amd64/amd64/locore.S	Thu Jul 20 01:43:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.76.2.1 2017/04/26 14:52:50 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.76.2.2 2017/07/20 01:43:40 snj Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1298,7 +1298,6 @@ IDTVEC(osyscall)
 	addq $0x10,%rsp
 #endif
 	pushq	$2		# size of instruction for restart
-osyscall1:
 	pushq	$T_ASTFLT	# trap # for doing ASTs
 	INTRENTRY
 	STI(si)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.112 src/sys/arch/i386/i386/locore.S:1.112.4.1
--- src/sys/arch/i386/i386/locore.S:1.112	Thu Feb 20 18:19:10 2014
+++ src/sys/arch/i386/i386/locore.S	Thu Jul 20 01:43:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.112 2014/02/20 18:19:10 dsl Exp $	*/
+/*	$NetBSD: locore.S,v 1.112.4.1 2017/07/20 01:43:40 snj Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -129,7 +129,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.112 2014/02/20 18:19:10 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.112.4.1 2017/07/20 01:43:40 snj Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_ddb.h"
@@ -1144,30 +1144,12 @@ ENTRY(savectx)
 END(savectx)
 
 /*
- * osyscall()
- *
- * Old call gate entry for syscall
- */
-IDTVEC(osyscall)
-#ifndef XEN
-	/* XXX we are in trouble! interrupts be off here. */
-	cli			# must be first instruction
-#endif
-	pushfl			# set eflags in trap frame
-	popl	8(%esp)
-	orl	$PSL_I,8(%esp)	# re-enable ints on return to user
-	pushl	$7		# size of instruction for restart
-	jmp	syscall1
-IDTVEC_END(osyscall)
-
-/*
  * syscall()
  *
  * Trap gate entry for syscall
  */
 IDTVEC(syscall)
 	pushl	$2		# size of instruction for restart
-syscall1:
 	pushl	$T_ASTFLT	# trap # for doing ASTs
 	INTRENTRY
 	STI(%eax)

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.752 src/sys/arch/i386/i386/machdep.c:1.752.4.1
--- src/sys/arch/i386/i386/machdep.c:1.752	Sun Feb 23 22:36:43 2014
+++ src/sys/arch/i386/i386/machdep.c	Thu Jul 20 01:43:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.752 2014/02/23 22:36:43 dsl Exp $	*/
+/*	$NetBSD: machdep.c,v 1.752.4.1 2017/07/20 01:43:40 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.752 2014/02/23 22:36:43 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.752.4.1 2017/07/20 01:43:40 snj Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -924,7 +924,6 @@ setsegment(struct segment_descriptor *sd
 #define	IDTVEC(name)	__CONCAT(X, name)
 typedef void (vector)(void);
 extern vector IDTVEC(syscall);
-extern vector IDTVEC(osyscall);
 extern vector *IDTVEC(exceptions)[];
 extern vector IDTVEC(svr4_fasttrap);
 void (*svr4_fasttrap_vec)(void) = (void (*)(void))nullop;
@@ -1345,13 +1344,9 @@ init386(paddr_t first_avail)
 #endif /* XEN */
 
 	/* make ldt gates and memory segments */
-	setgate([LSYS5CALLS_SEL].gd, (osyscall), 1,
-	SDT_SYS386CGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL));
-
 	ldt[LUCODE_SEL] = gdt[GUCODE_SEL];
 	ldt[LUCODEBIG_SEL] = gdt[GUCODEBIG_SEL];
 	ldt[LUDATA_SEL] = gdt[GUDATA_SEL];
-	ldt[LSOL26CALLS_SEL] = ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL];
 
 #ifndef XEN
 	/* exceptions */

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.272.4.1 src/sys/arch/i386/i386/trap.c:1.272.4.2
--- src/sys/arch/i386/i386/trap.c:1.272.4.1	Sat Mar 25 16:57:40 2017
+++ src/sys/arch/i386/i386/trap.c	Thu Jul 20 01:43:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.272.4.1 2017/03/25 16:57:40 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.272.4.2 2017/07/20 01:43:40 snj Exp $	*/
 
 /*-
  * 

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

2017-07-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jul  8 17:04:22 UTC 2017

Modified Files:
src/sys/arch/amd64/conf [netbsd-7]: XEN3_DOM0
src/sys/arch/i386/conf [netbsd-7]: XEN3_DOM0
src/sys/arch/xen/conf [netbsd-7]: files.xen

Log Message:
Pull up following revision(s) (requested by khorben in ticket #1445):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.136
sys/arch/i386/conf/XEN3_DOM0: revision 1.113
sys/arch/xen/conf/files.xen: revision 1.148
Register support for SD card readers with Xen DOM0 kernels
Tested on a Lenovo ThinkPad T440s (amd64)


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.8 -r1.103.2.9 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.85.2.8 -r1.85.2.9 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.133.4.2 -r1.133.4.3 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/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.8 src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.9
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.8	Sat May 13 06:28:59 2017
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat Jul  8 17:04:21 2017
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.103.2.8 2017/05/13 06:28:59 snj Exp $
+# $NetBSD: XEN3_DOM0,v 1.103.2.9 2017/07/08 17:04:21 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -786,6 +786,19 @@ wsmouse* at btmagic? mux 0
 # Bluetooth Audio support
 btsco* at bthub?
 
+
+# SD/MMC/SDIO Controller and Device support
+
+# SD/MMC controller
+sdhc*	at pci?		# SD Host Controller
+rtsx*	at pci?		# Realtek RTS5209/RTS5229 Card Reader
+#sdhc*	at cardbus?	# SD Host Controller
+sdmmc*	at sdhc?	# SD/MMC bus
+sdmmc*	at rtsx?	# SD/MMC bus
+
+ld*	at sdmmc?
+
+
 # Cryptographic Devices
 
 # PCI cryptographic devices

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.8 src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.9
--- src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.8	Tue Apr 18 19:53:50 2017
+++ src/sys/arch/i386/conf/XEN3_DOM0	Sat Jul  8 17:04:21 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.85.2.8 2017/04/18 19:53:50 snj Exp $
+#	$NetBSD: XEN3_DOM0,v 1.85.2.9 2017/07/08 17:04:21 snj Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -684,6 +684,23 @@ ieee1394if* at fwohci?
 fwip*	at ieee1394if?			# IP over IEEE1394
 sbp*	at ieee1394if? euihi ? euilo ?	# SCSI over IEEE1394
 
+
+# SD/MMC/SDIO Controller and Device support
+
+# PCI SD/MMC controller
+sdhc*	at pci?# SD Host Controller
+rtsx*	at pci?# Realtek RTS5209/RTS5229 Card Reader
+
+# CardBus SD/MMC controller
+#sdhc*	at cardbus? function ?		# SD Host Controller
+
+sdmmc*	at sdhc?			# SD/MMC bus
+sdmmc*	at rtsx?			# SD/MMC bus
+ld*	at sdmmc?
+
+
+# Audio Devices
+
 # PCI audio devices
 auacer* at pci? dev ? function ?	# ALi M5455 integrated AC'97 Audio
 auich*	at pci? dev ? function ?	# Intel ICH integrated AC'97 Audio
@@ -761,6 +778,7 @@ wsmouse* at btmagic? mux 0
 # Bluetooth Audio support
 btsco* at bthub?
 
+
 # Cryptographic Devices
 
 # PCI cryptographic devices

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.133.4.2 src/sys/arch/xen/conf/files.xen:1.133.4.3
--- src/sys/arch/xen/conf/files.xen:1.133.4.2	Sun Dec 18 07:50:37 2016
+++ src/sys/arch/xen/conf/files.xen	Sat Jul  8 17:04:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.133.4.2 2016/12/18 07:50:37 snj Exp $
+#	$NetBSD: files.xen,v 1.133.4.3 2017/07/08 17:04:22 snj Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -368,6 +368,8 @@ include	"compat/ossaudio/files.ossaudio"
 # Bluetooth
 include "dev/bluetooth/files.bluetooth"
 
+include "dev/sdmmc/files.sdmmc"
+
 #
 # CARDBUS
 #



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

2017-07-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jul  8 17:01:52 UTC 2017

Modified Files:
src/sys/arch/arm/cortex [netbsd-7]: a9_mpsubr.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1444):
sys/arch/arm/cortex/a9_mpsubr.S: revision 1.48
Make fp 0 on entry to idle_stack to ensure we mark that we're top of
stack


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.4 -r1.18.2.5 src/sys/arch/arm/cortex/a9_mpsubr.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/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.18.2.4 src/sys/arch/arm/cortex/a9_mpsubr.S:1.18.2.5
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.18.2.4	Fri Feb 26 22:52:53 2016
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Sat Jul  8 17:01:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.18.2.4 2016/02/26 22:52:53 snj Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.18.2.5 2017/07/08 17:01:52 snj Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -736,6 +736,7 @@ cortex_mpcontinuation:
 	movw	r2, #:lower16:MD_CPU_HATCH	// pass md_cpu_hatch
 	movt	r2, #:upper16:MD_CPU_HATCH	// pass md_cpu_hatch
 	bl	_C_LABEL(cpu_hatch)
+	mov	fp, #0// top stack frame
 	b	_C_LABEL(idle_loop)		// never to return
 ASEND(cortex_mpcontinuation)
 



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

2017-06-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jun  3 17:01:31 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1424):
sys/arch/arm/arm32/pmap.c: revision 1.345
Perform icache syncs for ARM_MMU_EXTENDED as well.  This helps the PT_STEP
code in pr/52119 and probably other things.


To generate a diff of this commit:
cvs rdiff -u -r1.295.2.10 -r1.295.2.11 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.295.2.10 src/sys/arch/arm/arm32/pmap.c:1.295.2.11
--- src/sys/arch/arm/arm32/pmap.c:1.295.2.10	Sat Mar 11 16:03:54 2017
+++ src/sys/arch/arm/arm32/pmap.c	Sat Jun  3 17:01:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.295.2.10 2017/03/11 16:03:54 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.295.2.11 2017/06/03 17:01:30 snj Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,7 @@
 #include 
 //#include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295.2.10 2017/03/11 16:03:54 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295.2.11 2017/06/03 17:01:30 snj Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -424,13 +424,13 @@ static struct evcnt pmap_ev_exec_synced 
PMAP_EVCNT_INITIALIZER("exec pages synced");
 static struct evcnt pmap_ev_exec_synced_map =
PMAP_EVCNT_INITIALIZER("exec pages synced (MP)");
-#ifndef ARM_MMU_EXTENDED
 static struct evcnt pmap_ev_exec_synced_unmap =
PMAP_EVCNT_INITIALIZER("exec pages synced (UM)");
 static struct evcnt pmap_ev_exec_synced_remap =
PMAP_EVCNT_INITIALIZER("exec pages synced (RM)");
 static struct evcnt pmap_ev_exec_synced_clearbit =
PMAP_EVCNT_INITIALIZER("exec pages synced (DG)");
+#ifndef ARM_MMU_EXTENDED
 static struct evcnt pmap_ev_exec_synced_kremove =
PMAP_EVCNT_INITIALIZER("exec pages synced (KU)");
 #endif
@@ -1066,12 +1066,10 @@ pmap_enter_pv(struct vm_page_md *md, pad
 	 * for this page, make sure to sync the I-cache.
 	 */
 	if (PV_IS_EXEC_P(flags)) {
-#ifndef ARM_MMU_EXTENDED
 		if (!PV_IS_EXEC_P(md->pvh_attrs)) {
 			pmap_syncicache_page(md, pa);
 			PMAPCOUNT(exec_synced_map);
 		}
-#endif
 		PMAPCOUNT(exec_mappings);
 	}
 #endif
@@ -1145,26 +1143,19 @@ pmap_remove_pv(struct vm_page_md *md, pa
 
 			PMAPCOUNT(unmappings);
 #ifdef PMAP_CACHE_VIPT
-			if (!(pv->pv_flags & PVF_WRITE))
-break;
 			/*
 			 * If this page has had an exec mapping, then if
 			 * this was the last mapping, discard the contents,
 			 * otherwise sync the i-cache for this page.
 			 */
 			if (PV_IS_EXEC_P(md->pvh_attrs)) {
-#ifdef ARM_MMU_EXTENDED
-md->pvh_attrs &= ~PVF_EXEC;
-PMAPCOUNT(exec_discarded_unmap);
-#else
 if (SLIST_EMPTY(>pvh_list)) {
 	md->pvh_attrs &= ~PVF_EXEC;
 	PMAPCOUNT(exec_discarded_unmap);
-} else {
+} else if (pv->pv_flags & PVF_WRITE) {
 	pmap_syncicache_page(md, pa);
 	PMAPCOUNT(exec_synced_unmap);
 }
-#endif /* ARM_MMU_EXTENDED */
 			}
 #endif /* PMAP_CACHE_VIPT */
 			break;
@@ -1276,7 +1267,6 @@ pmap_modify_pv(struct vm_page_md *md, pa
 			md->pvh_attrs |= PVF_WRITE;
 		}
 	}
-#ifndef ARM_MMU_EXTENDED
 	/*
 	 * We have two cases here: the first is from enter_pv (new exec
 	 * page), the second is a combined pmap_remove_pv/pmap_enter_pv.
@@ -1289,6 +1279,7 @@ pmap_modify_pv(struct vm_page_md *md, pa
 		pmap_syncicache_page(md, pa);
 		PMAPCOUNT(exec_synced_remap);
 	}
+#ifndef ARM_MMU_EXTENDED
 	KASSERT((md->pvh_attrs & PVF_DMOD) == 0 || (md->pvh_attrs & (PVF_DIRTY|PVF_NC)));
 #endif /* !ARM_MMU_EXTENDED */
 #endif /* PMAP_CACHE_VIPT */
@@ -2338,12 +2329,12 @@ pmap_clearbit(struct vm_page_md *md, pad
 	struct pv_entry *pv;
 #ifdef PMAP_CACHE_VIPT
 	const bool want_syncicache = PV_IS_EXEC_P(md->pvh_attrs);
+	bool need_syncicache = false;
 #ifdef ARM_MMU_EXTENDED
 	const u_int execbits = (maskbits & PVF_EXEC) ? L2_XS_XN : 0;
 #else
 	const u_int execbits = 0;
 	bool need_vac_me_harder = false;
-	bool need_syncicache = false;
 #endif
 #else
 	const u_int execbits = 0;
@@ -2359,12 +2350,9 @@ pmap_clearbit(struct vm_page_md *md, pad
 	 * then we know we definitely need to sync or discard it.
 	 */
 	if (want_syncicache) {
-#ifdef ARM_MMU_EXTENDED
-		if (md->pvh_attrs & PVF_MOD)
-			md->pvh_attrs &= ~PVF_EXEC;
-#else
-		need_syncicache = md->pvh_attrs & PVF_MOD;
-#endif
+		if (md->pvh_attrs & PVF_MOD) {
+			need_syncicache = true;
+		}
 	}
 #endif
 	KASSERT(pmap_page_locked_p(md));
@@ -2375,7 +2363,7 @@ pmap_clearbit(struct vm_page_md *md, pad
 	md->pvh_attrs &= ~(maskbits & (PVF_MOD | PVF_REF));
 
 	if (SLIST_EMPTY(>pvh_list)) {
-#if defined(PMAP_CACHE_VIPT) && !defined(ARM_MMU_EXTENDED)
+#if defined(PMAP_CACHE_VIPT)
 		if (need_syncicache) {
 			/*
 			 * No one has it mapped, so just discard it.  The next
@@ -2484,9 +2472,9 @@ pmap_clearbit(struct vm_page_md *md, pad
 

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

2017-06-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jun  3 16:55:07 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by matin in ticket #1426):
sys/arch/i386/stand/misc/rawr32.exe.uue: revision 1.7
Update to rawrite32 1.0.5 (new signatures to avoid scary windows
warnings)


To generate a diff of this commit:
cvs rdiff -u -r1.4.24.1 -r1.4.24.2 \
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.

diffs are larger than 1MB and have been omitted


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

2017-05-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat May 13 06:28:59 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1408):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.135 via patch
Add ixg(4). Fixes PR#52180 from Harry Waddell.


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.7 -r1.103.2.8 src/sys/arch/amd64/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.103.2.7 src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.8
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.7	Tue Apr 18 19:53:50 2017
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat May 13 06:28:59 2017
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.103.2.7 2017/04/18 19:53:50 snj Exp $
+# $NetBSD: XEN3_DOM0,v 1.103.2.8 2017/05/13 06:28:59 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -364,6 +364,7 @@ hme*	at pci? dev ? function ?	# Sun Micr
 ipw*	at pci? dev ? function ?	# Intel PRO/Wireless 2100
 iwi*	at pci? dev ? function ?	# Intel PRO/Wireless 2200BG
 iwn*	at pci? dev ? function ?	# Intel PRO/Wireless 4965AGN
+ixg*	at pci? dev ? function ?	# Intel 8259x 10 gigabit
 jme*	at pci? dev ? function ?	# JMicron JMC2[56]0 ethernet
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet



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

2017-05-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri May 12 06:23:29 UTC 2017

Modified Files:
src/sys/arch/mips/include [netbsd-7]: ecoff_machdep.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1406):
sys/arch/mips/include/ecoff_machdep.h: revision 1.23
sys/sys/exec_ecoff.h: revision 1.21
tools/Makefile.nbincludes: revision 1.5
tools/mips-elf2ecoff/Makefile: revision 1.3
tools/mips-elf2ecoff/machine/ecoff_machdep.h: revision 1.3
tools/mips-elf2ecoff/sys/exec_elf.h: file removal
tools/mips-elf2ecoff/sys/exec_ecoff.h: file removal
usr.bin/elf2ecoff/elf2ecoff.c: revision 1.30-1.33
use the nbcompat copies for those files
--
ignore the abiflags section
--
Add exec_ecoff.h
--
provide ecoff 32 defines.
--
This only works with 32 bit Elf and COFF files, make it specific this way
and use sized types so that it works on 64 bit systems (so it can become
a tool).
--
Provided sized definitions for ecoff 32 bit headers.
--
refresh
--
fix printf format.
--
fix printf format


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.14.1 src/sys/arch/mips/include/ecoff_machdep.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/mips/include/ecoff_machdep.h
diff -u src/sys/arch/mips/include/ecoff_machdep.h:1.21 src/sys/arch/mips/include/ecoff_machdep.h:1.21.14.1
--- src/sys/arch/mips/include/ecoff_machdep.h:1.21	Tue Mar 20 11:28:04 2012
+++ src/sys/arch/mips/include/ecoff_machdep.h	Fri May 12 06:23:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ecoff_machdep.h,v 1.21 2012/03/20 11:28:04 nonaka Exp $	*/
+/*	$NetBSD: ecoff_machdep.h,v 1.21.14.1 2017/05/12 06:23:28 snj Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -37,6 +37,12 @@
 #define ECOFF_LDPGSZ 4096
 
 #define ECOFF_PAD
+#define ECOFF32_PAD
+
+#define ECOFF32_MACHDEP \
+ecoff32_ulong gprmask; \
+ecoff32_ulong cprmask[4]; \
+ecoff32_ulong gp_value
 
 #define ECOFF_MACHDEP \
 u_long gprmask; \
@@ -67,6 +73,7 @@
 
 
 #define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
+#define ECOFF32_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
 
 #ifdef _KERNEL
 struct proc;
@@ -75,6 +82,34 @@ void	cpu_exec_ecoff_setregs(struct lwp *
 #endif	/* _KERNEL */
 
 
+struct ecoff32_symhdr {
+	int16_t		magic;
+	int16_t		vstamp;
+	int32_t		ilineMax;
+	int32_t		cbLine;
+	int32_t		cbLineOffset;
+	int32_t		idnMax;
+	int32_t		cbDnOffset;
+	int32_t		ipdMax;
+	int32_t		cbPdOffset;
+	int32_t		isymMax;
+	int32_t		cbSymOffset;
+	int32_t		ioptMax;
+	int32_t		cbOptOffset;
+	int32_t		iauxMax;
+	int32_t		cbAuxOffset;
+	int32_t		issMax;
+	int32_t		cbSsOffset;
+	int32_t		issExtMax;
+	int32_t		cbSsExtOffset;
+	int32_t		ifdMax;
+	int32_t		cbFdOffset;
+	int32_t		crfd;
+	int32_t		cbRfdOffset;
+	int32_t		iextMax;
+	int32_t		cbExtOffset;
+};
+
 /*
  * ECOFF symbol definitions for 32-bit mips.
  * XXX 64-bit (mips3?) may be different.
@@ -121,3 +156,14 @@ struct ecoff_extsym {
 	unsigned	:1;
 	unsigned	es_symauxindex:20;
 };
+
+struct ecoff32_extsym {
+	uint16_t	es_flags;
+	uint16_t	es_ifd;
+	int32_t		es_strindex;
+	int32_t		es_value;
+	unsigned	es_type:6;
+	unsigned	es_class:5;
+	unsigned	:1;
+	unsigned	es_symauxindex:20;
+};



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

2017-05-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri May 12 05:17:40 UTC 2017

Modified Files:
src/sys/arch/arm/omap [netbsd-7]: omap_edma.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1387):
sys/arch/arm/omap/omap_edma.c: revision 1.4 via patch
PR/51380: Mutex error: mutex_vector_enter: locking against myself
Change the interrupt handler IPL level to IPL_VM (aka IPL_BIO aka
IPL_SDMMC) so that the sdhc_host_lock prevents edma_intr from running


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/arm/omap/omap_edma.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/omap/omap_edma.c
diff -u src/sys/arch/arm/omap/omap_edma.c:1.1.2.2 src/sys/arch/arm/omap/omap_edma.c:1.1.2.3
--- src/sys/arch/arm/omap/omap_edma.c:1.1.2.2	Sun Apr 19 04:37:17 2015
+++ src/sys/arch/arm/omap/omap_edma.c	Fri May 12 05:17:40 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: omap_edma.c,v 1.1.2.2 2015/04/19 04:37:17 msaitoh Exp $ */
+/* $NetBSD: omap_edma.c,v 1.1.2.3 2017/05/12 05:17:40 snj Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap_edma.c,v 1.1.2.2 2015/04/19 04:37:17 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap_edma.c,v 1.1.2.3 2017/05/12 05:17:40 snj Exp $");
 
 #include "opt_omap.h"
 
@@ -141,7 +141,7 @@ edma_attach(device_t parent, device_t se
 
 	sc->sc_dev = self;
 	sc->sc_iot = obio->obio_iot;
-	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SCHED);
+   mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM);
 	if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size,
 	0, >sc_ioh) != 0) {
 		aprint_error(": couldn't map address spcae\n");
@@ -164,13 +164,13 @@ edma_attach(device_t parent, device_t se
 	edma_init(sc);
 
 	sc->sc_ih = intr_establish(obio->obio_intrbase + 0,
-	IPL_SCHED, IST_LEVEL, edma_intr, sc);
+   IPL_VM, IST_LEVEL | IST_MPSAFE, edma_intr, sc);
 	KASSERT(sc->sc_ih != NULL);
 
 	sc->sc_mperr_ih = intr_establish(obio->obio_intrbase + 1,
-	IPL_SCHED, IST_LEVEL, edma_mperr_intr, sc);
+   IPL_VM, IST_LEVEL, edma_mperr_intr, sc);
 	sc->sc_errint_ih = intr_establish(obio->obio_intrbase + 2,
-	IPL_SCHED, IST_LEVEL, edma_errint_intr, sc);
+   IPL_VM, IST_LEVEL, edma_errint_intr, sc);
 }
 
 /*



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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:54:57 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7]: trap.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #1410):
sys/arch/amd64/amd64/trap.c: revision 1.96
restore the ability to run netbsd 1.0 32-bit executables
by checking for the relevant lcall instruction in the trap handler
and treating it as a syscall.


To generate a diff of this commit:
cvs rdiff -u -r1.78.4.2 -r1.78.4.3 src/sys/arch/amd64/amd64/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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.4.2 src/sys/arch/amd64/amd64/trap.c:1.78.4.3
--- src/sys/arch/amd64/amd64/trap.c:1.78.4.2	Wed Apr 26 14:52:50 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:54:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.4.3 2017/04/26 14:54:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,12 +68,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.3 2017/04/26 14:54:57 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
 #include "opt_xen.h"
 #include "opt_dtrace.h"
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
 
 #include 
 #include 
@@ -90,6 +92,11 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.7
 
 #include 
 
+#ifdef COMPAT_NETBSD32
+#include 
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -389,6 +396,27 @@ kernelfault:
 #endif
 
 	case T_PROTFLT|T_USER:		/* protection fault */
+#if defined(COMPAT_NETBSD32) && defined(COMPAT_10)
+	{
+		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
+		const size_t sz = sizeof(lcall);
+		char tmp[sz];
+
+		/* Check for the oosyscall lcall instruction. */
+		if (p->p_emul == _netbsd32 &&
+		frame->tf_rip < VM_MAXUSER_ADDRESS32 - sz &&
+		copyin((void *)frame->tf_rip, tmp, sz) == 0 &&
+		memcmp(tmp, lcall, sz) == 0) {
+
+			/* Advance past the lcall. */
+			frame->tf_rip += sz;
+
+			/* Do the syscall. */
+			p->p_md.md_syscall(frame);
+			goto out;
+		}
+	}
+#endif
 	case T_TSSFLT|T_USER:
 	case T_SEGNPFLT|T_USER:
 	case T_STKFLT|T_USER:



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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:52:50 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7]: locore.S machdep.c trap.c

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

sys/arch/amd64/amd64/locore.S   1.122 (via patch)
sys/arch/amd64/amd64/machdep.c  1.254 (via patch)
sys/arch/amd64/amd64/trap.c 1.95 (via patch)

Remove the call gate on amd64, it is useless and vulnerable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.76.2.1 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.211 -r1.211.2.1 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.78.4.1 -r1.78.4.2 src/sys/arch/amd64/amd64/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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.76 src/sys/arch/amd64/amd64/locore.S:1.76.2.1
--- src/sys/arch/amd64/amd64/locore.S:1.76	Fri May 16 00:48:41 2014
+++ src/sys/arch/amd64/amd64/locore.S	Wed Apr 26 14:52:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.76 2014/05/16 00:48:41 rmind Exp $	*/
+/*	$NetBSD: locore.S,v 1.76.2.1 2017/04/26 14:52:50 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1287,27 +1287,6 @@ NENTRY(lwp_trampoline)
 END(lwp_trampoline)
 
 /*
- * oosyscall()
- *
- * Old call gate entry for syscall. only needed if we're
- * going to support running old i386 NetBSD 1.0 or ibcs2 binaries, etc,
- * on NetBSD/amd64.
- * The 64bit call gate can't request that arguments be copied from the
- * user stack (which the i386 code uses to get a gap for the flags).
- * push/pop are :: cycles.
- */
-IDTVEC(oosyscall)
-	/* Set rflags in trap frame. */
-	pushq	(%rsp)		# move user's %eip
-	pushq	16(%rsp)	# and %cs
-	popq	8(%rsp)
-	pushfq
-	popq	16(%rsp)
-	pushq	$7		# size of instruction for restart
-	jmp	osyscall1
-IDTVEC_END(oosyscall)
-
-/*
  * osyscall()
  *
  * Trap gate entry for int $80 syscall, also used by sigreturn.

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.211 src/sys/arch/amd64/amd64/machdep.c:1.211.2.1
--- src/sys/arch/amd64/amd64/machdep.c:1.211	Mon May 12 22:50:03 2014
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Apr 26 14:52:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $	*/
+/*	$NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 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.211 2014/05/12 22:50:03 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1696,10 +1696,7 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(GDT_ADDR_MEM(gdtstore, GUDATA_SEL), 0,
 	x86_btop(VM_MAXUSER_ADDRESS) - 1, SDT_MEMRWA, SEL_UPL, 1, 0, 1);
 
-	/* make ldt gates and memory segments */
-	setgate((struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	(oosyscall), 0, SDT_SYS386CGT, SEL_UPL,
-	GSEL(GCODE_SEL, SEL_KPL));
+	/* make ldt memory segments */
 	*(struct mem_segment_descriptor *)(ldtstore + LUCODE_SEL) =
 	*GDT_ADDR_MEM(gdtstore, GUCODE_SEL);
 	*(struct mem_segment_descriptor *)(ldtstore + LUDATA_SEL) =
@@ -1731,16 +1728,6 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(ldt_segp, 0, x86_btop(VM_MAXUSER_ADDRESS32) - 1,
 	SDT_MEMRWA, SEL_UPL, 1, 1, 0);
 
-	/*
-	 * Other entries.
-	 */
-	memcpy((struct gate_descriptor *)(ldtstore + LSOL26CALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-	memcpy((struct gate_descriptor *)(ldtstore + LBSDICALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-
 	/* exceptions */
 	for (x = 0; x < 32; x++) {
 #ifndef XEN

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.4.1 src/sys/arch/amd64/amd64/trap.c:1.78.4.2
--- src/sys/arch/amd64/amd64/trap.c:1.78.4.1	Sat Mar 25 16:57:39 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:52:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -222,7 +222,6 @@ trap(struct trapframe *frame)
 	struct proc *p;
 	struct pcb *pcb;
 	extern char fusuintrfailure[], kcopy_fault[];
-	extern char IDTVEC(oosyscall)[];
 	extern char IDTVEC(osyscall)[];
 	extern char IDTVEC(syscall32)[];
 #ifndef XEN
@@ -647,8 +646,7 @@ 

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

2017-04-20 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 20 07:04:48 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1396):
sys/arch/hppa/hppa/machdep.c: revision 1.7
PR/52129: NetBSD/hppa 7.1 fails to boot on 712/60
Add 712/* models to cpu_model_cpuid


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.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/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.4 src/sys/arch/hppa/hppa/machdep.c:1.4.6.1
--- src/sys/arch/hppa/hppa/machdep.c:1.4	Fri Apr 18 18:32:00 2014
+++ src/sys/arch/hppa/hppa/machdep.c	Thu Apr 20 07:04:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.4 2014/04/18 18:32:00 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.4.6.1 2017/04/20 07:04:48 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.4 2014/04/18 18:32:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.4.6.1 2017/04/20 07:04:48 snj Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -861,6 +861,9 @@ cpu_model_cpuid(int modelno)
 	case HPPA_BOARD_HPE25:
 	case HPPA_BOARD_HPE35:
 	case HPPA_BOARD_HPE45:
+	case HPPA_BOARD_HP712_60:
+	case HPPA_BOARD_HP712_80:
+	case HPPA_BOARD_HP712_100:
 	case HPPA_BOARD_HP715_80:
 	case HPPA_BOARD_HP715_64:
 	case HPPA_BOARD_HP715_100:



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

2017-04-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Apr 19 17:02:43 UTC 2017

Modified Files:
src/sys/arch/powerpc/powerpc [netbsd-7]: locore_subr.S

Log Message:
Pull up following revision(s) (requested by phx in ticket #1382):
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.55
in cpu_switchto() and the fast-softint context switch code,
put back the stwcx. instruction to clear the reservation.
we used to have this in the old cpu_switch() until it was
if-0'd in 2003 and removed completely in 2007.
this fixes hangs I've seen where a softint thread is
blocked waiting for a mutex that is not held.
this should also fix PR 44387.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.2.1 src/sys/arch/powerpc/powerpc/locore_subr.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/powerpc/powerpc/locore_subr.S
diff -u src/sys/arch/powerpc/powerpc/locore_subr.S:1.54 src/sys/arch/powerpc/powerpc/locore_subr.S:1.54.2.1
--- src/sys/arch/powerpc/powerpc/locore_subr.S:1.54	Wed Jul 30 23:27:55 2014
+++ src/sys/arch/powerpc/powerpc/locore_subr.S	Wed Apr 19 17:02:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.54 2014/07/30 23:27:55 matt Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.54.2.1 2017/04/19 17:02:43 snj Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -288,6 +288,7 @@ switchto_restore:
  */
 	ldreg	%r31,CFRAME_R31(%r1)	/* restore saved registers */
 	ldreg	%r30,CFRAME_R30(%r1)
+	stwcx.	%r1,0,%r1		/* clear reservation */
 #if 1
 	addi	%r1,%r1,CALLFRAMELEN
 #else
@@ -328,6 +329,7 @@ _ENTRY(softint_cleanup)
 	mtmsr	%r0
 	isync
 #endif
+	stwcx.	%r1,0,%r1		/* clear reservation */
 	addi	%r1, %r1, CALLFRAMELEN
 	ldreg	%r0, CFRAME_LR(%r1)
 	mtlr	%r0
@@ -478,6 +480,7 @@ _ENTRY(softint_fast_dispatch)
 	ldreg	%r29,SFRAME_R29(%r1)	/* R29 */
 	ldreg	%r31,SFRAMELEN+CFRAME_R31(%r1)	/* restore saved registers */
 	ldreg	%r30,SFRAMELEN+CFRAME_R30(%r1)
+	stwcx.	%r1,0,%r1		/* clear reservation */
 	addi	%r1,%r1,SFRAMELEN+2*CALLFRAMELEN /* remove switch & callframes */
 #endif
 	ldreg	%r0,CFRAME_LR(%r1)



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

2017-04-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Apr 18 19:53:50 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1367):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.134
sys/arch/i386/conf/XEN3_DOM0: revision 1.112
Be more explicit about the status of dom0 SMP support.


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.6 -r1.103.2.7 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.85.2.7 -r1.85.2.8 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.103.2.6 src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.7
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.6	Mon Apr 17 06:02:05 2017
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Tue Apr 18 19:53:50 2017
@@ -1,8 +1,8 @@
-# $NetBSD: XEN3_DOM0,v 1.103.2.6 2017/04/17 06:02:05 snj Exp $
+# $NetBSD: XEN3_DOM0,v 1.103.2.7 2017/04/18 19:53:50 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
-#options 	MULTIPROCESSOR	# (experimental)
+#options 	MULTIPROCESSOR	# (not yet - dom0 stuff is not MP-safe)
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.7 src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.8
--- src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.7	Mon Apr 17 06:02:05 2017
+++ src/sys/arch/i386/conf/XEN3_DOM0	Tue Apr 18 19:53:50 2017
@@ -1,10 +1,10 @@
-#	$NetBSD: XEN3_DOM0,v 1.85.2.7 2017/04/17 06:02:05 snj Exp $
+#	$NetBSD: XEN3_DOM0,v 1.85.2.8 2017/04/18 19:53:50 snj Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
 include 	"arch/xen/conf/std.xen"
 
-#options 	MULTIPROCESSOR	# (experimental)
+#options 	MULTIPROCESSOR	# (not yet - dom0 stuff is not MP-safe)
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 



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

2017-04-17 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Apr 17 06:02:05 UTC 2017

Modified Files:
src/sys/arch/amd64/conf [netbsd-7]: XEN3_DOM0
src/sys/arch/i386/conf [netbsd-7]: XEN3_DOM0
src/sys/arch/xen/x86 [netbsd-7]: xen_pmap.c

Log Message:
Pull up following revision(s) (requested by khorben in ticket #1367):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.126
sys/arch/i386/conf/XEN3_DOM0: revision 1.104
sys/arch/xen/x86/xen_pmap.c: revision 1.25
In the MP case,
do not attempt to pmap_tlb_shootdown() after a pmap_kenter_ma() during
boot. pmap_tlb_shootdown() assumes post boot. Instead invalidate the
entry on the local CPU only.
XXX: to DTRT, probably this assumption needs re-examination.
XXX: The tradeoff is a (predicted) single word size comparison
  penalty, so perhaps a decision needs performance stats.
xen dom0 SMP is now bootable again.
--
add the 'options MULTIPROCESSOR' in respective configs, but mark them
experimental - and thus disabled by default.


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.85.2.6 -r1.85.2.7 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.22 -r1.22.14.1 src/sys/arch/xen/x86/xen_pmap.c

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.5 src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.6
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.5	Fri Dec  9 05:10:45 2016
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Mon Apr 17 06:02:05 2017
@@ -1,7 +1,9 @@
-# $NetBSD: XEN3_DOM0,v 1.103.2.5 2016/12/09 05:10:45 snj Exp $
+# $NetBSD: XEN3_DOM0,v 1.103.2.6 2017/04/17 06:02:05 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
+#options 	MULTIPROCESSOR	# (experimental)
+
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
 #options 	UVMHIST

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.6 src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.7
--- src/sys/arch/i386/conf/XEN3_DOM0:1.85.2.6	Fri Dec  9 05:10:45 2016
+++ src/sys/arch/i386/conf/XEN3_DOM0	Mon Apr 17 06:02:05 2017
@@ -1,9 +1,11 @@
-#	$NetBSD: XEN3_DOM0,v 1.85.2.6 2016/12/09 05:10:45 snj Exp $
+#	$NetBSD: XEN3_DOM0,v 1.85.2.7 2017/04/17 06:02:05 snj Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
 include 	"arch/xen/conf/std.xen"
 
+#options 	MULTIPROCESSOR	# (experimental)
+
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
 #options 	UVMHIST

Index: src/sys/arch/xen/x86/xen_pmap.c
diff -u src/sys/arch/xen/x86/xen_pmap.c:1.22 src/sys/arch/xen/x86/xen_pmap.c:1.22.14.1
--- src/sys/arch/xen/x86/xen_pmap.c:1.22	Sun Jun 24 18:31:53 2012
+++ src/sys/arch/xen/x86/xen_pmap.c	Mon Apr 17 06:02:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_pmap.c,v 1.22 2012/06/24 18:31:53 jym Exp $	*/
+/*	$NetBSD: xen_pmap.c,v 1.22.14.1 2017/04/17 06:02:05 snj Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.22 2012/06/24 18:31:53 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.22.14.1 2017/04/17 06:02:05 snj Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -192,9 +192,13 @@ pmap_kenter_ma(vaddr_t va, paddr_t ma, v
 
 	if (pmap_valid_entry(opte)) {
 #if defined(MULTIPROCESSOR)
-		kpreempt_disable();
-		pmap_tlb_shootdown(pmap_kernel(), va, opte, TLBSHOOT_KENTER);
-		kpreempt_enable();
+		if (__predict_false(x86_mp_online == false)) {
+			pmap_update_pg(va);
+		} else {
+			kpreempt_disable();
+			pmap_tlb_shootdown(pmap_kernel(), va, opte, TLBSHOOT_KENTER);
+			kpreempt_enable();
+		}
 #else
 		/* Don't bother deferring in the single CPU case. */
 		pmap_update_pg(va);



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

2017-04-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 11 16:55:39 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf [netbsd-7]: SHEEVAPLUG TWINTAIL

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1400):
sys/arch/evbarm/conf/SHEEVAPLUG: revision 1.45
sys/arch/evbarm/conf/TWINTAIL: revision 1.65
Comment out more USB options to to fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/arch/evbarm/conf/SHEEVAPLUG
cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/arch/evbarm/conf/TWINTAIL

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/SHEEVAPLUG
diff -u src/sys/arch/evbarm/conf/SHEEVAPLUG:1.39 src/sys/arch/evbarm/conf/SHEEVAPLUG:1.39.2.1
--- src/sys/arch/evbarm/conf/SHEEVAPLUG:1.39	Sun Aug  3 09:18:16 2014
+++ src/sys/arch/evbarm/conf/SHEEVAPLUG	Tue Apr 11 16:55:39 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: SHEEVAPLUG,v 1.39 2014/08/03 09:18:16 martin Exp $
+#	$NetBSD: SHEEVAPLUG,v 1.39.2.1 2017/04/11 16:55:39 martin Exp $
 #
 #  This configuration supports for generically Marvell SheevaPlug
 #
@@ -300,7 +300,7 @@ cd*	at scsibus? target ? lun ?	# SCSI CD
 uaudio* at uhub? port ? configuration ?
 
 # USB MIDI
-umidi* at uhub? port ? configuration ?
+#umidi* at uhub? port ? configuration ?
 
 # USB IrDA
 # USB-IrDA bridge spec

Index: src/sys/arch/evbarm/conf/TWINTAIL
diff -u src/sys/arch/evbarm/conf/TWINTAIL:1.61 src/sys/arch/evbarm/conf/TWINTAIL:1.61.2.1
--- src/sys/arch/evbarm/conf/TWINTAIL:1.61	Sun Aug  3 09:18:16 2014
+++ src/sys/arch/evbarm/conf/TWINTAIL	Tue Apr 11 16:55:39 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: TWINTAIL,v 1.61 2014/08/03 09:18:16 martin Exp $
+#	$NetBSD: TWINTAIL,v 1.61.2.1 2017/04/11 16:55:39 martin Exp $
 #
 #	TWINTAIL -- Genetec corp. G4255EB-X002 Evaluation Board Kernel
 #
@@ -116,7 +116,7 @@ options 	COMPAT_16	# NetBSD 1.6 compatib
 options 	KTRACE		# system call tracing, a la ktrace(1)
 #options 	KMEMSTATS	# kernel memory statistics
 options 	PCMCIAVERBOSE	# verbose PCMCIA configuration messages
-options 	USBVERBOSE	# verbose USB device autoconfig messages
+#options 	USBVERBOSE	# verbose USB device autoconfig messages
 options 	SCSIVERBOSE	# Verbose SCSI errors
 #options 	MIIVERBOSE	# Verbose MII autoconfuration messages
 #options 	DDB_KEYCODE=0x40



CVS commit: [netbsd-7] src/sys/arch/evbmips/loongson

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:15:09 UTC 2017

Modified Files:
src/sys/arch/evbmips/loongson [netbsd-7]: gdium_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1399):
sys/arch/evbmips/loongson/gdium_machdep.c: 1.8
Adapt to netbsd-7-nhusb.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/arch/evbmips/loongson/gdium_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/evbmips/loongson/gdium_machdep.c
diff -u src/sys/arch/evbmips/loongson/gdium_machdep.c:1.6 src/sys/arch/evbmips/loongson/gdium_machdep.c:1.6.12.1
--- src/sys/arch/evbmips/loongson/gdium_machdep.c:1.6	Wed Mar 13 21:18:35 2013
+++ src/sys/arch/evbmips/loongson/gdium_machdep.c	Sat Apr  8 16:15:09 2017
@@ -284,7 +284,7 @@ gdium_device_register(device_t dev, void
 	case 5:	/* umass at uhub port 3 */
 		if (device_is_a(dev, "umass")) {
 			struct usb_attach_arg *uaa = aux;
-			if (uaa->port == 3)
+			if (uaa->uaa_port == 3)
 goto advance;
 		}
 		break;



CVS commit: [netbsd-7] src/sys/arch/macppc/dev

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:12:22 UTC 2017

Modified Files:
src/sys/arch/macppc/dev [netbsd-7]: pbms.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1398):
sys/arch/macppc/dev/pbms.c: revision 1.14
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.12.1 src/sys/arch/macppc/dev/pbms.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/dev/pbms.c
diff -u src/sys/arch/macppc/dev/pbms.c:1.13 src/sys/arch/macppc/dev/pbms.c:1.13.12.1
--- src/sys/arch/macppc/dev/pbms.c:1.13	Sat Oct 27 17:18:00 2012
+++ src/sys/arch/macppc/dev/pbms.c	Sat Apr  8 16:12:22 2017
@@ -1,4 +1,4 @@
-/* $Id: pbms.c,v 1.13 2012/10/27 17:18:00 chs Exp $ */
+/* $Id: pbms.c,v 1.13.12.1 2017/04/08 16:12:22 snj Exp $ */
 
 /*
  * Copyright (c) 2005, Johan Wallén
@@ -306,7 +306,7 @@ pbms_match(device_t parent, cfdata_t mat
 	 * We just check if the vendor and product IDs have the magic numbers
 	 * we expect. 
 	 */
-	if (uha->uaa->proto == UIPROTO_MOUSE &&
+	if (uha->uiaa->uiaa_proto == UIPROTO_MOUSE &&
 	(udd = usbd_get_device_descriptor(uha->parent->sc_udev)) != NULL) {
 		vendor = UGETW(udd->idVendor);
 		product = UGETW(udd->idProduct);



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

2017-03-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 26 16:08:12 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1379):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.70 via patch
Try to be smarted in the rx path: if the packet is small enough copy the
data to the mbuf's data area instead of allocating a new page from the pool.
While there fix a struct xennet_rxreq leak if xennet_checksum_fill()
fails with ENOMEM.


To generate a diff of this commit:
cvs rdiff -u -r1.63.2.1 -r1.63.2.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.63.2.1 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.2
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.1	Sun Mar  6 18:52:06 2016
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sun Mar 26 16:08:12 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -1073,26 +1073,35 @@ again:
 		MCLAIM(m, >sc_ethercom.ec_rx_mowner);
 
 		m->m_pkthdr.rcvif = ifp;
-		req->rxreq_va = (vaddr_t)pool_cache_get_paddr(
-		if_xennetrxbuf_cache, PR_NOWAIT, >rxreq_pa);
-		if (__predict_false(req->rxreq_va == 0)) {
-			printf("%s: rx no buf\n", ifp->if_xname);
-			ifp->if_ierrors++;
-			req->rxreq_va = va;
-			req->rxreq_pa = pa;
-			xennet_rx_free_req(req);
-			m_freem(m);
-			continue;
+		if (rx->status <= MHLEN) {
+			/* small packet; copy to mbuf data area */
+			m_copyback(m, 0, rx->status, pktp);
+			KASSERT(m->m_pkthdr.len == rx->status);
+			KASSERT(m->m_len == rx->status);
+		} else {
+			/* large packet; attach buffer to mbuf */
+			req->rxreq_va = (vaddr_t)pool_cache_get_paddr(
+			if_xennetrxbuf_cache, PR_NOWAIT, >rxreq_pa);
+			if (__predict_false(req->rxreq_va == 0)) {
+printf("%s: rx no buf\n", ifp->if_xname);
+ifp->if_ierrors++;
+req->rxreq_va = va;
+req->rxreq_pa = pa;
+xennet_rx_free_req(req);
+m_freem(m);
+continue;
+			}
+			m->m_len = m->m_pkthdr.len = rx->status;
+			MEXTADD(m, pktp, rx->status,
+			M_DEVBUF, xennet_rx_mbuf_free, NULL);
+			m->m_ext.ext_paddr = pa;
+			m->m_flags |= M_EXT_RW; /* we own the buffer */
 		}
-		m->m_len = m->m_pkthdr.len = rx->status;
-		MEXTADD(m, pktp, rx->status,
-		M_DEVBUF, xennet_rx_mbuf_free, NULL);
-		m->m_flags |= M_EXT_RW; /* we own the buffer */
-		m->m_ext.ext_paddr = pa;
 		if ((rx->flags & NETRXF_csum_blank) != 0) {
 			xennet_checksum_fill();
 			if (m == NULL) {
 ifp->if_ierrors++;
+xennet_rx_free_req(req);
 continue;
 			}
 		}



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

2017-03-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 26 16:05:41 UTC 2017

Modified Files:
src/sys/arch/amd64/include [netbsd-7]: param.h
src/sys/arch/i386/include [netbsd-7]: param.h
src/sys/arch/x86/x86 [netbsd-7]: bus_space.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1375):
sys/arch/amd64/include/param.h: revision 1.20
sys/arch/i386/include/param.h: revision 1.80
sys/arch/x86/x86/bus_space.c: revision 1.39
increase max io mem on amd64. some devices need it.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.14.1 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.77 -r1.77.14.1 src/sys/arch/i386/include/param.h
cvs rdiff -u -r1.38 -r1.38.22.1 src/sys/arch/x86/x86/bus_space.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/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.18 src/sys/arch/amd64/include/param.h:1.18.14.1
--- src/sys/arch/amd64/include/param.h:1.18	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/amd64/include/param.h	Sun Mar 26 16:05:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.18 2012/04/20 22:23:24 rmind Exp $	*/
+/*	$NetBSD: param.h,v 1.18.14.1 2017/03/26 16:05:40 snj Exp $	*/
 
 #ifdef __x86_64__
 
@@ -27,6 +27,8 @@
 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
 #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
 
+#define	MAXIOMEM	0x
+
 /*
  * XXXfvdl change this (after bootstrap) to take # of bits from
  * config info into account.

Index: src/sys/arch/i386/include/param.h
diff -u src/sys/arch/i386/include/param.h:1.77 src/sys/arch/i386/include/param.h:1.77.14.1
--- src/sys/arch/i386/include/param.h:1.77	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/i386/include/param.h	Sun Mar 26 16:05:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.77 2012/04/20 22:23:24 rmind Exp $	*/
+/*	$NetBSD: param.h,v 1.77.14.1 2017/03/26 16:05:41 snj Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -65,6 +65,8 @@
 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
 #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
 
+#define	MAXIOMEM	0x
+
 #if defined(_KERNEL_OPT)
 #include "opt_kernbase.h"
 #endif /* defined(_KERNEL_OPT) */

Index: src/sys/arch/x86/x86/bus_space.c
diff -u src/sys/arch/x86/x86/bus_space.c:1.38 src/sys/arch/x86/x86/bus_space.c:1.38.22.1
--- src/sys/arch/x86/x86/bus_space.c:1.38	Fri Jan 27 18:53:07 2012
+++ src/sys/arch/x86/x86/bus_space.c	Sun Mar 26 16:05:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.38 2012/01/27 18:53:07 para Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.38.22.1 2017/03/26 16:05:41 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.38 2012/01/27 18:53:07 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.38.22.1 2017/03/26 16:05:41 snj Exp $");
 
 #include 
 #include 
@@ -129,7 +129,7 @@ x86_bus_space_init(void)
 	ioport_ex = extent_create("ioport", 0x0, 0x,
 	(void *)ioport_ex_storage, sizeof(ioport_ex_storage),
 	EX_NOCOALESCE|EX_NOWAIT);
-	iomem_ex = extent_create("iomem", 0x0, 0x,
+	iomem_ex = extent_create("iomem", 0x0, MAXIOMEM,
 	(void *)iomem_ex_storage, sizeof(iomem_ex_storage),
 	EX_NOCOALESCE|EX_NOWAIT);
 



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

2017-03-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Mar 25 16:57:40 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1391):
sys/arch/amd64/amd64/trap.c: revision 1.94
sys/arch/i386/i386/trap.c: revision 1.287
Mmh, allow iret to be handled when an #SS fault (T_STKFLT) happens. Even
if the sdm is far from being clear, it appears that iret can trigger an #SS
fault if %ss points to a writable but non-present segment; in which case
the kernel would panic, thinking the fault was internal to it.
In particular, userland can create a broken segment in the ldt with
USER_LDT, update its %ss with setcontext and trigger the panic. I don't
think amd64 is affected since USER_LDT does not exist there, and the
changes on tf_ss seem correct - but I'm still adding T_STKFLT for safety.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.4.1 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.272 -r1.272.4.1 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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78 src/sys/arch/amd64/amd64/trap.c:1.78.4.1
--- src/sys/arch/amd64/amd64/trap.c:1.78	Tue Mar 11 20:54:29 2014
+++ src/sys/arch/amd64/amd64/trap.c	Sat Mar 25 16:57:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78 2014/03/11 20:54:29 para Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78 2014/03/11 20:54:29 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -301,6 +301,7 @@ trap(struct trapframe *frame)
 	case T_PROTFLT:
 	case T_SEGNPFLT:
 	case T_ALIGNFLT:
+	case T_STKFLT:
 	case T_TSSFLT:
 		if (p == NULL)
 			goto we_re_toast;

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.272 src/sys/arch/i386/i386/trap.c:1.272.4.1
--- src/sys/arch/i386/i386/trap.c:1.272	Wed Mar 12 18:59:07 2014
+++ src/sys/arch/i386/i386/trap.c	Sat Mar 25 16:57:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.272 2014/03/12 18:59:07 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.272.4.1 2017/03/25 16:57:40 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.272 2014/03/12 18:59:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.272.4.1 2017/03/25 16:57:40 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -349,6 +349,7 @@ trap(struct trapframe *frame)
 	case T_PROTFLT:
 	case T_SEGNPFLT:
 	case T_ALIGNFLT:
+	case T_STKFLT:
 	case T_TSSFLT:
 		if (p == NULL)
 			goto we_re_toast;



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

2017-03-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Mar 11 07:40:21 UTC 2017

Modified Files:
src/sys/arch/arm/arm32 [netbsd-7]: pmap.c
src/sys/arch/arm/include/arm32 [netbsd-7]: pmap.h
src/sys/arch/evbarm/gumstix [netbsd-7]: gumstix_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1366):
sys/arch/arm/include/arm32/pmap.h: 1.145
sys/arch/arm/arm32/pmap.c: 1.343, 1.344
sys/arch/evbarm/gumstix/gumstix_machdep.c: 1.58 via patch
Fixup the compile time decisions around PMAP_{INCLUDE,NEEDS}_PTE_SYNC and
fix the options for xscale boards which require the code in
pmap_l2ptp_ctor marked as #ifndef PMAP_INCLUDE_PTE_SYNC.
Fix the typo (pte -> opte) in this code block and consistently use opte
elsewhere.
PR/51990: Regression data_abort_handler: data_aborts fsr=0x406 far=0xbfffeff5  
on copyout in init
--
fix unused.
--
Set xscale_cache_clean_addr appropriately and re-arrange default KVA
layout to allow direct map for all boards.
OVERO/DUOVERO/PEPPER aren't tested.
PR/52010: Regression: Gumstix Verdex is hanging in enabling cache + KASSERT 
ram_size


To generate a diff of this commit:
cvs rdiff -u -r1.295.2.8 -r1.295.2.9 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.135.2.2 -r1.135.2.3 src/sys/arch/arm/include/arm32/pmap.h
cvs rdiff -u -r1.50 -r1.50.2.1 src/sys/arch/evbarm/gumstix/gumstix_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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.295.2.8 src/sys/arch/arm/arm32/pmap.c:1.295.2.9
--- src/sys/arch/arm/arm32/pmap.c:1.295.2.8	Fri Feb 26 22:31:06 2016
+++ src/sys/arch/arm/arm32/pmap.c	Sat Mar 11 07:40:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.295.2.8 2016/02/26 22:31:06 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.295.2.9 2017/03/11 07:40:21 snj Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,7 @@
 #include 
 //#include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295.2.8 2016/02/26 22:31:06 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295.2.9 2017/03/11 07:40:21 snj Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -968,6 +968,7 @@ pmap_is_cached(pmap_t pm)
  *   - The specified pmap is 'active' in the cache/tlb.
  */
 
+#ifdef PMAP_INCLUDE_PTE_SYNC
 static inline void
 pmap_pte_sync_current(pmap_t pm, pt_entry_t *ptep)
 {
@@ -976,10 +977,9 @@ pmap_pte_sync_current(pmap_t pm, pt_entr
 	arm_dsb();
 }
 
-#ifdef PMAP_INCLUDE_PTE_SYNC
-#define	PTE_SYNC_CURRENT(pm, ptep)	pmap_pte_sync_current(pm, ptep)
+# define PTE_SYNC_CURRENT(pm, ptep)	pmap_pte_sync_current(pm, ptep)
 #else
-#define	PTE_SYNC_CURRENT(pm, ptep)	/* nothing */
+# define PTE_SYNC_CURRENT(pm, ptep)	__nothing
 #endif
 
 /*
@@ -1708,7 +1708,7 @@ pmap_l2ptp_ctor(void *arg, void *v, int 
 			/*
 			 * Page tables must have the cache-mode set correctly.
 			 */
-			const pt_entry_t npte = (pte & ~L2_S_CACHE_MASK)
+			const pt_entry_t npte = (opte & ~L2_S_CACHE_MASK)
 			| pte_l2_s_cache_mode_pt;
 			l2pte_set(ptep, npte, opte);
 			PTE_SYNC(ptep);
@@ -1987,7 +1987,7 @@ pmap_vac_me_user(struct vm_page_md *md, 
 			pt_entry_t npte = opte & ~L2_S_CACHE_MASK;
 
 			if ((va != pv->pv_va || pm != pv->pv_pmap)
-			&& l2pte_valid_p(npte)) {
+			&& l2pte_valid_p(opte)) {
 #ifdef PMAP_CACHE_VIVT
 pmap_cache_wbinv_page(pv->pv_pmap, pv->pv_va,
 true, pv->pv_flags);
@@ -2315,7 +2315,7 @@ pmap_vac_me_harder(struct vm_page_md *md
 		if (opte == npte)	/* only update is there's a change */
 			continue;
 
-		if (l2pte_valid_p(npte)) {
+		if (l2pte_valid_p(opte)) {
 			pmap_tlb_flush_SE(pv->pv_pmap, pv->pv_va, pv->pv_flags);
 		}
 
@@ -4252,7 +4252,7 @@ pmap_prefetchabt_fixup(void *v)
 	if ((opte & L2_S_PROT_U) == 0 || (opte & L2_XS_XN) == 0)
 		goto out;
 
-	paddr_t pa = l2pte_pa(pte);
+	paddr_t pa = l2pte_pa(opte);
 	struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
 	KASSERT(pg != NULL);
 

Index: src/sys/arch/arm/include/arm32/pmap.h
diff -u src/sys/arch/arm/include/arm32/pmap.h:1.135.2.2 src/sys/arch/arm/include/arm32/pmap.h:1.135.2.3
--- src/sys/arch/arm/include/arm32/pmap.h:1.135.2.2	Wed May 27 05:33:29 2015
+++ src/sys/arch/arm/include/arm32/pmap.h	Sat Mar 11 07:40:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.135.2.2 2015/05/27 05:33:29 msaitoh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.135.2.3 2017/03/11 07:40:21 snj Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -479,15 +479,21 @@ vtophys(vaddr_t va)
 extern int pmap_needs_pte_sync;
 #if defined(_KERNEL_OPT)
 /*
+ * Perform compile time evaluation of PMAP_NEEDS_PTE_SYNC when only a
+ * single MMU type is selected.
+ *
  * StrongARM SA-1 caches do not have a write-through mode.  So, on these,
- * we need to do PTE syncs.  If only SA-1 is configured, then evaluate
- * this at compile time.
+ * we need to do PTE syncs. Additionally, V6 MMUs also need PTE syncs.
+ * Finally, MEMC, GENERIC and 

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

2017-03-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar  7 20:26:12 UTC 2017

Modified Files:
src/sys/arch/xen/xen [netbsd-7]: hypervisor.c

Log Message:
Pull up following revision(s) (requested by jnmeth in ticket #1328):
sys/arch/xen/xen/hypervisor.c: revision 1.67
add machdep.xen.version sysctl to easily get hypervisor version


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/arch/xen/xen/hypervisor.c

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

Modified files:

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.65 src/sys/arch/xen/xen/hypervisor.c:1.65.4.1
--- src/sys/arch/xen/xen/hypervisor.c:1.65	Sat Feb  1 20:07:07 2014
+++ src/sys/arch/xen/xen/hypervisor.c	Tue Mar  7 20:26:12 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.65 2014/02/01 20:07:07 bouyer Exp $ */
+/* $NetBSD: hypervisor.c,v 1.65.4.1 2017/03/07 20:26:12 snj Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,12 +53,13 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.65 2014/02/01 20:07:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.65.4.1 2017/03/07 20:26:12 snj Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include "xenbus.h"
 #include "xencons.h"
@@ -203,14 +204,32 @@ hypervisor_attach(device_t parent, devic
 #endif /* NPCI */
 	union hypervisor_attach_cookie hac;
 	char xen_extra_version[XEN_EXTRAVERSION_LEN];
+	static char xen_version_string[20];
+	int rc;
+	const struct sysctlnode *node = NULL;
 
 	xenkernfs_init();
 
 	xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
 	memset(xen_extra_version, 0, sizeof(xen_extra_version));
 	HYPERVISOR_xen_version(XENVER_extraversion, xen_extra_version);
-	aprint_normal(": Xen version %d.%d%s\n", XEN_MAJOR(xen_version),
+	rc = snprintf(xen_version_string, 20, "%d.%d%s", XEN_MAJOR(xen_version),
 		XEN_MINOR(xen_version), xen_extra_version);
+	aprint_normal(": Xen version %s\n", xen_version_string);
+	if (rc >= 20)
+		aprint_debug(": xen_version_string truncated\n");
+
+	sysctl_createv(NULL, 0, NULL, , 0,
+	CTLTYPE_NODE, "xen",
+	SYSCTL_DESCR("Xen top level node"),
+	NULL, 0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+
+	if (node != NULL) {
+		sysctl_createv(NULL, 0, , NULL, CTLFLAG_READONLY,
+		CTLTYPE_STRING, "version",
+		SYSCTL_DESCR("Xen hypervisor version"),
+		NULL, 0, xen_version_string, 0, CTL_CREATE, CTL_EOL);
+	}
 
 	xengnt_init();
 	events_init();



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

2017-03-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Mar  6 03:27:19 UTC 2017

Modified Files:
src/sys/arch/x86/include [netbsd-7]: pmap.h
src/sys/arch/x86/x86 [netbsd-7]: pmap.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1388):
sys/arch/x86/x86/pmap.c: revision 1.241
Should be PG_k, doesn't change anything.
--
Remove PG_u from the kernel pages on Xen. Otherwise there is no privilege
separation between the kernel and userland.
On Xen-amd64, the kernel runs in ring3 just like userland, and the
separation is guaranteed by the hypervisor - each syscall/trap is
intercepted by Xen and sent manually to the kernel. Before that, the
hypervisor modifies the page tables so that the kernel becomes accessible.
Later, when returning to userland, the hypervisor removes the kernel pages
and flushes the TLB.
However, TLB flushes are costly, and in order to reduce the number of pages
flushed Xen marks the userland pages as global, while keeping the kernel
ones as local. This way, when returning to userland, only the kernel pages
get flushed - which makes sense since they are the only ones that got
removed from the mapping.
Xen differentiates the userland pages by looking at their PG_u bit in the
PTE; if a page has this bit then Xen tags it as global, otherwise Xen
manually adds the bit but keeps the page as local. The thing is, since we
set PG_u in the kernel pages, Xen believes our kernel pages are in fact
userland pages, so it marks them as global. Therefore, when returning to
userland, the kernel pages indeed get removed from the page tree, but are
not flushed from the TLB. Which means that they are still accessible.
With this - and depending on the DTLB size - userland has a small window
where it can read/write to the last kernel pages accessed, which is enough
to completely escalate privileges: the sysent structure systematically gets
read when performing a syscall, and chances are that it will still be
cached in the TLB. Userland can then use this to patch a chosen syscall,
make it point to a userland function, retrieve %gs and compute the address
of its credentials, and finally grant itself root privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.2 -r1.55.4.3 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.183.2.5 -r1.183.2.6 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.55.4.2 src/sys/arch/x86/include/pmap.h:1.55.4.3
--- src/sys/arch/x86/include/pmap.h:1.55.4.2	Sun Dec 18 07:01:57 2016
+++ src/sys/arch/x86/include/pmap.h	Mon Mar  6 03:27:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.55.4.2 2016/12/18 07:01:57 snj Exp $	*/
+/*	$NetBSD: pmap.h,v 1.55.4.3 2017/03/06 03:27:19 snj Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -179,15 +179,7 @@ struct pmap {
 	((pmap)->pm_pdirpa[0] + (index) * sizeof(pd_entry_t))
 #endif
 
-/* 
- * flag to be used for kernel mappings: PG_u on Xen/amd64, 
- * 0 otherwise.
- */
-#if defined(XEN) && defined(__x86_64__)
-#define PG_k PG_u
-#else
 #define PG_k 0
-#endif
 
 /*
  * MD flags that we use for pmap_enter and pmap_kenter_pa:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.183.2.5 src/sys/arch/x86/x86/pmap.c:1.183.2.6
--- src/sys/arch/x86/x86/pmap.c:1.183.2.5	Sun Dec 18 07:01:57 2016
+++ src/sys/arch/x86/x86/pmap.c	Mon Mar  6 03:27:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.183.2.5 2016/12/18 07:01:57 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.183.2.6 2017/03/06 03:27:19 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.5 2016/12/18 07:01:57 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.6 2017/03/06 03:27:19 snj Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1613,7 +1613,7 @@ pmap_bootstrap(vaddr_t kva_start)
 	memset((void *) (xen_dummy_user_pgd + KERNBASE), 0, PAGE_SIZE);
 	/* Mark read-only */
 	HYPERVISOR_update_va_mapping(xen_dummy_user_pgd + KERNBASE,
-	pmap_pa2pte(xen_dummy_user_pgd) | PG_u | PG_V, UVMF_INVLPG);
+	pmap_pa2pte(xen_dummy_user_pgd) | PG_k | PG_V, UVMF_INVLPG);
 	/* Pin as L4 */
 	xpq_queue_pin_l4_table(xpmap_ptom_masked(xen_dummy_user_pgd));
 #endif /* __x86_64__ */
@@ -2206,7 +2206,7 @@ pmap_pdp_ctor(void *arg, void *v, int fl
 	 * this pdir will NEVER be active in kernel mode
 	 * so mark recursive entry invalid
 	 */
-	pdir[PDIR_SLOT_PTE] = pmap_pa2pte(pdirpa) | PG_u;
+	pdir[PDIR_SLOT_PTE] = pmap_pa2pte(pdirpa) | PG_k;
 	/*
 	 * PDP constructed this way won't be for kernel,
 	 * hence we don't put kernel mappings on Xen.



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

2017-01-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan  3 06:42:04 UTC 2017

Modified Files:
src/sys/arch/amiga/dev [netbsd-7]: sbic.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1345):
sys/arch/amiga/dev/sbic.c: revision 1.74
Make it compile with -DDEBUG again.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.2.1 src/sys/arch/amiga/dev/sbic.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/sbic.c
diff -u src/sys/arch/amiga/dev/sbic.c:1.73 src/sys/arch/amiga/dev/sbic.c:1.73.2.1
--- src/sys/arch/amiga/dev/sbic.c:1.73	Thu Aug  7 08:59:42 2014
+++ src/sys/arch/amiga/dev/sbic.c	Tue Jan  3 06:42:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbic.c,v 1.73 2014/08/07 08:59:42 joerg Exp $ */
+/*	$NetBSD: sbic.c,v 1.73.2.1 2017/01/03 06:42:04 snj Exp $ */
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -81,7 +81,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbic.c,v 1.73 2014/08/07 08:59:42 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbic.c,v 1.73.2.1 2017/01/03 06:42:04 snj Exp $");
 
 #include 
 #include 
@@ -1231,11 +1231,17 @@ int
 sbicxfin(sbic_regmap_t regs, int len, void *bp)
 {
 	int wait;
-	u_char *buf;
 	u_char orig_csr, csr, asr;
+	u_char *buf;
+#ifdef DEBUG
+	u_char *obp;
+#endif
 
 	wait = sbic_data_wait;
 	buf = bp;
+#ifdef DEBUG
+	obp = bp;
+#endif
 
 	GET_SBIC_csr (regs, orig_csr);
 	__USE(orig_csr);



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

2017-01-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan  3 06:37:25 UTC 2017

Modified Files:
src/sys/arch/powerpc/fpu [netbsd-7]: fpu_emu.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1342):
sys/arch/powerpc/fpu/fpu_emu.c: revision 1.18
Fix build without DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.16.14.1 -r1.16.14.2 src/sys/arch/powerpc/fpu/fpu_emu.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/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.16.14.1 src/sys/arch/powerpc/fpu/fpu_emu.c:1.16.14.2
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.16.14.1	Tue Jan  3 06:19:21 2017
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Tue Jan  3 06:37:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.16.14.1 2017/01/03 06:19:21 snj Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.16.14.2 2017/01/03 06:37:25 snj Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.16.14.1 2017/01/03 06:19:21 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.16.14.2 2017/01/03 06:37:25 snj Exp $");
 
 #include "opt_ddb.h"
 
@@ -248,14 +248,14 @@ fpu_emulate(struct trapframe *tf, struct
 	case NOTFPU:
 	default:
 		DPRINTF(FPE_EX, ("fpu_emulate: SIGILL\n"));
-#ifdef DEBUG
+#if defined(DDB) && defined(DEBUG)
 		if (fpe_debug & FPE_EX) {
 			printf("fpu_emulate:  illegal insn %x at %p:",
 			insn.i_int, (void *) (tf->tf_srr0));
 			opc_disasm((vaddr_t)(tf->tf_srr0), insn.i_int);
 		}
 #endif
-#if defined(PPC_IBM4XX) && defined(DEBUG)
+#if defined(PPC_IBM4XX) && defined(DDB) && defined(DEBUG)
 		/*
 		*  retry an illegal insn once due to cache issues.
 		*/
@@ -265,7 +265,7 @@ fpu_emulate(struct trapframe *tf, struct
 Debugger();
 		}
 		lastill = tf->tf_srr0;
-#endif /* PPC_IBM4XX && DEBUG */
+#endif /* PPC_IBM4XX && DDB && DEBUG */
 		return false;
 	}
 }



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

2017-01-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan  3 06:19:21 UTC 2017

Modified Files:
src/sys/arch/powerpc/fpu [netbsd-7]: fpu_emu.c fpu_explode.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1341):
sys/arch/powerpc/fpu/fpu_emu.c: revision 1.19
sys/arch/powerpc/fpu/fpu_explode.c: revision 1.7
- add missing default from FreeBSD
- remove duplicate panic pointed out by matt
--
PR port-powerpc/51368: powerpc FPU emulation fails for single precision
floating point arithmetic
For single precision instruction, calculate first in double precision,
and then round it. With this fix, single precision arithmetic gets sane
on ibm4xx and booke.
Taken from FreeBSD commit r258250:
   https://svnweb.freebsd.org/base?view=revision=258250
Ok matt and simonb.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.14.1 src/sys/arch/powerpc/fpu/fpu_emu.c
cvs rdiff -u -r1.6 -r1.6.140.1 src/sys/arch/powerpc/fpu/fpu_explode.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/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.16 src/sys/arch/powerpc/fpu/fpu_emu.c:1.16.14.1
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.16	Mon Jul 23 04:13:06 2012
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Tue Jan  3 06:19:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.16 2012/07/23 04:13:06 matt Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.16.14.1 2017/01/03 06:19:21 snj Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.16 2012/07/23 04:13:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.16.14.1 2017/01/03 06:19:21 snj Exp $");
 
 #include "opt_ddb.h"
 
@@ -626,9 +626,11 @@ fpu_execute(struct trapframe *tf, struct
 			rb = instr.i_a.i_frb;
 			rc = instr.i_a.i_frc;
 
-			type = FTYPE_SNG;
-			if (instr.i_any.i_opcd & 0x4)
-type = FTYPE_DBL;
+			/*
+			 * All arithmetic operations work on registers, which
+			 * are stored as doubles.
+			 */
+			type = FTYPE_DBL;
 			switch ((unsigned int)instr.i_a.i_xo) {
 			case	OPC59_FDIVS:
 FPU_EMU_EVCNT_INCR(fdiv);
@@ -745,6 +747,13 @@ fpu_execute(struct trapframe *tf, struct
 return (NOTFPU);
 break;
 			}
+
+			/* If the instruction was single precision, round */
+			if (!(instr.i_any.i_opcd & 0x4)) {
+fpu_implode(fe, fp, FTYPE_SNG, 
+	(u_int *)>fpreg[rt]);
+fpu_explode(fe, fp = >fe_f1, FTYPE_SNG, rt);
+			}
 		}
 	} else {
 		return (NOTFPU);

Index: src/sys/arch/powerpc/fpu/fpu_explode.c
diff -u src/sys/arch/powerpc/fpu/fpu_explode.c:1.6 src/sys/arch/powerpc/fpu/fpu_explode.c:1.6.140.1
--- src/sys/arch/powerpc/fpu/fpu_explode.c:1.6	Sun Dec 11 12:18:42 2005
+++ src/sys/arch/powerpc/fpu/fpu_explode.c	Tue Jan  3 06:19:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_explode.c,v 1.6 2005/12/11 12:18:42 christos Exp $ */
+/*	$NetBSD: fpu_explode.c,v 1.6.140.1 2017/01/03 06:19:21 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.6 2005/12/11 12:18:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.6.140.1 2017/01/03 06:19:21 snj Exp $");
 
 #include 
 #include 
@@ -235,7 +235,7 @@ fpu_explode(struct fpemu *fe, struct fpn
 		s = fpu_dtof(fp, s, space[1]);
 		break;
 
-		panic("fpu_explode");
+	default:
 		panic("fpu_explode: invalid type %d", type);
 	}
 



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

2016-12-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Dec 24 04:07:25 UTC 2016

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

Log Message:
Apply patch (requested by maxv in ticket #1278):
suword: Don't allow 4 bytes to overflow beyond the userland space.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.34.1 src/sys/arch/amd64/amd64/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.18 src/sys/arch/amd64/amd64/copy.S:1.18.34.1
--- src/sys/arch/amd64/amd64/copy.S:1.18	Wed Jul  7 01:13:29 2010
+++ src/sys/arch/amd64/amd64/copy.S	Sat Dec 24 04:07:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.18 2010/07/07 01:13:29 chs Exp $	*/
+/*	$NetBSD: copy.S,v 1.18.34.1 2016/12/24 04:07:25 snj Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -413,7 +413,7 @@ ENTRY(fubyte)
 
 ENTRY(suword)
 	DEFERRED_SWITCH_CHECK
-	movq	$VM_MAXUSER_ADDRESS-4,%r11
+	movq	$VM_MAXUSER_ADDRESS-8,%r11
 	cmpq	%r11,%rdi
 	ja	_C_LABEL(fusuaddrfault)
 



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

2016-12-17 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 18 07:50:37 UTC 2016

Modified Files:
src/sys/arch/xen/conf [netbsd-7]: files.xen

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1326):
sys/arch/xen/conf/files.xen: revision 1.141
make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE


To generate a diff of this commit:
cvs rdiff -u -r1.133.4.1 -r1.133.4.2 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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.133.4.1 src/sys/arch/xen/conf/files.xen:1.133.4.2
--- src/sys/arch/xen/conf/files.xen:1.133.4.1	Sun Sep 25 12:11:33 2016
+++ src/sys/arch/xen/conf/files.xen	Sun Dec 18 07:50:37 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.133.4.1 2016/09/25 12:11:33 bouyer Exp $
+#	$NetBSD: files.xen,v 1.133.4.2 2016/12/18 07:50:37 snj Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -92,9 +92,9 @@ file	arch/xen/x86/xen_pmap.c
 file	arch/xen/x86/xen_intr.c
 file	arch/xen/x86/xenfunc.c
 
-file	arch/xen/xen/xen_ucode.c	dom0ops | cpu_ucode needs-flag
-file	arch/x86/x86/cpu_ucode_amd.c	dom0ops | cpu_ucode needs-flag
-file	arch/x86/x86/cpu_ucode_intel.c	dom0ops | cpu_ucode needs-flag
+file	arch/xen/xen/xen_ucode.c	dom0ops & cpu_ucode needs-flag
+file	arch/x86/x86/cpu_ucode_amd.c	dom0ops & cpu_ucode needs-flag
+file	arch/x86/x86/cpu_ucode_intel.c	dom0ops & cpu_ucode needs-flag
 
 file	arch/xen/xen/xen_machdep.c
 file	arch/xen/xen/xen_debug.c



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

2016-12-17 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 18 07:01:57 UTC 2016

Modified Files:
src/sys/arch/x86/include [netbsd-7]: pmap.h
src/sys/arch/x86/x86 [netbsd-7]: pmap.c vm_machdep.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1316):
sys/arch/x86/x86/pmap.c: revision 1.223
sys/arch/x86/x86/vm_machdep.c: revision 1.26
sys/arch/x86/include/pmap.h: revision 1.61
PR/49691: KAMADA Ken'ichi: free deferred ptp mappings if present.
XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.1 -r1.55.4.2 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.183.2.4 -r1.183.2.5 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/x86/x86/vm_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/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.55.4.1 src/sys/arch/x86/include/pmap.h:1.55.4.2
--- src/sys/arch/x86/include/pmap.h:1.55.4.1	Thu Apr 23 07:31:16 2015
+++ src/sys/arch/x86/include/pmap.h	Sun Dec 18 07:01:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.55.4.1 2015/04/23 07:31:16 snj Exp $	*/
+/*	$NetBSD: pmap.h,v 1.55.4.2 2016/12/18 07:01:57 snj Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -479,6 +479,7 @@ void	pmap_kenter_ma(vaddr_t, paddr_t, vm
 int	pmap_enter_ma(struct pmap *, vaddr_t, paddr_t, paddr_t,
 	vm_prot_t, u_int, int);
 bool	pmap_extract_ma(pmap_t, vaddr_t, paddr_t *);
+void	pmap_free_ptps(struct vm_page *);
 
 /*
  * Hooks for the pool allocator.

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.183.2.4 src/sys/arch/x86/x86/pmap.c:1.183.2.5
--- src/sys/arch/x86/x86/pmap.c:1.183.2.4	Fri Feb 26 21:50:54 2016
+++ src/sys/arch/x86/x86/pmap.c	Sun Dec 18 07:01:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.183.2.4 2016/02/26 21:50:54 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.183.2.5 2016/12/18 07:01:57 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.4 2016/02/26 21:50:54 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.5 2016/12/18 07:01:57 snj Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -2405,7 +2405,7 @@ pmap_create(void)
  * pmap_free_ptps: put a list of ptps back to the freelist.
  */
 
-static void
+void
 pmap_free_ptps(struct vm_page *empty_ptps)
 {
 	struct vm_page *ptp;

Index: src/sys/arch/x86/x86/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.25 src/sys/arch/x86/x86/vm_machdep.c:1.25.4.1
--- src/sys/arch/x86/x86/vm_machdep.c:1.25	Tue Mar 11 20:55:19 2014
+++ src/sys/arch/x86/x86/vm_machdep.c	Sun Dec 18 07:01:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.25 2014/03/11 20:55:19 para Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.25.4.1 2016/12/18 07:01:57 snj Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.25 2014/03/11 20:55:19 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.25.4.1 2016/12/18 07:01:57 snj Exp $");
 
 #include "opt_mtrr.h"
 
@@ -249,6 +249,12 @@ cpu_lwp_free(struct lwp *l, int proc)
 	if (proc && l->l_proc->p_md.md_flags & MDP_USEDMTRR)
 		mtrr_clean(l->l_proc);
 #endif
+	/*
+	 * Free deferred mappings if any.
+	 */
+	struct vm_page *empty_ptps = l->l_md.md_gc_ptp;
+	l->l_md.md_gc_ptp = NULL;
+	pmap_free_ptps(empty_ptps);
 }
 
 /*



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

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 05:10:45 UTC 2016

Modified Files:
src/sys/arch/amd64/conf [netbsd-7]: ALL GENERIC XEN3_DOM0
src/sys/arch/i386/conf [netbsd-7]: ALL GENERIC XEN3_DOM0

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1297):
sys/arch/amd64/conf/ALL: revision 1.37
sys/arch/amd64/conf/GENERIC: revision 1.436
sys/arch/amd64/conf/XEN3_DOM0: revision 1.120
sys/arch/i386/conf/ALL: revision 1.400
sys/arch/i386/conf/GENERIC: revision 1.1138
sys/arch/i386/conf/XEN3_DOM0: revision 1.99
Add sdtemp(4)
--
Add ichsmb(4), spdmem(4) and sdtemp(4).


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.3 -r1.13.2.4 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.392.2.7 -r1.392.2.8 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.103.2.4 -r1.103.2.5 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.380.2.2 -r1.380.2.3 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1107.2.8 -r1.1107.2.9 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.85.2.5 -r1.85.2.6 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/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.13.2.3 src/sys/arch/amd64/conf/ALL:1.13.2.4
--- src/sys/arch/amd64/conf/ALL:1.13.2.3	Fri May 15 03:44:17 2015
+++ src/sys/arch/amd64/conf/ALL	Fri Dec  9 05:10:45 2016
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.13.2.3 2015/05/15 03:44:17 snj Exp $
+# $NetBSD: ALL,v 1.13.2.4 2016/12/09 05:10:45 snj Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.13.2.3 $"
+#ident 		"ALL-$Revision: 1.13.2.4 $"
 
 maxusers	64		# estimated number of users
 
@@ -668,6 +668,13 @@ spdmem* at iic? addr 0x55
 spdmem* at iic? addr 0x56
 spdmem* at iic? addr 0x57
 sdtemp* at iic? addr 0x18
+sdtemp* at iic? addr 0x19
+sdtemp* at iic? addr 0x1a
+sdtemp* at iic? addr 0x1b
+sdtemp* at iic? addr 0x1c
+sdtemp* at iic? addr 0x1d
+sdtemp* at iic? addr 0x1e
+sdtemp* at iic? addr 0x1f
 
 # I2O devices
 iop*	at pci? dev ? function ?	# I/O processor

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.392.2.7 src/sys/arch/amd64/conf/GENERIC:1.392.2.8
--- src/sys/arch/amd64/conf/GENERIC:1.392.2.7	Fri May 15 03:44:17 2015
+++ src/sys/arch/amd64/conf/GENERIC	Fri Dec  9 05:10:45 2016
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.392.2.7 2015/05/15 03:44:17 snj Exp $
+# $NetBSD: GENERIC,v 1.392.2.8 2016/12/09 05:10:45 snj 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.392.2.7 $"
+#ident 		"GENERIC-$Revision: 1.392.2.8 $"
 
 maxusers	64		# estimated number of users
 
@@ -515,6 +515,14 @@ iic*	at ichsmb?
 #spdmem* at iic? addr 0x55
 #spdmem* at iic? addr 0x56
 #spdmem* at iic? addr 0x57
+#sdtemp* at iic? addr 0x18
+#sdtemp* at iic? addr 0x19
+#sdtemp* at iic? addr 0x1a
+#sdtemp* at iic? addr 0x1b
+#sdtemp* at iic? addr 0x1c
+#sdtemp* at iic? addr 0x1d
+#sdtemp* at iic? addr 0x1e
+#sdtemp* at iic? addr 0x1f
 
 # I2O devices
 iop*	at pci? dev ? function ?	# I/O processor

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.4 src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.5
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.103.2.4	Wed Jul 22 16:53:34 2015
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Fri Dec  9 05:10:45 2016
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.103.2.4 2015/07/22 16:53:34 snj Exp $
+# $NetBSD: XEN3_DOM0,v 1.103.2.5 2016/12/09 05:10:45 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -299,11 +299,33 @@ amdtemp* at amdnb_misc?			# AMD CPU Temp
 amdpm*	at pci? dev ? function ?	# RNG and SMBus 1.0 interface
 #iic*	at amdpm?			# sensors below are on this bus
 
+# Intel ICH SMBus controller
+ichsmb* at pci? dev ? function ?
+iic*	at ichsmb?
+
 # Thermal monitor and fan controller
 #dbcool* at iic? addr 0x2C		# Unknown other motherboard(s)
 #dbcool* at iic? addr 0x2D		# Tyan S2881
 #dbcool* at iic? addr 0x2E		# Tyan S2882-D
 
+# Serial Presence Detect capable memory modules
+#spdmem* at iic? addr 0x50
+#spdmem* at iic? addr 0x51
+#spdmem* at iic? addr 0x52
+#spdmem* at iic? addr 0x53
+#spdmem* at iic? addr 0x54
+#spdmem* at iic? addr 0x55
+#spdmem* at iic? addr 0x56
+#spdmem* at iic? addr 0x57
+#sdtemp* at iic? addr 0x18
+#sdtemp* at iic? addr 0x19
+#sdtemp* at iic? addr 0x1a
+#sdtemp* at iic? addr 0x1b
+#sdtemp* at iic? addr 0x1c
+#sdtemp* at iic? addr 0x1d
+#sdtemp* at iic? addr 0x1e
+#sdtemp* at iic? addr 0x1f
+
 # Winbond LPC Super I/O
 #wbsio*	at isa? port 0x2e
 #wbsio*	at isa? port 0x4e

Index: src/sys/arch/i386/conf/ALL
diff -u 

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

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 04:48:44 UTC 2016

Modified Files:
src/sys/arch/x86/pci [netbsd-7]: ichlpcib.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1295):
sys/arch/x86/pci/ichlpcib.c: revision 1.50
Add Core 5G (mobile) LPC support.


To generate a diff of this commit:
cvs rdiff -u -r1.43.4.5 -r1.43.4.6 src/sys/arch/x86/pci/ichlpcib.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/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.43.4.5 src/sys/arch/x86/pci/ichlpcib.c:1.43.4.6
--- src/sys/arch/x86/pci/ichlpcib.c:1.43.4.5	Sun Aug 28 03:38:15 2016
+++ src/sys/arch/x86/pci/ichlpcib.c	Fri Dec  9 04:48:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.43.4.5 2016/08/28 03:38:15 snj Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.43.4.6 2016/12/09 04:48:44 snj Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.43.4.5 2016/08/28 03:38:15 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.43.4.6 2016/12/09 04:48:44 snj Exp $");
 
 #include 
 #include 
@@ -261,6 +261,8 @@ static struct lpcib_device {
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_Z97_LPC, 1, 0 },
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X99_LPC, 1, 0 },
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X99_LPC_2, 1, 0 },
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_4, 1, 0 },
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_LPC_7, 1, 0 },
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C222_LPC, 1, 0 },
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C224_LPC, 1, 0 },
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C226_LPC, 1, 0 },



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

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  8 08:06:38 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1293):
sys/arch/x86/x86/procfs_machdep.c: revisions 1.12-1.14
Update for x86 /proc/cpuinfo:
- Add ptsc, avx512dq, avx512bw, avx512vl and rdt_a.
- Update VIA/Cyrix/Centaur-defined bits. Part of PR#39950.
- Remove pcommit.
- Update some Linux mapping unused in /proc/cpuinfo.


To generate a diff of this commit:
cvs rdiff -u -r1.6.4.1 -r1.6.4.2 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.6.4.1 src/sys/arch/x86/x86/procfs_machdep.c:1.6.4.2
--- src/sys/arch/x86/x86/procfs_machdep.c:1.6.4.1	Sun Mar  6 17:58:22 2016
+++ src/sys/arch/x86/x86/procfs_machdep.c	Thu Dec  8 08:06:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.6.4.1 2016/03/06 17:58:22 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.6.4.2 2016/12/08 08:06:38 snj Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.1 2016/03/06 17:58:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.2 2016/12/08 08:06:38 snj Exp $");
 
 #include 
 #include 
@@ -61,13 +61,13 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_machd
  *  x86/include/asm/cpufeatures.h.
  */
 static const char * const x86_features[][32] = {
-	{ /* (0) Common */
+	{ /* (0) Common: 0x001 edx */
 	"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
 	"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
 	"pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
 	"fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe"},
 
-	{ /* (1) AMD-defined: 8001 edx */
+	{ /* (1) AMD-defined: 0x8001 edx */
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL,
@@ -86,7 +86,7 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (4) Intel-defined: 8001 ecx */
+	{ /* (4) Intel-defined: 0x0001 ecx */
 	"pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est",
 	"tm2", "ssse3", "cid", "sdbg", "fma", "cx16", "xtpr", "pdcm",
 	NULL, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", "movbe", "popcnt",
@@ -95,7 +95,7 @@ static const char * const x86_features[]
 
 	{ /* (5) VIA/Cyrix/Centaur-defined */
 	NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	"ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
@@ -105,12 +105,13 @@ static const char * const x86_features[]
 	"3dnowprefetch", "osvw", "ibs", "xop", "skinit", "wdt", NULL, "lwp",
 	"fma4", "tce", NULL, "nodeid_msr",
 	NULL, "tbm", "topoext", "perfctr_core",
-	"perfctr_nb", NULL, "bpext", NULL, "perfctr_l2", "mwaitx", NULL, NULL},
+	"perfctr_nb", NULL, "bpext", "ptsc",
+	"perfctr_l2", "mwaitx", NULL, NULL},
 
 	{ /* (7) Linux mapping */
-	"ida", "arat", "cpb", "ebp", NULL, "pln", "pts", "dtherm",
-	"hw_pstate", "proc_feedback", "hwp", "hwp_notify", "hwp_act_window",
-	"hwp_epp", "hwp_pkg_req", "intel_pt",
+	NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm",
+	"hw_pstate", "proc_feedback", NULL, NULL,
+	NULL, NULL, NULL, "intel_pt",
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
@@ -124,11 +125,11 @@ static const char * const x86_features[]
 
 	{ /* (9) Intel-defined: 0007 ebx */
 	"fsgsbase", "tsc_adjust", NULL, "bmi1", "hle", "avx2", NULL, "smep",
-	"bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", NULL,
-	"avx512f", NULL, "rdseed", "adx",
-	"smap", NULL, "pcommit", "clflushopt",
+	"bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", "rdt_a",
+	"avx512f", "avx512dq", "rdseed", "adx",
+	"smap", NULL, NULL, "clflushopt",
 	"clwb", NULL, "avx512pf", "avx512er",
-	"avx512cd", "sha_ni", NULL, NULL},
+	"avx512cd", "sha_ni", "avx512bw", "avx512vl"},
 
 	{ /* (10) 000d eax */
 	"xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL,



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

2016-12-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  8 07:41:14 UTC 2016

Modified Files:
src/sys/arch/arm/include [netbsd-7]: armreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1287):
sys/arch/arm/include/armreg.h: revision 1.111
Fix CORTEXA9Rx definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/sys/arch/arm/include/armreg.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/arm/include/armreg.h
diff -u src/sys/arch/arm/include/armreg.h:1.97.2.1 src/sys/arch/arm/include/armreg.h:1.97.2.2
--- src/sys/arch/arm/include/armreg.h:1.97.2.1	Sun Nov  9 16:05:25 2014
+++ src/sys/arch/arm/include/armreg.h	Thu Dec  8 07:41:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: armreg.h,v 1.97.2.1 2014/11/09 16:05:25 martin Exp $	*/
+/*	$NetBSD: armreg.h,v 1.97.2.2 2016/12/08 07:41:14 snj Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -220,9 +220,10 @@
 #define CPU_ID_CORTEXA8R1	0x411fc080
 #define CPU_ID_CORTEXA8R2	0x412fc080
 #define CPU_ID_CORTEXA8R3	0x413fc080
-#define CPU_ID_CORTEXA9R2	0x411fc090
-#define CPU_ID_CORTEXA9R3	0x412fc090
-#define CPU_ID_CORTEXA9R4	0x413fc090
+#define CPU_ID_CORTEXA9R1	0x411fc090
+#define CPU_ID_CORTEXA9R2	0x412fc090
+#define CPU_ID_CORTEXA9R3	0x413fc090
+#define CPU_ID_CORTEXA9R4	0x414fc090
 #define CPU_ID_CORTEXA15R2	0x412fc0f0
 #define CPU_ID_CORTEXA15R3	0x413fc0f0
 #define CPU_ID_CORTEX_P(n)	((n & 0xff0ff000) == 0x410fc000)



CVS commit: [netbsd-7] src/sys/arch/dreamcast/dev

2016-12-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec  6 06:52:22 UTC 2016

Modified Files:
src/sys/arch/dreamcast/dev [netbsd-7]: pvr.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1284):
sys/arch/dreamcast/dev/pvr.c: revision 1.36
Properly zero out struct fb_devconfig, including rasops_info.
Fix panic after wsconscfg(8) from serial console, caused by
a junk function pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/arch/dreamcast/dev/pvr.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/dreamcast/dev/pvr.c
diff -u src/sys/arch/dreamcast/dev/pvr.c:1.35 src/sys/arch/dreamcast/dev/pvr.c:1.35.4.1
--- src/sys/arch/dreamcast/dev/pvr.c:1.35	Wed Mar 26 16:08:45 2014
+++ src/sys/arch/dreamcast/dev/pvr.c	Tue Dec  6 06:52:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pvr.c,v 1.35 2014/03/26 16:08:45 christos Exp $	*/
+/*	$NetBSD: pvr.c,v 1.35.4.1 2016/12/06 06:52:22 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pvr.c,v 1.35 2014/03/26 16:08:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pvr.c,v 1.35.4.1 2016/12/06 06:52:22 snj Exp $");
 
 #include 
 #include 
@@ -281,7 +281,7 @@ pvr_attach(device_t parent, device_t sel
 		sc->sc_nscreens = 1;
 	} else {
 		sc->sc_dc = malloc(sizeof(struct fb_devconfig), M_DEVBUF,
-		M_WAITOK);
+		M_WAITOK | M_ZERO);
 		pvr_getdevconfig(sc->sc_dc);
 	}
 	printf(": %d x %d, %dbpp, %s, %s\n", sc->sc_dc->dc_wid,



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

2016-12-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec  6 06:46:02 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1282):
sys/arch/x68k/x68k/machdep.c: revision 1.194
Fix crashdump on machines with EXTENDED_MEMORY.
PR port-x68k/51663 from Rin Okuyama.


To generate a diff of this commit:
cvs rdiff -u -r1.191.4.1 -r1.191.4.2 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.191.4.1 src/sys/arch/x68k/x68k/machdep.c:1.191.4.2
--- src/sys/arch/x68k/x68k/machdep.c:1.191.4.1	Thu Nov  5 20:40:22 2015
+++ src/sys/arch/x68k/x68k/machdep.c	Tue Dec  6 06:46:02 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.191.4.1 2015/11/05 20:40:22 riz Exp $	*/
+/*	$NetBSD: machdep.c,v 1.191.4.2 2016/12/06 06:46:02 snj Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.191.4.1 2015/11/05 20:40:22 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.191.4.2 2016/12/06 06:46:02 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -553,7 +553,10 @@ cpu_init_kcore_hdr(void)
 {
 	cpu_kcore_hdr_t *h = _kcore_hdr;
 	struct m68k_kcore_hdr *m = >un._m68k;
-	int i;
+	psize_t size;
+#ifdef EXTENDED_MEMORY
+	int i, seg;
+#endif
 
 	memset(_kcore_hdr, 0, sizeof(cpu_kcore_hdr));
 
@@ -602,14 +605,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;
-	for (i = 1; i < vm_nphysseg; i++) {
-		m->ram_segs[i].start =
-		ctob(VM_PHYSMEM_PTR(i)->start);
-		m->ram_segs[i].size  =
-		ctob(VM_PHYSMEM_PTR(i)->end - VM_PHYSMEM_PTR(i)->start);
+	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-7] src/sys/arch/luna68k/luna68k

2016-12-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec  6 06:44:14 UTC 2016

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-7]: locore.s

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1281):
sys/arch/luna68k/luna68k/locore.s: revisions 1.60-1.62
Allow NetBSD/luna68k kernel work with 8kB/page (PGSHIFT==13) settings.
Tested on both LUNA (68030) and LUNA-II (68040).
--
Make kernels build without options M68030.
--
Fix spelling in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.59.4.1 src/sys/arch/luna68k/luna68k/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/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.59 src/sys/arch/luna68k/luna68k/locore.s:1.59.4.1
--- src/sys/arch/luna68k/luna68k/locore.s:1.59	Sat Mar 22 16:52:07 2014
+++ src/sys/arch/luna68k/luna68k/locore.s	Tue Dec  6 06:44:14 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.59 2014/03/22 16:52:07 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.59.4.1 2016/12/06 06:44:14 snj Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -187,12 +187,14 @@ Lstart1:
 	jra	Lstart2
 1:
 #endif
+#if defined(M68030)
 	cmpl	#CPU_68030,%a0@		| 68030?
 	jne	1f			| no, skip
 	movl	#_C_LABEL(busaddrerr2030),%a2@(8)
 	movl	#_C_LABEL(busaddrerr2030),%a2@(12)
 	jra	Lstart2
 1:
+#endif
 	/* Config botch; no hope. */
 	PANIC("Config botch in locore")
 
@@ -287,7 +289,7 @@ Lmotommu1:
 	RELOC(protott1,%a0)		| tt1 range 8000.-.
 	.long	0xf0100c00		| pmove %a0@,mmutt1
 	pflusha
-	RELOC(prototc,%a0)		| %tc: SRP,CRP,4KB page,A=10bit,B=10bit
+	RELOC(prototc,%a0)		| %tc: SRP,CRP,4KB or 8KB page
 	pmove	%a0@,%tc
 /*
  * Should be running mapped from this point on
@@ -909,17 +911,25 @@ GLOBAL(protocrp)
 	.long	0x8002,0	| prototype CPU root pointer
 
 GLOBAL(prototc)
+#if PGSHIFT == 13
+	.long	0x82d08b00	| %tc (SRP,CRP,8KB page, TIA/TIB=8/11bits)
+#else
 	.long	0x82c0aa00	| %tc (SRP,CRP,4KB page, TIA/TIB=10/10bits)
+#endif
 GLOBAL(protott0)		| tt0 0x4000.-0x7fff.
 	.long	0x403f8543	|
 GLOBAL(protott1)		| tt1 0x8000.-0x.
 	.long	0x807f8543	|
 GLOBAL(proto040tc)
+#if PGSHIFT == 13
+	.long	0xc000		| %tc (8KB page)
+#else
 	.long	0x8000		| %tc (4KB page)
+#endif
 GLOBAL(proto040tt0)		| tt0 0x4000.-0x7fff.
-	.long	0x403fa040	| kernel only, cache inhebit, serialized
+	.long	0x403fa040	| kernel only, cache inhibit, serialized
 GLOBAL(proto040tt1)		| tt1 0x8000.-0x.
-	.long	0x807fa040	| kernel only, cache inhebit, serialized
+	.long	0x807fa040	| kernel only, cache inhibit, serialized
 nullrp:
 	.long	0x7fff0001	| do-nothing MMU root pointer
 



CVS commit: [netbsd-7] src/sys/arch/alpha

2016-11-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Nov  1 20:28:32 UTC 2016

Modified Files:
src/sys/arch/alpha/alpha [netbsd-7]: machdep.c prom.c
src/sys/arch/alpha/stand/common [netbsd-7]: booted_dev.c prom.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/prom.c: revision 1.15
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.345.2.1 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.48 -r1.48.22.1 src/sys/arch/alpha/alpha/prom.c
cvs rdiff -u -r1.3 -r1.3.196.1 src/sys/arch/alpha/stand/common/booted_dev.c
cvs rdiff -u -r1.14 -r1.14.38.1 src/sys/arch/alpha/stand/common/prom.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.345 src/sys/arch/alpha/alpha/machdep.c:1.345.2.1
--- src/sys/arch/alpha/alpha/machdep.c:1.345	Fri May 16 19:18:21 2014
+++ src/sys/arch/alpha/alpha/machdep.c	Tue Nov  1 20:28:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.345 2014/05/16 19:18:21 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.345.2.1 2016/11/01 20:28:32 snj 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.345 2014/05/16 19:18:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.345.2.1 2016/11/01 20:28:32 snj Exp $");
 
 #include 
 #include 
@@ -171,7 +171,7 @@ struct bootinfo_kernel bootinfo;
 
 /* For built-in TCDS */
 #if defined(DEC_3000_300) || defined(DEC_3000_500)
-uint8_t	dec_3000_scsiid[2], dec_3000_scsifast[2];
+uint8_t	dec_3000_scsiid[3], dec_3000_scsifast[3];
 #endif
 
 struct platform platform;

Index: src/sys/arch/alpha/alpha/prom.c
diff -u src/sys/arch/alpha/alpha/prom.c:1.48 src/sys/arch/alpha/alpha/prom.c:1.48.22.1
--- src/sys/arch/alpha/alpha/prom.c:1.48	Mon Feb  6 02:14:12 2012
+++ src/sys/arch/alpha/alpha/prom.c	Tue Nov  1 20:28:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.48 2012/02/06 02:14:12 matt Exp $ */
+/* $NetBSD: prom.c,v 1.48.22.1 2016/11/01 20:28:32 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
@@ -27,7 +27,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.48 2012/02/06 02:14:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.48.22.1 2016/11/01 20:28:32 snj Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -95,7 +95,7 @@ init_bootstrap_console(void)
 
 	init_prom_interface(hwrpb);
 
-	prom_getenv(PROM_E_TTY_DEV, buf, 4);
+	prom_getenv(PROM_E_TTY_DEV, buf, sizeof(buf));
 	alpha_console = buf[0] - '0';
 
 	/* XXX fake out the console routines, for now */
@@ -238,14 +238,14 @@ prom_getenv(int id, char *buf, int len)
 
 	prom_enter();
 	ret.bits = prom_getenv_disp(id, to, len);
-	memcpy(buf, to, len);
-	prom_leave();
-
 	if (ret.u.status & 0x4)
 		ret.u.retval = 0;
-	buf[ret.u.retval] = '\0';
+	len = min(len - 1, ret.u.retval);
+	memcpy(buf, to, len);
+	buf[len] = '\0';
+	prom_leave();
 
-	return (ret.bits);
+	return len;
 }
 
 void

Index: src/sys/arch/alpha/stand/common/booted_dev.c
diff -u src/sys/arch/alpha/stand/common/booted_dev.c:1.3 src/sys/arch/alpha/stand/common/booted_dev.c:1.3.196.1
--- src/sys/arch/alpha/stand/common/booted_dev.c:1.3	Sat Nov 13 21:38:20 1999
+++ src/sys/arch/alpha/stand/common/booted_dev.c	Tue Nov  1 20:28:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: booted_dev.c,v 1.3 1999/11/13 21:38:20 thorpej Exp $ */
+/* $NetBSD: booted_dev.c,v 1.3.196.1 2016/11/01 20:28:32 snj Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -53,9 +53,8 @@ booted_dev_open(void)
 	 * We don't know what device names look like yet,
 	 * so we can't change them.
 	 */
-	ret.bits = prom_getenv(PROM_E_BOOTED_DEV, booted_dev_name,
+	devlen = prom_getenv(PROM_E_BOOTED_DEV, booted_dev_name,
 	sizeof(booted_dev_name));
-	devlen = ret.u.retval;
 
 	ret.bits = prom_open(booted_dev_name, devlen);
 

Index: src/sys/arch/alpha/stand/common/prom.c
diff -u src/sys/arch/alpha/stand/common/prom.c:1.14 src/sys/arch/alpha/stand/common/prom.c:1.14.38.1
--- src/sys/arch/alpha/stand/common/prom.c:1.14	Wed Mar 18 10:22:22 2009
+++ src/sys/arch/alpha/stand/common/prom.c	Tue Nov  1 20:28:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.14 2009/03/18 10:22:22 cegger Exp $ */
+/* $NetBSD: prom.c,v 1.14.38.1 2016/11/01 20:28:32 snj Exp $ */
 
 /*  
  * Mach Operating System
@@ -57,7 +57,7 @@ init_prom_calls(void)
 	prom_dispatch_v.routine = c->crb_v_dispatch->entry_va;
 
 	/* Look for console 

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

2016-11-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Nov  1 19:00:11 UTC 2016

Modified Files:
src/sys/arch/amd64/conf [netbsd-7]: std.xen
src/sys/arch/xen/conf [netbsd-7]: std.xen

Log Message:
Pull up following revision(s) (requested by joerg in ticket #1258):
sys/arch/amd64/conf/std.xen: revision 1.8
sys/arch/xen/conf/std.xen: revision 1.8
Use the same process and file limits as normal AND64 for Xen kernels.
Given Xen/i386 the same process and file limit as native i386.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.38.1 src/sys/arch/amd64/conf/std.xen
cvs rdiff -u -r1.7 -r1.7.28.1 src/sys/arch/xen/conf/std.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/amd64/conf/std.xen
diff -u src/sys/arch/amd64/conf/std.xen:1.6 src/sys/arch/amd64/conf/std.xen:1.6.38.1
--- src/sys/arch/amd64/conf/std.xen:1.6	Wed Jul 29 12:02:05 2009
+++ src/sys/arch/amd64/conf/std.xen	Tue Nov  1 19:00:11 2016
@@ -1,4 +1,4 @@
-# $NetBSD: std.xen,v 1.6 2009/07/29 12:02:05 cegger Exp $
+# $NetBSD: std.xen,v 1.6.38.1 2016/11/01 19:00:11 snj Exp $
 # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp 
 #
 # standard, required NetBSD/i386 'options'
@@ -14,5 +14,8 @@ options 	EXEC_ELF64	# exec ELF binaries
 options 	EXEC_SCRIPT	# exec #! scripts
 options 	MTRR
 
+options 	CHILD_MAX=1024	# 160 is too few
+options 	OPEN_MAX=1024	# 128 is too few
+
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"

Index: src/sys/arch/xen/conf/std.xen
diff -u src/sys/arch/xen/conf/std.xen:1.7 src/sys/arch/xen/conf/std.xen:1.7.28.1
--- src/sys/arch/xen/conf/std.xen:1.7	Thu Jun 30 20:09:38 2011
+++ src/sys/arch/xen/conf/std.xen	Tue Nov  1 19:00:11 2016
@@ -1,4 +1,4 @@
-# $NetBSD: std.xen,v 1.7 2011/06/30 20:09:38 wiz Exp $
+# $NetBSD: std.xen,v 1.7.28.1 2016/11/01 19:00:11 snj Exp $
 # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp 
 #
 # standard, required NetBSD/i386 'options'
@@ -16,5 +16,8 @@ options 	CPU_IN_CKSUM
 #options 	CRYPTO_MD_BF_ENC	# machine-dependent code for BF_encrypt
 #options 	CRYPTO_MD_BF_CBC	# careful: uses bswapl, requires 486
 
+options 	CHILD_MAX=1024	# 160 is too few
+options 	OPEN_MAX=1024	# 128 is too few
+
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"



CVS commit: [netbsd-7] src/sys/arch/sparc64/sparc64

2016-09-25 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Sep 25 12:13:39 UTC 2016

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-7]: locore.s

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1257):
sys/arch/sparc64/sparc64/locore.s: revision 1.401
Fix RAS for 32-bit kernels.  trapframe is always 64-bit.


To generate a diff of this commit:
cvs rdiff -u -r1.369.2.3 -r1.369.2.4 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.369.2.3 src/sys/arch/sparc64/sparc64/locore.s:1.369.2.4
--- src/sys/arch/sparc64/sparc64/locore.s:1.369.2.3	Mon Nov 16 13:33:40 2015
+++ src/sys/arch/sparc64/sparc64/locore.s	Sun Sep 25 12:13:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.369.2.3 2015/11/16 13:33:40 msaitoh Exp $	*/
+/*	$NetBSD: locore.s,v 1.369.2.4 2016/09/25 12:13:39 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -5598,12 +5598,12 @@ ENTRY(cpu_switchto)
 	brz,pt	%o1, Lsw_noras		! no, skip RAS check
 	 LDPTR	[%i1 + L_TF], %l3	! pointer to trap frame
 	call	_C_LABEL(ras_lookup)
-	 LDPTR	[%l3 + TF_PC], %o1
+	 ldx	[%l3 + TF_PC], %o1
 	cmp	%o0, -1
-	be,pt	%xcc, Lsw_noras
+	be,pt	CCCR, Lsw_noras
 	 add	%o0, 4, %o1
-	STPTR	%o0, [%l3 + TF_PC]	! store rewound %pc
-	STPTR	%o1, [%l3 + TF_NPC]	! and %npc
+	stx	%o0, [%l3 + TF_PC]	! store rewound %pc
+	stx	%o1, [%l3 + TF_NPC]	! and %npc
 
 Lsw_noras:
 



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

2016-09-25 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Sep 25 12:11:33 UTC 2016

Modified Files:
src/sys/arch/xen/conf [netbsd-7]: files.xen

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1255):
sys/arch/xen/conf/files.xen: revision 1.137
Include files.sljit as i386/amd64 do.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.133.4.1 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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.133 src/sys/arch/xen/conf/files.xen:1.133.4.1
--- src/sys/arch/xen/conf/files.xen:1.133	Wed Feb 12 23:24:09 2014
+++ src/sys/arch/xen/conf/files.xen	Sun Sep 25 12:11:33 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.133 2014/02/12 23:24:09 dsl Exp $
+#	$NetBSD: files.xen,v 1.133.4.1 2016/09/25 12:11:33 bouyer Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -109,6 +109,12 @@ file	dev/cons.c
 
 
 #
+# Stack-less Just-In-Time compiler
+#
+
+include	"external/bsd/sljit/conf/files.sljit"
+
+#
 # Machine-independent SCSI drivers
 #
 



CVS commit: [netbsd-7] src/sys/arch/sparc64/sparc64

2016-09-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 10 06:38:54 UTC 2016

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-7]: kobj_machdep.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1248):
sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6
The target of the OLO10 relocation is the simd13 field of the instruction,
so use a 13 bit target mask.
Fixes PR kern/51436 (I broke this myself in rev 1.4)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/arch/sparc64/sparc64/kobj_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/sparc64/sparc64/kobj_machdep.c
diff -u src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.5 src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.5.4.1
--- src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.5	Sat Feb  1 11:19:04 2014
+++ src/sys/arch/sparc64/sparc64/kobj_machdep.c	Sat Sep 10 06:38:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.5 2014/02/01 11:19:04 nakayama Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.5.4.1 2016/09/10 06:38:54 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 Jake Burkholder.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.5 2014/02/01 11:19:04 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.5.4.1 2016/09/10 06:38:54 snj Exp $");
 
 #define	ELFSIZE		ARCH_ELFSIZE
 
@@ -164,7 +164,7 @@ static const long reloc_target_bitmask[]
 	_BM(22), _BM(10),		/* _HIPLT22, LOPLT10 */
 	_BM(32), _BM(22), _BM(10),	/* _PCPLT32, _PCPLT22, _PCPLT10 */
 	_BM(10), _BM(11), -1,		/* _10, _11, _64 */
-	_BM(10), _BM(22),		/* _OLO10, _HH22 */
+	_BM(13), _BM(22),		/* _OLO10, _HH22 */
 	_BM(10), _BM(22),		/* _HM10, _LM22 */
 	_BM(22), _BM(10), _BM(22),	/* _PC_HH22, _PC_HM10, _PC_LM22 */
 	_BM(16), _BM(19),		/* _WDISP16, _WDISP19 */



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

2016-08-27 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Aug 28 03:38:15 UTC 2016

Modified Files:
src/sys/arch/x86/pci [netbsd-7]: ichlpcib.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1213):
sys/arch/x86/pci/ichlpcib.c: revision 1.51
Disable gpio(4) attachment to ichlpcib(4) by default.
The GPIO lines on an ICH are usually connected to opaque platform-
defined functionality, and may be manipulated by the ACPI DSDT or other
mechanisms behind our backs.  In one instance, it was found this
in combiation with gpio_resume() sabotaged repeated suspend/resume cycles.
GPIO functionality can be enabled by setting ichlpcib_gpio_disable to 0,
for instance with `gdb -write`.


To generate a diff of this commit:
cvs rdiff -u -r1.43.4.4 -r1.43.4.5 src/sys/arch/x86/pci/ichlpcib.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/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.43.4.4 src/sys/arch/x86/pci/ichlpcib.c:1.43.4.5
--- src/sys/arch/x86/pci/ichlpcib.c:1.43.4.4	Thu Apr 30 19:27:20 2015
+++ src/sys/arch/x86/pci/ichlpcib.c	Sun Aug 28 03:38:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.43.4.4 2015/04/30 19:27:20 snj Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.43.4.5 2016/08/28 03:38:15 snj Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.43.4.4 2015/04/30 19:27:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.43.4.5 2016/08/28 03:38:15 snj Exp $");
 
 #include 
 #include 
@@ -279,6 +279,14 @@ static struct lpcib_device {
 };
 
 /*
+ * Allow user to enable GPIO functionality if they really need it.  The
+ * vast majority of systems with an ICH should not expose GPIO to the
+ * kernel or user.  In at least one instance the gpio_resume() handler
+ * on ICH GPIO was found to sabotage S3 suspend/resume.
+ */
+int	ichlpcib_gpio_disable = 1;
+
+/*
  * Autoconf callbacks.
  */
 static int
@@ -1073,6 +1081,9 @@ lpcib_gpio_configure(device_t self)
 	int pin, shift, base_reg, cntl_reg, reg;
 	int rv;
 
+	if (ichlpcib_gpio_disable != 0)
+		return;
+
 	/* this implies ICH >= 6, and thus different mapreg */
 	if (sc->sc_has_rcba) {
 		base_reg = LPCIB_PCI_GPIO_BASE_ICH6;



CVS commit: [netbsd-7] src/sys/arch/evbppc/conf

2016-08-27 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Aug 27 15:19:09 UTC 2016

Modified Files:
src/sys/arch/evbppc/conf [netbsd-7]: Makefile.ev64260.inc
Makefile.obs405.inc Makefile.walnut.inc

Log Message:
Pull up following revision(s) (requested by maya in ticket #1211):
sys/arch/evbppc/conf/Makefile.walnut.inc: revision 1.9
sys/arch/evbppc/conf/Makefile.obs405.inc: revision 1.13
sys/arch/evbppc/conf/Makefile.ev64260.inc: revision 1.8
Fix typo in Makefile which resulted in kernel image not being generated
>From Rin Okuyama in PR/51369


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/arch/evbppc/conf/Makefile.ev64260.inc
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/evbppc/conf/Makefile.obs405.inc
cvs rdiff -u -r1.8 -r1.8.4.1 src/sys/arch/evbppc/conf/Makefile.walnut.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/evbppc/conf/Makefile.ev64260.inc
diff -u src/sys/arch/evbppc/conf/Makefile.ev64260.inc:1.7 src/sys/arch/evbppc/conf/Makefile.ev64260.inc:1.7.4.1
--- src/sys/arch/evbppc/conf/Makefile.ev64260.inc:1.7	Mon Mar  3 19:08:46 2014
+++ src/sys/arch/evbppc/conf/Makefile.ev64260.inc	Sat Aug 27 15:19:09 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ev64260.inc,v 1.7 2014/03/03 19:08:46 joerg Exp $
+#	$NetBSD: Makefile.ev64260.inc,v 1.7.4.1 2016/08/27 15:19:09 bouyer Exp $
 
 MKIMG?=	${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh
 
@@ -9,5 +9,5 @@ SYSTEM_FIRST_SFILE=	${THISPPC}/${BOARDTY
 
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${MKIMG} $@ $@.img ; \
-	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \
+	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \
 		export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img

Index: src/sys/arch/evbppc/conf/Makefile.obs405.inc
diff -u src/sys/arch/evbppc/conf/Makefile.obs405.inc:1.12 src/sys/arch/evbppc/conf/Makefile.obs405.inc:1.12.2.1
--- src/sys/arch/evbppc/conf/Makefile.obs405.inc:1.12	Tue Aug  5 15:40:59 2014
+++ src/sys/arch/evbppc/conf/Makefile.obs405.inc	Sat Aug 27 15:19:09 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.obs405.inc,v 1.12 2014/08/05 15:40:59 apb Exp $
+#	$NetBSD: Makefile.obs405.inc,v 1.12.2.1 2016/08/27 15:19:09 bouyer Exp $
 
 CFLAGS+=-mcpu=405
 AFLAGS+=-mcpu=405
@@ -15,7 +15,7 @@ SYSTEM_FIRST_SFILE=	${THISPPC}/obs405/ob
 
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${MKIMG} $@ $@.img ; \
-	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \
+	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \
 		export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img
 
 
@@ -30,7 +30,7 @@ SYSTEM_FIRST_SFILE=	${POWERPC}/${PPCDIR}
 
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${MKIMG} $@ $@.img ; \
-	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \
+	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \
 		export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img
 
 

Index: src/sys/arch/evbppc/conf/Makefile.walnut.inc
diff -u src/sys/arch/evbppc/conf/Makefile.walnut.inc:1.8 src/sys/arch/evbppc/conf/Makefile.walnut.inc:1.8.4.1
--- src/sys/arch/evbppc/conf/Makefile.walnut.inc:1.8	Mon Mar  3 19:08:46 2014
+++ src/sys/arch/evbppc/conf/Makefile.walnut.inc	Sat Aug 27 15:19:09 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.walnut.inc,v 1.8 2014/03/03 19:08:46 joerg Exp $
+#	$NetBSD: Makefile.walnut.inc,v 1.8.4.1 2016/08/27 15:19:09 bouyer Exp $
 
 MKIMG?=	${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh
 CFLAGS+=-mcpu=403
@@ -10,5 +10,5 @@ SYSTEM_FIRST_SFILE=	${THISPPC}/walnut/wa
 
 SYSTEM_LD_TAIL_EXTRA_EXTRA+=; \
 	echo ${MKIMG} $@ $@.img ; \
-	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \
+	OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \
 		export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img



CVS commit: [netbsd-7] src/sys/arch/evbmips/loongson

2016-07-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 11 10:37:51 UTC 2016

Modified Files:
src/sys/arch/evbmips/loongson [netbsd-7]: yeeloong_machdep.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1202):
sys/arch/evbmips/loongson/yeeloong_machdep.c: revision 1.8
The version of PMON on my 8089B (LM8089-1.4.9a) configures OHCI but doesn't
enable memory space access. Enable it before the ohci driver attaches to
allow low- and full-speed devices to work.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/evbmips/loongson/yeeloong_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/evbmips/loongson/yeeloong_machdep.c
diff -u src/sys/arch/evbmips/loongson/yeeloong_machdep.c:1.6 src/sys/arch/evbmips/loongson/yeeloong_machdep.c:1.6.4.1
--- src/sys/arch/evbmips/loongson/yeeloong_machdep.c:1.6	Sat Mar 29 19:28:28 2014
+++ src/sys/arch/evbmips/loongson/yeeloong_machdep.c	Mon Jul 11 10:37:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: yeeloong_machdep.c,v 1.6 2014/03/29 19:28:28 christos Exp $	*/
+/*	$NetBSD: yeeloong_machdep.c,v 1.6.4.1 2016/07/11 10:37:51 martin Exp $	*/
 /*	$OpenBSD: yeeloong_machdep.c,v 1.16 2011/04/15 20:40:06 deraadt Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: yeeloong_machdep.c,v 1.6 2014/03/29 19:28:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: yeeloong_machdep.c,v 1.6.4.1 2016/07/11 10:37:51 martin Exp $");
 
 #include 
 #include 
@@ -558,6 +558,18 @@ lemote_device_register(device_t dev, voi
 	if (device_class(dev) != bootdev_class)
 		return;
 
+	/* OHCI memory space access may not be enabled by the BIOS */
+	if (device_is_a(dev, "ohci")) {
+		struct pci_attach_args *pa = aux;
+		pcireg_t csr = pci_conf_read(pa->pa_pc, pa->pa_tag,
+		PCI_COMMAND_STATUS_REG);
+		if ((csr & PCI_COMMAND_MEM_ENABLE) == 0) {
+			csr |= PCI_COMMAND_MEM_ENABLE;
+			pci_conf_write(pa->pa_pc, pa->pa_tag,
+			PCI_COMMAND_STATUS_REG, csr);
+		}
+	}
+
 	/* 
 	 * The device numbering must match. There's no way
 	 * pmon tells us more info. Depending on the usb slot



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

2016-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 10 10:33:42 UTC 2016

Modified Files:
src/sys/arch/mips/mips [netbsd-7]: pmap.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1200):
sys/arch/mips/mips/pmap.c: revision 1.221
sys/arch/mips/mips/pmap.c: revision 1.222
sys/arch/mips/mips/pmap.c: revision 1.223
Fix a bug introduced by me in 1.214 where unmanaged mappings would be
affected by calls to pmap_page_protect which is wrong.  Now PV_KENTER
mappings are left intact.
Thanks to chuq for spotting my mistake and reviewing this diff.
Thanks to everyone who tested it as well.
Fix PR/51288 reproducable panic on evbmips64-eb (erlite)
pmap_page_remove from the previous change neglected to terminate the pv
list correctly when it started with an initial unmanaged mapping and
subsequent managed mappings.  Fix this.
Fix MIPS3_NO_PV_UNCACHED alias handling by looping through the pv_list
looking for bad aliases and removing the bad entries.  That is, revert
to the code before the matt-mips64 merge.
Additionally, fix the pmap_update call to not use the (recently
  removed/freed) pv for the pmap_t.
Fixes the following two PRs
PR/49903: Panic during installation on WorkPad Z50 (hpcmips) whilst 
uncompressing base.tgz
PR/51226: Install bug for hpcmips NetBSD V7 using FTP Full installation


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.214.2.1 src/sys/arch/mips/mips/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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.214 src/sys/arch/mips/mips/pmap.c:1.214.2.1
--- src/sys/arch/mips/mips/pmap.c:1.214	Sun May 11 07:53:28 2014
+++ src/sys/arch/mips/mips/pmap.c	Sun Jul 10 10:33:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.214 2014/05/11 07:53:28 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.214.2.1 2016/07/10 10:33:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.214 2014/05/11 07:53:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.214.2.1 2016/07/10 10:33:42 martin Exp $");
 
 /*
  *	Manages physical address maps.
@@ -316,6 +316,7 @@ u_int		pmap_page_colormask;
 	 (pm) == curlwp->l_proc->p_vmspace->vm_map.pmap)
 
 /* Forward function declarations */
+void pmap_page_remove(struct vm_page *);
 void pmap_remove_pv(pmap_t, vaddr_t, struct vm_page *, bool);
 void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *, int);
 pt_entry_t *pmap_pte(pmap_t, vaddr_t);
@@ -1063,6 +1064,10 @@ pmap_page_protect(struct vm_page *pg, vm
 			while (pv != NULL) {
 const pmap_t pmap = pv->pv_pmap;
 const uint16_t gen = PG_MD_PVLIST_GEN(md);
+if (pv->pv_va & PV_KENTER) {
+	pv = pv->pv_next;
+	continue;
+}
 va = trunc_page(pv->pv_va);
 PG_MD_PVLIST_UNLOCK(md);
 pmap_protect(pmap, va, va + PAGE_SIZE, prot);
@@ -1087,17 +1092,7 @@ pmap_page_protect(struct vm_page *pg, vm
 		if (pmap_clear_mdpage_attributes(md, PG_MD_EXECPAGE)) {
 			PMAP_COUNT(exec_uncached_page_protect);
 		}
-		(void)PG_MD_PVLIST_LOCK(md, false);
-		pv = >pvh_first;
-		while (pv->pv_pmap != NULL) {
-			const pmap_t pmap = pv->pv_pmap;
-			va = trunc_page(pv->pv_va);
-			PG_MD_PVLIST_UNLOCK(md);
-			pmap_remove(pmap, va, va + PAGE_SIZE);
-			pmap_update(pmap);
-			(void)PG_MD_PVLIST_LOCK(md, false);
-		}
-		PG_MD_PVLIST_UNLOCK(md);
+		pmap_page_remove(pg);
 	}
 }
 
@@ -2069,6 +2064,32 @@ pmap_set_modified(paddr_t pa)
 / pv_entry management /
 
 static void
+pmap_check_alias(struct vm_page *pg)
+{
+#ifdef MIPS3_PLUS	/* XXX mmu XXX */
+#ifndef MIPS3_NO_PV_UNCACHED
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+
+	if (MIPS_HAS_R4K_MMU && PG_MD_UNCACHED_P(md)) {
+		/*
+		 * Page is currently uncached, check if alias mapping has been
+		 * removed.  If it was, then reenable caching.
+		 */
+		pv_entry_t pv = >pvh_first;
+		pv_entry_t pv0 = pv->pv_next;
+
+		for (; pv0; pv0 = pv0->pv_next) {
+			if (mips_cache_badalias(pv->pv_va, pv0->pv_va))
+break;
+		}
+		if (pv0 == NULL)
+			pmap_page_cache(pg, true);
+	}
+#endif
+#endif	/* MIPS3_PLUS */
+}
+
+static void
 pmap_check_pvlist(struct vm_page_md *md)
 {
 #ifdef PARANOIADIAG
@@ -2156,12 +2177,12 @@ again:
 			 * be mapped with one index at any given time.
 			 */
 
-			if (mips_cache_badalias(pv->pv_va, va)) {
-for (npv = pv; npv; npv = npv->pv_next) {
-	vaddr_t nva = trunc_page(npv->pv_va);
-	pmap_remove(npv->pv_pmap, nva,
-	nva + PAGE_SIZE);
-	pmap_update(npv->pv_pmap);
+			for (npv = pv; npv; npv = npv->pv_next) {
+vaddr_t nva = trunc_page(npv->pv_va);
+pmap_t npm = npv->pv_pmap;
+if (mips_cache_badalias(nva, va)) {
+	pmap_remove(npm, nva, nva + PAGE_SIZE);
+	pmap_update(npm);
 	goto again;
 }
 			}
@@ -2285,6 +2306,114 @@ again:
 }
 
 

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

2016-06-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jun 22 08:13:14 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #1172):
sys/arch/i386/stand/misc/rawr32.exe.uue: up to revision 1.6
New Rawrite32 release


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.24.1 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.

diffs are larger than 1MB and have been omitted


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

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:17:19 UTC 2016

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

Log Message:
Pullup the following revision to fix build break caused by ticket #1118:

sys/arch/xen/x86/cpu.c  1.102-1.103

Increase the number of entries of cpu_features from 5 to 7.


To generate a diff of this commit:
cvs rdiff -u -r1.98.4.1 -r1.98.4.2 src/sys/arch/xen/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/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.98.4.1 src/sys/arch/xen/x86/cpu.c:1.98.4.2
--- src/sys/arch/xen/x86/cpu.c:1.98.4.1	Tue Aug  4 18:12:28 2015
+++ src/sys/arch/xen/x86/cpu.c	Mon Mar  7 08:17:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.98.4.1 2015/08/04 18:12:28 snj Exp $	*/
+/*	$NetBSD: cpu.c,v 1.98.4.2 2016/03/07 08:17:19 msaitoh Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98.4.1 2015/08/04 18:12:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98.4.2 2016/03/07 08:17:19 msaitoh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -172,12 +172,14 @@ struct cpu_info phycpu_info_primary __al
 struct cpu_info *cpu_info_list = _info_primary;
 struct cpu_info *phycpu_info_list = _info_primary;
 
-uint32_t cpu_feature[5]; /* X86 CPUID feature bits
+uint32_t cpu_feature[7]; /* X86 CPUID feature bits
 			  *	[0] basic features %edx
 			  *	[1] basic features %ecx
 			  *	[2] extended features %edx
 			  *	[3] extended features %ecx
 			  *	[4] VIA padlock features
+			  * [5] structured extended features cpuid.7:%ebx
+			  * [6] structured extended features cpuid.7:%ecx
 			  */
 
 bool x86_mp_online;



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

2016-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  6 18:52:07 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1125):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.67
In xennet_xenbus_detach(), remove the event handler early (just after
xennet_stop()) so that we don't get events while slepping (e.g.
in softint_disestablish()) when some structures have already been
freed.
Problem reported and patch tested by Rohan Desai.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.2.1 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.63 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.1
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63	Sun Aug 10 16:44:35 2014
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sun Mar  6 18:52:06 2016
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.63 2014/08/10 16:44:35 tls Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63 2014/08/10 16:44:35 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -421,6 +421,7 @@ xennet_xenbus_detach(device_t self, int 
 	DPRINTF(("%s: xennet_xenbus_detach\n", device_xname(self)));
 	s0 = splnet();
 	xennet_stop(ifp, 1);
+	event_remove_handler(sc->sc_evtchn, _handler, sc);
 	/* wait for pending TX to complete, and collect pending RX packets */
 	xennet_handler(sc);
 	while (sc->sc_tx_ring.sring->rsp_prod != sc->sc_tx_ring.rsp_cons) {
@@ -456,7 +457,6 @@ xennet_xenbus_detach(device_t self, int 
 	uvm_km_free(kernel_map, (vaddr_t)sc->sc_rx_ring.sring, PAGE_SIZE,
 	UVM_KMF_WIRED);
 	softint_disestablish(sc->sc_softintr);
-	event_remove_handler(sc->sc_evtchn, _handler, sc);
 	splx(s0);
 
 	pmf_device_deregister(self);



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

2016-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  6 17:58:22 UTC 2016

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

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

sys/arch/x86/x86/procfs_machdep.c   1.7-1.11

x86's /proc/cpuinfo fixes:
- Always output 2 digits for the cpu frequency decimal part.
- Update x86's feature bits in /proc/cpuinfo (PR#49246).
- Fix a bug that /proc/cpuinfo's CPU model was incorrect on many newer
  CPUs and CPU family was incorrect on some AMD CPUs.
- Add comment. Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 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.6 src/sys/arch/x86/x86/procfs_machdep.c:1.6.4.1
--- src/sys/arch/x86/x86/procfs_machdep.c:1.6	Sat Apr  5 18:43:09 2014
+++ src/sys/arch/x86/x86/procfs_machdep.c	Sun Mar  6 17:58:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.6 2014/04/05 18:43:09 christos Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.6.4.1 2016/03/06 17:58:22 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6 2014/04/05 18:43:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.1 2016/03/06 17:58:22 martin Exp $");
 
 #include 
 #include 
@@ -56,50 +56,97 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_machd
 #include 
 #include 
 
-static const char * const x86_features[] = {
-	/* Intel-defined */
+/*
+ *  The feature table. The order is the same as Linux's
+ *  x86/include/asm/cpufeatures.h.
+ */
+static const char * const x86_features[][32] = {
+	{ /* (0) Common */
 	"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
 	"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
 	"pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
-	"fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
-#ifdef __x86_64__
-	/* AMD-defined */
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
-	NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, 
-	NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, 
-	NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
-
-	/* Transmeta-defined */
-	"recovery", "longrun", NULL, "lrti", 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, NULL, NULL, NULL, 
-
-	/* Linux-defined */
-	"cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL, 
-	"constant_tsc", 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, NULL, 
-
-	/* Intel-defined */
-	"pni", NULL, NULL, "monitor", "ds_cpi", "vmx", NULL, "est", 
-	"tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL, 
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
-
-	/* VIA/Cyrix/Centaur-defined */
-	NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", 
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
-
-	/* AMD defined */
-	"lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", 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, NULL, NULL, 
-#endif
+	"fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe"},
+
+	{ /* (1) AMD-defined: 8001 edx */
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL,
+	NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", "3dnowext","3dnow"},
+
+	{ /* (2) Transmeta-defined */
+	"recovery", "longrun", NULL, "lrti", 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, NULL, NULL, NULL},
+
+	{ /* (3) Linux mapping */
+	"cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
+	"constant_tsc", 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, NULL},
+
+	{ /* (4) Intel-defined: 8001 ecx */
+	"pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est",
+	"tm2", "ssse3", "cid", "sdbg", "fma", "cx16", "xtpr", "pdcm",
+	NULL, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", "movbe", "popcnt",
+	"tsc_deadline_timer", "aes", "xsave", NULL,
+	"avx", "f16c", "rdrand", "hypervisor"},
+
+	{ /* (5) VIA/Cyrix/Centaur-defined */
+	NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en",
+	NULL, NULL, NULL, NULL, NULL, NULL, 

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

2016-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  6 17:53:27 UTC 2016

Modified Files:
src/sys/arch/x86/include [netbsd-7]: cpu.h cpuvar.h
src/sys/arch/x86/x86 [netbsd-7]: cpu.c identcpu.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1118):
sys/arch/x86/include/cpuvar.h: revision 1.47
sys/arch/x86/x86/cpu.c: revision 1.117
sys/arch/x86/x86/identcpu.c: revision 1.49
sys/arch/x86/include/cpu.h: revision 1.67
Retrieve cpuid7 (Structured Extended Features) into ci_feat_val.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.66.4.1 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.46 -r1.46.14.1 src/sys/arch/x86/include/cpuvar.h
cvs rdiff -u -r1.111.2.2 -r1.111.2.3 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.45.2.1 -r1.45.2.2 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/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.66 src/sys/arch/x86/include/cpu.h:1.66.4.1
--- src/sys/arch/x86/include/cpu.h:1.66	Sun Feb 23 22:38:40 2014
+++ src/sys/arch/x86/include/cpu.h	Sun Mar  6 17:53:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.66 2014/02/23 22:38:40 dsl Exp $	*/
+/*	$NetBSD: cpu.h,v 1.66.4.1 2016/03/06 17:53:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -157,12 +157,14 @@ struct cpu_info {
 	uint32_t	ci_max_ext_cpuid; /* cpuid.8000:%eax */
 	volatile uint32_t	ci_lapic_counter;
 
-	uint32_t	ci_feat_val[5]; /* X86 CPUID feature bits */
+	uint32_t	ci_feat_val[7]; /* X86 CPUID feature bits */
 			/* [0] basic features cpuid.1:%edx
 			 * [1] basic features cpuid.1:%ecx (CPUID2_xxx bits)
 			 * [2] extended features cpuid:8001:%edx
 			 * [3] extended features cpuid:8001:%ecx
 			 * [4] VIA padlock features
+			 * [5] structured extended features cpuid.7:%ebx
+			 * [6] structured extended features cpuid.7:%ecx
 			 */
 	
 	const struct cpu_functions *ci_func;  /* start/stop functions */

Index: src/sys/arch/x86/include/cpuvar.h
diff -u src/sys/arch/x86/include/cpuvar.h:1.46 src/sys/arch/x86/include/cpuvar.h:1.46.14.1
--- src/sys/arch/x86/include/cpuvar.h:1.46	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/x86/include/cpuvar.h	Sun Mar  6 17:53:26 2016
@@ -1,4 +1,4 @@
-/* 	$NetBSD: cpuvar.h,v 1.46 2012/04/20 22:23:24 rmind Exp $ */
+/* 	$NetBSD: cpuvar.h,v 1.46.14.1 2016/03/06 17:53:26 martin Exp $ */
 
 /*-
  * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@ void	pat_init(struct cpu_info *);
 extern int cpu_vendor;
 extern bool x86_mp_online;
 
-extern uint32_t cpu_feature[5];
+extern uint32_t cpu_feature[7];
 
 #endif /* _KERNEL */
 

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.111.2.2 src/sys/arch/x86/x86/cpu.c:1.111.2.3
--- src/sys/arch/x86/x86/cpu.c:1.111.2.2	Fri Nov  6 00:40:02 2015
+++ src/sys/arch/x86/x86/cpu.c	Sun Mar  6 17:53:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.111.2.2 2015/11/06 00:40:02 riz Exp $	*/
+/*	$NetBSD: cpu.c,v 1.111.2.3 2016/03/06 17:53:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111.2.2 2015/11/06 00:40:02 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111.2.3 2016/03/06 17:53:26 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -177,13 +177,15 @@ static void	tss_init(struct i386tss *, v
 
 static void	cpu_init_idle_lwp(struct cpu_info *);
 
-uint32_t cpu_feature[5]; /* X86 CPUID feature bits
-			  *	[0] basic features %edx
-			  *	[1] basic features %ecx
-			  *	[2] extended features %edx
-			  *	[3] extended features %ecx
-			  *	[4] VIA padlock features
-			  */
+uint32_t cpu_feature[7]; /* X86 CPUID feature bits */
+			/* [0] basic features cpuid.1:%edx
+			 * [1] basic features cpuid.1:%ecx (CPUID2_xxx bits)
+			 * [2] extended features cpuid:8001:%edx
+			 * [3] extended features cpuid:8001:%ecx
+			 * [4] VIA padlock features
+			 * [5] structured extended features cpuid.7:%ebx
+			 * [6] structured extended features cpuid.7:%ecx
+			 */
 
 extern char x86_64_doubleflt_stack[];
 
@@ -784,7 +786,7 @@ cpu_boot_secondary(struct cpu_info *ci)
 }
 
 /*
- * The CPU ends up here when its ready to run
+ * The CPU ends up here when it's ready to run.
  * This is called from code in mptramp.s; at this point, we are running
  * in the idle pcb/idle stack of the new CPU.  When this function returns,
  * this processor will enter the idle loop and start looking for work.

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.45.2.1 src/sys/arch/x86/x86/identcpu.c:1.45.2.2
--- src/sys/arch/x86/x86/identcpu.c:1.45.2.1	Thu Oct 30 18:58:45 2014
+++ src/sys/arch/x86/x86/identcpu.c	Sun Mar  6 17:53:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.45.2.1 

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

2016-02-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 26 22:31:06 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1106):
sys/arch/arm/arm32/pmap.c: revision 1.332
Delete pmap_pmaps and its only user pmap_dump_all.  The list wasn't
being updated in an MP-safe manner.


To generate a diff of this commit:
cvs rdiff -u -r1.295.2.7 -r1.295.2.8 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.295.2.7 src/sys/arch/arm/arm32/pmap.c:1.295.2.8
--- src/sys/arch/arm/arm32/pmap.c:1.295.2.7	Wed May 27 05:33:29 2015
+++ src/sys/arch/arm/arm32/pmap.c	Fri Feb 26 22:31:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.295.2.7 2015/05/27 05:33:29 msaitoh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.295.2.8 2016/02/26 22:31:06 snj Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,7 @@
 #include 
 //#include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295.2.7 2015/05/27 05:33:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295.2.8 2016/02/26 22:31:06 snj Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -281,7 +281,6 @@ int			arm_poolpage_vmfreelist = VM_FREEL
  * in pmap_create().
  */
 static struct pool_cache pmap_cache;
-static LIST_HEAD(, pmap) pmap_pmaps;
 
 /*
  * Pool of PV structures
@@ -3035,8 +3034,6 @@ pmap_create(void)
 
 	pmap_pinit(pm);
 
-	LIST_INSERT_HEAD(_pmaps, pm, pm_list);
-
 	return (pm);
 }
 
@@ -5102,8 +5099,6 @@ pmap_destroy(pmap_t pm)
 	}
 #endif
 
-	LIST_REMOVE(pm, pm_list);
-
 	pmap_free_l1(pm);
 
 #ifdef ARM_MMU_EXTENDED
@@ -6240,8 +6235,6 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v
 	 */
 	pool_cache_bootstrap(_cache, sizeof(struct pmap), 0, 0, 0,
 	"pmappl", NULL, IPL_NONE, pmap_pmap_ctor, NULL, NULL);
-	LIST_INIT(_pmaps);
-	LIST_INSERT_HEAD(_pmaps, pm, pm_list);
 
 	/*
 	 * Initialize the pv pool.
@@ -7486,22 +7479,8 @@ pmap_kernel_L1_addr(void)
 /*
  * A couple of ddb-callable functions for dumping pmaps
  */
-void pmap_dump_all(void);
 void pmap_dump(pmap_t);
 
-void
-pmap_dump_all(void)
-{
-	pmap_t pm;
-
-	LIST_FOREACH(pm, _pmaps, pm_list) {
-		if (pm == pmap_kernel())
-			continue;
-		pmap_dump(pm);
-		printf("\n");
-	}
-}
-
 static pt_entry_t ncptes[64];
 static void pmap_dump_ncpg(pmap_t);
 



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

2016-02-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 26 22:25:07 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1104):
sys/arch/arm/arm/disassem.c: revisions 1.29-1.34
Remove duplicate entry
--
Document 'e'
--
Remove incorrect entries
--
More instructions. Lots left to do.
--
Move /* A5.2.10 Synchronisation primitives */ block earlier so it
matches correctly
--
Move mcrr and mrrc up the list so they match ahead of ldc/ldc2


To generate a diff of this commit:
cvs rdiff -u -r1.24.4.3 -r1.24.4.4 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.24.4.3 src/sys/arch/arm/arm/disassem.c:1.24.4.4
--- src/sys/arch/arm/arm/disassem.c:1.24.4.3	Fri May 15 04:12:07 2015
+++ src/sys/arch/arm/arm/disassem.c	Fri Feb 26 22:25:07 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: disassem.c,v 1.24.4.3 2015/05/15 04:12:07 snj Exp $	*/
+/*	$NetBSD: disassem.c,v 1.24.4.4 2016/02/26 22:25:07 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe.
@@ -49,7 +49,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: disassem.c,v 1.24.4.3 2015/05/15 04:12:07 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disassem.c,v 1.24.4.4 2016/02/26 22:25:07 snj Exp $");
 
 #include 
 
@@ -71,15 +71,21 @@ __KERNEL_RCSID(0, "$NetBSD: disassem.c,v
  * the instruction. The only exception is the writeback flag which
  * follows a operand.
  *
- *
+ * !c - cps flags and mode
+ * !d - debug option (bit 0-3)
+ * !l - dmb/dsb limitation
+ * !m - mode
  * 2 - print Operand 2 of a data processing instruction
  * a - address operand of ldr/str instruction
  * b - branch address
  * c - comment field bits(0-23)
  * d - destination register (bits 12-15)
+ * e - address operand of ldrx/strx instruction
  * f - 1st fp operand (register) (bits 12-14)
  * g - 2nd fp operand (register) (bits 16-18)
  * h - 3rd fp operand (register/immediate) (bits 0-4)
+ * i - lsb operand (bits 7-11)
+ * j - msb operand (bits 6,7,12-14)
  * k - breakpoint comment (bits 0-3, 8-19)
  * l - register list for ldm/stm instruction
  * m - m register (bits 0-3)
@@ -87,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: disassem.c,v
  * o - indirect register rn (bits 16-19) (used by swap)
  * p - saved or current status register
  * q - neon N register (7, 19-16)
+ * r - width minus 1 (bits 16-20)
  * s - s register (bits 8-11)
  * t - thumb branch address (bits 24, 0-23)
  * u - neon M register (5, 3-0)
@@ -95,6 +102,7 @@ __KERNEL_RCSID(0, "$NetBSD: disassem.c,v
  * x - instruction in hex
  * y - co-processor data processing registers
  * z - co-processor register transfer registers
+ * C - cps effect
  * D - destination-is-r15 (P) flag on TST, TEQ, CMP, CMN
  * F - PSR transfer fields
  * I - NEON operand size
@@ -120,62 +128,140 @@ struct arm32_insn {
 };
 
 static const struct arm32_insn arm32_i[] = {
-{ 0x0fff, 0x0ff0, "imb",	"c" },		/* Before swi */
-{ 0x0fff, 0x0ff1, "imbrange",	"c" },	/* Before swi */
-{ 0x0fff, 0x0320f003, "yield",	"" },	/* Before swi */
-{ 0x0fff, 0x0320f002, "wfe",	"" },	/* Before swi */
-{ 0x0fff, 0x0320f003, "wfi",	"" },	/* Before swi */
-{ 0x0f00, 0x0f00, "swi",	"c" },
+/* A5.7 Unconditional instructions */
+/*
+ * A5.7.1 Memory hints, Advanced SIMD instructions, and
+ * miscellaneous instructions
+ */
+{ 0xfff10020, 0xf100, "cps",	"C!c" },
+{ 0xfff100f0, 0xf101, "setend\tle", "" },
+{ 0xfff102f0, 0xf1010200, "setend\tbe", "" },
+/* pli */
+/* pld */
+{ 0x, 0xf57ff01f, "clrex",  "" },
+{ 0xfff0, 0xf57ff040, "dsb","!l" },
+{ 0xfff0, 0xf57ff050, "dmb","!l" },
+{ 0xfff0, 0xf57ff060, "isb","" },
+/* pli */
+/* pld */
+
+//{ 0x0e10, 0x0800, "stm",	"XnWl" },
+{ 0xfe5fffe0, 0xf84d0500, "srs",	"XnW!m" },
+{ 0xfe50, 0xf8100a00, "rfe",	"XnW" },
 { 0xfe00, 0xfa00, "blx",	"t" },		/* Before b and bl */
-{ 0x0f00, 0x0a00, "b",	"b" },
-{ 0x0f00, 0x0b00, "bl",	"b" },
-{ 0x0fe000f0, 0x0090, "mul",	"Snms" },
-{ 0x0fe000f0, 0x00200090, "mla",	"Snmsd" },
-{ 0x0fe000f0, 0x00800090, "umull",	"Sdnms" },
-{ 0x0fe000f0, 0x00c00090, "smull",	"Sdnms" },
-{ 0x0fe000f0, 0x00a00090, "umlal",	"Sdnms" },
-{ 0x0fe000f0, 0x00e00090, "smlal",	"Sdnms" },
+{ 0xfe100090, 0xfc00, "stc2",	"L#v" },
+{ 0x0e100090, 0x0c00, "stc",	"L#v" },
+{ 0x0ff0, 0x0c40, "mcrr",	"#&" },
+{ 0x0ff0, 0x0c50, "mrrc",	"#&" },
+{ 0xfe100090, 0xfc10, "ldc2",	"L#v" },
+{ 0x0e100090, 0x0c10, "ldc",	"L#v" },
+{ 0xff10, 0xfe00, "cdp2",	"#y" },
+{ 0x0f10, 0x0e00, "cdp",	"#y" },
+{ 0xff100010, 0xfe10, "mcr2",	"#z" },
+{ 

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

2016-02-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 26 21:50:54 UTC 2016

Modified Files:
src/sys/arch/x86/x86 [netbsd-7]: pmap.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1100):
sys/arch/x86/x86/pmap.c: revision 1.190
Operation pmap_pp_clear_attrs() may remove the "used" attribute from a page
that is still cached in the TLB of other CPUs.
Call pmap_tlb_shootnow() here before enabling preemption to clear the
TLB entries on other CPUs.
Should prevent tmpfs data corruption under load.
Ok: Chuck Silvers


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.3 -r1.183.2.4 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.183.2.3 src/sys/arch/x86/x86/pmap.c:1.183.2.4
--- src/sys/arch/x86/x86/pmap.c:1.183.2.3	Fri Feb 12 10:55:35 2016
+++ src/sys/arch/x86/x86/pmap.c	Fri Feb 26 21:50:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.183.2.3 2016/02/12 10:55:35 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.183.2.4 2016/02/26 21:50:54 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.3 2016/02/12 10:55:35 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.4 2016/02/26 21:50:54 snj Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3867,6 +3867,7 @@ startover:
 	}
 	result = pp->pp_attrs & clearbits;
 	pp->pp_attrs &= ~clearbits;
+	pmap_tlb_shootnow();
 	kpreempt_enable();
 
 	return result != 0;



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

2016-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 12 10:55:35 UTC 2016

Modified Files:
src/sys/arch/x86/x86 [netbsd-7]: pmap.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1115):
sys/arch/x86/x86/pmap.c: patch
Use IPL_NONE for pserialized lock.  Assert sleepable.  (OOPS.)


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.2 -r1.183.2.3 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.183.2.2 src/sys/arch/x86/x86/pmap.c:1.183.2.3
--- src/sys/arch/x86/x86/pmap.c:1.183.2.2	Thu Apr 23 07:31:16 2015
+++ src/sys/arch/x86/x86/pmap.c	Fri Feb 12 10:55:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.183.2.2 2015/04/23 07:31:16 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.183.2.3 2016/02/12 10:55:35 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.2 2015/04/23 07:31:16 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.3 2016/02/12 10:55:35 snj Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -490,7 +490,7 @@ void
 pmap_pv_init(void)
 {
 
-	mutex_init(_unmanaged.lock, MUTEX_DEFAULT, IPL_VM);
+	mutex_init(_unmanaged.lock, MUTEX_DEFAULT, IPL_NONE);
 	pv_unmanaged.psz = pserialize_create();
 	pv_unmanaged.list = NULL;
 }
@@ -504,6 +504,9 @@ pmap_pv_track(paddr_t start, psize_t siz
 	KASSERT(start == trunc_page(start));
 	KASSERT(size == trunc_page(size));
 
+	/* We may sleep for allocation.  */
+	ASSERT_SLEEPABLE();
+
 	npages = size >> PAGE_SHIFT;
 	pvt = kmem_zalloc(offsetof(struct pv_track, pvt_pages[npages]),
 	KM_SLEEP);
@@ -526,6 +529,9 @@ pmap_pv_untrack(paddr_t start, psize_t s
 	KASSERT(start == trunc_page(start));
 	KASSERT(size == trunc_page(size));
 
+	/* We may sleep for pserialize_perform.  */
+	ASSERT_SLEEPABLE();
+
 	mutex_enter(_unmanaged.lock);
 	for (pvtp = _unmanaged.list;
 	 (pvt = *pvtp) != NULL;



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

2016-02-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Feb  6 20:50:28 UTC 2016

Modified Files:
src/sys/arch/hp300/hp300 [netbsd-7]: intr.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1093):
sys/arch/hp300/hp300/intr.c: revision 1.42
Fix fatal "intr_dispatch: stray level 6 interrupt" panic by the GENERIC
kernel on machines without arcofi(4) audio (i.e. all hp300 except HP425e).
I failed to pull all necessary changes for arcofi(4) from OpenBSD
and I should have tested 7.0_RC kernels on my HP382 too :-(
Should be pulled up to netbsd-7 and netbsd-7-0.


To generate a diff of this commit:
cvs rdiff -u -r1.40.34.1 -r1.40.34.2 src/sys/arch/hp300/hp300/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/hp300/hp300/intr.c
diff -u src/sys/arch/hp300/hp300/intr.c:1.40.34.1 src/sys/arch/hp300/hp300/intr.c:1.40.34.2
--- src/sys/arch/hp300/hp300/intr.c:1.40.34.1	Fri Aug 29 11:42:15 2014
+++ src/sys/arch/hp300/hp300/intr.c	Sat Feb  6 20:50:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.40.34.1 2014/08/29 11:42:15 martin Exp $	*/
+/*	$NetBSD: intr.c,v 1.40.34.2 2016/02/06 20:50:28 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.40.34.1 2014/08/29 11:42:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.40.34.2 2016/02/06 20:50:28 snj Exp $");
 
 #define _HP300_INTR_H_PRIVATE
 
@@ -199,9 +199,12 @@ intr_dispatch(int evec /* format | vecto
 
 	list = _intr_list[ipl];
 	if (LIST_FIRST(>hi_q) == NULL) {
-		printf("intr_dispatch: ipl %d unexpected\n", ipl);
-		if (++unexpected > 10)
-			panic("intr_dispatch: too many unexpected interrupts");
+		if (ipl != 6) {
+			printf("intr_dispatch: ipl %d unexpected\n", ipl);
+			if (++unexpected > 10)
+panic("intr_dispatch:"
+" too many unexpected interrupts");
+		}
 		return;
 	}
 



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

2016-01-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 26 23:46:59 UTC 2016

Modified Files:
src/sys/arch/x86/include [netbsd-7]: cpufunc.h
src/sys/arch/x86/x86 [netbsd-7]: errata.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1073):
sys/arch/x86/x86/errata.c: revision 1.23
sys/arch/x86/include/cpufunc.h: revision 1.19
Adapt prototypes and usage of rdmsr_locked() and wrmsr_locked() to
their implementation.  Both functions don't take the passcode as
argument.
As wrmsr_locked() no longer writes the passcode to the msr the
erratum 721 on my Opteron 2356 really gets patched and cc1 no longer
crashes with SIGSEGV.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.4.1 src/sys/arch/x86/include/cpufunc.h
cvs rdiff -u -r1.21 -r1.21.12.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/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.18 src/sys/arch/x86/include/cpufunc.h:1.18.4.1
--- src/sys/arch/x86/include/cpufunc.h:1.18	Tue Feb 25 22:16:52 2014
+++ src/sys/arch/x86/include/cpufunc.h	Tue Jan 26 23:46:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.18 2014/02/25 22:16:52 dsl Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.18.4.1 2016/01/26 23:46:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -134,12 +134,12 @@ void	x86_reset(void);
 #define	OPTERON_MSR_PASSCODE	0x9c5a203aU
 
 uint64_t	rdmsr(u_int);
-uint64_t	rdmsr_locked(u_int, u_int);
+uint64_t	rdmsr_locked(u_int);
 int		rdmsr_safe(u_int, uint64_t *);
 uint64_t	rdtsc(void);
 uint64_t	rdpmc(u_int);
 void		wrmsr(u_int, uint64_t);
-void		wrmsr_locked(u_int, u_int, uint64_t);
+void		wrmsr_locked(u_int, uint64_t);
 void		setfs(int);
 void		setusergs(int);
 

Index: src/sys/arch/x86/x86/errata.c
diff -u src/sys/arch/x86/x86/errata.c:1.21 src/sys/arch/x86/x86/errata.c:1.21.12.1
--- src/sys/arch/x86/x86/errata.c:1.21	Thu Mar 21 13:22:37 2013
+++ src/sys/arch/x86/x86/errata.c	Tue Jan 26 23:46:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: errata.c,v 1.21 2013/03/21 13:22:37 christos Exp $	*/
+/*	$NetBSD: errata.c,v 1.21.12.1 2016/01/26 23:46:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.21 2013/03/21 13:22:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.21.12.1 2016/01/26 23:46:59 snj Exp $");
 
 #include 
 #include 
@@ -294,7 +294,7 @@ x86_errata_testmsr(struct cpu_info *ci, 
 
 	(void)ci;
 
-	val = rdmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE);
+	val = rdmsr_locked(e->e_data1);
 	if ((val & e->e_data2) != 0)
 		return FALSE;
 
@@ -309,10 +309,10 @@ x86_errata_setmsr(struct cpu_info *ci, e
 
 	(void)ci;
 
-	val = rdmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE);
+	val = rdmsr_locked(e->e_data1);
 	if ((val & e->e_data2) != 0)
 		return FALSE;
-	wrmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE, val | e->e_data2);
+	wrmsr_locked(e->e_data1, val | e->e_data2);
 	aprint_debug_dev(ci->ci_dev, "erratum %d patched\n",
 	e->e_num);
 



CVS commit: [netbsd-7] src/sys/arch/sparc64/sparc64

2016-01-25 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Jan 26 04:56:34 UTC 2016

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-7]: ofw_machdep.c

Log Message:
Pull up following revision(s) (requested by jdc in ticket #1069):
sys/arch/sparc64/sparc64/ofw_machdep.c: revision 1.45
Restrict the check for fully specified interrupts to machines with psycho
controllers only, and adjust comments to note this.
See also the mail thread starting at:
http://mail-index.NetBSD.org/port-sparc64/2015/12/03/msg002488.html


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.2.1 src/sys/arch/sparc64/sparc64/ofw_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/sparc64/sparc64/ofw_machdep.c
diff -u src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.42 src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.42.2.1
--- src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.42	Sun May  4 09:05:39 2014
+++ src/sys/arch/sparc64/sparc64/ofw_machdep.c	Tue Jan 26 04:56:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.42 2014/05/04 09:05:39 martin Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.42.2.1 2016/01/26 04:56:34 riz Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.42 2014/05/04 09:05:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.42.2.1 2016/01/26 04:56:34 riz Exp $");
 
 #include 
 #include 
@@ -707,22 +707,22 @@ OF_mapintr(int node, int *interrupt, int
 	int phc_node;
 	int rc = -1;
 
+	phc_node = find_pci_host_node(node);
+
 	/* 
-	 * Don't try to map interrupts for onboard devices, or if the
-	 * interrupt is already fully specified.
-	 * XXX This should be done differently (i.e. by matching
-	 * the node name) - but we need access to a machine where
-	 * a change is testable - hence the printf below.
+	 * On machines with psycho PCI controllers, we don't need to map
+	 * interrupts if they are already fully specified (0x20 to 0x3f
+	 * for onboard devices and IGN 0x7c0 for psycho0/psycho1).
 	 */
 	if (*interrupt & 0x20 || *interrupt & 0x7c0) {
-		char name[40];
-
-		OF_getprop(node, "name", , sizeof(name));
-		printf("\nATTENTION: if you see this message, please mail "
-		"the output of \"dmesg\" and \"ofctl -p\" to "
-		"port-spar...@netbsd.org!\n"
-		"Not mapping interrupt for node %s (%x)\n", name, node);
-		return validlen;
+		char model[40];
+		
+		if (OF_getprop(phc_node, "model", , sizeof(model)) > 10
+		&& !strcmp(model, "SUNW,psycho")) {
+			DPRINTF(("OF_mapintr: interrupt %x already mapped\n",
+			*interrupt));
+			return validlen;
+		}
 	}
 
 	/*
@@ -744,8 +744,6 @@ OF_mapintr(int node, int *interrupt, int
 		return (-1);
 	}
 
-	phc_node = find_pci_host_node(node);
-
 	while (node) {
 #ifdef DEBUG
 		char name[40];



CVS commit: [netbsd-7] src/sys/arch/sparc64/dev

2016-01-25 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Jan 26 01:25:33 UTC 2016

Modified Files:
src/sys/arch/sparc64/dev [netbsd-7]: schizo.c schizoreg.h schizovar.h

Log Message:
Pull up following revision(s) (requested by jdc in ticket #1064):
sys/arch/sparc64/dev/schizo.c: revision 1.34
sys/arch/sparc64/dev/schizo.c: revision 1.35
sys/arch/sparc64/dev/schizovar.h: revision 1.7
sys/arch/sparc64/dev/schizoreg.h: revision 1.10
sys/arch/sparc64/dev/schizoreg.h: revision 1.11
add some tomatillo specific information to schizo_pbm_regs.
Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.
Use __BIT() for some masks to fix the sparc build.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.31.8.1 -r1.31.8.2 src/sys/arch/sparc64/dev/schizo.c
cvs rdiff -u -r1.9 -r1.9.14.1 src/sys/arch/sparc64/dev/schizoreg.h
cvs rdiff -u -r1.6 -r1.6.14.1 src/sys/arch/sparc64/dev/schizovar.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/sparc64/dev/schizo.c
diff -u src/sys/arch/sparc64/dev/schizo.c:1.31.8.1 src/sys/arch/sparc64/dev/schizo.c:1.31.8.2
--- src/sys/arch/sparc64/dev/schizo.c:1.31.8.1	Mon Nov 10 17:59:57 2014
+++ src/sys/arch/sparc64/dev/schizo.c	Tue Jan 26 01:25:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: schizo.c,v 1.31.8.1 2014/11/10 17:59:57 snj Exp $	*/
+/*	$NetBSD: schizo.c,v 1.31.8.2 2016/01/26 01:25:32 riz Exp $	*/
 /*	$OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.31.8.1 2014/11/10 17:59:57 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.31.8.2 2016/01/26 01:25:32 riz Exp $");
 
 #include 
 #include 
@@ -74,6 +74,10 @@ static	int	schizo_match(device_t, cfdata
 static	void	schizo_attach(device_t, device_t, void *);
 static	int	schizo_print(void *aux, const char *p);
 
+#ifdef DEBUG
+void schizo_print_regs(int unit, int what);
+#endif
+
 CFATTACH_DECL_NEW(schizo, sizeof(struct schizo_softc),
 schizo_match, schizo_attach, NULL, NULL);
 
@@ -143,8 +147,8 @@ schizo_attach(device_t parent, device_t 
 	struct schizo_pbm *pbm;
 	struct iommu_state *is;
 	struct pcibus_attach_args pba;
-	uint64_t reg, eccctrl;
-	int *busranges = NULL, nranges;
+	uint64_t reg, eccctrl, ino_bitmap;
+	int *busranges = NULL, nranges, *ino_bitmaps = NULL, nbitmaps;
 	char *str;
 	bool no_sc;
 
@@ -180,6 +184,9 @@ schizo_attach(device_t parent, device_t 
 	if (pbm == NULL)
 		panic("schizo: can't alloc schizo pbm");
 
+#ifdef DEBUG
+	sc->sc_pbm = pbm;
+#endif
 	pbm->sp_sc = sc;
 	pbm->sp_regt = sc->sc_bustag;
 
@@ -194,11 +201,25 @@ schizo_attach(device_t parent, device_t 
 	if (bus_space_map(sc->sc_bustag, ma->ma_reg[0].ur_paddr,
 			  ma->ma_reg[0].ur_len,
 			  BUS_SPACE_MAP_LINEAR, >sp_intrh)) {
-		aprint_error(": failed to interrupt map registers\n");
+		aprint_error(": failed to map interrupt registers\n");
 		kmem_free(pbm, sizeof(*pbm));
 		return;
 	}
 
+#ifdef DEBUG
+	/*
+	 * Map ichip registers
+	 */
+	if (sc->sc_tomatillo)
+		if (bus_space_map(sc->sc_bustag, ma->ma_reg[3].ur_paddr,
+			  ma->ma_reg[3].ur_len,
+			  BUS_SPACE_MAP_LINEAR, >sp_ichiph)) {
+			aprint_error(": failed to map ichip registers\n");
+			kmem_free(pbm, sizeof(*pbm));
+			return;
+		}
+#endif
+
 	if (prom_getprop(sc->sc_node, "ranges", sizeof(struct schizo_range),
 	>sp_nrange, (void **)>sp_range))
 		panic("schizo: can't get ranges");
@@ -207,7 +228,7 @@ schizo_attach(device_t parent, device_t 
 	(void **)))
 		panic("schizo: can't get bus-range");
 
-	aprint_normal(": \"%s\", version %d, ign %x, bus %c %d to %d\n",
+	aprint_normal(": %s, version %d, ign %x, bus %c %d to %d\n",
 	sc->sc_tomatillo ? "Tomatillo" : "Schizo", sc->sc_ver,
 	sc->sc_ign, pbm->sp_bus_a ? 'A' : 'B', busranges[0], busranges[1]);
 	aprint_naive("\n");
@@ -304,20 +325,34 @@ schizo_attach(device_t parent, device_t 
 	SCZ_PCIDIAG_D_INTSYNC);
 	schizo_pbm_write(pbm, SCZ_PCI_DIAG, reg);
 
-	if (pbm->sp_bus_a)
+	if (prom_getprop(sc->sc_node, "ino-bitmap", sizeof(int), ,
+	(void **)_bitmaps)) {
+		/* No property - set defaults (double map UE, CE, SERR). */
+		if (pbm->sp_bus_a)
+			ino_bitmap = __BIT(SCZ_PCIERR_A_INO);
+		else
+			ino_bitmap = __BIT(SCZ_PCIERR_B_INO);
+		ino_bitmap |= __BIT(SCZ_UE_INO) | __BIT(SCZ_CE_INO) |
+		__BIT(SCZ_SERR_INO);
+	} else
+		ino_bitmap = (uint64_t) ino_bitmaps[1] << 32 | ino_bitmaps[0];
+	DPRINTF(SDB_INTR, ("ino_bitmap=0x%016" PRIx64 "\n", ino_bitmap));
+
+	if (ino_bitmap & __BIT(SCZ_PCIERR_A_INO))
 		schizo_set_intr(sc, pbm, PIL_HIGH, schizo_pci_error,
 		   pbm, SCZ_PCIERR_A_INO, "pci_a");
-	else
+	if (ino_bitmap & __BIT(SCZ_PCIERR_B_INO))
 		schizo_set_intr(sc, pbm, PIL_HIGH, schizo_pci_error,
 		   pbm, 

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

2016-01-16 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan 16 10:09:13 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf [netbsd-7]: OPENRD

Log Message:
Pull up following revision(s) (requested by cyber in ticket #1061):
sys/arch/evbarm/conf/OPENRD: revision 1.6
mvsdio does not work on OPENRD, disable it.
Tested on OpenRD-Client, causes infinite loop during autoconf when enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/arch/evbarm/conf/OPENRD

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/OPENRD
diff -u src/sys/arch/evbarm/conf/OPENRD:1.5 src/sys/arch/evbarm/conf/OPENRD:1.5.4.1
--- src/sys/arch/evbarm/conf/OPENRD:1.5	Fri Apr  4 07:55:25 2014
+++ src/sys/arch/evbarm/conf/OPENRD	Sat Jan 16 10:09:13 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: OPENRD,v 1.5 2014/04/04 07:55:25 msaitoh Exp $
+#	$NetBSD: OPENRD,v 1.5.4.1 2016/01/16 10:09:13 snj Exp $
 #
 # This is a working config file for OpenRD(.org) Client.  Note that the
 # default boot address will not work and the kernel has to load at 8MB
@@ -23,3 +23,9 @@ no options 	COMPAT_LINUX
 
 vga*		at pci? dev ? function ?
 wsdisplay*	at vga? console ?
+
+
+# mvsdio doesn't currently function on OPENRD
+# Tested on OpenRD-Client
+no mvsdio
+



  1   2   3   >