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

2022-09-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 24 08:10:26 UTC 2022

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_can.c

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

sys/arch/arm/sunxi/sunxi_can.c: revision 1.10,1.11 (via patch)

Don't process RX if SUNXI_CAN_INT_DATA_OR is pending. Seems to fix occasional
RX stalls

Just skipping sunxi_can_rx_intr() if the DATA_OR flag is set isn't enough
to properly recover from overrrun in all case. So go the linux way and reset
the hardware.

Don't write SUNXI_CAN_INT_RX_FLAG to SUNXI_CAN_INT_REG, this could race
with hardware and clear the interrupt while there are new packets received.
SUNXI_CAN_INT_RX_FLAG clears automatically when all pending packets have been
read, so when no more packets are pending just read SUNXI_CAN_INT_REG again
and process other interrupts, if any (or RX if there are new packets pending).

With this change it seems I get overruns less often in my use case.


To generate a diff of this commit:
cvs rdiff -u -r1.1.8.1 -r1.1.8.2 src/sys/arch/arm/sunxi/sunxi_can.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/sunxi/sunxi_can.c
diff -u src/sys/arch/arm/sunxi/sunxi_can.c:1.1.8.1 src/sys/arch/arm/sunxi/sunxi_can.c:1.1.8.2
--- src/sys/arch/arm/sunxi/sunxi_can.c:1.1.8.1	Wed Oct 23 19:43:25 2019
+++ src/sys/arch/arm/sunxi/sunxi_can.c	Sat Sep 24 08:10:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunxi_can.c,v 1.1.8.1 2019/10/23 19:43:25 martin Exp $	*/
+/*	$NetBSD: sunxi_can.c,v 1.1.8.2 2022/09/24 08:10:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017,2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.1.8.1 2019/10/23 19:43:25 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.1.8.2 2022/09/24 08:10:26 martin Exp $");
 
 #include 
 #include 
@@ -101,6 +101,8 @@ static void sunxi_can_ifwatchdog(struct 
 
 static void sunxi_can_enter_reset(struct sunxi_can_softc *);
 static void sunxi_can_exit_reset(struct sunxi_can_softc *);
+static void sunxi_can_ifdown(struct sunxi_can_softc * const);
+static int sunxi_can_ifup(struct sunxi_can_softc * const);
 
 CFATTACH_DECL_NEW(sunxi_can, sizeof(struct sunxi_can_softc),
 	sunxi_can_match, sunxi_can_attach, NULL, NULL);
@@ -347,7 +349,9 @@ sunxi_can_err_intr(struct sunxi_can_soft
 
 	if (irq & SUNXI_CAN_INT_DATA_OR) {
 		ifp->if_ierrors++;
+		sunxi_can_ifdown(sc);
 		sunxi_can_write(sc, SUNXI_CAN_CMD_REG, SUNXI_CAN_CMD_CLR_OR);
+		sunxi_can_ifup(sc);
 	}
 	if (irq & SUNXI_CAN_INT_ERR) {
 		reg = sunxi_can_read(sc, SUNXI_CAN_REC_REG);
@@ -386,21 +390,31 @@ sunxi_can_intr(void *arg)
 	while ((irq = sunxi_can_read(sc, SUNXI_CAN_INT_REG)) != 0) {
 		uint32_t sts = sunxi_can_read(sc, SUNXI_CAN_STA_REG);
 		rv = 1;
+rnd_add_uint32(>sc_rnd_source, irq);
 
-		if (irq & SUNXI_CAN_INT_TX_FLAG) {
-			sunxi_can_tx_intr(sc);
-		}
-		if (irq & SUNXI_CAN_INT_RX_FLAG) {
+		if ((irq & (SUNXI_CAN_INT_RX_FLAG | SUNXI_CAN_INT_DATA_OR)) ==
+		SUNXI_CAN_INT_RX_FLAG) {
 			while (sts & SUNXI_CAN_STA_RX_RDY) {
 sunxi_can_rx_intr(sc);
 sts = sunxi_can_read(sc, SUNXI_CAN_STA_REG);
 			}
+			/*
+			 * Don't write SUNXI_CAN_INT_RX_FLAG to the interrupt
+			 * register, this may clear the RX pending flag
+			 * while there is indeed a packet pending.
+			 * Reading packets should have cleared the RX interrupt,
+			 * so just restart the loop and re-read the interrupt
+			 * register. In the common case irq will now be 0.
+			 */
+			continue;
+		}
+		if (irq & SUNXI_CAN_INT_TX_FLAG) {
+			sunxi_can_tx_intr(sc);
 		}
 		if (irq & SUNXI_CAN_INT_ALLERRS) {
 			sunxi_can_err_intr(sc, irq, sts);
 		}
 		sunxi_can_write(sc, SUNXI_CAN_INT_REG, irq);
-rnd_add_uint32(>sc_rnd_source, irq);
 
 	}
 	mutex_exit(>sc_intr_lock);



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

2022-09-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 24 08:10:26 UTC 2022

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_can.c

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

sys/arch/arm/sunxi/sunxi_can.c: revision 1.10,1.11 (via patch)

Don't process RX if SUNXI_CAN_INT_DATA_OR is pending. Seems to fix occasional
RX stalls

Just skipping sunxi_can_rx_intr() if the DATA_OR flag is set isn't enough
to properly recover from overrrun in all case. So go the linux way and reset
the hardware.

Don't write SUNXI_CAN_INT_RX_FLAG to SUNXI_CAN_INT_REG, this could race
with hardware and clear the interrupt while there are new packets received.
SUNXI_CAN_INT_RX_FLAG clears automatically when all pending packets have been
read, so when no more packets are pending just read SUNXI_CAN_INT_REG again
and process other interrupts, if any (or RX if there are new packets pending).

With this change it seems I get overruns less often in my use case.


To generate a diff of this commit:
cvs rdiff -u -r1.1.8.1 -r1.1.8.2 src/sys/arch/arm/sunxi/sunxi_can.c

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



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

2022-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 16 18:36:43 UTC 2022

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

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

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

Add tdx_guest, brs, hfi, ibt, amx_bf16, amx_tile and amx_int8.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.5 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.6
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.5	Mon Jan 31 17:54:59 2022
+++ src/sys/arch/x86/x86/procfs_machdep.c	Fri Sep 16 18:36:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.6 2022/09/16 18:36:43 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.6 2022/09/16 18:36:43 martin Exp $");
 
 #include 
 #include 
@@ -122,7 +122,7 @@ static const char * const x86_features[]
 	{ /* (8) Linux mapping */
 	"tpr_shadow", "vnmi", "flexpriority", "ept", "vpid", NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmmcall",
-	NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, "ept_ad", NULL, NULL, NULL, NULL, "tdx_guest", NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (9) Intel-defined: 0007 ebx */
@@ -157,13 +157,13 @@ static const char * const x86_features[]
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
-	NULL, "virt_ssbd", NULL, "cppc", NULL, NULL, NULL, NULL},
+	NULL, "virt_ssbd", NULL, "cppc", NULL, NULL, NULL, "brs"},
 
 	{ /* (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, "hfi", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (15) AMD 0x800a edx */
@@ -193,8 +193,8 @@ static const char * const x86_features[]
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL,
 	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL,
 	"tsxldtrk", NULL, "pconfig", "arch_lbr",
-	NULL, NULL, NULL, "avx512_fp16",
-	NULL, NULL, NULL, NULL,
+	"ibt", NULL, "amx_bf16", "avx512_fp16",
+	"amx_tile", "amx_int8", NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
 
 	{ /* (19) AMD 0x801f eax */



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

2022-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 16 18:36:43 UTC 2022

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

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

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

Add tdx_guest, brs, hfi, ibt, amx_bf16, amx_tile and amx_int8.


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

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



CVS commit: [netbsd-9] src/sys/arch/atari/conf

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:24:18 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: ATARITT FALCON HADES MILAN-ISAIDE
MILAN-PCIIDE SMALL030

Log Message:
regen (ticket #1521)


To generate a diff of this commit:
cvs rdiff -u -r1.120.4.1 -r1.120.4.2 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.117.4.1 -r1.117.4.2 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.115.4.1 -r1.115.4.2 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.93.2.1 -r1.93.2.2 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.23.6.1 -r1.23.6.2 src/sys/arch/atari/conf/SMALL030

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/atari/conf/ATARITT
diff -u src/sys/arch/atari/conf/ATARITT:1.120.4.1 src/sys/arch/atari/conf/ATARITT:1.120.4.2
--- src/sys/arch/atari/conf/ATARITT:1.120.4.1	Sun Sep 11 18:17:02 2022
+++ src/sys/arch/atari/conf/ATARITT	Sun Sep 11 18:24:18 2022
@@ -1,5 +1,5 @@
 #
-# $NetBSD: ATARITT,v 1.120.4.1 2022/09/11 18:17:02 martin Exp $
+# $NetBSD: ATARITT,v 1.120.4.2 2022/09/11 18:24:18 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.

Index: src/sys/arch/atari/conf/FALCON
diff -u src/sys/arch/atari/conf/FALCON:1.117.4.1 src/sys/arch/atari/conf/FALCON:1.117.4.2
--- src/sys/arch/atari/conf/FALCON:1.117.4.1	Sun Sep 11 18:17:02 2022
+++ src/sys/arch/atari/conf/FALCON	Sun Sep 11 18:24:18 2022
@@ -1,5 +1,5 @@
 #
-# $NetBSD: FALCON,v 1.117.4.1 2022/09/11 18:17:02 martin Exp $
+# $NetBSD: FALCON,v 1.117.4.2 2022/09/11 18:24:18 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.

Index: src/sys/arch/atari/conf/HADES
diff -u src/sys/arch/atari/conf/HADES:1.115.4.1 src/sys/arch/atari/conf/HADES:1.115.4.2
--- src/sys/arch/atari/conf/HADES:1.115.4.1	Sun Sep 11 18:17:02 2022
+++ src/sys/arch/atari/conf/HADES	Sun Sep 11 18:24:18 2022
@@ -1,5 +1,5 @@
 #
-# $NetBSD: HADES,v 1.115.4.1 2022/09/11 18:17:02 martin Exp $
+# $NetBSD: HADES,v 1.115.4.2 2022/09/11 18:24:18 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.

Index: src/sys/arch/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.93.2.1 src/sys/arch/atari/conf/MILAN-ISAIDE:1.93.2.2
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.93.2.1	Sun Sep 11 18:17:02 2022
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Sun Sep 11 18:24:18 2022
@@ -1,11 +1,11 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.93.2.1 2022/09/11 18:17:02 martin Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.93.2.2 2022/09/11 18:24:18 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.29 2019/05/04 13:12:03 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.29.2.1 2022/09/11 18:23:30 martin Exp $
 #		NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -83,6 +83,7 @@ options WS_KERNEL_BG=WSCOL_BLACK
 options WSDISPLAY_COMPAT_USL # wsconscfg VT handling
 options WSDISPLAY_DEFAULTSCREENS=4
 options PCDISPLAY_SOFTCURSOR
+options FONT_VT220L8x16
 isab0 at mainbus0 # ISA-bus
 isa0 at isab0
 pcib0 at mainbus0 # PCI-bus

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.97.2.1 src/sys/arch/atari/conf/MILAN-PCIIDE:1.97.2.2
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.97.2.1	Sun Sep 11 18:17:02 2022
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Sun Sep 11 18:24:18 2022
@@ -1,11 +1,11 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.97.2.1 2022/09/11 18:17:02 martin Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.97.2.2 2022/09/11 18:24:18 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.29 2019/05/04 13:12:03 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.29.2.1 2022/09/11 18:23:30 martin Exp $
 #		NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -83,6 +83,7 @@ options WS_KERNEL_BG=WSCOL_BLACK
 options WSDISPLAY_COMPAT_USL # wsconscfg VT handling
 options WSDISPLAY_DEFAULTSCREENS=4
 options PCDISPLAY_SOFTCURSOR
+options FONT_VT220L8x16
 isab0 at mainbus0 # ISA-bus
 isa0 at isab0
 pcib0 at mainbus0 # PCI-bus

Index: src/sys/arch/atari/conf/SMALL030
diff -u src/sys/arch/atari/conf/SMALL030:1.23.6.1 src/sys/arch/atari/conf/SMALL030:1.23.6.2
--- src/sys/arch/atari/conf/SMALL030:1.23.6.1	Sun Sep 11 18:17:02 2022
+++ src/sys/arch/atari/conf/SMALL030	Sun Sep 11 18:24:18 2022
@@ -1,5 +1,5 @@
 #
-# $NetBSD: SMALL030,v 1.23.6.1 2022/09/11 18:17:02 

CVS commit: [netbsd-9] src/sys/arch/atari/conf

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:24:18 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: ATARITT FALCON HADES MILAN-ISAIDE
MILAN-PCIIDE SMALL030

Log Message:
regen (ticket #1521)


To generate a diff of this commit:
cvs rdiff -u -r1.120.4.1 -r1.120.4.2 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.117.4.1 -r1.117.4.2 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.115.4.1 -r1.115.4.2 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.93.2.1 -r1.93.2.2 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.23.6.1 -r1.23.6.2 src/sys/arch/atari/conf/SMALL030

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



CVS commit: [netbsd-9] src/sys/arch/atari

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:23:30 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: MILAN.in
src/sys/arch/atari/pci [netbsd-9]: pci_vga.c

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

sys/arch/atari/pci/pci_vga.c: revision 1.19
sys/arch/atari/conf/MILAN.in: revision 1.30

Improve VGA console settings for Milan, especially for sysinst.
- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)

Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/arch/atari/conf/MILAN.in
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/atari/pci/pci_vga.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/atari/conf/MILAN.in
diff -u src/sys/arch/atari/conf/MILAN.in:1.29 src/sys/arch/atari/conf/MILAN.in:1.29.2.1
--- src/sys/arch/atari/conf/MILAN.in:1.29	Sat May  4 13:12:03 2019
+++ src/sys/arch/atari/conf/MILAN.in	Sun Sep 11 18:23:30 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: MILAN.in,v 1.29 2019/05/04 13:12:03 tsutsui Exp $
+#	$NetBSD: MILAN.in,v 1.29.2.1 2022/09/11 18:23:30 martin Exp $
 #
 # Milan
 #
@@ -34,6 +34,8 @@ options 	WSDISPLAY_DEFAULTSCREENS=4
 options 	PCDISPLAY_SOFTCURSOR
 # modify the screen type of the console; defaults to "80x25"
 #options 	VGA_CONSOLE_SCREENTYPE="\"80x25\""
+# use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
+options 	FONT_VT220L8x16
 
 #
 # The following sections describe various hardware options.

Index: src/sys/arch/atari/pci/pci_vga.c
diff -u src/sys/arch/atari/pci/pci_vga.c:1.17 src/sys/arch/atari/pci/pci_vga.c:1.17.2.1
--- src/sys/arch/atari/pci/pci_vga.c:1.17	Sat May  4 09:03:08 2019
+++ src/sys/arch/atari/pci/pci_vga.c	Sun Sep 11 18:23:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_vga.c,v 1.17 2019/05/04 09:03:08 tsutsui Exp $	*/
+/*	$NetBSD: pci_vga.c,v 1.17.2.1 2022/09/11 18:23:30 martin Exp $	*/
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.17 2019/05/04 09:03:08 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.17.2.1 2022/09/11 18:23:30 martin Exp $");
 
 #include 
 #include 
@@ -55,11 +55,51 @@ extern font_info	font_info_8x8;
 extern font_info	font_info_8x16;
 
 /* Console colors */
-static const uint8_t conscolors[3][3] = {
-	/* background, foreground, hilite */
-	{ 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x30 },
-	{ 0x3f, 0x3f, 0x3f }
+/* attribute controller registers */
+static const uint8_t vga_atc[] = {
+	0x00,	/* 00: internal palette  0 */
+	0x01,	/* 01: internal palette  1 */
+	0x02,	/* 02: internal palette  2 */
+	0x03,	/* 03: internal palette  3 */
+	0x04,	/* 04: internal palette  4 */
+	0x05,	/* 05: internal palette  5 */
+	0x14,	/* 06: internal palette  6 */
+	0x07,	/* 07: internal palette  7 */
+	0x38,	/* 08: internal palette  8 */
+	0x39,	/* 09: internal palette  9 */
+	0x3a,	/* 0A: internal palette 10 */
+	0x3b,	/* 0B: internal palette 11 */
+	0x3c,	/* 0C: internal palette 12 */
+	0x3d,	/* 0D: internal palette 13 */
+	0x3e,	/* 0E: internal palette 14 */
+	0x3f,	/* 0F: internal palette 15 */
+	0x0c,	/* 10: attribute mode control */
+	0x00,	/* 11: overscan color */
+	0x0f,	/* 12: color plane enable */
+	0x08,	/* 13: horizontal PEL panning */
+	0x00	/* 14: color select */
+};
+
+/* video DAC palette registers */
+/* XXX only set up 16 colors used by internal palette in ATC regsters */
+static const uint8_t vga_dacpal[] = {
+	/* R G B */
+	0x00, 0x00, 0x00,	/* BLACK*/
+	0x00, 0x00, 0x2a,	/* BLUE	*/
+	0x00, 0x2a, 0x00,	/* GREEN*/
+	0x00, 0x2a, 0x2a,	/* CYAN */
+	0x2a, 0x00, 0x00,	/* RED  */
+	0x2a, 0x00, 0x2a,	/* MAGENTA  */
+	0x2a, 0x15, 0x00,	/* BROWN*/
+	0x2a, 0x2a, 0x2a,	/* LIGHTGREY*/
+	0x15, 0x15, 0x15,	/* DARKGREY */
+	0x15, 0x15, 0x3f,	/* LIGHTBLUE*/
+	0x15, 0x3f, 0x15,	/* LIGHTGREEN   */
+	0x15, 0x3f, 0x3f,	/* LIGHTCYAN*/
+	0x3f, 0x15, 0x15,	/* LIGHTRED */
+	0x3f, 0x15, 0x3f,	/* LIGHTMAGENTA */
+	0x3f, 0x3f, 0x15,	/* YELLOW   */
+	0x3f, 0x3f, 0x3f	/* WHITE*/
 };
 
 static bus_space_tag_t	vga_iot, vga_memt;
@@ -79,7 +119,7 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	pci_chipset_tag_t	pc = NULL; /* XXX */
 	bus_space_handle_t	ioh_regs, memh_fb;
 	pcitag_t		tag;
-	int			device, found, maxndevs, i, j;
+	int			device, found, maxndevs, i;
 	int			got_ioh, got_memh, rv;
 	uint32_t		id, class;
 	volatile uint8_t	*regs;
@@ -176,16 +216,23 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	 * Generic 

CVS commit: [netbsd-9] src/sys/arch/atari

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:23:30 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: MILAN.in
src/sys/arch/atari/pci [netbsd-9]: pci_vga.c

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

sys/arch/atari/pci/pci_vga.c: revision 1.19
sys/arch/atari/conf/MILAN.in: revision 1.30

Improve VGA console settings for Milan, especially for sysinst.
- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)

Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/arch/atari/conf/MILAN.in
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/atari/pci/pci_vga.c

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



CVS commit: [netbsd-9] src/sys/arch/atari/vme

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:21:56 UTC 2022

Modified Files:
src/sys/arch/atari/vme [netbsd-9]: if_le_vme.c

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

sys/arch/atari/vme/if_le_vme.c: revision 1.32
sys/arch/atari/vme/if_le_vme.c: revision 1.33

Fix a long-standing "leprobe: cannot map memory-area" error during probe.

PAM and ROTHRON VME LANCE seem to have 64KB RAM, but the register
address region are overwrapped, so we cannot map both of them via
bus_space_map(9) that checks regions using extent(9).

To work around this, just use only 32KB RAM for buffers.

XXX: not sure if anyone tried these VME LANCE variants

No need to print errors via aprint_error(9) in probe/match function.

Note aprint_error(9) triggers "WARNING: 1 error while detecting hardware"
message after device configuration, so it's a bit confusing for users.

Also check all possible variants even if bus_space_map(9) fails
(though now it shouldn't fail).


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.58.1 src/sys/arch/atari/vme/if_le_vme.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/atari/vme/if_le_vme.c
diff -u src/sys/arch/atari/vme/if_le_vme.c:1.31 src/sys/arch/atari/vme/if_le_vme.c:1.31.58.1
--- src/sys/arch/atari/vme/if_le_vme.c:1.31	Fri Jul  1 20:34:06 2011
+++ src/sys/arch/atari/vme/if_le_vme.c	Sun Sep 11 18:21:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le_vme.c,v 1.31 2011/07/01 20:34:06 dyoung Exp $	*/
+/*	$NetBSD: if_le_vme.c,v 1.31.58.1 2022/09/11 18:21:56 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998 maximum entropy.  All rights reserved.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_le_vme.c,v 1.31 2011/07/01 20:34:06 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_vme.c,v 1.31.58.1 2022/09/11 18:21:56 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -111,8 +111,11 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_vme.c,
 #include 
 
 /*
- * All cards except BVME410 have 64KB RAM. However On the Riebl cards the
- * area between the offsets 0xee70-0xeec0 is used to store config data.
+ * All cards except BVME410 have 64KB RAM. However,
+ *  - On the Riebl cards the area between the offsets 0xee70-0xeec0 is used
+ *to store config data.
+ *  - On PAM and ROTHRON, mem_addr cannot be mapped if reg_addr is already
+ *mapped because they are overwrapped. Just use 32KB as Linux does.
  */
 struct le_addresses {
 	u_long	reg_addr;
@@ -124,9 +127,9 @@ struct le_addresses {
 } lestd[] = {
 	{ 0xfe00fff0, 0xfe01, IRQUNK, 16, 64*1024,
 LE_OLD_RIEBL|LE_NEW_RIEBL }, /* Riebl	*/
-	{ 0xfec0, 0xfecf,  5, 16, 64*1024,
+	{ 0xfec0, 0xfecf,  5, 16, 32*1024,
 LE_PAM },		 /* PAM	*/
-	{ 0xfec0, 0xfecf,  5, 16, 64*1024,
+	{ 0xfec0, 0xfecf,  5, 16, 32*1024,
 LE_ROTHRON },		 /* Rhotron	*/
 	{ 0xfeff4100, 0xfe00,  4,  8, VMECF_MEMSIZ_DEFAULT,
 LE_BVME410 }		 /* BVME410 */
@@ -230,8 +233,7 @@ le_vme_match(device_t parent, cfdata_t c
 
 		if (bus_space_map(iot, le_ap->reg_addr, le_ap->reg_size, 0,
 		)) {
-			aprint_error("leprobe: cannot map io-area\n");
-			return 0;
+			continue;
 		}
 		if (le_ap->mem_size == VMECF_MEMSIZ_DEFAULT) {
 			if (bvme410_probe(iot, ioh)) {
@@ -249,8 +251,7 @@ le_vme_match(device_t parent, cfdata_t c
 		if (bus_space_map(memt, le_ap->mem_addr, le_ap->mem_size, 0,
 		)) {
 			bus_space_unmap(iot, ioh, le_ap->reg_size);
-			aprint_error("leprobe: cannot map memory-area\n");
-			return 0;
+			continue;
 		}
 		found = probe_addresses(, , , );
 		bus_space_unmap(iot, ioh, le_ap->reg_size);



CVS commit: [netbsd-9] src/sys/arch/atari/vme

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:21:56 UTC 2022

Modified Files:
src/sys/arch/atari/vme [netbsd-9]: if_le_vme.c

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

sys/arch/atari/vme/if_le_vme.c: revision 1.32
sys/arch/atari/vme/if_le_vme.c: revision 1.33

Fix a long-standing "leprobe: cannot map memory-area" error during probe.

PAM and ROTHRON VME LANCE seem to have 64KB RAM, but the register
address region are overwrapped, so we cannot map both of them via
bus_space_map(9) that checks regions using extent(9).

To work around this, just use only 32KB RAM for buffers.

XXX: not sure if anyone tried these VME LANCE variants

No need to print errors via aprint_error(9) in probe/match function.

Note aprint_error(9) triggers "WARNING: 1 error while detecting hardware"
message after device configuration, so it's a bit confusing for users.

Also check all possible variants even if bus_space_map(9) fails
(though now it shouldn't fail).


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.58.1 src/sys/arch/atari/vme/if_le_vme.c

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



CVS commit: [netbsd-9] src/sys/arch/atari/conf

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:17:02 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: ATARITT FALCON HADES MILAN-ISAIDE
MILAN-PCIIDE SMALL030

Log Message:
regen (ticket #1519)


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.120.4.1 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.117 -r1.117.4.1 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.115 -r1.115.4.1 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.93 -r1.93.2.1 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/arch/atari/conf/SMALL030

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/atari/conf/ATARITT
diff -u src/sys/arch/atari/conf/ATARITT:1.120 src/sys/arch/atari/conf/ATARITT:1.120.4.1
--- src/sys/arch/atari/conf/ATARITT:1.120	Sat Apr 13 08:26:14 2019
+++ src/sys/arch/atari/conf/ATARITT	Sun Sep 11 18:17:02 2022
@@ -1,11 +1,11 @@
 #
-# $NetBSD: ATARITT,v 1.120 2019/04/13 08:26:14 isaki Exp $
+# $NetBSD: ATARITT,v 1.120.4.1 2022/09/11 18:17:02 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: GENERIC.in,v 1.118 2019/04/13 08:22:59 isaki Exp $
+#		NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 include "arch/atari/conf/std.atari"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk
@@ -44,7 +44,7 @@ options KTRACE # Add kernel tracing syst
 options USERCONF # userconf(4) support
 options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
 options MODULAR # new style module(7) framework
-options ST_POOL_SIZE=24 # smallest that allows TT-HIGH
+options ST_POOL_SIZE=56 # for SCSI, FDC, and Xserver
 options TT_SCSI # SCSI-support for TT
 options TT_VIDEO # Graphics support for TT
 options MEMORY_DISK_HOOKS # Boot RAM-disk

Index: src/sys/arch/atari/conf/FALCON
diff -u src/sys/arch/atari/conf/FALCON:1.117 src/sys/arch/atari/conf/FALCON:1.117.4.1
--- src/sys/arch/atari/conf/FALCON:1.117	Sat Apr 13 08:26:14 2019
+++ src/sys/arch/atari/conf/FALCON	Sun Sep 11 18:17:02 2022
@@ -1,11 +1,11 @@
 #
-# $NetBSD: FALCON,v 1.117 2019/04/13 08:26:14 isaki Exp $
+# $NetBSD: FALCON,v 1.117.4.1 2022/09/11 18:17:02 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: GENERIC.in,v 1.118 2019/04/13 08:22:59 isaki Exp $
+#		NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 include "arch/atari/conf/std.atari"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk
@@ -49,7 +49,7 @@ options KTRACE # Add kernel tracing syst
 options USERCONF # userconf(4) support
 options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
 options MODULAR # new style module(7) framework
-options ST_POOL_SIZE=24 # smallest that allows TT-HIGH
+options ST_POOL_SIZE=56 # for SCSI, FDC, and Xserver
 options FALCON_SCSI # SCSI-support for Falcon
 options FALCON_VIDEO # Graphics support for FALCON
 options MEMORY_DISK_HOOKS # Boot RAM-disk

Index: src/sys/arch/atari/conf/HADES
diff -u src/sys/arch/atari/conf/HADES:1.115 src/sys/arch/atari/conf/HADES:1.115.4.1
--- src/sys/arch/atari/conf/HADES:1.115	Sat Apr 13 08:26:14 2019
+++ src/sys/arch/atari/conf/HADES	Sun Sep 11 18:17:02 2022
@@ -1,12 +1,12 @@
 #
-# $NetBSD: HADES,v 1.115 2019/04/13 08:26:14 isaki Exp $
+# $NetBSD: HADES,v 1.115.4.1 2022/09/11 18:17:02 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
 #		NetBSD: HADES.in,v 1.16 2018/03/31 04:19:41 tsutsui Exp $
-#		NetBSD: GENERIC.in,v 1.118 2019/04/13 08:22:59 isaki Exp $
+#		NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 include "arch/atari/conf/std.hades"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk
@@ -48,7 +48,7 @@ options KTRACE # Add kernel tracing syst
 options USERCONF # userconf(4) support
 options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
 options MODULAR # new style module(7) framework
-options ST_POOL_SIZE=24 # smallest that allows TT-HIGH
+options ST_POOL_SIZE=56 # for SCSI, FDC, and Xserver
 options TT_SCSI # SCSI-support for TT
 options TT_VIDEO # Graphics support for TT
 options MEMORY_DISK_HOOKS # Boot RAM-disk

Index: src/sys/arch/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.93 src/sys/arch/atari/conf/MILAN-ISAIDE:1.93.2.1
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.93	Sat May  4 13:14:18 2019
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Sun Sep 11 18:17:02 

CVS commit: [netbsd-9] src/sys/arch/atari/conf

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:17:02 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: ATARITT FALCON HADES MILAN-ISAIDE
MILAN-PCIIDE SMALL030

Log Message:
regen (ticket #1519)


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.120.4.1 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.117 -r1.117.4.1 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.115 -r1.115.4.1 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.93 -r1.93.2.1 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/arch/atari/conf/SMALL030

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



CVS commit: [netbsd-9] src/sys/arch/atari

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:14:55 UTC 2022

Modified Files:
src/sys/arch/atari/atari [netbsd-9]: atari_init.c
src/sys/arch/atari/conf [netbsd-9]: GENERIC.in files.atari

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

sys/arch/atari/conf/GENERIC.in: revision 1.123
sys/arch/atari/conf/files.atari: revision 1.124
sys/arch/atari/atari/atari_init.c: revision 1.105

Allocalte enough reserved ST-RAM to make the old Xserver work by default.

Instead, check ST-RAM size and TT-RAM size on startup and restrict
size of reserved ST memory on lower RAM machines.

Closes PR port-atari/41002 from David Ross.

While here, make options ST_POOL_SIZE defparam'ed to make sure to
reflect config(5) changes on each build.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.8.1 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.123 -r1.123.4.1 src/sys/arch/atari/conf/files.atari

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/atari/atari/atari_init.c
diff -u src/sys/arch/atari/atari/atari_init.c:1.101 src/sys/arch/atari/atari/atari_init.c:1.101.8.1
--- src/sys/arch/atari/atari/atari_init.c:1.101	Mon Feb 26 15:11:12 2018
+++ src/sys/arch/atari/atari/atari_init.c	Sun Sep 11 18:14:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari_init.c,v 1.101 2018/02/26 15:11:12 tsutsui Exp $	*/
+/*	$NetBSD: atari_init.c,v 1.101.8.1 2022/09/11 18:14:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -33,12 +33,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.101 2018/02/26 15:11:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.101.8.1 2022/09/11 18:14:55 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mbtype.h"
 #include "opt_m060sp.h"
 #include "opt_m68k_arch.h"
+#include "opt_st_pool_size.h"
 
 #include 
 #include 
@@ -145,18 +146,29 @@ extern struct pcb	*curpcb;
 vaddr_t	page_zero;
 
 /*
- * Crude support for allocation in ST-ram. Currently only used to allocate
- * video ram.
+ * Simple support for allocation in ST-ram.
+ * Currently 16 bit ST-ram is required to allocate DMA buffers for SCSI and
+ * FDC transfers, and video memory for the XFree68 based Xservers.
  * The physical address is also returned because the video init needs it to
  * setup the controller at the time the vm-system is not yet operational so
  * 'kvtop()' cannot be used.
  */
+#define	ST_POOL_SIZE_MIN	24	/* for DMA bounce buffers */
 #ifndef ST_POOL_SIZE
-#define	ST_POOL_SIZE	40			/* XXX: enough? */
+#define	ST_POOL_SIZE		56	/* Xserver requires 320KB (40 pages) */
 #endif
 
-u_long	st_pool_size = ST_POOL_SIZE * PAGE_SIZE; /* Patchable	*/
-u_long	st_pool_virt, st_pool_phys;
+psize_t	st_pool_size = ST_POOL_SIZE * PAGE_SIZE; /* Patchable	*/
+vaddr_t	st_pool_virt;
+paddr_t	st_pool_phys;
+
+/*
+ * Thresholds to restrict size of reserved ST memory to make sure
+ * the kernel at least boot even on lower memory machines.
+ * Nowadays we could assume most users have 4MB ST-RAM and 16MB TT-RAM.
+ */
+#define	STRAM_MINTHRESH		(2 * 1024 * 1024)
+#define	TTRAM_MINTHRESH		(4 * 1024 * 1024)
 
 /* I/O address space variables */
 vaddr_t	stio_addr;		/* Where the st io-area is mapped	*/
@@ -284,12 +296,20 @@ start_c(int id, u_int ttphystart, u_int 
 #endif
 
 	/*
-	 * The following is a hack. We do not know how much ST memory we
-	 * really need until after configuration has finished. At this
-	 * time I have no idea how to grab ST memory at that time.
+	 * We do not know how much ST memory we really need until after
+	 * configuration has finished, but typical users of ST memory
+	 * are bounce buffers DMA against TT-RAM for SCSI and FDC,
+	 * and video memory for the Xserver.
+	 * If we have enough RAMs reserve ST memory including for the Xserver.
+	 * Otherwise just allocate minimum one for SCSI and FDC.
+	 *
 	 * The round_page() call is ment to correct errors made by
 	 * binpatching!
 	 */
+	if (st_pool_size > ST_POOL_SIZE_MIN * PAGE_SIZE &&
+	(stphysize <= STRAM_MINTHRESH || ttphysize <= TTRAM_MINTHRESH)) {
+		st_pool_size = ST_POOL_SIZE_MIN * PAGE_SIZE;
+	}
 	st_pool_size   = m68k_round_page(st_pool_size);
 	st_pool_phys   = stphysize - st_pool_size;
 	stphysize  = st_pool_phys;

Index: src/sys/arch/atari/conf/GENERIC.in
diff -u src/sys/arch/atari/conf/GENERIC.in:1.118 src/sys/arch/atari/conf/GENERIC.in:1.118.4.1
--- src/sys/arch/atari/conf/GENERIC.in:1.118	Sat Apr 13 08:22:59 2019
+++ src/sys/arch/atari/conf/GENERIC.in	Sun Sep 11 18:14:55 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.in,v 1.118 2019/04/13 08:22:59 isaki Exp $
+#	$NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 #
 # Generic atari
 #
@@ -204,7 +204,7 @@ options		PIPE_SOCKETPAIR	# smaller, but 
 # Atari specific options
 #
 #options 	

CVS commit: [netbsd-9] src/sys/arch/atari

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:14:55 UTC 2022

Modified Files:
src/sys/arch/atari/atari [netbsd-9]: atari_init.c
src/sys/arch/atari/conf [netbsd-9]: GENERIC.in files.atari

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

sys/arch/atari/conf/GENERIC.in: revision 1.123
sys/arch/atari/conf/files.atari: revision 1.124
sys/arch/atari/atari/atari_init.c: revision 1.105

Allocalte enough reserved ST-RAM to make the old Xserver work by default.

Instead, check ST-RAM size and TT-RAM size on startup and restrict
size of reserved ST memory on lower RAM machines.

Closes PR port-atari/41002 from David Ross.

While here, make options ST_POOL_SIZE defparam'ed to make sure to
reflect config(5) changes on each build.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.8.1 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.123 -r1.123.4.1 src/sys/arch/atari/conf/files.atari

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



CVS commit: [netbsd-9] src/sys/arch/atari/dev

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:10:23 UTC 2022

Modified Files:
src/sys/arch/atari/dev [netbsd-9]: ite.c ite_cc.c ite_et.c itevar.h

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

sys/arch/atari/dev/ite.c: revision 1.82
sys/arch/atari/dev/ite_cc.c: revision 1.45
sys/arch/atari/dev/ite_et.c: revision 1.36
sys/arch/atari/dev/itevar.h: revision 1.15

Add a minimum DEC special graphics character support for atari ite(4).

This closes PR port-atari/46647 (Menu borders in sysinst appear as
characters with diacritical marks instead of graphics characters).

Switching encoding support by "ESC ( " sequence for vt220 was
pulled from x68k ite(4) (that already supports ISO-2022-JP and EUC-JP).

Note atari's fonts already include DEC special graphics characters.
ET4000 on Hades is untested due to long-term lack of hardware.

Discussed on port-atari@ etc.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.79.2.1 src/sys/arch/atari/dev/ite.c
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/atari/dev/ite_cc.c
cvs rdiff -u -r1.31 -r1.31.2.1 src/sys/arch/atari/dev/ite_et.c
cvs rdiff -u -r1.14 -r1.14.58.1 src/sys/arch/atari/dev/itevar.h

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



CVS commit: [netbsd-9] src/sys/arch/atari/dev

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:10:23 UTC 2022

Modified Files:
src/sys/arch/atari/dev [netbsd-9]: ite.c ite_cc.c ite_et.c itevar.h

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

sys/arch/atari/dev/ite.c: revision 1.82
sys/arch/atari/dev/ite_cc.c: revision 1.45
sys/arch/atari/dev/ite_et.c: revision 1.36
sys/arch/atari/dev/itevar.h: revision 1.15

Add a minimum DEC special graphics character support for atari ite(4).

This closes PR port-atari/46647 (Menu borders in sysinst appear as
characters with diacritical marks instead of graphics characters).

Switching encoding support by "ESC ( " sequence for vt220 was
pulled from x68k ite(4) (that already supports ISO-2022-JP and EUC-JP).

Note atari's fonts already include DEC special graphics characters.
ET4000 on Hades is untested due to long-term lack of hardware.

Discussed on port-atari@ etc.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.79.2.1 src/sys/arch/atari/dev/ite.c
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/atari/dev/ite_cc.c
cvs rdiff -u -r1.31 -r1.31.2.1 src/sys/arch/atari/dev/ite_et.c
cvs rdiff -u -r1.14 -r1.14.58.1 src/sys/arch/atari/dev/itevar.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/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.79 src/sys/arch/atari/dev/ite.c:1.79.2.1
--- src/sys/arch/atari/dev/ite.c:1.79	Sat Jun 29 16:41:19 2019
+++ src/sys/arch/atari/dev/ite.c	Sun Sep 11 18:10:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.79 2019/06/29 16:41:19 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.79.2.1 2022/09/11 18:10:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.79 2019/06/29 16:41:19 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.79.2.1 2022/09/11 18:10:23 martin Exp $");
 
 #include "opt_ddb.h"
 
@@ -736,6 +736,12 @@ ite_reset(struct ite_softc *sc)
 	sc->keypad_appmode = 0;
 	sc->imode = 0;
 	sc->key_repeat = 1;
+	sc->G0 = CSET_ASCII;
+	sc->G1 = CSET_DECGRAPH;
+	sc->G2 = 0;
+	sc->G3 = 0;
+	sc->GL = >G0;
+	sc->GR = >G1;
 	memset(sc->tabs, 0, sc->cols);
 	for (i = 0; i < sc->cols; i++)
 		sc->tabs[i] = ((i & 7) == 0);
@@ -1247,6 +1253,14 @@ ite_lf (struct ite_softc *sc)
 }
   SUBR_CURSOR(sc, MOVE_CURSOR);
   clr_attr(sc, ATTR_INV);
+
+  /* reset character set */
+  sc->G0 = CSET_ASCII;
+  sc->G1 = CSET_DECGRAPH;
+  sc->G2 = 0;
+  sc->G3 = 0;
+  sc->GL = >G0;
+  sc->GR = >G1;
 }
 
 static inline void
@@ -1446,7 +1460,7 @@ iteputchar(register int c, struct ite_so
 		  case 'B':	/* ASCII */
 		  case 'A':	/* ISO latin 1 */
 		  case '<':	/* user preferred suplemental */
-		  case '0':	/* dec special graphics */
+		  case '0':	/* DEC special graphics */
 		  
 		  /* 96-character sets: */
 		  case '-':	/* G1 */
@@ -1471,27 +1485,32 @@ iteputchar(register int c, struct ite_so
 		  
 		  /* locking shift modes (as you might guess, not yet supported..) */
 		  case '`':
-		sc->GR = sc->G1;
+		sc->GR = >G1;
 		sc->escape = 0;
 		return;
 		
 		  case 'n':
-		sc->GL = sc->G2;
+		sc->GL = >G2;
 		sc->escape = 0;
 		return;
 		
 		  case '}':
-		sc->GR = sc->G2;
+		sc->GR = >G2;
 		sc->escape = 0;
 		return;
 		
 		  case 'o':
-		sc->GL = sc->G3;
+		sc->GL = >G3;
 		sc->escape = 0;
 		return;
 		
 		  case '|':
-		sc->GR = sc->G3;
+		sc->GR = >G3;
+		sc->escape = 0;
+		return;
+
+		  case '~':
+		sc->GR = >G1;
 		sc->escape = 0;
 		return;
 		
@@ -1511,16 +1530,30 @@ iteputchar(register int c, struct ite_so
 
 
 		  case '7':
+		/* save cursor */
 		sc->save_curx = sc->curx;
 		sc->save_cury = sc->cury;
 		sc->save_attribute = sc->attribute;
+		sc->sc_G0 = sc->G0;
+		sc->sc_G1 = sc->G1;
+		sc->sc_G2 = sc->G2;
+		sc->sc_G3 = sc->G3;
+		sc->sc_GL = sc->GL;
+		sc->sc_GR = sc->GR;
 		sc->escape = 0;
 		return;
 		
 		  case '8':
+		/* restore cursor */
 		sc->curx = sc->save_curx;
 		sc->cury = sc->save_cury;
 		sc->attribute = sc->save_attribute;
+		sc->G0 = sc->sc_G0;
+		sc->G1 = sc->sc_G1;
+		sc->G2 = sc->sc_G2;
+		sc->G3 = sc->sc_G3;
+		sc->GL = sc->sc_GL;
+		sc->GR = sc->sc_GR;
 		SUBR_CURSOR(sc, MOVE_CURSOR);
 		sc->escape = 0;
 		return;
@@ -1551,8 +1584,22 @@ iteputchar(register int c, struct ite_so
 		break;
 
 
-	  case '(':
-	  case ')':
+	  case '(': /* designated G0 */
+		switch (c) {
+		case 'B': /* US-ASCII */
+		  sc->G0 = CSET_ASCII;
+		  sc->escape = 0;
+		  return;
+		case '0': /* DEC special graphics */
+		  sc->G0 = CSET_DECGRAPH;
+		  sc->escape = 0;
+		  return;
+		default:
+		  /* not supported */
+		  sc->escape = 0;
+		  return;
+		}
+	  case ')': /* 

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

2022-08-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 30 18:31:49 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k [netbsd-9]: m68k_trap.c

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

sys/arch/m68k/m68k/m68k_trap.c: revision 1.3

Minimal (but hackish) change to make a DEBUG kernel compilable.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/m68k/m68k/m68k_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/m68k/m68k/m68k_trap.c
diff -u src/sys/arch/m68k/m68k/m68k_trap.c:1.2 src/sys/arch/m68k/m68k/m68k_trap.c:1.2.6.1
--- src/sys/arch/m68k/m68k/m68k_trap.c:1.2	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/m68k/m68k/m68k_trap.c	Tue Aug 30 18:31:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_trap.c,v 1.2 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: m68k_trap.c,v 1.2.6.1 2022/08/30 18:31:49 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_trap.c,v 1.2 2019/04/06 03:06:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_trap.c,v 1.2.6.1 2022/08/30 18:31:49 martin Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -91,6 +91,15 @@ extern int suline(void *, void *);	/* lo
 #define	KDFAULT(c)	(KDFAULT_060(c) || KDFAULT_040(c) || KDFAULT_OTH(c))
 #define	WRFAULT(c)	(WRFAULT_060(c) || WRFAULT_040(c) || WRFAULT_OTH(c))
 
+
+#ifdef DEBUG
+extern int mmudebug, mmupid;
+#define MDB_FOLLOW	1
+#define MDB_WBFOLLOW	2
+#define MDB_WBFAILED	4
+#define MDB_ISPID(pid)	((pid) == mmupid)
+#endif
+
 #ifdef M68040
 #ifdef DEBUG
 struct writebackstats {



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

2022-08-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 30 18:31:49 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k [netbsd-9]: m68k_trap.c

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

sys/arch/m68k/m68k/m68k_trap.c: revision 1.3

Minimal (but hackish) change to make a DEBUG kernel compilable.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/m68k/m68k/m68k_trap.c

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



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

2022-06-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 16 14:22:02 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: pmap.c

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

sys/arch/hppa/hppa/pmap.c: revision 1.120

Re-reading the PA2.0 Cache Move-In rules tells me we do indeed need to
purge the translations from the TLBs in pmap_procwr.

PR/56867: hppa: intermittent SIGSEGV reports in t_ptrace_wait's stepN
and setstepN test cases


To generate a diff of this commit:
cvs rdiff -u -r1.100.20.1 -r1.100.20.2 src/sys/arch/hppa/hppa/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/hppa/hppa/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.100.20.1 src/sys/arch/hppa/hppa/pmap.c:1.100.20.2
--- src/sys/arch/hppa/hppa/pmap.c:1.100.20.1	Fri Jun 10 17:16:54 2022
+++ src/sys/arch/hppa/hppa/pmap.c	Thu Jun 16 14:22:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.100.20.1 2022/06/10 17:16:54 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.100.20.2 2022/06/16 14:22:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100.20.1 2022/06/10 17:16:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100.20.2 2022/06/16 14:22:02 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -1658,10 +1658,13 @@ pmap_activate(struct lwp *l)
 void
 pmap_procwr(struct proc *p, vaddr_t va, size_t len)
 {
-	pmap_t pmap = p->p_vmspace->vm_map.pmap;
+	const pmap_t pmap = p->p_vmspace->vm_map.pmap;
+	const pa_space_t space = pmap->pm_space;
 
-	fdcache(pmap->pm_space, va, len);
-	ficache(pmap->pm_space, va, len);
+	fdcache(space, va, len);
+	ficache(space, va, len);
+	pdtlb(space, va);
+	pitlb(space, va);
 }
 
 static inline void



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

2022-06-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 16 14:22:02 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: pmap.c

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

sys/arch/hppa/hppa/pmap.c: revision 1.120

Re-reading the PA2.0 Cache Move-In rules tells me we do indeed need to
purge the translations from the TLBs in pmap_procwr.

PR/56867: hppa: intermittent SIGSEGV reports in t_ptrace_wait's stepN
and setstepN test cases


To generate a diff of this commit:
cvs rdiff -u -r1.100.20.1 -r1.100.20.2 src/sys/arch/hppa/hppa/pmap.c

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



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

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:34:22 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: trap.c
src/sys/arch/hppa/include [netbsd-9]: ptrace.h

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

sys/arch/hppa/hppa/trap.c: revision 1.120
sys/arch/hppa/include/ptrace.h: revision 1.11-1.12 (via patch)

Define a PTRACE_ILLEGAL_ASM

Match up PTRACE_BREAKPOINT_ASM with PTRACE_BREAKPOINT which is the
gdb breakpoint instruction.

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT
This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and
single-step breakpoints


To generate a diff of this commit:
cvs rdiff -u -r1.111.4.2 -r1.111.4.3 src/sys/arch/hppa/hppa/trap.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/hppa/include/ptrace.h

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

Modified files:

Index: src/sys/arch/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.111.4.2 src/sys/arch/hppa/hppa/trap.c:1.111.4.3
--- src/sys/arch/hppa/hppa/trap.c:1.111.4.2	Fri Jun 10 16:28:16 2022
+++ src/sys/arch/hppa/hppa/trap.c	Fri Jun 10 17:34:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.111.4.2 2022/06/10 16:28:16 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.111.4.3 2022/06/10 17:34:22 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111.4.2 2022/06/10 16:28:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111.4.3 2022/06/10 17:34:22 martin Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -775,13 +775,13 @@ do_onfault:
 	case T_DBREAK | T_USER:
 		KSI_INIT_TRAP();
 		ksi.ksi_signo = SIGTRAP;
-		ksi.ksi_code = TRAP_TRACE;
+		ksi.ksi_code = TRAP_BRKPT;
 		ksi.ksi_trap = trapnum;
 		ksi.ksi_addr = (void *)(frame->tf_iioq_head & ~HPPA_PC_PRIV_MASK);
 #ifdef PTRACE
 		ss_clear_breakpoints(l);
 		if (opcode == SSBREAKPOINT)
-			ksi.ksi_code = TRAP_BRKPT;
+			ksi.ksi_code = TRAP_TRACE;
 #endif
 		/* pass to user debugger */
 		trapsignal(l, );

Index: src/sys/arch/hppa/include/ptrace.h
diff -u src/sys/arch/hppa/include/ptrace.h:1.9 src/sys/arch/hppa/include/ptrace.h:1.9.2.1
--- src/sys/arch/hppa/include/ptrace.h:1.9	Tue Jun 18 21:18:12 2019
+++ src/sys/arch/hppa/include/ptrace.h	Fri Jun 10 17:34:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.9 2019/06/18 21:18:12 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.9.2.1 2022/06/10 17:34:22 martin Exp $	*/
 
 /*	$OpenBSD: ptrace.h,v 1.2 1998/12/01 03:05:44 mickey Exp $	*/
 
@@ -58,6 +58,11 @@
 #define PTRACE_REG_SP(r)	(r)->r_regs[30]
 #define PTRACE_REG_INTRV(r)	(r)->r_regs[28]
 
+#define HPPA_BREAK_GDB		4
+#define HPPA_BREAK_GDB_SS	8
+
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0x00, 0x01, 0x00, 0x04 })
-#define PTRACE_BREAKPOINT_ASM	__asm __volatile("break	%0, %1" :: "i" (HPPA_BREAK_KERNEL), "i" (HPPA_BREAK_SS) : "memory")
+#define PTRACE_BREAKPOINT_ASM	__asm __volatile("break	%0, %1" :: "i" (HPPA_BREAK_GDB), "i" (HPPA_BREAK_GDB_SS) : "memory")
 #define PTRACE_BREAKPOINT_SIZE	4
+
+#define PTRACE_ILLEGAL_ASM	__asm __volatile (".word 0x000ff000" : : : "memory")



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

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:34:22 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: trap.c
src/sys/arch/hppa/include [netbsd-9]: ptrace.h

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

sys/arch/hppa/hppa/trap.c: revision 1.120
sys/arch/hppa/include/ptrace.h: revision 1.11-1.12 (via patch)

Define a PTRACE_ILLEGAL_ASM

Match up PTRACE_BREAKPOINT_ASM with PTRACE_BREAKPOINT which is the
gdb breakpoint instruction.

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT
This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and
single-step breakpoints


To generate a diff of this commit:
cvs rdiff -u -r1.111.4.2 -r1.111.4.3 src/sys/arch/hppa/hppa/trap.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/hppa/include/ptrace.h

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



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

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:16:54 UTC 2022

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

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

sys/arch/hppa/include/pmap.h: revision 1.41
sys/arch/hppa/hppa/pmap.c: revision 1.117

port-hppa/56849: Wacko kernel memory accounting in current/hppa

Two fixes:
- Don't include direct mapped memory in pmap statistics
- Decrement pmap statistics counts in pmap_kremove


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.100.20.1 src/sys/arch/hppa/hppa/pmap.c
cvs rdiff -u -r1.37 -r1.37.42.1 src/sys/arch/hppa/include/pmap.h

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

Modified files:

Index: src/sys/arch/hppa/hppa/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.100 src/sys/arch/hppa/hppa/pmap.c:1.100.20.1
--- src/sys/arch/hppa/hppa/pmap.c:1.100	Thu Dec 22 14:47:57 2016
+++ src/sys/arch/hppa/hppa/pmap.c	Fri Jun 10 17:16:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.100 2016/12/22 14:47:57 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.100.20.1 2022/06/10 17:16:54 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100 2016/12/22 14:47:57 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100.20.1 2022/06/10 17:16:54 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -975,7 +975,7 @@ pmap_bootstrap(vaddr_t vstart)
 		else if (va == uvm_lwp_getuarea() + USPACE - PAGE_SIZE)
 			prot = UVM_PROT_NONE;
 #endif
-		pmap_kenter_pa(va, va, prot, 0);
+		pmap_kenter_pa(va, va, prot, PMAP_DIRECTMAP);
 	}
 
 	/* XXXNH update */
@@ -1777,8 +1777,11 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	pmap_prot(pmap_kernel(), prot & VM_PROT_ALL));
 	if (IS_IOPAGE_P(pa) || (flags & PMAP_NOCACHE))
 		pte |= PTE_PROT(TLB_UNCACHEABLE);
-	pmap_kernel()->pm_stats.wired_count++;
-	pmap_kernel()->pm_stats.resident_count++;
+
+	if ((flags & PMAP_DIRECTMAP) == 0) {
+		pmap_kernel()->pm_stats.wired_count++;
+		pmap_kernel()->pm_stats.resident_count++;
+	}
 	if (opte)
 		pmap_pte_flush(pmap_kernel(), va, opte);
 
@@ -1865,6 +1868,9 @@ pmap_kremove(vaddr_t va, vsize_t size)
 		pmap_pte_flush(pmap, va, pte);
 		pmap_pte_set(pde, va, 0);
 
+		pmap->pm_stats.wired_count--;
+		pmap->pm_stats.resident_count--;
+
 		pg = pmap_initialized ? PHYS_TO_VM_PAGE(PTE_PAGE(pte)) : NULL;
 		if (pg != NULL) {
 			pve = pmap_pv_remove(pg, pmap, va);

Index: src/sys/arch/hppa/include/pmap.h
diff -u src/sys/arch/hppa/include/pmap.h:1.37 src/sys/arch/hppa/include/pmap.h:1.37.42.1
--- src/sys/arch/hppa/include/pmap.h:1.37	Mon Jan  7 16:57:28 2013
+++ src/sys/arch/hppa/include/pmap.h	Fri Jun 10 17:16:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.37 2013/01/07 16:57:28 chs Exp $	*/
+/*	$NetBSD: pmap.h,v 1.37.42.1 2022/06/10 17:16:54 martin Exp $	*/
 
 /*	$OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $	*/
 
@@ -72,6 +72,8 @@ struct pmap {
 #define	HPPA_MAX_PID	0xfffa
 #define	HPPA_SID_MAX	0x7ffd
 
+#define	PMAP_DIRECTMAP	0x1000 /* kenter_pa */
+
 /*
  * DON'T CHANGE THIS - this is assumed in lots of places.
  */



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

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:16:54 UTC 2022

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

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

sys/arch/hppa/include/pmap.h: revision 1.41
sys/arch/hppa/hppa/pmap.c: revision 1.117

port-hppa/56849: Wacko kernel memory accounting in current/hppa

Two fixes:
- Don't include direct mapped memory in pmap statistics
- Decrement pmap statistics counts in pmap_kremove


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.100.20.1 src/sys/arch/hppa/hppa/pmap.c
cvs rdiff -u -r1.37 -r1.37.42.1 src/sys/arch/hppa/include/pmap.h

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



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

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 16:28:16 UTC 2022

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

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

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

Handle 'NA' (non-access) traps for the lpa and probe instructions.  The
change is inspired by OpenBSD with a bunch of my own, mainly stylistic,
changes.

Thanks to Tom Lane for the analysis.

PR/56118: sporadic app crashes in HPPA -current


To generate a diff of this commit:
cvs rdiff -u -r1.111.4.1 -r1.111.4.2 src/sys/arch/hppa/hppa/trap.c

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

Modified files:

Index: src/sys/arch/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.111.4.1 src/sys/arch/hppa/hppa/trap.c:1.111.4.2
--- src/sys/arch/hppa/hppa/trap.c:1.111.4.1	Sat Apr 25 10:52:56 2020
+++ src/sys/arch/hppa/hppa/trap.c	Fri Jun 10 16:28:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.111.4.1 2020/04/25 10:52:56 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.111.4.2 2022/06/10 16:28:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111.4.1 2020/04/25 10:52:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111.4.2 2022/06/10 16:28:16 martin Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -480,6 +480,93 @@ out:
 }
 #endif /* DEBUG */
 
+
+#define __PABITS(x, y)		__BITS(31 - (x), 31 - (y))
+#define __PABIT(x)		__BIT(31 - (x))
+
+#define LPA_MASK \
+ (  __PABITS(0, 5) | \
+__PABITS(18, 25))
+#define LPA	 \
+ (__SHIFTIN(1,  __PABITS(0, 5))| \
+  __SHIFTIN(0x4d, __PABITS(18, 25)))
+
+
+#define PROBE_ENCS	(0x46 | 0xc6 | 0x47 | 0xc7)
+#define PROBE_PL	__PABITS(14, 15)
+#define PROBE_IMMED	__PABIT(18)
+#define PROBE_RW	__PABIT(25)
+
+#define PROBE_MASK   \
+((  __PABITS(0, 5) | \
+__PABITS(18, 25)   | \
+__PABIT(26))   ^ \
+ (PROBE_IMMED | PROBE_RW))
+
+#define PROBE	 \
+((__SHIFTIN(1,  __PABITS(0, 5))| \
+  __SHIFTIN(PROBE_ENCS, __PABITS(18, 25))  | \
+  __SHIFTIN(0,  __PABIT(26)))  ^ \
+ (PROBE_IMMED | PROBE_RW))
+
+/* for hppa64 */
+CTASSERT(sizeof(register_t) == sizeof(u_int));
+size_t hppa_regmap[] = {
+	0,	/* r0 is special case */
+	offsetof(struct trapframe, tf_r1  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_rp  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r3  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r4  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r5  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r6  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r7  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r8  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r9  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r10 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r11 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r12 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r13 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r14 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r15 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r16 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r17 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r18 ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_t4  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_t3  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_t2  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_t1  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_arg3) / sizeof(register_t),
+	offsetof(struct trapframe, tf_arg2) / sizeof(register_t),
+	offsetof(struct trapframe, tf_arg1) / sizeof(register_t),
+	offsetof(struct trapframe, tf_arg0) / sizeof(register_t),
+	offsetof(struct trapframe, tf_dp  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_ret0) / sizeof(register_t),
+	offsetof(struct trapframe, tf_ret1) / sizeof(register_t),
+	offsetof(struct trapframe, tf_sp  ) / sizeof(register_t),
+	offsetof(struct trapframe, tf_r31 ) / sizeof(register_t),
+};
+
+
+static inline register_t
+tf_getregno(struct trapframe *tf, u_int regno)
+{
+	register_t *tf_reg = (register_t *)tf;
+	if (regno == 0)
+		return 0;
+	else
+		return tf_reg[hppa_regmap[regno]];
+}
+
+static inline void
+tf_setregno(struct trapframe *tf, u_int regno, register_t val)
+{
+	register_t *tf_reg = (register_t *)tf;
+	if (regno == 0)
+		return;
+	else
+		tf_reg[hppa_regmap[regno]] = val;
+}
+
 void
 trap(int type, struct trapframe *frame)
 {
@@ -593,6 +680,7 @@ trap(int type, struct trapframe *frame)
 		

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

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 16:28:16 UTC 2022

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

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

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

Handle 'NA' (non-access) traps for the lpa and probe instructions.  The
change is inspired by OpenBSD with a bunch of my own, mainly stylistic,
changes.

Thanks to Tom Lane for the analysis.

PR/56118: sporadic app crashes in HPPA -current


To generate a diff of this commit:
cvs rdiff -u -r1.111.4.1 -r1.111.4.2 src/sys/arch/hppa/hppa/trap.c

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



CVS commit: [netbsd-9] src/sys/arch/atari/atari

2022-06-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  4 12:38:34 UTC 2022

Modified Files:
src/sys/arch/atari/atari [netbsd-9]: stalloc.c

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

sys/arch/atari/atari/stalloc.c: revision 1.17

Restore NULL pointer checks lost in rev 1.16.

Fixes PR port-atari/56859, ok'ed mlelstv@, and confirmed on TT030.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.34.1 src/sys/arch/atari/atari/stalloc.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/atari/atari/stalloc.c
diff -u src/sys/arch/atari/atari/stalloc.c:1.16 src/sys/arch/atari/atari/stalloc.c:1.16.34.1
--- src/sys/arch/atari/atari/stalloc.c:1.16	Fri Jan  3 07:14:20 2014
+++ src/sys/arch/atari/atari/stalloc.c	Sat Jun  4 12:38:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: stalloc.c,v 1.16 2014/01/03 07:14:20 mlelstv Exp $	*/
+/*	$NetBSD: stalloc.c,v 1.16.34.1 2022/06/04 12:38:34 martin Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman (Atari modifications)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.16 2014/01/03 07:14:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.16.34.1 2022/06/04 12:38:34 martin Exp $");
 
 #include 
 #include 
@@ -163,7 +163,7 @@ free_stmem(void *mem)
 	/*
 	 * check ahead of us.
 	 */
-	if (next->type == MNODE_FREE) {
+	if (next != NULL && next->type == MNODE_FREE) {
 		/*
 		 * if next is: a valid node and a free node. ==> merge
 		 */
@@ -174,7 +174,7 @@ free_stmem(void *mem)
 		stmem_total += mn->size + sizeof(struct mem_node);
 		mn->size += next->size + sizeof(struct mem_node);
 	}
-	if (prev->type == MNODE_FREE) {
+	if (prev != NULL && prev->type == MNODE_FREE) {
 		/*
 		 * if prev is: a valid node and a free node. ==> merge
 		 */



CVS commit: [netbsd-9] src/sys/arch/atari/atari

2022-06-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  4 12:38:34 UTC 2022

Modified Files:
src/sys/arch/atari/atari [netbsd-9]: stalloc.c

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

sys/arch/atari/atari/stalloc.c: revision 1.17

Restore NULL pointer checks lost in rev 1.16.

Fixes PR port-atari/56859, ok'ed mlelstv@, and confirmed on TT030.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.34.1 src/sys/arch/atari/atari/stalloc.c

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



CVS commit: [netbsd-9] src/sys/arch/luna68k/conf

2022-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 15 12:29:47 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: GENERIC INSTALL

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

sys/arch/luna68k/conf/INSTALL: revision 1.32
sys/arch/luna68k/conf/GENERIC: revision 1.131

Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.2.1 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.27 -r1.27.2.1 src/sys/arch/luna68k/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/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.127 src/sys/arch/luna68k/conf/GENERIC:1.127.2.1
--- src/sys/arch/luna68k/conf/GENERIC:1.127	Fri Apr 26 22:46:03 2019
+++ src/sys/arch/luna68k/conf/GENERIC	Sun May 15 12:29:46 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.127 2019/04/26 22:46:03 sevan Exp $
+# $NetBSD: GENERIC,v 1.127.2.1 2022/05/15 12:29:46 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/luna68k/conf/std.luna68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.127 $"
+#ident 		"GENERIC-$Revision: 1.127.2.1 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -128,6 +128,9 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 options 	WSEMUL_VT100
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
 options 	WSDISPLAY_COMPAT_RAWKBD
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+
 options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?

Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.27 src/sys/arch/luna68k/conf/INSTALL:1.27.2.1
--- src/sys/arch/luna68k/conf/INSTALL:1.27	Fri Apr 26 22:46:03 2019
+++ src/sys/arch/luna68k/conf/INSTALL	Sun May 15 12:29:46 2022
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.27 2019/04/26 22:46:03 sevan Exp $
+# $NetBSD: INSTALL,v 1.27.2.1 2022/05/15 12:29:46 martin Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -108,6 +108,9 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 options 	WSEMUL_VT100
 options 	WSDISPLAY_DEFAULTSCREENS=1
 #options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+
 options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?



CVS commit: [netbsd-9] src/sys/arch/luna68k/conf

2022-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 15 12:29:47 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: GENERIC INSTALL

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

sys/arch/luna68k/conf/INSTALL: revision 1.32
sys/arch/luna68k/conf/GENERIC: revision 1.131

Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.2.1 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.27 -r1.27.2.1 src/sys/arch/luna68k/conf/INSTALL

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



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

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:38:32 UTC 2022

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

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

sys/arch/hppa/hppa/idle_machdep.c: revision 1.4
sys/arch/hppa/hppa/machdep.c: revision 1.17

Add some special NOPs to help qemu.
thanks to Helge Deller for the heads-up.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/arch/hppa/hppa/idle_machdep.c
cvs rdiff -u -r1.10 -r1.10.4.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/idle_machdep.c
diff -u src/sys/arch/hppa/hppa/idle_machdep.c:1.3 src/sys/arch/hppa/hppa/idle_machdep.c:1.3.4.1
--- src/sys/arch/hppa/hppa/idle_machdep.c:1.3	Mon Apr 15 20:45:08 2019
+++ src/sys/arch/hppa/hppa/idle_machdep.c	Sat May 14 11:38:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $	*/
+/*	$NetBSD: idle_machdep.c,v 1.3.4.1 2022/05/14 11:38:31 martin Exp $	*/
 
 /*
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.3.4.1 2022/05/14 11:38:31 martin Exp $");
 
 #include 
 #include 
@@ -36,5 +36,8 @@ __KERNEL_RCSID(0, "$NetBSD: idle_machdep
 void
 cpu_idle(void)
 {
-	/* do nothing */
+/*
+	 * This NOP instruction is used by qemu to detect the idle loop.
+	 */
+	__asm volatile("or	%%r10,%%r10,%%r10" ::: "memory");
 }

Index: src/sys/arch/hppa/hppa/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.10 src/sys/arch/hppa/hppa/machdep.c:1.10.4.1
--- src/sys/arch/hppa/hppa/machdep.c:1.10	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/hppa/hppa/machdep.c	Sat May 14 11:38:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.10 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.10.4.1 2022/05/14 11:38:31 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10 2019/04/06 03:06:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10.4.1 2022/05/14 11:38:31 martin Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -1459,8 +1459,13 @@ cpu_reboot(int howto, char *user_boot_st
 		:: "r" (CMD_RESET), "r" (HPPA_LBCAST + iomod_command));
 	}
 
-	for (;;)
-		/* loop while bus reset is coming up */ ;
+	for (;;) {
+		/*
+		 * loop while bus reset is coming up.  This NOP instruction
+		 * is used by qemu to detect the 'death loop'.
+		 */
+		__asm volatile("or %%r31, %%r31, %%r31" ::: "memory");
+	}
 	/* NOTREACHED */
 }
 



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

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:38:32 UTC 2022

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

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

sys/arch/hppa/hppa/idle_machdep.c: revision 1.4
sys/arch/hppa/hppa/machdep.c: revision 1.17

Add some special NOPs to help qemu.
thanks to Helge Deller for the heads-up.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/arch/hppa/hppa/idle_machdep.c
cvs rdiff -u -r1.10 -r1.10.4.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.



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

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:32:43 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: hppa_machdep.c

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

sys/arch/hppa/hppa/hppa_machdep.c: revision 1.33

port-hppa/56830: RAS support is slightly incorrect on hppa

When searching for RAS use tf_iioq_head without the HPPA_PC_PRIV_MASK bits
set.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.34.1 src/sys/arch/hppa/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/hppa_machdep.c
diff -u src/sys/arch/hppa/hppa/hppa_machdep.c:1.29 src/sys/arch/hppa/hppa/hppa_machdep.c:1.29.34.1
--- src/sys/arch/hppa/hppa/hppa_machdep.c:1.29	Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/hppa/hppa_machdep.c	Sat May 14 11:32:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_machdep.c,v 1.29 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: hppa_machdep.c,v 1.29.34.1 2022/05/14 11:32:43 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.29 2014/02/24 07:23:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.29.34.1 2022/05/14 11:32:43 martin Exp $");
 
 #include 
 #include 
@@ -279,7 +279,9 @@ hppa_ras(struct lwp *l)
 
 	p = l->l_proc;
 	tf = l->l_md.md_regs;
-	rasaddr = (intptr_t)ras_lookup(p, (void *)tf->tf_iioq_head);
+
+	rasaddr = (intptr_t)ras_lookup(p,
+	(void *)(tf->tf_iioq_head & ~HPPA_PC_PRIV_MASK));
 	if (rasaddr != -1) {
 		rasaddr |= HPPA_PC_PRIV_USER;
 		tf->tf_iioq_head = rasaddr;



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

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:32:43 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: hppa_machdep.c

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

sys/arch/hppa/hppa/hppa_machdep.c: revision 1.33

port-hppa/56830: RAS support is slightly incorrect on hppa

When searching for RAS use tf_iioq_head without the HPPA_PC_PRIV_MASK bits
set.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.34.1 src/sys/arch/hppa/hppa/hppa_machdep.c

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



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:12:49 UTC 2022

Modified Files:
src/sys/arch/xen/x86 [netbsd-9]: x86_xpmap.c

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

sys/arch/xen/x86/x86_xpmap.c: revision 1.91

In bootstrap, after switching to a new page table make sure that
now-unused memory is unmapped.


To generate a diff of this commit:
cvs rdiff -u -r1.84.4.1 -r1.84.4.2 src/sys/arch/xen/x86/x86_xpmap.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/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.1 src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.2
--- src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.1	Sun May 31 10:39:34 2020
+++ src/sys/arch/xen/x86/x86_xpmap.c	Fri May 13 11:12:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.84.4.1 2020/05/31 10:39:34 martin Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.84.4.2 2022/05/13 11:12:49 martin Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.84.4.1 2020/05/31 10:39:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.84.4.2 2022/05/13 11:12:49 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -909,7 +909,7 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 	/* Unpin old PGD */
 	xpq_queue_unpin_table(xpmap_ptom_masked(old_pgd - KERNBASE));
 
-	/* Mark old tables RW */
+	/* Mark old tables RW if used, unmap otherwise */
 	page = old_pgd;
 	addr = xpmap_mtop((paddr_t)L2[pl2_pi(page)] & PG_FRAME);
 	pte = (pd_entry_t *)((u_long)addr + KERNBASE);
@@ -923,6 +923,12 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 		 */
 		pte++;
 	}
+	while (page < old_pgd + (old_count * PAGE_SIZE)) {
+		addr = xpmap_ptom(((u_long)pte) - KERNBASE);
+		xpq_queue_pte_update(addr, 0);
+		page += PAGE_SIZE;
+		pte++;
+	}
 	xpq_flush_queue();
 }
 



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:12:49 UTC 2022

Modified Files:
src/sys/arch/xen/x86 [netbsd-9]: x86_xpmap.c

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

sys/arch/xen/x86/x86_xpmap.c: revision 1.91

In bootstrap, after switching to a new page table make sure that
now-unused memory is unmapped.


To generate a diff of this commit:
cvs rdiff -u -r1.84.4.1 -r1.84.4.2 src/sys/arch/xen/x86/x86_xpmap.c

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



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:10:38 UTC 2022

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

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

sys/arch/x86/x86/pmap.c: revision 1.414

return after calling xen_pagezero(), don't fall back to the legacy
pmap_zero_page() method.

This should only affect performances.


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



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:10:38 UTC 2022

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

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

sys/arch/x86/x86/pmap.c: revision 1.414

return after calling xen_pagezero(), don't fall back to the legacy
pmap_zero_page() method.

This should only affect performances.


To generate a diff of this commit:
cvs rdiff -u -r1.334.2.6 -r1.334.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.334.2.6 src/sys/arch/x86/x86/pmap.c:1.334.2.7
--- src/sys/arch/x86/x86/pmap.c:1.334.2.6	Fri Sep  3 10:27:33 2021
+++ src/sys/arch/x86/x86/pmap.c	Fri May 13 11:10:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.334.2.6 2021/09/03 10:27:33 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.334.2.7 2022/05/13 11:10:38 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.6 2021/09/03 10:27:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.7 2022/05/13 11:10:38 martin Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3187,8 +3187,10 @@ pmap_zero_page(paddr_t pa)
 	pagezero(PMAP_DIRECT_MAP(pa));
 #else
 #if defined(XENPV)
-	if (XEN_VERSION_SUPPORTED(3, 4))
+	if (XEN_VERSION_SUPPORTED(3, 4)) {
 		xen_pagezero(pa);
+		return;
+	}
 #endif
 	struct cpu_info *ci;
 	pt_entry_t *zpte;



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:54:59 UTC 2022

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

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.43
sys/arch/x86/x86/procfs_machdep.c: revision 1.44

Update for cpuid flags:
  - The table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux mapping.
  - The table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID 0x07 leaf 1
%edx. Print avx_vnni and avx512_bf16.
  - Print cppc, enqcmd and arch_lbr.
  - Modify linux mapping. No used on NetBSD.

Fix procfs_machdep.c rev. 1.143. Print CPUID 0x0007:1 %eax correctly.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.4 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.5
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.4	Fri Dec  3 19:49:35 2021
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jan 31 17:54:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 martin Exp $");
 
 #include 
 #include 
@@ -120,10 +120,8 @@ static const char * const x86_features[]
 	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL},
 
 	{ /* (8) Linux mapping */
-	"tpr_shadow", "vnmi", "flexpriority", "ept",
-	"vpid", "npt", "lbrv", "svm_lock",
-	"nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid",
-	"decodeassists", "pausefilter", "pfthreshold", "vmmcall",
+	"tpr_shadow", "vnmi", "flexpriority", "ept", "vpid", NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmmcall",
 	NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
@@ -141,15 +139,16 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (11) 0x000f:0 edx */
-	NULL, "cqm_llc", NULL, NULL, NULL, NULL, NULL, NULL,
+	{ /* (11) Linux mapping */
+	"cqm_llc", "cqm_occup_llc", "cqm_mbm_total", "cqm_mbm_local",
+	NULL, NULL, "split_lock_detect", 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},
 
-	{ /* (12) 0x000f:1 edx */
-	"cqm_occup_llc", "cqm_mbm_total", "cqm_mbm_local", NULL,
+	{ /* (12) Intel-defined 0x0007:1 eax */
 	NULL, NULL, NULL, NULL,
+	"avx_vnni", "avx512_bf16", 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},
@@ -158,7 +157,7 @@ static const char * const x86_features[]
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
-	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "virt_ssbd", NULL, "cppc", NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */
 	"dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
@@ -181,7 +180,8 @@ static const char * const x86_features[]
 	"gfni", "vaes", "vpclmulqdq", "avx512_vnni",
 	"avx512_bitalg", "tme", "avx512_vpopcntdq", NULL,
 	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
-	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, "sgx_lc", NULL},
+	NULL, "cldemote", NULL, "movdiri",
+	"movdir64b", "enqcmd", "sgx_lc", NULL},
 
 	{ /* (17) 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
@@ -192,7 +192,8 @@ static const char * const x86_features[]
 	{ /* (18) Intel 0x0007 edx */
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL,
 	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL,
-	"tsxldtrk", NULL, "pconfig", NULL, NULL, NULL, NULL, "avx512_fp16",
+	"tsxldtrk", NULL, "pconfig", "arch_lbr",
+	NULL, NULL, NULL, "avx512_fp16",
 	NULL, NULL, NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
 
@@ -307,14 +308,11 @@ procfs_getonecpufeatures(struct cpu_info
 		diff = last - *left;
 	}
 
-	if (ci->ci_max_cpuid >= 0x0f) {
-		x86_cpuid2(0x0f, 0, descs);
-		procfs_getonefeatreg(descs[3], x86_features[11], p + diff,
-		left);
-		diff = last - *left;
+	/* x86_features[11] is Linux defined mapping */
 
-		x86_cpuid2(0x0f, 1, descs);
-		procfs_getonefeatreg(descs[3], x86_features[12], p 

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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:54:59 UTC 2022

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

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.43
sys/arch/x86/x86/procfs_machdep.c: revision 1.44

Update for cpuid flags:
  - The table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux mapping.
  - The table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID 0x07 leaf 1
%edx. Print avx_vnni and avx512_bf16.
  - Print cppc, enqcmd and arch_lbr.
  - Modify linux mapping. No used on NetBSD.

Fix procfs_machdep.c rev. 1.143. Print CPUID 0x0007:1 %eax correctly.


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

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



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:42:18 UTC 2022

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1417:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


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

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.9 src/sys/arch/x86/include/specialreg.h:1.150.2.10
--- src/sys/arch/x86/include/specialreg.h:1.150.2.9	Wed Dec  8 15:44:16 2021
+++ src/sys/arch/x86/include/specialreg.h	Mon Jan 31 17:42:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.9 2021/12/08 15:44:16 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.10 2022/01/31 17:42:17 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -97,29 +97,29 @@
 /*
  * CR4
  */
-#define CR4_VME		0x0001 /* virtual 8086 mode extension enable */
-#define CR4_PVI		0x0002 /* protected mode virtual interrupt enable */
-#define CR4_TSD		0x0004 /* restrict RDTSC instruction to cpl 0 */
-#define CR4_DE		0x0008 /* debugging extension */
-#define CR4_PSE		0x0010 /* large (4MB) page size enable */
-#define CR4_PAE		0x0020 /* physical address extension enable */
-#define CR4_MCE		0x0040 /* machine check enable */
-#define CR4_PGE		0x0080 /* page global enable */
-#define CR4_PCE		0x0100 /* enable RDPMC instruction for all cpls */
-#define CR4_OSFXSR	0x0200 /* enable fxsave/fxrestor and SSE */
-#define CR4_OSXMMEXCPT	0x0400 /* enable unmasked SSE exceptions */
-#define CR4_UMIP	0x0800 /* user-mode instruction prevention */
+#define CR4_VME		0x0001 /* Virtual 8086 mode extension enable */
+#define CR4_PVI		0x0002 /* Protected mode virtual interrupt enable */
+#define CR4_TSD		0x0004 /* Restrict RDTSC instruction to cpl 0 */
+#define CR4_DE		0x0008 /* Debugging extension */
+#define CR4_PSE		0x0010 /* Large (4MB) page size enable */
+#define CR4_PAE		0x0020 /* Physical address extension enable */
+#define CR4_MCE		0x0040 /* Machine check enable */
+#define CR4_PGE		0x0080 /* Page global enable */
+#define CR4_PCE		0x0100 /* Enable RDPMC instruction for all cpls */
+#define CR4_OSFXSR	0x0200 /* Enable fxsave/fxrestor and SSE */
+#define CR4_OSXMMEXCPT	0x0400 /* Enable unmasked SSE exceptions */
+#define CR4_UMIP	0x0800 /* User Mode Instruction Prevention */
 #define CR4_LA57	0x1000 /* 57-bit linear addresses */
-#define CR4_VMXE	0x2000 /* enable VMX operations */
-#define CR4_SMXE	0x4000 /* enable SMX operations */
-#define CR4_FSGSBASE	0x0001 /* enable *FSBASE and *GSBASE instructions */
-#define CR4_PCIDE	0x0002 /* enable Process Context IDentifiers */
-#define CR4_OSXSAVE	0x0004 /* enable xsave and xrestore */
-#define CR4_SMEP	0x0010 /* enable SMEP support */
-#define CR4_SMAP	0x0020 /* enable SMAP support */
-#define CR4_PKE		0x0040 /* enable Protection Keys for user pages */
-#define CR4_CET		0x0080 /* enable CET */
-#define CR4_PKS		0x0100 /* enable Protection Keys for kern pages */
+#define CR4_VMXE	0x2000 /* Enable VMX operations */
+#define CR4_SMXE	0x4000 /* Enable SMX operations */
+#define CR4_FSGSBASE	0x0001 /* Enable *FSBASE and *GSBASE instructions */
+#define CR4_PCIDE	0x0002 /* Enable Process Context IDentifiers */
+#define CR4_OSXSAVE	0x0004 /* Enable xsave and xrestore */
+#define CR4_SMEP	0x0010 /* Enable SMEP support */
+#define CR4_SMAP	0x0020 /* Enable SMAP support */
+#define CR4_PKE		0x0040 /* Enable Protection Keys for user pages */
+#define CR4_CET		0x0080 /* Enable CET */
+#define CR4_PKS		0x0100 /* Enable Protection Keys for kern pages */
 
 /*
  * Extended Control Register XCR0
@@ -137,14 +137,15 @@
 #define XCR0_CET_U	0x0800	/* User CET state */
 #define XCR0_CET_S	0x1000	/* Kern CET state */
 #define XCR0_HDC	0x2000	/* Hardware Duty Cycle state */
+#define XCR0_LBR	0x8000	/* Last Branch Record */
 #define XCR0_HWP	0x0001	/* Hardware P-states */
 
-#define XCR0_FLAGS1	"\20" \
-	"\1" "x87"		"\2" "SSE"		"\3" "AVX"	\
-	"\4" "BNDREGS"		"\5" "BNDCSR"		

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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:42:18 UTC 2022

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1417:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


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

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



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

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:39:24 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: identcpu.c

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

sys/arch/x86/x86/identcpu.c: revision 1.121

make a numeric literal unsigned as it is bit-negated.


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.2 -r1.93.2.3 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/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.93.2.2 src/sys/arch/x86/x86/identcpu.c:1.93.2.3
--- src/sys/arch/x86/x86/identcpu.c:1.93.2.2	Tue Dec  7 12:35:27 2021
+++ src/sys/arch/x86/x86/identcpu.c	Tue Dec  7 12:39:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.93.2.2 2021/12/07 12:35:27 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.93.2.3 2021/12/07 12:39:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.93.2.2 2021/12/07 12:35:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.93.2.3 2021/12/07 12:39:23 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -478,7 +478,7 @@ cpu_probe_cyrix_cmn(struct cpu_info *ci)
 	/* cyrix's workaround  for the "coma bug" */
 	cyrix_write_reg(0x31, cyrix_read_reg(0x31) | 0xf8);
 	cyrix_write_reg(0x32, cyrix_read_reg(0x32) | 0x7f);
-	cyrix_write_reg(0x33, cyrix_read_reg(0x33) & ~0xff);
+	cyrix_write_reg(0x33, cyrix_read_reg(0x33) & ~0xffu);
 	cyrix_write_reg(0x3c, cyrix_read_reg(0x3c) | 0x87);
 	/* disable access to ccr4/ccr5 */
 	cyrix_write_reg(0xC3, c3);



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

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:39:24 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: identcpu.c

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

sys/arch/x86/x86/identcpu.c: revision 1.121

make a numeric literal unsigned as it is bit-negated.


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



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

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:35:27 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: identcpu.c

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

sys/arch/x86/x86/identcpu.c: revision 1.103
sys/arch/x86/x86/identcpu.c: revision 1.104
sys/arch/x86/x86/identcpu.c: revision 1.105

Add EX2 for Vortex86 SoCs (Andrius V)

use __arraycount, and fix comparison

flip the comparison again


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



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

2021-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  7 12:35:27 UTC 2021

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: identcpu.c

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

sys/arch/x86/x86/identcpu.c: revision 1.103
sys/arch/x86/x86/identcpu.c: revision 1.104
sys/arch/x86/x86/identcpu.c: revision 1.105

Add EX2 for Vortex86 SoCs (Andrius V)

use __arraycount, and fix comparison

flip the comparison again


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.1 -r1.93.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/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.93.2.1 src/sys/arch/x86/x86/identcpu.c:1.93.2.2
--- src/sys/arch/x86/x86/identcpu.c:1.93.2.1	Thu Sep 26 18:50:18 2019
+++ src/sys/arch/x86/x86/identcpu.c	Tue Dec  7 12:35:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.93.2.1 2019/09/26 18:50:18 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.93.2.2 2021/12/07 12:35:27 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.93.2.1 2019/09/26 18:50:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.93.2.2 2021/12/07 12:35:27 martin Exp $");
 
 #include "opt_xen.h"
 
@@ -704,7 +704,7 @@ cpu_probe_vortex86(struct cpu_info *ci)
 #define PCI_MODE1_DATA_REG	0x0cfc
 #define PCI_MODE1_ENABLE	0x8000UL
 
-	uint32_t reg;
+	uint32_t reg, idx;
 
 	if (cpu_vendor != CPUVENDOR_VORTEX86)
 		return;
@@ -718,17 +718,18 @@ cpu_probe_vortex86(struct cpu_info *ci)
 	outl(PCI_MODE1_ADDRESS_REG, PCI_MODE1_ENABLE | 0x90);
 	reg = inl(PCI_MODE1_DATA_REG);
 
-	if ((reg & 0xf8ff) != 0x30504d44) {
-		reg = 0;
+	if ((reg & 0xf0ff) != 0x30504d44) {
+		idx = 0;
 	} else {
-		reg = (reg >> 24) & 7;
+		idx = (reg >> 24) & 0xf;
 	}
 
 	static const char *cpu_vortex86_flavor[] = {
-	"??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX",
+	"??", "SX", "DX", "MX", "DX2", "MX+", "DX3", "EX", "EX2",
 	};
+	idx = idx < __arraycount(cpu_vortex86_flavor) ? idx : 0;
 	snprintf(cpu_brand_string, sizeof(cpu_brand_string), "Vortex86%s",
-	cpu_vortex86_flavor[reg]);
+	cpu_vortex86_flavor[idx]);
 
 #undef PCI_MODE1_ENABLE
 #undef PCI_MODE1_ADDRESS_REG



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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 19:49:35 UTC 2021

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

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

sys/arch/x86/x86/procfs_machdep.c   1.40-1.42

- Add v_spec_ctrl, avx512_fp16, sme, sev, sev_es, sgx, sgx_lc,
  serialize and tsxldtrk.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.3 -r1.33.2.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.33.2.3 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.4
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.3	Fri Jul 10 10:36:56 2020
+++ src/sys/arch/x86/x86/procfs_machdep.c	Fri Dec  3 19:49:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.3 2020/07/10 10:36:56 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.3 2020/07/10 10:36:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $");
 
 #include 
 #include 
@@ -82,11 +82,13 @@ static const char * const x86_features[]
 	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},
+	"cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", NULL, NULL, NULL, NULL,
+	"constant_tsc", "up", "art", "arch_perfmon",
+	"pebs", "bts", NULL, NULL,
+	"rep_good", NULL, NULL, "acc_power",
+	"nopl", NULL, "xtopology", "tsc_reliable",
+	"nonstop_tsc", "cpuid", "extd_apicid", "amd_dcm",
+	"aperfmperf", "rapl", "nonstop_tsc_s3", "tsc_known_freq"},
 
 	{ /* (4) Intel-defined: 0x0001 ecx */
 	"pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est",
@@ -112,7 +114,7 @@ static const char * const x86_features[]
 
 	{ /* (7) Linux mapping */
 	NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm",
-	"hw_pstate", "proc_feedback", "sme", NULL,
+	"hw_pstate", "proc_feedback", NULL, NULL,
 	NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL},
@@ -126,7 +128,7 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (9) Intel-defined: 0007 ebx */
-	"fsgsbase", "tsc_adjust", NULL, "bmi1", "hle", "avx2", NULL, "smep",
+	"fsgsbase", "tsc_adjust", "sgx", "bmi1", "hle", "avx2", NULL, "smep",
 	"bmi2", "erms", "invpcid", "rtm", "cqm", NULL, "mpx", "rdt_a",
 	"avx512f", "avx512dq", "rdseed", "adx",
 	"smap", "avx512ifma", NULL, "clflushopt",
@@ -165,12 +167,12 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (15) 0x800a edx */
+	{ /* (15) AMD 0x800a edx */
 	"npt", "lbrv", "svm_lock", "nrip_save",
 	"tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
 	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
 	"v_vmsave_vmload",
-	"vgif", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	"vgif", NULL, NULL, NULL, "v_spec_ctrl", NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
@@ -179,7 +181,7 @@ static const char * const x86_features[]
 	"gfni", "vaes", "vpclmulqdq", "avx512_vnni",
 	"avx512_bitalg", "tme", "avx512_vpopcntdq", NULL,
 	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
-	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, NULL, NULL},
+	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, "sgx_lc", NULL},
 
 	{ /* (17) 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
@@ -189,10 +191,16 @@ static const char * const x86_features[]
 
 	{ /* (18) Intel 0x0007 edx */
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL,
-	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, "pconfig", NULL, NULL, NULL, NULL, NULL,
+	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL,
+	"tsxldtrk", NULL, "pconfig", NULL, NULL, NULL, NULL, "avx512_fp16",
 	NULL, NULL, NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
+
+	{ /* (19) AMD 0x801f eax */
+	"sme", "sev", NULL, "sev_es", 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 *);
@@ 

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

2021-12-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec  3 19:49:35 UTC 2021

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

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

sys/arch/x86/x86/procfs_machdep.c   1.40-1.42

- Add v_spec_ctrl, avx512_fp16, sme, sev, sev_es, sgx, sgx_lc,
  serialize and tsxldtrk.
- Whitespace fix.


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



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

2021-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep  5 10:48:48 UTC 2021

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: trap.c

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

sys/arch/mips/mips/trap.c: revision 1.250
sys/arch/mips/mips/trap.c: revision 1.251

Add missing newline to a diagnostic printf.

Comment out the diagnostic message in the TLB_MOD handler that's logged if
pmap_tlb_update_addr() indicates that the VA+ASID was not found in the TLB.

It's a harmless race condition that can happen for legitimate reasons (e.g.
a TLB miss in an interrupt handler that evicts the entry from the TLB).

See discussion:
http://mail-index.netbsd.org/port-mips/2020/03/07/msg000927.html


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.249.4.1 src/sys/arch/mips/mips/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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.249 src/sys/arch/mips/mips/trap.c:1.249.4.1
--- src/sys/arch/mips/mips/trap.c:1.249	Sat Apr  6 11:54:20 2019
+++ src/sys/arch/mips/mips/trap.c	Sun Sep  5 10:48:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.249 2019/04/06 11:54:20 kamil Exp $	*/
+/*	$NetBSD: trap.c,v 1.249.4.1 2021/09/05 10:48:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.249 2019/04/06 11:54:20 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.249.4.1 2021/09/05 10:48:48 martin Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -296,10 +296,20 @@ trap(uint32_t status, uint32_t cause, va
 		vaddr = trunc_page(vaddr);
 		int ok = pmap_tlb_update_addr(pmap, vaddr, pte, 0);
 		kpreempt_enable();
-		if (ok != 1)
+		if (ok != 1) {
+#if 0 /* PMAP_FAULTINFO? */
+			/*
+			 * Since we don't block interrupts here,
+			 * this can legitimately happen if we get
+			 * a TLB miss that's serviced in an interrupt
+			 * hander that happens to randomly evict the
+			 * TLB entry we're concerned about.
+			 */
 			printf("pmap_tlb_update_addr(%p,%#"
-			PRIxVADDR",%#"PRIxPTE", 0) returned %d",
+			PRIxVADDR",%#"PRIxPTE", 0) returned %d\n",
 			pmap, vaddr, pte_value(pte), ok);
+#endif
+		}
 		paddr_t pa = pte_to_paddr(pte);
 		KASSERTMSG(uvm_pageismanaged(pa),
 		"%#"PRIxVADDR" pa %#"PRIxPADDR, vaddr, pa);



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

2021-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep  5 10:48:48 UTC 2021

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: trap.c

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

sys/arch/mips/mips/trap.c: revision 1.250
sys/arch/mips/mips/trap.c: revision 1.251

Add missing newline to a diagnostic printf.

Comment out the diagnostic message in the TLB_MOD handler that's logged if
pmap_tlb_update_addr() indicates that the VA+ASID was not found in the TLB.

It's a harmless race condition that can happen for legitimate reasons (e.g.
a TLB miss in an interrupt handler that evicts the entry from the TLB).

See discussion:
http://mail-index.netbsd.org/port-mips/2020/03/07/msg000927.html


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.249.4.1 src/sys/arch/mips/mips/trap.c

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



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

2021-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  3 10:27:33 UTC 2021

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

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

sys/arch/x86/x86/pmap.c: revision 1.410

Make pat_init() a NOOP on XENPV; it causes a trap with Xen 4.15


To generate a diff of this commit:
cvs rdiff -u -r1.334.2.5 -r1.334.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/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.334.2.5 src/sys/arch/x86/x86/pmap.c:1.334.2.6
--- src/sys/arch/x86/x86/pmap.c:1.334.2.5	Thu Sep  3 13:45:24 2020
+++ src/sys/arch/x86/x86/pmap.c	Fri Sep  3 10:27:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.334.2.5 2020/09/03 13:45:24 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.334.2.6 2021/09/03 10:27:33 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.5 2020/09/03 13:45:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.6 2021/09/03 10:27:33 martin Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -806,6 +806,7 @@ pmap_exec_fixup(struct vm_map *map, stru
 void
 pat_init(struct cpu_info *ci)
 {
+#ifndef XENPV
 	uint64_t pat;
 
 	if (!(ci->ci_feat_val[0] & CPUID_PAT))
@@ -819,6 +820,7 @@ pat_init(struct cpu_info *ci)
 
 	wrmsr(MSR_CR_PAT, pat);
 	cpu_pat_enabled = true;
+#endif
 }
 
 static pt_entry_t



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

2021-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  3 10:27:33 UTC 2021

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

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

sys/arch/x86/x86/pmap.c: revision 1.410

Make pat_init() a NOOP on XENPV; it causes a trap with Xen 4.15


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



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 11:11:17 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: netbsd32_machdep.c

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

sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.126

Don't depend on #ifdef USER_LDT in cpu_mcontext32_validate(), but rather on
whether the proc uses a user-set LDT. Same as check_sigcontext32().


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.1 -r1.125.2.2 \
src/sys/arch/amd64/amd64/netbsd32_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/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125.2.1 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125.2.2
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125.2.1	Thu Nov 21 14:02:33 2019
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Wed Nov 27 11:11:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.125.2.1 2019/11/21 14:02:33 martin Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.125.2.2 2019/11/27 11:11:17 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.125.2.1 2019/11/21 14:02:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.125.2.2 2019/11/27 11:11:17 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -905,12 +905,6 @@ startlwp32(void *arg)
 	userret(l);
 }
 
-/*
- * For various reasons, the amd64 port can't do what the i386 port does,
- * and relies on catching invalid user contexts on exit from the kernel.
- * These functions perform the needed checks.
- */
-
 int
 check_sigcontext32(struct lwp *l, const struct netbsd32_sigcontext *scp)
 {
@@ -925,21 +919,22 @@ check_sigcontext32(struct lwp *l, const 
 		return EINVAL;
 
 	if (__predict_false(pmap->pm_ldt != NULL)) {
-		/* Only when the LDT is user-set (with USER_LDT) */
+		/* Allow unfamiliar segment register values (USER_LDT). */
 		if (!USERMODE(scp->sc_cs))
 			return EINVAL;
 	} else {
 		if (!VALID_USER_CSEL32(scp->sc_cs))
 			return EINVAL;
 		if (scp->sc_fs != 0 && !VALID_USER_DSEL32(scp->sc_fs) &&
-			!(VALID_USER_FSEL32(scp->sc_fs) && pcb->pcb_fs != 0))
+		!(VALID_USER_FSEL32(scp->sc_fs) && pcb->pcb_fs != 0))
 			return EINVAL;
 		if (scp->sc_gs != 0 && !VALID_USER_DSEL32(scp->sc_gs) &&
-			!(VALID_USER_GSEL32(scp->sc_gs) && pcb->pcb_gs != 0))
+		!(VALID_USER_GSEL32(scp->sc_gs) && pcb->pcb_gs != 0))
 			return EINVAL;
 		if (scp->sc_es != 0 && !VALID_USER_DSEL32(scp->sc_es))
 			return EINVAL;
-		if (!VALID_USER_DSEL32(scp->sc_ds) || !VALID_USER_DSEL32(scp->sc_ss))
+		if (!VALID_USER_DSEL32(scp->sc_ds) ||
+		!VALID_USER_DSEL32(scp->sc_ss))
 			return EINVAL;
 	}
 
@@ -952,36 +947,37 @@ check_sigcontext32(struct lwp *l, const 
 int
 cpu_mcontext32_validate(struct lwp *l, const mcontext32_t *mcp)
 {
+	struct pmap *pmap = l->l_proc->p_vmspace->vm_map.pmap;
 	const __greg32_t *gr;
 	struct trapframe *tf;
+	struct pcb *pcb;
 
 	gr = mcp->__gregs;
 	tf = l->l_md.md_regs;
+	pcb = lwp_getpcb(l);
 
 	if (((gr[_REG32_EFL] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0)
 		return EINVAL;
 
-#ifdef USER_LDT
-	/* Userland is allowed to have unfamiliar segment register values */
-	if (!USERMODE(gr[_REG32_CS]))
-		return EINVAL;
-#else
-	struct pcb *pcb = lwp_getpcb(l);
-
-	if (!VALID_USER_CSEL32(gr[_REG32_CS]))
-		return EINVAL;
-	if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]) &&
-	!(VALID_USER_FSEL32(gr[_REG32_FS]) && pcb->pcb_fs != 0))
-		return EINVAL;
-	if (gr[_REG32_GS] != 0 && !VALID_USER_DSEL32(gr[_REG32_GS]) &&
-	!(VALID_USER_GSEL32(gr[_REG32_GS]) && pcb->pcb_gs != 0))
-		return EINVAL;
-	if (gr[_REG32_ES] != 0 && !VALID_USER_DSEL32(gr[_REG32_ES]))
-		return EINVAL;
-	if (!VALID_USER_DSEL32(gr[_REG32_DS]) ||
-	!VALID_USER_DSEL32(gr[_REG32_SS]))
-		return EINVAL;
-#endif
+	if (__predict_false(pmap->pm_ldt != NULL)) {
+		/* Allow unfamiliar segment register values (USER_LDT). */
+		if (!USERMODE(gr[_REG32_CS]))
+			return EINVAL;
+	} else {
+		if (!VALID_USER_CSEL32(gr[_REG32_CS]))
+			return EINVAL;
+		if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]) &&
+		!(VALID_USER_FSEL32(gr[_REG32_FS]) && pcb->pcb_fs != 0))
+			return EINVAL;
+		if (gr[_REG32_GS] != 0 && !VALID_USER_DSEL32(gr[_REG32_GS]) &&
+		!(VALID_USER_GSEL32(gr[_REG32_GS]) && pcb->pcb_gs != 0))
+			return EINVAL;
+		if (gr[_REG32_ES] != 0 && !VALID_USER_DSEL32(gr[_REG32_ES]))
+			return EINVAL;
+		if (!VALID_USER_DSEL32(gr[_REG32_DS]) ||
+		!VALID_USER_DSEL32(gr[_REG32_SS]))
+			return EINVAL;
+	}
 
 	if (gr[_REG32_EIP] >= VM_MAXUSER_ADDRESS32)
 		return EINVAL;



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 11:11:17 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: netbsd32_machdep.c

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

sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.126

Don't depend on #ifdef USER_LDT in cpu_mcontext32_validate(), but rather on
whether the proc uses a user-set LDT. Same as check_sigcontext32().


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.1 -r1.125.2.2 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:20:41 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_drm.c

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

sys/arch/arm/sunxi/sunxi_drm.c: revision 1.9

Reclaim bootloader FB memory for CMA pool.


To generate a diff of this commit:
cvs rdiff -u -r1.7.6.1 -r1.7.6.2 src/sys/arch/arm/sunxi/sunxi_drm.c

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:20:41 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_drm.c

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

sys/arch/arm/sunxi/sunxi_drm.c: revision 1.9

Reclaim bootloader FB memory for CMA pool.


To generate a diff of this commit:
cvs rdiff -u -r1.7.6.1 -r1.7.6.2 src/sys/arch/arm/sunxi/sunxi_drm.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/sunxi/sunxi_drm.c
diff -u src/sys/arch/arm/sunxi/sunxi_drm.c:1.7.6.1 src/sys/arch/arm/sunxi/sunxi_drm.c:1.7.6.2
--- src/sys/arch/arm/sunxi/sunxi_drm.c:1.7.6.1	Wed Nov  6 09:48:31 2019
+++ src/sys/arch/arm/sunxi/sunxi_drm.c	Mon Nov 25 16:20:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_drm.c,v 1.7.6.1 2019/11/06 09:48:31 martin Exp $ */
+/* $NetBSD: sunxi_drm.c,v 1.7.6.2 2019/11/25 16:20:41 martin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.7.6.1 2019/11/06 09:48:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.7.6.2 2019/11/25 16:20:41 martin Exp $");
 
 #include 
 #include 
@@ -296,6 +296,27 @@ static struct drm_mode_config_funcs sunx
 };
 
 static int
+sunxi_drm_simplefb_lookup(bus_addr_t *paddr, bus_size_t *psize)
+{
+	static const char * compat[] = { "simple-framebuffer", NULL };
+	int chosen, child;
+
+	chosen = OF_finddevice("/chosen");
+	if (chosen == -1)
+		return ENOENT;
+
+	for (child = OF_child(chosen); child; child = OF_peer(child)) {
+		if (!fdtbus_status_okay(child))
+			continue;
+		if (!of_match_compatible(child, compat))
+			continue;
+		return fdtbus_get_reg(child, 0, paddr, psize);
+	}
+
+	return ENOENT;
+}
+
+static int
 sunxi_drm_fb_probe(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes)
 {
 	struct sunxi_drm_softc * const sc = sunxi_drm_private(helper->dev);
@@ -303,6 +324,8 @@ sunxi_drm_fb_probe(struct drm_fb_helper 
 	struct sunxi_drm_framebuffer *sfb = to_sunxi_drm_framebuffer(helper->fb);
 	struct drm_framebuffer *fb = helper->fb;
 	struct sunxi_drmfb_attach_args sfa;
+	bus_addr_t sfb_addr;
+	bus_size_t sfb_size;
 	size_t cma_size;
 	int error;
 
@@ -312,14 +335,31 @@ sunxi_drm_fb_probe(struct drm_fb_helper 
 
 	const size_t size = roundup(height * pitch, PAGE_SIZE);
 
-	/* Reserve enough memory for the FB console plus a 4K plane, rounded to 1MB */
-	cma_size = size;
-	cma_size += (SUNXI_DRM_MAX_WIDTH * SUNXI_DRM_MAX_HEIGHT * 4);
+	if (sunxi_drm_simplefb_lookup(_addr, _size) != 0)
+		sfb_size = 0;
+
+	/* Reserve enough memory for a 4K plane, rounded to 1MB */
+	cma_size = (SUNXI_DRM_MAX_WIDTH * SUNXI_DRM_MAX_HEIGHT * 4);
+	if (sfb_size == 0) {
+		/* Add memory for FB console if we cannot reclaim bootloader memory */
+		cma_size += size;
+	}
 	cma_size = roundup(cma_size, 1024 * 1024);
 	sc->sc_ddev->cma_pool = sunxi_drm_alloc_cma_pool(sc->sc_ddev, cma_size);
-	if (sc->sc_ddev->cma_pool != NULL)
-		aprint_normal_dev(sc->sc_dev, "reserved %u MB DRAM for CMA\n",
-		(u_int)(cma_size / (1024 * 1024)));
+	if (sc->sc_ddev->cma_pool != NULL) {
+		if (sfb_size != 0) {
+			error = vmem_add(sc->sc_ddev->cma_pool, sfb_addr,
+			sfb_size, VM_SLEEP);
+			if (error != 0)
+sfb_size = 0;
+		}
+		aprint_normal_dev(sc->sc_dev, "reserved %u MB DRAM for CMA",
+		(u_int)((cma_size + sfb_size) / (1024 * 1024)));
+		if (sfb_size != 0)
+			aprint_normal(" (%u MB reclaimed from bootloader)",
+			(u_int)(sfb_size / (1024 * 1024)));
+		aprint_normal("\n");
+	}
 
 	sfb->obj = drm_gem_cma_create(ddev, size);
 	if (sfb->obj == NULL) {



CVS commit: [netbsd-9] src/sys/arch/evbarm/beagle

2019-11-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 25 05:47:13 UTC 2019

Modified Files:
src/sys/arch/evbarm/beagle [netbsd-9]: beagle_machdep.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #466):
sys/arch/evbarm/beagle/beagle_machdep.c: revision 1.80
"rv" is only used on some boards and only with options DIAGNOSTIC.
So move the declaration into the proper #ifdef block.


To generate a diff of this commit:
cvs rdiff -u -r1.78.2.1 -r1.78.2.2 \
src/sys/arch/evbarm/beagle/beagle_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/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78.2.1 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78.2.2
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78.2.1	Fri Nov 22 15:28:18 2019
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Nov 25 05:47:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.78.2.1 2019/11/22 15:28:18 bouyer Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.78.2.2 2019/11/25 05:47:13 msaitoh Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.78.2.1 2019/11/22 15:28:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.78.2.2 2019/11/25 05:47:13 msaitoh Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -1075,7 +1075,6 @@ void
 beagle_device_register(device_t self, void *aux)
 {
 	prop_dictionary_t dict = device_properties(self);
-	int rv __diagused;
 
 	if (device_is_a(self, "armperiph")
 	&& device_is_a(device_parent(self), "mainbus")) {
@@ -1170,6 +1169,7 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_int16(dict, "port2-gpio", -1);
 #endif
 #if defined(OMAP_5430)
+		int rv __diagused;
 		bus_space_tag_t iot = _bs_tag;
 		bus_space_handle_t ioh;
 		omap2_gpio_ctl(80, GPIO_PIN_OUTPUT);



CVS commit: [netbsd-9] src/sys/arch/evbarm/beagle

2019-11-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 25 05:47:13 UTC 2019

Modified Files:
src/sys/arch/evbarm/beagle [netbsd-9]: beagle_machdep.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #466):
sys/arch/evbarm/beagle/beagle_machdep.c: revision 1.80
"rv" is only used on some boards and only with options DIAGNOSTIC.
So move the declaration into the proper #ifdef block.


To generate a diff of this commit:
cvs rdiff -u -r1.78.2.1 -r1.78.2.2 \
src/sys/arch/evbarm/beagle/beagle_machdep.c

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



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

2019-11-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Nov 22 15:28:18 UTC 2019

Modified Files:
src/sys/arch/arm/omap [netbsd-9]: obio_mputmr.c
src/sys/arch/evbarm/beagle [netbsd-9]: beagle_machdep.c
src/sys/arch/xen/xen [netbsd-9]: xenevt.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #463):
sys/arch/xen/xen/xenevt.c: revision 1.54
sys/arch/arm/omap/obio_mputmr.c: revision 1.9
sys/arch/evbarm/beagle/beagle_machdep.c: revision 1.79
Make this files compilable w/o options DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.38.1 src/sys/arch/arm/omap/obio_mputmr.c
cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.53 -r1.53.4.1 src/sys/arch/xen/xen/xenevt.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/obio_mputmr.c
diff -u src/sys/arch/arm/omap/obio_mputmr.c:1.8 src/sys/arch/arm/omap/obio_mputmr.c:1.8.38.1
--- src/sys/arch/arm/omap/obio_mputmr.c:1.8	Sun Jun 16 17:47:54 2013
+++ src/sys/arch/arm/omap/obio_mputmr.c	Fri Nov 22 15:28:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: obio_mputmr.c,v 1.8 2013/06/16 17:47:54 matt Exp $ */
+/* $NetBSD: obio_mputmr.c,v 1.8.38.1 2019/11/22 15:28:18 bouyer Exp $ */
 
 /*
  * Based on omap_mputmr.c
@@ -101,7 +101,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obio_mputmr.c,v 1.8 2013/06/16 17:47:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio_mputmr.c,v 1.8.38.1 2019/11/22 15:28:18 bouyer Exp $");
 
 #include "opt_omap.h"
 #include "opt_cpuoptions.h"
@@ -302,9 +302,9 @@ gpt_enable(
 
 #if defined(OMAP_2430) || defined(OMAP_2420)
 	bus_space_handle_t ioh;
-	uint32_t r;
+	uint32_t r, err __diagused;
 
-	int err = bus_space_map(obio->obio_iot, OMAP2_CM_BASE,
+	err = bus_space_map(obio->obio_iot, OMAP2_CM_BASE,
 	OMAP2_CM_SIZE, 0, );
 	KASSERT(err == 0);
 

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78.2.1
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78	Tue Jul 16 14:41:44 2019
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Fri Nov 22 15:28:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.78 2019/07/16 14:41:44 skrll Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.78.2.1 2019/11/22 15:28:18 bouyer Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.78 2019/07/16 14:41:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.78.2.1 2019/11/22 15:28:18 bouyer Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -1075,6 +1075,7 @@ void
 beagle_device_register(device_t self, void *aux)
 {
 	prop_dictionary_t dict = device_properties(self);
+	int rv __diagused;
 
 	if (device_is_a(self, "armperiph")
 	&& device_is_a(device_parent(self), "mainbus")) {
@@ -1180,7 +1181,7 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_int16(dict, "port0-gpio", 80);
 		prop_dictionary_set_bool(dict, "port0-gpioval", true);
 #endif
-		int rv = bus_space_map(iot, OMAP5_CM_CTL_WKUP_REF_CLK0_OUT_REF_CLK1_OUT, 4, 0, );
+		rv = bus_space_map(iot, OMAP5_CM_CTL_WKUP_REF_CLK0_OUT_REF_CLK1_OUT, 4, 0, );
 		KASSERT(rv == 0);
 		uint32_t v = bus_space_read_4(iot, ioh, 0);
 		v &= 0x;

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.53 src/sys/arch/xen/xen/xenevt.c:1.53.4.1
--- src/sys/arch/xen/xen/xenevt.c:1.53	Tue Dec 25 06:50:12 2018
+++ src/sys/arch/xen/xen/xenevt.c	Fri Nov 22 15:28:17 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.53 2018/12/25 06:50:12 cherry Exp $  */
+/*  $NetBSD: xenevt.c,v 1.53.4.1 2019/11/22 15:28:17 bouyer Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.53 2018/12/25 06:50:12 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.53.4.1 2019/11/22 15:28:17 bouyer Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -161,7 +161,7 @@ static evtchn_port_t xenevt_alloc_event(
 void
 xenevtattach(int n)
 {
-	struct intrhand *ih;
+	struct intrhand *ih __diagused;
 	int level = IPL_HIGH;
 	bool mpsafe = (level != IPL_VM);
 



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

2019-11-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Nov 22 15:28:18 UTC 2019

Modified Files:
src/sys/arch/arm/omap [netbsd-9]: obio_mputmr.c
src/sys/arch/evbarm/beagle [netbsd-9]: beagle_machdep.c
src/sys/arch/xen/xen [netbsd-9]: xenevt.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #463):
sys/arch/xen/xen/xenevt.c: revision 1.54
sys/arch/arm/omap/obio_mputmr.c: revision 1.9
sys/arch/evbarm/beagle/beagle_machdep.c: revision 1.79
Make this files compilable w/o options DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.38.1 src/sys/arch/arm/omap/obio_mputmr.c
cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.53 -r1.53.4.1 src/sys/arch/xen/xen/xenevt.c

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



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

2019-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 14:02:33 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: netbsd32_machdep.c

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

sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.130

Fix netbsd32_process_write_dbregs() for amd64:
- Zero-clear regs64 so that random values are not written into the
   preserved registers.
- Cast 32-bit registers (int) to u_int, in order to avoid undesired
   sign extension when filled into 64-bit registers (long).

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.125.2.1 src/sys/arch/amd64/amd64/netbsd32_machdep.c

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



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

2019-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 14:02:33 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: netbsd32_machdep.c

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

sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.130

Fix netbsd32_process_write_dbregs() for amd64:
- Zero-clear regs64 so that random values are not written into the
   preserved registers.
- Cast 32-bit registers (int) to u_int, in order to avoid undesired
   sign extension when filled into 64-bit registers (long).

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.125.2.1 src/sys/arch/amd64/amd64/netbsd32_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/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125.2.1
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125	Sat Jul 20 18:25:11 2019
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Thu Nov 21 14:02:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.125 2019/07/20 18:25:11 christos Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.125.2.1 2019/11/21 14:02:33 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.125 2019/07/20 18:25:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.125.2.1 2019/11/21 14:02:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -489,13 +489,15 @@ netbsd32_process_write_dbregs(struct lwp
 		return EINVAL;
 	}
 
-	regs64.dr[0] = regs->dr[0];
-	regs64.dr[1] = regs->dr[1];
-	regs64.dr[2] = regs->dr[2];
-	regs64.dr[3] = regs->dr[3];
+	memset(, 0, sizeof(regs64));
 
-	regs64.dr[6] = regs->dr[6];
-	regs64.dr[7] = regs->dr[7];
+	regs64.dr[0] = (u_int)regs->dr[0];
+	regs64.dr[1] = (u_int)regs->dr[1];
+	regs64.dr[2] = (u_int)regs->dr[2];
+	regs64.dr[3] = (u_int)regs->dr[3];
+
+	regs64.dr[6] = (u_int)regs->dr[6];
+	regs64.dr[7] = (u_int)regs->dr[7];
 
 	x86_dbregs_write(l, );
 	return 0;



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

2019-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 20 16:49:58 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip [netbsd-9]: files.rockchip rk3399_cru.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64
Added Files:
src/sys/arch/arm/rockchip [netbsd-9]: rk_spi.c

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

sys/arch/arm/rockchip/rk3399_cru.c: revision 1.9
sys/arch/arm/rockchip/rk_spi.c: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.104
sys/arch/arm/rockchip/files.rockchip: revision 1.20

rk3399_cru: add definitions for SPI clocks

rk_spi: Rockchip SPI driver

Match only on RK3399 for now, but should work on RK3328 as well with
the proper CRU support. If you can, please test and enable for RK3328.

rkspi* at fdt?


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r1.8.4.1 -r1.8.4.2 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r0 -r1.3.2.2 src/sys/arch/arm/rockchip/rk_spi.c
cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/arch/evbarm/conf/GENERIC64

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



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

2019-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 20 16:49:58 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip [netbsd-9]: files.rockchip rk3399_cru.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64
Added Files:
src/sys/arch/arm/rockchip [netbsd-9]: rk_spi.c

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

sys/arch/arm/rockchip/rk3399_cru.c: revision 1.9
sys/arch/arm/rockchip/rk_spi.c: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.104
sys/arch/arm/rockchip/files.rockchip: revision 1.20

rk3399_cru: add definitions for SPI clocks

rk_spi: Rockchip SPI driver

Match only on RK3399 for now, but should work on RK3328 as well with
the proper CRU support. If you can, please test and enable for RK3328.

rkspi* at fdt?


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r1.8.4.1 -r1.8.4.2 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r0 -r1.3.2.2 src/sys/arch/arm/rockchip/rk_spi.c
cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/arch/evbarm/conf/GENERIC64

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/rockchip/files.rockchip
diff -u src/sys/arch/arm/rockchip/files.rockchip:1.19.2.1 src/sys/arch/arm/rockchip/files.rockchip:1.19.2.2
--- src/sys/arch/arm/rockchip/files.rockchip:1.19.2.1	Sat Nov 16 16:48:25 2019
+++ src/sys/arch/arm/rockchip/files.rockchip	Wed Nov 20 16:49:58 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.rockchip,v 1.19.2.1 2019/11/16 16:48:25 martin Exp $
+#	$NetBSD: files.rockchip,v 1.19.2.2 2019/11/20 16:49:58 martin Exp $
 #
 # Configuration info for Rockchip family SoCs
 #
@@ -42,6 +42,11 @@ device	rkiic: i2cbus, i2cexec
 attach	rkiic at fdt with rk_i2c
 file	arch/arm/rockchip/rk_i2c.c		rk_i2c
 
+# SPI
+device	rkspi: spibus
+attach	rkspi at fdt with rk_spi
+file	arch/arm/rockchip/rk_spi.c		rk_spi
+
 # USB PHY
 device	rkusb { }
 attach	rkusb at fdt with rk_usb

Index: src/sys/arch/arm/rockchip/rk3399_cru.c
diff -u src/sys/arch/arm/rockchip/rk3399_cru.c:1.8.4.1 src/sys/arch/arm/rockchip/rk3399_cru.c:1.8.4.2
--- src/sys/arch/arm/rockchip/rk3399_cru.c:1.8.4.1	Sat Nov 16 16:48:25 2019
+++ src/sys/arch/arm/rockchip/rk3399_cru.c	Wed Nov 20 16:49:58 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_cru.c,v 1.8.4.1 2019/11/16 16:48:25 martin Exp $ */
+/* $NetBSD: rk3399_cru.c,v 1.8.4.2 2019/11/20 16:49:58 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.8.4.1 2019/11/16 16:48:25 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.8.4.2 2019/11/20 16:49:58 martin Exp $");
 
 #include 
 #include 
@@ -771,6 +771,50 @@ static struct rk_cru_clk rk3399_cru_clks
 	RK_GATE(RK3399_PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", CLKGATE_CON(22), 9),
 	RK_GATE(RK3399_PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", CLKGATE_CON(22), 10),
 
+	/*
+	 * SPI
+	 */
+	RK_COMPOSITE(RK3399_SCLK_SPI0, "clk_spi0", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(59),	/* muxdiv_reg */
+		 __BIT(7),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(12),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI1, "clk_spi1", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(59),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(13),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI2, "clk_spi2", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(60),	/* muxdiv_reg */
+		 __BIT(7),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(14),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI4, "clk_spi4", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(60),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(15),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI5, "clk_spi5", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(58),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(13),	/* gate_reg */
+		 __BIT(13),		/* gate_mask */
+		 0),
+	RK_GATE(RK3399_PCLK_SPI0, "pclk_rkspi0", "pclk_perilp1", CLKGATE_CON(23), 10),
+	RK_GATE(RK3399_PCLK_SPI1, "pclk_rkspi1", "pclk_perilp1", CLKGATE_CON(23), 11),
+	RK_GATE(RK3399_PCLK_SPI2, "pclk_rkspi2", "pclk_perilp1", CLKGATE_CON(23), 12),
+	RK_GATE(RK3399_PCLK_SPI4, "pclk_rkspi4", "pclk_perilp1", CLKGATE_CON(23), 13),
+	RK_GATE(RK3399_PCLK_SPI5, "pclk_rkspi5", "hclk_perilp1", CLKGATE_CON(34), 5),
+
 	/* PCIe */
 	RK_GATE(RK3399_ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", CLKGATE_CON(20), 2),
 	RK_GATE(RK3399_ACLK_PCIE, "aclk_pcie", 

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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:36:03 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64

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

sys/arch/evbarm/conf/GENERIC64: revision 1.115
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.15

Add SPI clocks
Add sun6ispi


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.1 -r1.13.2.2 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.103.2.4 -r1.103.2.5 src/sys/arch/evbarm/conf/GENERIC64

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/sunxi/sun50i_a64_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.13.2.1 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.13.2.2
--- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.13.2.1	Mon Nov 18 19:31:00 2019
+++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c	Mon Nov 18 19:36:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_ccu.c,v 1.13.2.1 2019/11/18 19:31:00 martin Exp $ */
+/* $NetBSD: sun50i_a64_ccu.c,v 1.13.2.2 2019/11/18 19:36:03 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.13.2.1 2019/11/18 19:31:00 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.13.2.2 2019/11/18 19:36:03 martin Exp $");
 
 #include 
 #include 
@@ -60,6 +60,8 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_a64_c
 #define	SDMMC0_CLK_REG		0x088
 #define	SDMMC1_CLK_REG		0x08c
 #define	SDMMC2_CLK_REG		0x090
+#define	SPI0_CLK_REG		0x0a0
+#define	SPI1_CLK_REG		0x0a4
 #define	I2SPCM0_CLK_REG		0x0b0
 #define	I2SPCM1_CLK_REG		0x0b4
 #define	I2SPCM2_CLK_REG		0x0b8
@@ -158,6 +160,7 @@ static const char *ths_parents[] = { "ho
 static const char *de_parents[] = { "pll_periph0_2x", "pll_de" };
 static const char *hdmi_parents[] = { "pll_video0", "pll_video1" };
 static const char *i2s_parents[] = { "pll_audio_8x", "pll_audio_4x", "pll_audio_2x", "pll_audio" };
+static const char *spi_parents[] = { "hosc", "pll_periph0", "pll_periph1", NULL };
 static const char *tcon1_parents[] = { "pll_video0", NULL, "pll_video1", NULL };
 static const char *gpu_parents[] = { "pll_gpu" };
 
@@ -260,6 +263,16 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	SUNXI_CCU_NKMP_DIVIDE_BY_TWO),
 	SUNXI_CCU_FIXED_FACTOR(A64_CLK_PLL_PERIPH0_2X, "pll_periph0_2x", "pll_periph0", 1, 2),
 
+	SUNXI_CCU_NKMP(A64_CLK_PLL_PERIPH1, "pll_periph1", "hosc",
+	PLL_PERIPH1_CTRL_REG,	/* reg */
+	__BITS(12,8),		/* n */
+	__BITS(5,4), 		/* k */
+	0,/* m */
+	__BITS(17,16),		/* p */
+	__BIT(31),			/* enable */
+	SUNXI_CCU_NKMP_DIVIDE_BY_TWO),
+	SUNXI_CCU_FIXED_FACTOR(A64_CLK_PLL_PERIPH1_2X, "pll_periph1_2x", "pll_periph1", 1, 2),
+
 	SUNXI_CCU_NKMP_TABLE(A64_CLK_PLL_AUDIO_BASE, "pll_audio_base", "hosc",
 	PLL_AUDIO_CTRL_REG,		/* reg */
 	__BITS(14,8),		/* n */
@@ -430,6 +443,21 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	__BIT(31),		/* enable */
 	0),
 
+	SUNXI_CCU_NM(A64_CLK_SPI0, "spi0", spi_parents,
+	SPI0_CLK_REG,	/* reg */
+	__BITS(17,16),	/* n */
+	__BITS(3,0),	/* m */
+	__BITS(25,24),	/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
+
+	SUNXI_CCU_NM(A64_CLK_SPI1, "spi1", spi_parents,
+	SPI1_CLK_REG,	/* reg */
+	__BITS(17,16),	/* n */
+	__BITS(3,0),	/* m */
+	__BITS(25,24),	/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
 
 	SUNXI_CCU_DIV_GATE(A64_CLK_TCON1, "tcon1", tcon1_parents,
 	TCON1_CLK_REG,	/* reg */

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.103.2.4 src/sys/arch/evbarm/conf/GENERIC64:1.103.2.5
--- src/sys/arch/evbarm/conf/GENERIC64:1.103.2.4	Mon Nov 18 19:33:10 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Mon Nov 18 19:36:03 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.103.2.4 2019/11/18 19:33:10 martin Exp $
+#	$NetBSD: GENERIC64,v 1.103.2.5 2019/11/18 19:36:03 martin Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -402,6 +402,7 @@ ld*		at nvme? nsid ?
 
 # SPI controllers
 bcmspi*		at fdt?			# Broadcom BCM283x SPI
+sun6ispi*	at fdt?			# Allwinner SPI
 spi*		at spibus?
 
 # Audio support



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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:36:03 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64

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

sys/arch/evbarm/conf/GENERIC64: revision 1.115
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.15

Add SPI clocks
Add sun6ispi


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.1 -r1.13.2.2 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.103.2.4 -r1.103.2.5 src/sys/arch/evbarm/conf/GENERIC64

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



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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:31:00 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-a64-pine64-plus.dts
sun50i-a64-pine64.dts sun50i-a64-sopine-baseboard.dts
sun50i-a64.dtsi
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c sunxi_ccu_div.c
sunxi_dwhdmi.c sunxi_i2s.c

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

sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_ccu_div.c: revision 1.6
sys/arch/arm/dts/sun50i-a64.dtsi: revision 1.13
sys/arch/arm/dts/sun50i-a64-pine64.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_dwhdmi.c: revision 1.4
sys/arch/arm/dts/sun50i-a64-pine64-plus.dts: revision 1.3
sys/arch/arm/sunxi/sunxi_i2s.c: revision 1.7
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.14

Add support for A64 I2S clocks.
Add A64 HDMI audio support.
Enable HDMI audio support on Pine64, Pine64+, and Pine64 LTS boards.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.10.1 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/dts/sun50i-a64-pine64.dts \
src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/arch/arm/dts/sun50i-a64.dtsi
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.5 -r1.5.6.1 src/sys/arch/arm/sunxi/sunxi_ccu_div.c
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_i2s.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/dts/sun50i-a64-pine64-plus.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts:1.2 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts:1.2.10.1
--- src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts:1.2	Sat Sep  9 12:05:28 2017
+++ src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-pine64-plus.dts,v 1.2 2017/09/09 12:05:28 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-pine64-plus.dts,v 1.2.10.1 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -49,3 +49,11 @@
  {
 	status = "okay";
 };
+
+ {
+	status = "okay";
+};
+
+_hdmi {
+	status = "okay";
+};

Index: src/sys/arch/arm/dts/sun50i-a64-pine64.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-pine64.dts:1.1 src/sys/arch/arm/dts/sun50i-a64-pine64.dts:1.1.8.1
--- src/sys/arch/arm/dts/sun50i-a64-pine64.dts:1.1	Sun Feb 18 12:20:25 2018
+++ src/sys/arch/arm/dts/sun50i-a64-pine64.dts	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-pine64.dts,v 1.1 2018/02/18 12:20:25 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-pine64.dts,v 1.1.8.1 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,3 +28,11 @@
 
 #include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts"
 #include "sun50i-a64.dtsi"
+
+ {
+	status = "okay";
+};
+
+_hdmi {
+	status = "okay";
+};
Index: src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.1 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.1.8.1
--- src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.1	Thu Jun  7 00:51:41 2018
+++ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.1 2018/06/07 00:51:41 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.1.8.1 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,3 +28,11 @@
 
 #include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts"
 #include "sun50i-a64.dtsi"
+
+ {
+	status = "okay";
+};
+
+_hdmi {
+	status = "okay";
+};

Index: src/sys/arch/arm/dts/sun50i-a64.dtsi
diff -u src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11.2.1 src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11.2.2
--- src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11.2.1	Sun Nov 10 13:14:41 2019
+++ src/sys/arch/arm/dts/sun50i-a64.dtsi	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64.dtsi,v 1.11.2.1 2019/11/10 13:14:41 martin Exp $ */
+/* $NetBSD: sun50i-a64.dtsi,v 1.11.2.2 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -59,6 +59,36 @@
 			 ,
 			 ;
 	};
+
+	i2s2: i2s@1c22800 {
+		#sound-dai-cells = <0>;
+		compatible = "allwinner,sun50i-a64-i2s",
+			 "allwinner,sun8i-h3-i2s";
+		reg = <0x01c22800 0x400>;
+		interrupts = ;
+		clocks = < CLK_BUS_I2S2>, < CLK_I2S2>;
+		clock-names = "apb", "mod";
+		resets = < RST_BUS_I2S2>;
+		dma-names = "tx";
+		dmas = < 27>;
+		status = "disabled";
+	};
+
+	sound_hdmi: sound-hdmi {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = 

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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:31:00 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-a64-pine64-plus.dts
sun50i-a64-pine64.dts sun50i-a64-sopine-baseboard.dts
sun50i-a64.dtsi
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c sunxi_ccu_div.c
sunxi_dwhdmi.c sunxi_i2s.c

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

sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_ccu_div.c: revision 1.6
sys/arch/arm/dts/sun50i-a64.dtsi: revision 1.13
sys/arch/arm/dts/sun50i-a64-pine64.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_dwhdmi.c: revision 1.4
sys/arch/arm/dts/sun50i-a64-pine64-plus.dts: revision 1.3
sys/arch/arm/sunxi/sunxi_i2s.c: revision 1.7
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.14

Add support for A64 I2S clocks.
Add A64 HDMI audio support.
Enable HDMI audio support on Pine64, Pine64+, and Pine64 LTS boards.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.10.1 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/dts/sun50i-a64-pine64.dts \
src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/arch/arm/dts/sun50i-a64.dtsi
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.5 -r1.5.6.1 src/sys/arch/arm/sunxi/sunxi_ccu_div.c
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_i2s.c

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



CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:59:15 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: zbsdmod.c
src/sys/arch/zaurus/zaurus [netbsd-9]: machdep.c

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

sys/arch/zaurus/conf/GENERIC: revision 1.89
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.12
sys/arch/zaurus/conf/INSTALL: revision 1.40
sys/arch/zaurus/zaurus/machdep.c: revision 1.45

Make zaurus kernels use symbol tables loaded by the bootloader.

Now COPY_SYMTAB is no longer necessary and it saves ~500kbytes of
GENERIC, so re-enable options DDB (i.e. revert GENERIC rev 1.85).
Also fix zbsdmod.o (a kernel loader for Zaurus Linux) to load symbols
at a proper address as the MI sys/lib/libsa/loadfile_elf32.c does.

No particular comment on port-zaurus@:

 https://mail-index.netbsd.org/port-zaurus/2019/11/11/msg86.html

Note zbsdmod.c (derived from OpenBSD/zaurus) assumed that the loaded
kernels had "esym" variable at the top of its data section and
implicitly overwrote it with the address of loaded symbol tables.
OpenBSD/zaurus kernels used the esym value written by the zbsdmod.o
to initialize ksyms(4) on startup, but we will avoid such implicit
MD interface between the bootloader and kernels (though we don't
bother to add a symbol address value into bootinfo but just assume
symbols are loaded at end[] of a loaded kernel, as per the MI
libsa loadfile() implementation).

Worth to pullup to both netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.86.2.1 -r1.86.2.2 src/sys/arch/zaurus/conf/GENERIC
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/zaurus/conf/INSTALL
cvs rdiff -u -r1.9.34.1 -r1.9.34.2 \
src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
cvs rdiff -u -r1.42 -r1.42.2.1 src/sys/arch/zaurus/zaurus/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/zaurus/conf/GENERIC
diff -u src/sys/arch/zaurus/conf/GENERIC:1.86.2.1 src/sys/arch/zaurus/conf/GENERIC:1.86.2.2
--- src/sys/arch/zaurus/conf/GENERIC:1.86.2.1	Mon Nov  4 14:34:28 2019
+++ src/sys/arch/zaurus/conf/GENERIC	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.86.2.1 2019/11/04 14:34:28 martin Exp $
+#	$NetBSD: GENERIC,v 1.86.2.2 2019/11/16 16:59:15 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -150,11 +150,10 @@ options 	WSDISPLAY_COMPAT_RAWKBD		# can 
 options 	DIAGNOSTIC		# internal consistency checks
 #options 	DEBUG
 #options 	VERBOSE_INIT_ARM	# verbose bootstraping messages
-#options 	DDB			# in-kernel debugger
-#options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
+options 	DDB			# in-kernel debugger
+options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	KGDB
 #makeoptions 	DEBUG="-g"		# compile full symbol table
-makeoptions	COPY_SYMTAB=1
 
 
 # Kernel root file system and dump configuration.

Index: src/sys/arch/zaurus/conf/INSTALL
diff -u src/sys/arch/zaurus/conf/INSTALL:1.39 src/sys/arch/zaurus/conf/INSTALL:1.39.4.1
--- src/sys/arch/zaurus/conf/INSTALL:1.39	Thu Feb  7 20:56:27 2019
+++ src/sys/arch/zaurus/conf/INSTALL	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.39 2019/02/07 20:56:27 rin Exp $
+# $NetBSD: INSTALL,v 1.39.4.1 2019/11/16 16:59:15 martin Exp $
 #
 # INSTALL config file (GENERIC with memory disk root)
 #
@@ -59,7 +59,6 @@ options 		RASOPS_SMALL
 no options 		DIAGNOSTIC
 no options 		DDB
 no options 		DDB_HISTORY_SIZE
-no makeoptions	COPY_SYMTAB
 
 no options 		PXA2X0_DMAC_DMOVER_CONCURRENCY
 

Index: src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
diff -u src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9.34.1 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9.34.2
--- src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9.34.1	Sun Nov  3 11:36:56 2019
+++ src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: zbsdmod.c,v 1.9.34.1 2019/11/03 11:36:56 martin Exp $	*/
+/*	$NetBSD: zbsdmod.c,v 1.9.34.2 2019/11/16 16:59:15 martin Exp $	*/
 /*	$OpenBSD: zbsdmod.c,v 1.7 2005/05/02 02:45:29 uwe Exp $	*/
 
 /*
@@ -139,8 +139,8 @@ elf32bsdboot(void)
 			if (maxv < posv)
 maxv = posv;
 		}
-		if (IS_DATA(phdr[i]) && IS_BSS(phdr[i])) {
-			posv += phdr[i].p_memsz;
+		if (IS_BSS(phdr[i])) {
+			posv += phdr[i].p_memsz - phdr[i].p_filesz;
 			if (maxv < posv)
 maxv = posv;
 		}

Index: src/sys/arch/zaurus/zaurus/machdep.c
diff -u src/sys/arch/zaurus/zaurus/machdep.c:1.42 src/sys/arch/zaurus/zaurus/machdep.c:1.42.2.1
--- src/sys/arch/zaurus/zaurus/machdep.c:1.42	Tue Jul 16 14:41:49 2019
+++ src/sys/arch/zaurus/zaurus/machdep.c	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.42 2019/07/16 14:41:49 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.42.2.1 2019/11/16 16:59:15 martin Exp $	*/
 

CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:59:15 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: zbsdmod.c
src/sys/arch/zaurus/zaurus [netbsd-9]: machdep.c

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

sys/arch/zaurus/conf/GENERIC: revision 1.89
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.12
sys/arch/zaurus/conf/INSTALL: revision 1.40
sys/arch/zaurus/zaurus/machdep.c: revision 1.45

Make zaurus kernels use symbol tables loaded by the bootloader.

Now COPY_SYMTAB is no longer necessary and it saves ~500kbytes of
GENERIC, so re-enable options DDB (i.e. revert GENERIC rev 1.85).
Also fix zbsdmod.o (a kernel loader for Zaurus Linux) to load symbols
at a proper address as the MI sys/lib/libsa/loadfile_elf32.c does.

No particular comment on port-zaurus@:

 https://mail-index.netbsd.org/port-zaurus/2019/11/11/msg86.html

Note zbsdmod.c (derived from OpenBSD/zaurus) assumed that the loaded
kernels had "esym" variable at the top of its data section and
implicitly overwrote it with the address of loaded symbol tables.
OpenBSD/zaurus kernels used the esym value written by the zbsdmod.o
to initialize ksyms(4) on startup, but we will avoid such implicit
MD interface between the bootloader and kernels (though we don't
bother to add a symbol address value into bootinfo but just assume
symbols are loaded at end[] of a loaded kernel, as per the MI
libsa loadfile() implementation).

Worth to pullup to both netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.86.2.1 -r1.86.2.2 src/sys/arch/zaurus/conf/GENERIC
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/zaurus/conf/INSTALL
cvs rdiff -u -r1.9.34.1 -r1.9.34.2 \
src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
cvs rdiff -u -r1.42 -r1.42.2.1 src/sys/arch/zaurus/zaurus/machdep.c

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



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

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:55:47 UTC 2019

Modified Files:
src/sys/arch/arm/sa11x0 [netbsd-9]: sa11x0_ost.c
src/sys/arch/zaurus/zaurus [netbsd-9]: autoconf.c

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

sys/arch/arm/sa11x0/sa11x0_ost.c: revision 1.33
sys/arch/zaurus/zaurus/autoconf.c: revision 1.13

Fix attach failure of zaudio(4) WM8731 (C7x0/860) and WM8750 (C1000/3x00).

The new MI iic(4) layer requires an explicit quirk info of PROBE_STRATEGY
via device properties.  Fixes PR kern/54658.

Should be pulled up to netbsd-9.

 -

Fix another attach failure of zaudio(4) WM8731 on Zaurus SL-C7x0/860.

When kernels were configured for both CPU_XSCALE_PXA270 and
CPU_XSCALE_PXA250, the OST freq value was not set until tc_init(9)
then all delay(9) during configure(9) returned immediately.

While here, use proper macro with description for readability.

Should be pulled up to netbsd-8 and netbsd-9.
(though zaudio(4) won't work on netbsd-8)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.20.1 src/sys/arch/arm/sa11x0/sa11x0_ost.c
cvs rdiff -u -r1.12 -r1.12.44.1 src/sys/arch/zaurus/zaurus/autoconf.c

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



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

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:53:13 UTC 2019

Modified Files:
src/sys/arch/x86/pci [netbsd-9]: msipic.c

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

sys/arch/x86/pci/msipic.c: revision 1.19

Disable MSI-X before writing the MSI-X table.

That fixes MSI-X interrupt lost on VMware ESXi 6.7 PCI passthrough devices.

ok knakahara@


To generate a diff of this commit:
cvs rdiff -u -r1.17.2.1 -r1.17.2.2 src/sys/arch/x86/pci/msipic.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/msipic.c
diff -u src/sys/arch/x86/pci/msipic.c:1.17.2.1 src/sys/arch/x86/pci/msipic.c:1.17.2.2
--- src/sys/arch/x86/pci/msipic.c:1.17.2.1	Tue Oct 15 18:08:31 2019
+++ src/sys/arch/x86/pci/msipic.c	Sat Nov 16 16:53:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msipic.c,v 1.17.2.1 2019/10/15 18:08:31 martin Exp $	*/
+/*	$NetBSD: msipic.c,v 1.17.2.2 2019/11/16 16:53:13 martin Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17.2.1 2019/10/15 18:08:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17.2.2 2019/11/16 16:53:13 martin Exp $");
 
 #include "opt_intrdebug.h"
 
@@ -548,6 +548,11 @@ msix_addroute(struct pic *pic, struct cp
 	err = pci_get_capability(pc, tag, PCI_CAP_MSIX, , NULL);
 	KASSERT(err != 0);
 
+	/* Disable MSI-X before writing MSI-X table */
+	ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL);
+	ctl &= ~PCI_MSIX_CTL_ENABLE;
+	pci_conf_write(pc, tag, off + PCI_MSIX_CTL, ctl);
+
 	entry_base = PCI_MSIX_TABLE_ENTRY_SIZE * msix_vec;
 
 	/*



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

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:53:13 UTC 2019

Modified Files:
src/sys/arch/x86/pci [netbsd-9]: msipic.c

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

sys/arch/x86/pci/msipic.c: revision 1.19

Disable MSI-X before writing the MSI-X table.

That fixes MSI-X interrupt lost on VMware ESXi 6.7 PCI passthrough devices.

ok knakahara@


To generate a diff of this commit:
cvs rdiff -u -r1.17.2.1 -r1.17.2.2 src/sys/arch/x86/pci/msipic.c

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



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

2019-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 12 18:24:37 UTC 2019

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

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

sys/arch/x86/include/specialreg.h: revision 1.157
sys/arch/x86/x86/spectre.c: revision 1.31

Mitigation for CVE-2019-11135: TSX Asynchronous Abort (TAA).

Two sysctls are added:
machdep.taa.mitigated = {0/1} user-settable
machdep.taa.method = {string} constructed by the kernel

There are two cases:

  (1) If the CPU is affected by MDS, then the MDS mitigation will also
mitigate TAA, and we have nothing else to do. We make the 'mitigated' leaf
read-only, and force:

machdep.taa.mitigated = machdep.mds.mitigated
machdep.taa.method = [MDS]

The kernel already enables the MDS mitigation by default.

  (2) If the CPU is not affected by MDS but is affected by TAA, then we use
the new TSX_CTRL MSR to disable RTM. This MSR is provided via a microcode
update, now available on the Intel website. The kernel will automatically
enable the TAA mitigation if the updated microcode is present. If the new
microcode is not present, the user can load it via cpuctl, and set
machdep.taa.mitigated=1.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.3 -r1.150.2.4 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/arch/x86/x86/spectre.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.3 src/sys/arch/x86/include/specialreg.h:1.150.2.4
--- src/sys/arch/x86/include/specialreg.h:1.150.2.3	Sun Nov 10 13:06:46 2019
+++ src/sys/arch/x86/include/specialreg.h	Tue Nov 12 18:24:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.3 2019/11/10 13:06:46 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.4 2019/11/12 18:24:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -853,9 +853,14 @@
 #define 	IA32_ARCH_SKIP_L1DFL_VMENTRY 0x08
 #define 	IA32_ARCH_SSB_NO	0x10
 #define 	IA32_ARCH_MDS_NO	0x20
+#define 	IA32_ARCH_TSX_CTRL	0x80
+#define 	IA32_ARCH_TAA_NO	0x100
 #define MSR_IA32_FLUSH_CMD	0x10b
 #define 	IA32_FLUSH_CMD_L1D_FLUSH 0x01
 #define MSR_TSX_FORCE_ABORT	0x10f
+#define MSR_IA32_TSX_CTRL	0x122
+#define 	IA32_TSX_CTRL_RTM_DISABLE	__BIT(0)
+#define 	IA32_TSX_CTRL_TSX_CPUID_CLEAR	__BIT(1)
 #define MSR_SYSENTER_CS		0x174	/* PII+ only */
 #define MSR_SYSENTER_ESP	0x175	/* PII+ only */
 #define MSR_SYSENTER_EIP	0x176	/* PII+ only */

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.29.2.1 src/sys/arch/x86/x86/spectre.c:1.29.2.2
--- src/sys/arch/x86/x86/spectre.c:1.29.2.1	Thu Sep 26 18:47:14 2019
+++ src/sys/arch/x86/x86/spectre.c	Tue Nov 12 18:24:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.29.2.1 2019/09/26 18:47:14 martin Exp $	*/
+/*	$NetBSD: spectre.c,v 1.29.2.2 2019/11/12 18:24:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 NetBSD Foundation, Inc.
@@ -30,11 +30,11 @@
  */
 
 /*
- * Mitigations for the SpectreV2, SpectreV4 and MDS CPU flaws.
+ * Mitigations for the SpectreV2, SpectreV4, MDS and TAA CPU flaws.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.29.2.1 2019/09/26 18:47:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.29.2.2 2019/11/12 18:24:37 martin Exp $");
 
 #include "opt_spectre.h"
 
@@ -773,6 +773,185 @@ sysctl_machdep_mds_mitigated(SYSCTLFN_AR
 
 /* -- */
 
+enum taa_mitigation {
+	TAA_MITIGATION_NONE,
+	TAA_MITIGATION_TAA_NO,
+	TAA_MITIGATION_MDS,
+	TAA_MITIGATION_RTM_DISABLE
+};
+
+static char taa_mitigation_name[64] = "(none)";
+
+static enum taa_mitigation taa_mitigation_method = TAA_MITIGATION_NONE;
+static bool taa_mitigation_enabled __read_mostly = false;
+static bool *taa_mitigation_enabled_ptr = _mitigation_enabled;
+
+static void
+mitigation_taa_apply_cpu(struct cpu_info *ci, bool enabled)
+{
+	uint64_t msr;
+
+	switch (taa_mitigation_method) {
+	case TAA_MITIGATION_NONE:
+	case TAA_MITIGATION_TAA_NO:
+	case TAA_MITIGATION_MDS:
+		panic("impossible");
+	case TAA_MITIGATION_RTM_DISABLE:
+		msr = rdmsr(MSR_IA32_TSX_CTRL);
+		if (enabled) {
+			msr |= IA32_TSX_CTRL_RTM_DISABLE;
+		} else {
+			msr &= ~IA32_TSX_CTRL_RTM_DISABLE;
+		}
+		wrmsr(MSR_IA32_TSX_CTRL, msr);
+		break;
+	}
+}
+
+static void
+mitigation_taa_change_cpu(void *arg1, void *arg2)
+{
+	struct cpu_info *ci = curcpu();
+	bool enabled = (bool)arg1;
+
+	mitigation_taa_apply_cpu(ci, enabled);
+}
+
+static void
+taa_detect_method(void)
+{
+	u_int descs[4];
+	uint64_t msr;
+
+	taa_mitigation_enabled_ptr = _mitigation_enabled;
+
+	if (cpu_vendor != CPUVENDOR_INTEL) {
+		taa_mitigation_method = TAA_MITIGATION_TAA_NO;
+		

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

2019-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 12 18:24:37 UTC 2019

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

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

sys/arch/x86/include/specialreg.h: revision 1.157
sys/arch/x86/x86/spectre.c: revision 1.31

Mitigation for CVE-2019-11135: TSX Asynchronous Abort (TAA).

Two sysctls are added:
machdep.taa.mitigated = {0/1} user-settable
machdep.taa.method = {string} constructed by the kernel

There are two cases:

  (1) If the CPU is affected by MDS, then the MDS mitigation will also
mitigate TAA, and we have nothing else to do. We make the 'mitigated' leaf
read-only, and force:

machdep.taa.mitigated = machdep.mds.mitigated
machdep.taa.method = [MDS]

The kernel already enables the MDS mitigation by default.

  (2) If the CPU is not affected by MDS but is affected by TAA, then we use
the new TSX_CTRL MSR to disable RTM. This MSR is provided via a microcode
update, now available on the Intel website. The kernel will automatically
enable the TAA mitigation if the updated microcode is present. If the new
microcode is not present, the user can load it via cpuctl, and set
machdep.taa.mitigated=1.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.3 -r1.150.2.4 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/arch/x86/x86/spectre.c

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



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

2019-11-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 11 17:20:00 UTC 2019

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

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

sys/arch/x86/x86/intr.c: revision 1.147

 Fix a bug that evcnt_detach() called twice when the idt vector is full.

OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.146.2.1 src/sys/arch/x86/x86/intr.c

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



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

2019-11-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 11 17:20:00 UTC 2019

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

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

sys/arch/x86/x86/intr.c: revision 1.147

 Fix a bug that evcnt_detach() called twice when the idt vector is full.

OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.146.2.1 src/sys/arch/x86/x86/intr.c

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

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.146 src/sys/arch/x86/x86/intr.c:1.146.2.1
--- src/sys/arch/x86/x86/intr.c:1.146	Mon Jun 17 06:38:30 2019
+++ src/sys/arch/x86/x86/intr.c	Mon Nov 11 17:20:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.146 2019/06/17 06:38:30 msaitoh Exp $	*/
+/*	$NetBSD: intr.c,v 1.146.2.1 2019/11/11 17:20:00 martin Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.146 2019/06/17 06:38:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.146.2.1 2019/11/11 17:20:00 martin Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -475,8 +475,10 @@ intr_free_io_intrsource_direct(struct in
 	SIMPLEQ_REMOVE(_interrupt_sources, isp, intrsource, is_list);
 
 	/* Is this interrupt established? */
-	if (isp->is_evname[0] != '\0')
+	if (isp->is_evname[0] != '\0') {
 		evcnt_detach(>is_evcnt);
+		isp->is_evname[0] = '\0';
+	}
 
 	kmem_free(isp->is_saved_evcnt,
 	sizeof(*(isp->is_saved_evcnt)) * ncpu);
@@ -679,6 +681,7 @@ intr_allocate_slot(struct pic *pic, int 
 	}
 	if (idtvec == 0) {
 		evcnt_detach(>ci_isources[slot]->is_evcnt);
+		ci->ci_isources[slot]->is_evname[0] = '\0';
 		ci->ci_isources[slot] = NULL;
 		return EBUSY;
 	}



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:22:37 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: socfpga_cyclone5_de0_nano_soc.dts

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

sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts: revision 1.3

Disable private timer whose new driver clashes with the global timer's one.

Stopgap measure to make the DE0 Nano Soc work again, targeted for netbsd-9
pullup. We'll see later if we switch to using the private timer.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 \
src/sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:22:37 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: socfpga_cyclone5_de0_nano_soc.dts

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

sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts: revision 1.3

Disable private timer whose new driver clashes with the global timer's one.

Stopgap measure to make the DE0 Nano Soc work again, targeted for netbsd-9
pullup. We'll see later if we switch to using the private timer.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 \
src/sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts

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/dts/socfpga_cyclone5_de0_nano_soc.dts
diff -u src/sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts:1.2 src/sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts:1.2.6.1
--- src/sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts:1.2	Tue Jan 22 15:30:57 2019
+++ src/sys/arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts	Sun Nov 10 13:22:37 2019
@@ -4,6 +4,10 @@
 
 / {
 	soc {
+		timer@fffec600 {
+			status = "disabled";
+		};
+
 		gtimer@fffec200 {
 			compatible = "arm,cortex-a9-global-timer";
 			reg = <0xfffec200 0x20>;



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:14:41 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-a64.dtsi

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

sys/arch/arm/dts/sun50i-a64.dtsi: revision 1.12

Fix PMU interrupt numbers on Allwinner A64.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/arch/arm/dts/sun50i-a64.dtsi

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/dts/sun50i-a64.dtsi
diff -u src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11 src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11.2.1
--- src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11	Thu Jun  6 23:19:45 2019
+++ src/sys/arch/arm/dts/sun50i-a64.dtsi	Sun Nov 10 13:14:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64.dtsi,v 1.11 2019/06/06 23:19:45 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64.dtsi,v 1.11.2.1 2019/11/10 13:14:41 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -51,6 +51,14 @@
 			#thermal-sensor-cells = <0>;
 		};
 	};
+
+	/* PMU interrupt numbers are wrong in mainline dts */
+	pmu {
+		interrupts = ,
+			 ,
+			 ,
+			 ;
+	};
 };
 
  {



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:14:41 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-a64.dtsi

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

sys/arch/arm/dts/sun50i-a64.dtsi: revision 1.12

Fix PMU interrupt numbers on Allwinner A64.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/arch/arm/dts/sun50i-a64.dtsi

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:06:47 UTC 2019

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

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

sys/arch/x86/include/specialreg.h: revision 1.156

- GMET is not bit 11 but 17.
- Add unknown CPUID Fn8000_000a %edx bit 20.


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

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:06:47 UTC 2019

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

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

sys/arch/x86/include/specialreg.h: revision 1.156

- GMET is not bit 11 but 17.
- Add unknown CPUID Fn8000_000a %edx bit 20.


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

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.2 src/sys/arch/x86/include/specialreg.h:1.150.2.3
--- src/sys/arch/x86/include/specialreg.h:1.150.2.2	Thu Oct 17 18:56:24 2019
+++ src/sys/arch/x86/include/specialreg.h	Sun Nov 10 13:06:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.2 2019/10/17 18:56:24 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.3 2019/11/10 13:06:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -755,19 +755,20 @@
 #define CPUID_AMD_SVM_FlushByASID	0x0040
 #define CPUID_AMD_SVM_DecodeAssist	0x0080
 #define CPUID_AMD_SVM_PauseFilter	0x0400
-#define CPUID_AMD_SVM_GMET		0x0800
 #define CPUID_AMD_SVM_PFThreshold	0x1000 /* PAUSE filter threshold */
 #define CPUID_AMD_SVM_AVIC		0x2000 /* AMD Virtual intr. ctrl */
 #define CPUID_AMD_SVM_V_VMSAVE_VMLOAD	0x8000 /* Virtual VM{SAVE/LOAD} */
 #define CPUID_AMD_SVM_vGIF		0x0001 /* Virtualized GIF */
+#define CPUID_AMD_SVM_GMET		0x0002
 #define CPUID_AMD_SVM_FLAGS	 "\20" \
 	"\1" "NP"	"\2" "LbrVirt"	"\3" "SVML"	"\4" "NRIPS"	\
 	"\5" "TSCRate"	"\6" "VMCBCleanBits" \
 			"\7" "FlushByASID" "\10" "DecodeAssist"	\
-	"\11" "B08"	"\12" "B09"	"\13" "PauseFilter" "\14" "GMET" \
+	"\11" "B08"	"\12" "B09"	"\13" "PauseFilter" "\14" "B11"	\
 	"\15" "PFThreshold" "\16" "AVIC" "\17" "B14"			\
 		"\20" "V_VMSAVE_VMLOAD"	\
-	"\21" "VGIF"
+	"\21" "VGIF"	"\22" "GMET"	\
+	"\25" "B20"
 
 /*
  * AMD Fn8000_0001d Cache Topology Information.



CVS commit: [netbsd-9] src/sys/arch/zaurus/conf

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:34:28 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: GENERIC

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

sys/arch/zaurus/conf/GENERIC: revision 1.88

Put back options WSDISPLAY_COMPAT_RAWKBD. It's required by Xorg server.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.86.2.1 src/sys/arch/zaurus/conf/GENERIC

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

Modified files:

Index: src/sys/arch/zaurus/conf/GENERIC
diff -u src/sys/arch/zaurus/conf/GENERIC:1.86 src/sys/arch/zaurus/conf/GENERIC:1.86.2.1
--- src/sys/arch/zaurus/conf/GENERIC:1.86	Fri Jul 26 07:09:47 2019
+++ src/sys/arch/zaurus/conf/GENERIC	Mon Nov  4 14:34:28 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.86 2019/07/26 07:09:47 martin Exp $
+#	$NetBSD: GENERIC,v 1.86.2.1 2019/11/04 14:34:28 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -143,7 +143,7 @@ options 	WS_KERNEL_FG=WSCOL_GREEN
 # compatibility to other console drivers
 options 	WSDISPLAY_COMPAT_PCVT		# emulate some ioctls
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-# options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
+options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
 
 # Development and Debugging options
 



CVS commit: [netbsd-9] src/sys/arch/zaurus/conf

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:34:28 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: GENERIC

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

sys/arch/zaurus/conf/GENERIC: revision 1.88

Put back options WSDISPLAY_COMPAT_RAWKBD. It's required by Xorg server.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.86.2.1 src/sys/arch/zaurus/conf/GENERIC

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



CVS commit: [netbsd-9] src/sys/arch/zaurus/dev

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:29:26 UTC 2019

Modified Files:
src/sys/arch/zaurus/dev [netbsd-9]: zrc.c

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

sys/arch/zaurus/dev/zrc.c: revision 1.10

Fix build errors with options WSDISPLAY_COMPAT_RAWKBD.

- Add missing RAWKEY_* macro definitions (taken from OpenBSD)
- Explicitly include "opt_wsdisplay_compat.h" for
  #ifdef WSDISPLAY_COMPAT_RAWKBD conditionals.
  (it is not properly pulled at least in netbsd-8)
 https://mail-index.netbsd.org/port-zaurus/2019/11/02/msg83.html

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.42.1 src/sys/arch/zaurus/dev/zrc.c

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



CVS commit: [netbsd-9] src/sys/arch/zaurus/dev

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:29:26 UTC 2019

Modified Files:
src/sys/arch/zaurus/dev [netbsd-9]: zrc.c

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

sys/arch/zaurus/dev/zrc.c: revision 1.10

Fix build errors with options WSDISPLAY_COMPAT_RAWKBD.

- Add missing RAWKEY_* macro definitions (taken from OpenBSD)
- Explicitly include "opt_wsdisplay_compat.h" for
  #ifdef WSDISPLAY_COMPAT_RAWKBD conditionals.
  (it is not properly pulled at least in netbsd-8)
 https://mail-index.netbsd.org/port-zaurus/2019/11/02/msg83.html

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.42.1 src/sys/arch/zaurus/dev/zrc.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/zaurus/dev/zrc.c
diff -u src/sys/arch/zaurus/dev/zrc.c:1.9 src/sys/arch/zaurus/dev/zrc.c:1.9.42.1
--- src/sys/arch/zaurus/dev/zrc.c:1.9	Sat Oct 27 17:18:14 2012
+++ src/sys/arch/zaurus/dev/zrc.c	Mon Nov  4 14:29:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: zrc.c,v 1.9 2012/10/27 17:18:14 chs Exp $	*/
+/*	$NetBSD: zrc.c,v 1.9.42.1 2019/11/04 14:29:26 martin Exp $	*/
 /*	$OpenBSD: zaurus_remote.c,v 1.1 2005/11/17 05:26:31 uwe Exp $	*/
 
 /*
@@ -17,8 +17,10 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "opt_wsdisplay_compat.h"
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zrc.c,v 1.9 2012/10/27 17:18:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zrc.c,v 1.9.42.1 2019/11/04 14:29:26 martin Exp $");
 
 #include 
 #include 
@@ -131,6 +133,11 @@ static const keysym_t zrc_keydesc[] = {
 };
 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
+/* XXX see OpenBSD's  */
+#define	RAWKEY_Null		0x00
+#define	RAWKEY_AudioMute	0x85
+#define	RAWKEY_AudioLower	0x86
+#define	RAWKEY_AudioRaise 	0x87
 #define	RAWKEY_AudioRewind	0xa0
 #define	RAWKEY_AudioForward	0xa1
 #define	RAWKEY_AudioPlay	0xa2



CVS commit: [netbsd-9] src/sys/arch/aarch64

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:08:19 UTC 2019

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

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

sys/arch/aarch64/include/pmap.h: revision 1.26
sys/arch/aarch64/aarch64/pmap.c: revision 1.48

Define PMAP_NEED_PROCWR, providing strategically placed i-cache
synchronization where just-changed memory is about to be executed.

Fixes SIGILLs seen when running Mono 6 on QEMU Cortex-A57.

ok ryo


To generate a diff of this commit:
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/arch/aarch64/include/pmap.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.41.2.2 src/sys/arch/aarch64/aarch64/pmap.c:1.41.2.3
--- src/sys/arch/aarch64/aarch64/pmap.c:1.41.2.2	Mon Sep 23 07:00:35 2019
+++ src/sys/arch/aarch64/aarch64/pmap.c	Mon Nov  4 14:08:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.41.2.2 2019/09/23 07:00:35 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.41.2.3 2019/11/04 14:08:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.2 2019/09/23 07:00:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.3 2019/11/04 14:08:18 martin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -874,6 +874,22 @@ pmap_icache_sync_range(pmap_t pm, vaddr_
 	pm_unlock(pm);
 }
 
+/*
+ * Routine:	pmap_procwr
+ *
+ * Function:
+ *	Synchronize caches corresponding to [addr, addr+len) in p.
+ *
+ */
+void
+pmap_procwr(struct proc *p, vaddr_t va, int len)
+{
+
+	/* We only need to do anything if it is the current process. */
+	if (p == curproc)
+		cpu_icache_sync_range(va, len);
+}
+
 static pt_entry_t
 _pmap_pte_adjust_prot(pt_entry_t pte, vm_prot_t prot, vm_prot_t protmask,
 bool user)

Index: src/sys/arch/aarch64/include/pmap.h
diff -u src/sys/arch/aarch64/include/pmap.h:1.24 src/sys/arch/aarch64/include/pmap.h:1.24.4.1
--- src/sys/arch/aarch64/include/pmap.h:1.24	Mon Apr  8 21:18:22 2019
+++ src/sys/arch/aarch64/include/pmap.h	Mon Nov  4 14:08:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.24 2019/04/08 21:18:22 ryo Exp $ */
+/* $NetBSD: pmap.h,v 1.24.4.1 2019/11/04 14:08:18 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -46,6 +46,7 @@
 
 #include 
 
+#define PMAP_NEED_PROCWR
 #define PMAP_GROWKERNEL
 #define PMAP_STEAL_MEMORY
 
@@ -272,6 +273,7 @@ aarch64_mmap_flags(paddr_t mdpgno)
 #define pmap_wired_count(pmap)		((pmap)->pm_stats.wired_count)
 #define pmap_resident_count(pmap)	((pmap)->pm_stats.resident_count)
 
+void	pmap_procwr(struct proc *, vaddr_t, int);
 bool	pmap_extract_coherency(pmap_t, vaddr_t, paddr_t *, bool *);
 void	pmap_icache_sync_range(pmap_t, vaddr_t, vaddr_t);
 



CVS commit: [netbsd-9] src/sys/arch/aarch64

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:08:19 UTC 2019

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

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

sys/arch/aarch64/include/pmap.h: revision 1.26
sys/arch/aarch64/aarch64/pmap.c: revision 1.48

Define PMAP_NEED_PROCWR, providing strategically placed i-cache
synchronization where just-changed memory is about to be executed.

Fixes SIGILLs seen when running Mono 6 on QEMU Cortex-A57.

ok ryo


To generate a diff of this commit:
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/arch/aarch64/include/pmap.h

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



CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  3 11:36:56 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: Makefile.zaurus.inc
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: Makefile compat_linux.h
zbsdmod.c

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

sys/arch/zaurus/stand/zbsdmod/Makefile: revision 1.12
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.10
sys/arch/zaurus/conf/Makefile.zaurus.inc: revision 1.10
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.11
sys/arch/zaurus/stand/zbsdmod/compat_linux.h: revision 1.7

Explicitly set empty LINKENTRY to keep ENTRY address specified in ldscript.

This fixes kernel boot failures of NetBSD/zaurus 8.x and later.
While here, also set empty TEXTADDR also specified in ldscript.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

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

 -

Fix another boot failure issue of NetBSD/zaurus 8.x and later.

It looks some cacheline alignment restriction so that zbsdmod.o in
NetBSD/zaurus 8.x release cannot jump to a loaded kernel properly.

Adding an explicit alingment pseudo op to put all instructions
between I-cache flush and jumping to the loaded kernel into the
same cacheline solves the issue.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

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

 -

Misc cleanup to avoid future confusion.
- Remove more unnecessary debug sections
- Use DBG instead of COPTS to specify -Os as defined in bsd.prog.mk
- Use CFLAGS and CPPFLAGS correctly
- Explicitly set -ffreestanding

 -

Make sure to clear bss before jumping to a kernel copied from load buffer.
This will fix yet another boot failure issue
"screen white-out after loading a kernel"
 https://mail-index.netbsd.org/port-zaurus/2019/10/26/msg72.html

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.22.1 src/sys/arch/zaurus/conf/Makefile.zaurus.inc
cvs rdiff -u -r1.10 -r1.10.22.1 src/sys/arch/zaurus/stand/zbsdmod/Makefile
cvs rdiff -u -r1.6 -r1.6.52.1 \
src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
cvs rdiff -u -r1.9 -r1.9.34.1 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.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/zaurus/conf/Makefile.zaurus.inc
diff -u src/sys/arch/zaurus/conf/Makefile.zaurus.inc:1.9 src/sys/arch/zaurus/conf/Makefile.zaurus.inc:1.9.22.1
--- src/sys/arch/zaurus/conf/Makefile.zaurus.inc:1.9	Tue Aug 25 02:38:15 2015
+++ src/sys/arch/zaurus/conf/Makefile.zaurus.inc	Sun Nov  3 11:36:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.zaurus.inc,v 1.9 2015/08/25 02:38:15 uebayasi Exp $
+#	$NetBSD: Makefile.zaurus.inc,v 1.9.22.1 2019/11/03 11:36:56 martin Exp $
 
 MACHINE_ARCH?=		arm
 CPPFLAGS+=		-D${MACHINE}
@@ -20,6 +20,8 @@ SYSTEM_LD_TAIL_EXTRA+=; \
 KERNEL_BASE_VIRT=	$(LOADADDRESS)
 
 KERNLDSCRIPT=		ldscript
+TEXTADDR=		# defined in ldscript
+LINKENTRY=		# defined in ldscript
 
 EXTRA_CLEAN+=		netbsd.map assym.d ldscript tmp
 

Index: src/sys/arch/zaurus/stand/zbsdmod/Makefile
diff -u src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.10 src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.10.22.1
--- src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.10	Sun Jan 31 15:32:13 2016
+++ src/sys/arch/zaurus/stand/zbsdmod/Makefile	Sun Nov  3 11:36:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2016/01/31 15:32:13 christos Exp $
+#	$NetBSD: Makefile,v 1.10.22.1 2019/11/03 11:36:56 martin Exp $
 
 WARNS?=	4
 
@@ -10,8 +10,18 @@ OBJS=	zbsdmod.o
 SRCS=	zbsdmod.c
 NOMAN=	# defined
 
+OBJCOPY_FLAGS=			\
+	-R .debug_abbrev	\
+	-R .debug_aranges	\
+	-R .debug_info		\
+	-R .debug_line		\
+	-R .debug_loc		\
+	-R .debug_ranges	\
+	-R .debug_str		\
+	-R .eh_frame
+
 realall: ${OBJS}
-	${OBJCOPY} -R .eh_frame ${.OBJDIR}/zbsdmod.o
+	${OBJCOPY} ${OBJCOPY_FLAGS} ${.OBJDIR}/zbsdmod.o
 
 .include 
 .include 
@@ -21,11 +31,12 @@ afterinstall:
 		${OBJS} ${DESTDIR}/${BINDIR}
 
 CPUFLAGS=
-COPTS=		-Os
+DBG=		-Os
 CFLAGS+=	-fno-strict-aliasing
-CFLAGS+=	-DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
-CPPFLAGS+=	${ARM_APCS_FLAGS} -mcpu=xscale
-CPPFLAGS+=  -nostdinc -D_STANDALONE
+CFLAGS+=	-ffreestanding -nostdinc
+CFLAGS+=	${ARM_APCS_FLAGS} -mcpu=xscale
+CPPFLAGS+=	-DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
+CPPFLAGS+=	-D_STANDALONE
 CPPFLAGS+=	-I${.OBJDIR} -I${S}
 
 release: check_RELEASEDIR

Index: src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
diff -u src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6 src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6.52.1
--- src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6	Sun Dec 11 14:05:39 2011
+++ src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h	Sun Nov  3 11:36:56 2019
@@ 

CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  3 11:36:56 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: Makefile.zaurus.inc
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: Makefile compat_linux.h
zbsdmod.c

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

sys/arch/zaurus/stand/zbsdmod/Makefile: revision 1.12
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.10
sys/arch/zaurus/conf/Makefile.zaurus.inc: revision 1.10
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.11
sys/arch/zaurus/stand/zbsdmod/compat_linux.h: revision 1.7

Explicitly set empty LINKENTRY to keep ENTRY address specified in ldscript.

This fixes kernel boot failures of NetBSD/zaurus 8.x and later.
While here, also set empty TEXTADDR also specified in ldscript.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

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

 -

Fix another boot failure issue of NetBSD/zaurus 8.x and later.

It looks some cacheline alignment restriction so that zbsdmod.o in
NetBSD/zaurus 8.x release cannot jump to a loaded kernel properly.

Adding an explicit alingment pseudo op to put all instructions
between I-cache flush and jumping to the loaded kernel into the
same cacheline solves the issue.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

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

 -

Misc cleanup to avoid future confusion.
- Remove more unnecessary debug sections
- Use DBG instead of COPTS to specify -Os as defined in bsd.prog.mk
- Use CFLAGS and CPPFLAGS correctly
- Explicitly set -ffreestanding

 -

Make sure to clear bss before jumping to a kernel copied from load buffer.
This will fix yet another boot failure issue
"screen white-out after loading a kernel"
 https://mail-index.netbsd.org/port-zaurus/2019/10/26/msg72.html

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.22.1 src/sys/arch/zaurus/conf/Makefile.zaurus.inc
cvs rdiff -u -r1.10 -r1.10.22.1 src/sys/arch/zaurus/stand/zbsdmod/Makefile
cvs rdiff -u -r1.6 -r1.6.52.1 \
src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
cvs rdiff -u -r1.9 -r1.9.34.1 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:17:55 UTC 2019

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

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

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

Check CPU support of RDRAND before calling cpu_rng_rdrand().
cpu_earlyrng() checks CPU support of RDSEED and RDRAND before calling
cpu_rng_rdseed() and cpu_rng_rdrand().

But cpu_rng_rdseed() did not check CPU support of RDRAND and system had
crashed on such an environment.  There is no such case with real CPU but
some VM environment.

Fix kern/54655 and confirmed by msaitoh@.
Needs pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/cpu_rng.c

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:17:55 UTC 2019

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

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

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

Check CPU support of RDRAND before calling cpu_rng_rdrand().
cpu_earlyrng() checks CPU support of RDSEED and RDRAND before calling
cpu_rng_rdseed() and cpu_rng_rdrand().

But cpu_rng_rdseed() did not check CPU support of RDRAND and system had
crashed on such an environment.  There is no such case with real CPU but
some VM environment.

Fix kern/54655 and confirmed by msaitoh@.
Needs pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/cpu_rng.c

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

Modified files:

Index: src/sys/arch/x86/x86/cpu_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.9 src/sys/arch/x86/x86/cpu_rng.c:1.9.4.1
--- src/sys/arch/x86/x86/cpu_rng.c:1.9	Wed Aug 22 12:07:43 2018
+++ src/sys/arch/x86/x86/cpu_rng.c	Fri Nov  1 18:17:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.9 2018/08/22 12:07:43 maxv Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.9.4.1 2019/11/01 18:17:55 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -53,6 +53,8 @@ static enum {
 	CPU_RNG_VIA
 } cpu_rng_mode __read_mostly = CPU_RNG_NONE;
 
+static bool has_rdrand;
+
 bool
 cpu_rng_init(void)
 {
@@ -131,7 +133,10 @@ cpu_rng_rdseed(cpu_rng_t *out)
 	 * to be seeded even in this case.
 	 */
 exhausted:
-	return cpu_rng_rdrand(out);
+	if (has_rdrand)
+		return cpu_rng_rdrand(out);
+	else
+		return 0;
 }
 
 static size_t
@@ -213,7 +218,7 @@ cpu_earlyrng(void *out, size_t sz)
 	int i;
 
 	bool has_rdseed = (cpu_feature[5] & CPUID_SEF_RDSEED) != 0;
-	bool has_rdrand = (cpu_feature[1] & CPUID2_RDRAND) != 0;
+	has_rdrand = (cpu_feature[1] & CPUID2_RDRAND) != 0;
 
 	KASSERT(sz + sizeof(uint64_t) <= SHA512_DIGEST_LENGTH);
 



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:14:45 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_gmac.c

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

sys/arch/arm/sunxi/sunxi_gmac.c: revision 1.7

fetch PHY id from FDT.  same as sunxi_emac.c.

prevents PHY 0 of RTL8211E from wrongly attaching on e.g. Bananpi M1.
requested by jmcneill@, patch by martin@.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_gmac.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/sunxi/sunxi_gmac.c
diff -u src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6 src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6.2.1
--- src/sys/arch/arm/sunxi/sunxi_gmac.c:1.6	Sun Jul 21 08:24:32 2019
+++ src/sys/arch/arm/sunxi/sunxi_gmac.c	Fri Nov  1 18:14:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $ */
+/* $NetBSD: sunxi_gmac.c,v 1.6.2.1 2019/11/01 18:14:45 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.6 2019/07/21 08:24:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.6.2.1 2019/11/01 18:14:45 martin Exp $");
 
 #include 
 #include 
@@ -94,6 +94,24 @@ sunxi_gmac_intr(void *arg)
 }
 
 static int
+sunxi_gmac_get_phyid(int phandle)
+{
+	bus_addr_t addr;
+	int phy_phandle;
+
+	phy_phandle = fdtbus_get_phandle(phandle, "phy");
+	if (phy_phandle == -1)
+		phy_phandle = fdtbus_get_phandle(phandle, "phy-handle");
+	if (phy_phandle == -1)
+		return MII_PHY_ANY;
+
+	if (fdtbus_get_reg(phy_phandle, 0, , NULL) != 0)
+		return MII_PHY_ANY;
+
+	return (int)addr;
+}
+
+static int
 sunxi_gmac_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct fdt_attach_args * const faa = aux;
@@ -192,7 +210,8 @@ sunxi_gmac_attach(device_t parent, devic
 	if (sunxi_gmac_reset(phandle) != 0)
 		aprint_error_dev(self, "PHY reset failed\n");
 
-	dwc_gmac_attach(sc, MII_PHY_ANY, GMAC_MII_CLK_150_250M_DIV102);
+	dwc_gmac_attach(sc, sunxi_gmac_get_phyid(phandle),
+	GMAC_MII_CLK_150_250M_DIV102);
 }
 
 CFATTACH_DECL_NEW(sunxi_gmac, sizeof(struct dwc_gmac_softc),



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:14:45 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_gmac.c

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

sys/arch/arm/sunxi/sunxi_gmac.c: revision 1.7

fetch PHY id from FDT.  same as sunxi_emac.c.

prevents PHY 0 of RTL8211E from wrongly attaching on e.g. Bananpi M1.
requested by jmcneill@, patch by martin@.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_gmac.c

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



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:12:26 UTC 2019

Modified Files:
src/sys/arch/arm/fdt [netbsd-9]: cpu_fdt.c

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

sys/arch/arm/fdt/cpu_fdt.c: revision 1.29
sys/arch/arm/fdt/cpu_fdt.c: revision 1.30

re-apply r1.26:
  flush the dcache in cpu_enable_psci() before calling psci_cpu_on().
  fixes the kernel hanging with multiple "mpstart" on (at least) NanoPi R1.
but only #if !defined(AARCH64).

not necessary on armv8 and cache ops are not available that early there.

fix typos in comment in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/arch/arm/fdt/cpu_fdt.c

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

Modified files:

Index: src/sys/arch/arm/fdt/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.25.4.1 src/sys/arch/arm/fdt/cpu_fdt.c:1.25.4.2
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.25.4.1	Wed Oct 23 19:14:19 2019
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Fri Nov  1 18:12:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.25.4.1 2019/10/23 19:14:19 martin Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.25.4.2 2019/11/01 18:12:26 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.25.4.1 2019/10/23 19:14:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.25.4.2 2019/11/01 18:12:26 martin Exp $");
 
 #include 
 #include 
@@ -347,6 +347,14 @@ cpu_enable_psci(int phandle)
 
 	fdtbus_get_reg64(phandle, 0, , NULL);
 
+#if !defined(AARCH64)
+	/*
+	 * not necessary on AARCH64. beside there it hangs the system
+	 * because cache ops are only functional after cpu_attach()
+	 * was called.
+	 */
+	cpu_dcache_wbinv_all();
+#endif
 	ret = psci_cpu_on(mpidr, cpu_fdt_mpstart_pa(), 0);
 	if (ret != PSCI_SUCCESS)
 		return EIO;



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

2019-11-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Nov  1 18:12:26 UTC 2019

Modified Files:
src/sys/arch/arm/fdt [netbsd-9]: cpu_fdt.c

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

sys/arch/arm/fdt/cpu_fdt.c: revision 1.29
sys/arch/arm/fdt/cpu_fdt.c: revision 1.30

re-apply r1.26:
  flush the dcache in cpu_enable_psci() before calling psci_cpu_on().
  fixes the kernel hanging with multiple "mpstart" on (at least) NanoPi R1.
but only #if !defined(AARCH64).

not necessary on armv8 and cache ops are not available that early there.

fix typos in comment in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/arch/arm/fdt/cpu_fdt.c

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



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

2019-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 16:01:17 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf [netbsd-9]: mk.beagle

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

sys/arch/evbarm/conf/mk.beagle: revision 1.13

BEAGLE* kernel expects NetBSD bootargs (command line, no FDT).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/evbarm/conf/mk.beagle

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



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

2019-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 16:01:17 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf [netbsd-9]: mk.beagle

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

sys/arch/evbarm/conf/mk.beagle: revision 1.13

BEAGLE* kernel expects NetBSD bootargs (command line, no FDT).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/evbarm/conf/mk.beagle

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/mk.beagle
diff -u src/sys/arch/evbarm/conf/mk.beagle:1.12 src/sys/arch/evbarm/conf/mk.beagle:1.12.2.1
--- src/sys/arch/evbarm/conf/mk.beagle:1.12	Sat May 18 08:49:23 2019
+++ src/sys/arch/evbarm/conf/mk.beagle	Fri Oct 25 16:01:17 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.beagle,v 1.12 2019/05/18 08:49:23 skrll Exp $
+#	$NetBSD: mk.beagle,v 1.12.2.1 2019/10/25 16:01:17 martin Exp $
 .if ${KERNEL_BUILD:T:MPANDA*} != ""
 CPPFLAGS+=		-mcpu=cortex-a9
 .elif ${KERNEL_BUILD:T:MOMAP5*} != ""
@@ -13,7 +13,7 @@ SYSTEM_FIRST_SFILE=	${ARM}/arm/armv6_sta
 
 _OSRELEASE!=		${HOST_SH} $S/conf/osrelease.sh
 
-MKUBOOTIMAGEARGS=	-A arm -T kernel -O linux
+MKUBOOTIMAGEARGS=	-A arm -T kernel -O netbsd
 MKUBOOTIMAGEARGS+=	-a $(LOADADDRESS) -e $(LOADADDRESS)
 MKUBOOTIMAGEARGS+=	-n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
 MKUBOOTIMAGEARGS_NONE=	${MKUBOOTIMAGEARGS} -C none



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:14:19 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: cpu.c locore.S
src/sys/arch/aarch64/include [netbsd-9]: cpu.h param.h
src/sys/arch/arm/acpi [netbsd-9]: cpu_acpi.c
src/sys/arch/arm/arm32 [netbsd-9]: cpu.c
src/sys/arch/arm/fdt [netbsd-9]: cpu_fdt.c
src/sys/arch/arm/include [netbsd-9]: cpu.h

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

sys/arch/aarch64/aarch64/locore.S: revision 1.42
sys/arch/aarch64/aarch64/locore.S: revision 1.43
sys/arch/aarch64/aarch64/locore.S: revision 1.44
sys/arch/arm/fdt/cpu_fdt.c: revision 1.28
sys/arch/aarch64/include/cpu.h: revision 1.14
sys/arch/aarch64/include/param.h: revision 1.12
sys/arch/arm/arm32/cpu.c: revision 1.133
sys/arch/arm/arm32/cpu.c: revision 1.134
sys/arch/arm/include/cpu.h: revision 1.101
sys/arch/arm/acpi/cpu_acpi.c: revision 1.7
sys/arch/aarch64/aarch64/cpu.c: revision 1.23
sys/arch/aarch64/aarch64/cpu.c: revision 1.24
sys/arch/aarch64/aarch64/cpu.c: revision 1.25

Increase aarch64 MAXCPUS to 256.

 -

Invalidate dcache before polling AP hatched status

 -

Avoid overlap between BP and last AP stack. AP stacks are now in order of
increasing address order.

Spotted by and idea from mlelstv.

 -

Use separate cacheline aligned arrays for mbox and hatched as before.

 -

cpu_hatched_p only for MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.2.1 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.39.2.1 -r1.39.2.2 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/arm/acpi/cpu_acpi.c
cvs rdiff -u -r1.129 -r1.129.4.1 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/arm/fdt/cpu_fdt.c
cvs rdiff -u -r1.100 -r1.100.4.1 src/sys/arch/arm/include/cpu.h

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



  1   2   3   >