CVS commit: src/sys/arch

2017-11-08 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov  9 05:57:23 UTC 2017

Modified Files:
src/sys/arch/arm/imx: files.imx6 imx6_ahcisata.c imx6_axi.c
imx6_board.c imx6_ccm.c imx6_ccmreg.h imx6_ccmvar.h imx6_pcie.c
imx6_reg.h
src/sys/arch/evbarm/conf: CUBOX-I HUMMINGBOARD IMX6UL-STARTER
NITROGEN6X
src/sys/arch/evbarm/nitrogen6: nitrogen6_usb.c
Added Files:
src/sys/arch/arm/imx: imx6_usbphy.c imx6_usbphyreg.h

Log Message:
- Add imxusbphy driver for i.MX6.
- Clean up CCM (Clock driver).
  Add imx6_ccm_analog_read/write() functions.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx6_ahcisata.c \
src/sys/arch/arm/imx/imx6_ccmreg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx6_axi.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/imx6_board.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_ccm.c \
src/sys/arch/arm/imx/imx6_reg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_ccmvar.h \
src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx6_usbphy.c \
src/sys/arch/arm/imx/imx6_usbphyreg.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/conf/CUBOX-I
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/HUMMINGBOARD
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/IMX6UL-STARTER
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/NITROGEN6X
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/nitrogen6/nitrogen6_usb.c

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

Modified files:

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.11 src/sys/arch/arm/imx/files.imx6:1.12
--- src/sys/arch/arm/imx/files.imx6:1.11	Fri Sep  8 05:29:12 2017
+++ src/sys/arch/arm/imx/files.imx6	Thu Nov  9 05:57:23 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.11 2017/09/08 05:29:12 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.12 2017/11/09 05:57:23 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -90,6 +90,11 @@ file	arch/arm/imx/if_enet_imx6.c		enet
 device	imxusbc { unit, irq } : bus_dma_generic
 file	arch/arm/imx/imx6_usb.c			imxusbc
 
+# USB Phy
+device	imxusbphy
+attach	imxusbphy at axi
+file	arch/arm/imx/imx6_usbphy.c		imxusbphy
+
 attach	ehci at imxusbc with imxehci
 file	arch/arm/imx/imxusb.c			imxehci
 

Index: src/sys/arch/arm/imx/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/imx6_ahcisata.c:1.5 src/sys/arch/arm/imx/imx6_ahcisata.c:1.6
--- src/sys/arch/arm/imx/imx6_ahcisata.c:1.5	Fri Jun  9 18:14:59 2017
+++ src/sys/arch/arm/imx/imx6_ahcisata.c	Thu Nov  9 05:57:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.5 2017/06/09 18:14:59 ryo Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.6 2017/11/09 05:57:23 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.5 2017/06/09 18:14:59 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.6 2017/11/09 05:57:23 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -273,9 +273,9 @@ ixm6_ahcisata_init(struct imx_ahci_softc
 		"couldn't enable CCM_ANALOG_PLL_ENET\n");
 		return -1;
 	}
-	v = imx6_ccm_read(CCM_ANALOG_PLL_ENET);
+	v = imx6_ccm_analog_read(CCM_ANALOG_PLL_ENET);
 	v |= CCM_ANALOG_PLL_ENET_ENABLE_100M;
-	imx6_ccm_write(CCM_ANALOG_PLL_ENET, v);
+	imx6_ccm_analog_write(CCM_ANALOG_PLL_ENET, v);
 
 	v = iomux_read(IOMUX_GPR13);
 	/* clear */
Index: src/sys/arch/arm/imx/imx6_ccmreg.h
diff -u src/sys/arch/arm/imx/imx6_ccmreg.h:1.5 src/sys/arch/arm/imx/imx6_ccmreg.h:1.6
--- src/sys/arch/arm/imx/imx6_ccmreg.h:1.5	Fri Jun  9 18:14:59 2017
+++ src/sys/arch/arm/imx/imx6_ccmreg.h	Thu Nov  9 05:57:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccmreg.h,v 1.5 2017/06/09 18:14:59 ryo Exp $	*/
+/*	$NetBSD: imx6_ccmreg.h,v 1.6 2017/11/09 05:57:23 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -45,14 +45,29 @@
 #define IMX6_OSC_FREQ	(24 * 1000 * 1000)	/* 24MHz */
 #endif
 
-#define IMX6_CCM_SIZE0x8000
-		/* 0x = 0x020c4000 */
 #define CCM_CCR	0x
+#define  CCM_CCR_RBC_EN__BIT(27)
+#define  CCM_CCR_REG_BYPASS_COUNT		__BITS(26, 21)
+#define  CCM_CCR_WB_COUNT			__BITS(18, 16)
+#define  CCM_CCR_COSC_EN			__BIT(12)
+#define  CCM_CCR_OSCNT__BITS(7, 0)
+
 #define CCM_CCDR0x0004
 #define CCM_CSR	0x0008
 #define CCM_CCSR0x000c
+#define  CCM_CCSR_PLL3_PFD1_DIS_MASK		__BIT(15)
+#define  CCM_CCSR_PLL3_PFD0_DIS_MASK		__BIT(14)
+#define  CCM_CCSR_PLL3_PFD3_DIS_MASK		__BIT(13)
+#define  CCM_CCSR_PLL3_PFD2_DIS_MASK		__BIT(12)
+#define  CCM_CCSR_PLL2_PFD1_594M_DIS_MASK	__BIT(11)
+#define  CCM_CCSR_PLL2_PFD0_DIS_MASK		__BIT(10)
+#define  CCM_CCSR_PLL2_PFD2_DIS_MASK		__BIT(9)
+#define  CCM_CCSR_STEP_SEL			__BIT(8)
+#define  CCM_CCSR_PLL1_SW_CLK_SEL		__BIT(2)
+#define  CCM_CCSR_PLL3_SW_CLK_SEL		__BIT(0)
 #

CVS commit: src/tests/net/ipsec

2017-11-08 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov  9 04:51:07 UTC 2017

Modified Files:
src/tests/net/ipsec: t_ipsec_misc.sh

Log Message:
Dedup some checks

And the change a bit optimizes checks of SA expirations, which
may shorten testing time.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/net/ipsec/t_ipsec_misc.sh

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

Modified files:

Index: src/tests/net/ipsec/t_ipsec_misc.sh
diff -u src/tests/net/ipsec/t_ipsec_misc.sh:1.21 src/tests/net/ipsec/t_ipsec_misc.sh:1.22
--- src/tests/net/ipsec/t_ipsec_misc.sh:1.21	Thu Nov  9 04:50:37 2017
+++ src/tests/net/ipsec/t_ipsec_misc.sh	Thu Nov  9 04:51:07 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_misc.sh,v 1.21 2017/11/09 04:50:37 ozaki-r Exp $
+#	$NetBSD: t_ipsec_misc.sh,v 1.22 2017/11/09 04:51:07 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -78,6 +78,42 @@ setup_sasp()
 	#check_sa_entries $SOCK_PEER $ip_local $ip_peer
 }
 
+test_sad_disapper_until()
+{
+	local time=$1
+	local check_dead_sa=$2
+	local setkey_opts=
+	local n=$time
+	local tmpfile=./__tmp
+	local sock= ok=
+
+	if $check_dead_sa; then
+		setkey_opts="-D -a"
+	else
+		setkey_opts="-D"
+	fi
+
+	while [ $n -ne 0 ]; do
+		ok=0
+		sleep 1
+		for sock in $SOCK_LOCAL $SOCK_PEER; do
+			export RUMP_SERVER=$sock
+			$HIJACKING setkey $setkey_opts > $tmpfile
+			$DEBUG && cat $tmpfile
+			if grep -q 'No SAD entries.' $tmpfile; then
+ok=$((ok + 1))
+			fi
+		done
+		if [ $ok -eq 2 ]; then
+			return
+		fi
+
+		n=$((n - 1))
+	done
+
+	atf_fail "SAs didn't disappear after $time sec."
+}
+
 test_ipsec4_lifetime()
 {
 	local proto=$1
@@ -119,16 +155,8 @@ test_ipsec4_lifetime()
 	# Set up SAs with lifetime 1 sec.
 	setup_sasp $proto "$algo_args" $ip_local $ip_peer 1
 
-	# Wait for the SAs to be expired
-	atf_check -s exit:0 sleep $((1 + $buffertime))
-
 	# Check the SAs have been expired
-	export RUMP_SERVER=$SOCK_LOCAL
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D
-	export RUMP_SERVER=$SOCK_PEER
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D
+	test_sad_disapper_until $((1 + $buffertime)) false
 
 	# Clean up SPs
 	export RUMP_SERVER=$SOCK_LOCAL
@@ -149,15 +177,8 @@ test_ipsec4_lifetime()
 	atf_check -s exit:0 -o match:"$ip_peer > $ip_local: $proto_cap" \
 	cat $outfile
 
-	atf_check -s exit:0 sleep $((lifetime + $buffertime))
-
-	export RUMP_SERVER=$SOCK_LOCAL
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D -a
-
-	export RUMP_SERVER=$SOCK_PEER
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D -a
+	# Check the SAs have been expired
+	test_sad_disapper_until $((lifetime + $buffertime)) true
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	atf_check -s not-exit:0 -o match:'0 packets received' \
@@ -206,16 +227,8 @@ test_ipsec6_lifetime()
 	# Set up SAs with lifetime 1 sec.
 	setup_sasp $proto "$algo_args" $ip_local $ip_peer 1
 
-	# Wait for the SAs to be expired
-	atf_check -s exit:0 sleep $((1 + $buffertime))
-
 	# Check the SAs have been expired
-	export RUMP_SERVER=$SOCK_LOCAL
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D
-	export RUMP_SERVER=$SOCK_PEER
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D
+	test_sad_disapper_until $((1 + $buffertime)) false
 
 	# Clean up SPs
 	export RUMP_SERVER=$SOCK_LOCAL
@@ -236,15 +249,8 @@ test_ipsec6_lifetime()
 	atf_check -s exit:0 -o match:"$ip_peer > $ip_local: $proto_cap" \
 	cat $outfile
 
-	atf_check -s exit:0 sleep $((lifetime + $buffertime))
-
-	export RUMP_SERVER=$SOCK_LOCAL
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D -a
-
-	export RUMP_SERVER=$SOCK_PEER
-	$DEBUG && $HIJACKING setkey -D
-	atf_check -s exit:0 -o match:'No SAD entries.' $HIJACKING setkey -D -a
+	# Check the SAs have been expired
+	test_sad_disapper_until $((lifetime + $buffertime)) true
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	atf_check -s not-exit:0 -o match:'0 packets received' \



CVS commit: src/tests/net/ipsec

2017-11-08 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov  9 04:50:37 UTC 2017

Modified Files:
src/tests/net/ipsec: t_ipsec_misc.sh

Log Message:
"Mark key_timehandler_ch callout as MP-safe" change needs one more sec to make 
lifetime tests stable


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/net/ipsec/t_ipsec_misc.sh

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

Modified files:

Index: src/tests/net/ipsec/t_ipsec_misc.sh
diff -u src/tests/net/ipsec/t_ipsec_misc.sh:1.20 src/tests/net/ipsec/t_ipsec_misc.sh:1.21
--- src/tests/net/ipsec/t_ipsec_misc.sh:1.20	Fri Oct 20 03:45:47 2017
+++ src/tests/net/ipsec/t_ipsec_misc.sh	Thu Nov  9 04:50:37 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_misc.sh,v 1.20 2017/10/20 03:45:47 ozaki-r Exp $
+#	$NetBSD: t_ipsec_misc.sh,v 1.21 2017/11/09 04:50:37 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -88,6 +88,7 @@ test_ipsec4_lifetime()
 	local proto_cap=$(echo $proto | tr 'a-z' 'A-Z')
 	local algo_args="$(generate_algo_args $proto $algo)"
 	local lifetime=3
+	local buffertime=2
 
 	rump_server_crypto_start $SOCK_LOCAL netipsec
 	rump_server_crypto_start $SOCK_PEER netipsec
@@ -119,7 +120,7 @@ test_ipsec4_lifetime()
 	setup_sasp $proto "$algo_args" $ip_local $ip_peer 1
 
 	# Wait for the SAs to be expired
-	atf_check -s exit:0 sleep 2
+	atf_check -s exit:0 sleep $((1 + $buffertime))
 
 	# Check the SAs have been expired
 	export RUMP_SERVER=$SOCK_LOCAL
@@ -148,7 +149,7 @@ test_ipsec4_lifetime()
 	atf_check -s exit:0 -o match:"$ip_peer > $ip_local: $proto_cap" \
 	cat $outfile
 
-	atf_check -s exit:0 sleep $((lifetime + 1))
+	atf_check -s exit:0 sleep $((lifetime + $buffertime))
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	$DEBUG && $HIJACKING setkey -D
@@ -176,6 +177,7 @@ test_ipsec6_lifetime()
 	local proto_cap=$(echo $proto | tr 'a-z' 'A-Z')
 	local algo_args="$(generate_algo_args $proto $algo)"
 	local lifetime=3
+	local buffertime=2
 
 	rump_server_crypto_start $SOCK_LOCAL netinet6 netipsec
 	rump_server_crypto_start $SOCK_PEER netinet6 netipsec
@@ -205,7 +207,7 @@ test_ipsec6_lifetime()
 	setup_sasp $proto "$algo_args" $ip_local $ip_peer 1
 
 	# Wait for the SAs to be expired
-	atf_check -s exit:0 sleep 2
+	atf_check -s exit:0 sleep $((1 + $buffertime))
 
 	# Check the SAs have been expired
 	export RUMP_SERVER=$SOCK_LOCAL
@@ -234,7 +236,7 @@ test_ipsec6_lifetime()
 	atf_check -s exit:0 -o match:"$ip_peer > $ip_local: $proto_cap" \
 	cat $outfile
 
-	atf_check -s exit:0 sleep $((lifetime + 1))
+	atf_check -s exit:0 sleep $((lifetime + $buffertime))
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	$DEBUG && $HIJACKING setkey -D



CVS commit: src/sys/dev/pci

2017-11-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov  9 03:07:10 UTC 2017

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add PEX 8605 4port 4lane PCIe Gen 2 switch.


To generate a diff of this commit:
cvs rdiff -u -r1.1300 -r1.1301 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1300 src/sys/dev/pci/pcidevs:1.1301
--- src/sys/dev/pci/pcidevs:1.1300	Mon Oct 30 01:24:47 2017
+++ src/sys/dev/pci/pcidevs	Thu Nov  9 03:07:10 2017
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1300 2017/10/30 01:24:47 sevan Exp $
+$NetBSD: pcidevs,v 1.1301 2017/11/09 03:07:10 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5804,6 +5804,7 @@ product PLX 9656FPBGA	0x5601	9656 I/O Ac
 product PLX PEX_8111	0x8111	PEX 8111 PCIe-to-PCI Bridge
 product PLX PEX_8112	0x8112	PEX 8112 PCIe-to-PCI Bridge
 product PLX PEX_8114	0x8114	PEX 8114 PCIe-to-PCI/PCI-X Bridge
+product PLX PEX_8605	0x8605	PEX 8605 4port 4lane PCIe Gen 2 switch
 product PLX 9030	0x9030	9030 I/O Accelrator
 product PLX 9050	0x9050	9050 I/O Accelrator
 product PLX 9054	0x9054	9054 I/O Accelerator



CVS commit: src/usr.sbin/makefs/cd9660

2017-11-08 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Nov  9 01:28:06 UTC 2017

Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_eltorito.c

Log Message:
Initialize boot_catalog_entry's entry_type properly.

This had been missing but the type was used in cd9660_setup_boot().

>From OpenBSD usr.sbin/makefs/cd9660/cd9660_eltorito.c r1.10.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660/cd9660_eltorito.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.21 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.22
--- src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.21	Tue Jan 24 11:22:43 2017
+++ src/usr.sbin/makefs/cd9660/cd9660_eltorito.c	Thu Nov  9 01:28:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_eltorito.c,v 1.21 2017/01/24 11:22:43 nonaka Exp $	*/
+/*	$NetBSD: cd9660_eltorito.c,v 1.22 2017/11/09 01:28:05 nonaka Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -40,7 +40,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_eltorito.c,v 1.21 2017/01/24 11:22:43 nonaka Exp $");
+__RCSID("$NetBSD: cd9660_eltorito.c,v 1.22 2017/11/09 01:28:05 nonaka Exp $");
 #endif  /* !__lint */
 
 #ifdef DEBUG
@@ -247,6 +247,7 @@ cd9660_boot_setup_validation_entry(char 
 	size_t i;
 	entry = cd9660_init_boot_catalog_entry();
 
+	entry->entry_type = ET_ENTRY_VE;
 	ve = &entry->entry_data.VE;
 
 	ve->header_id[0] = 1;
@@ -281,6 +282,7 @@ cd9660_boot_setup_default_entry(struct c
 	if (default_entry == NULL)
 		return NULL;
 
+	default_entry->entry_type = ET_ENTRY_IE;
 	ie = &default_entry->entry_data.IE;
 
 	ie->boot_indicator[0] = disk->bootable;
@@ -308,6 +310,7 @@ cd9660_boot_setup_section_head(char plat
 	if (entry == NULL)
 		return NULL;
 
+	entry->entry_type = ET_ENTRY_SH;
 	sh = &entry->entry_data.SH;
 	/* More by default. The last one will manually be set to 0x91 */
 	sh->header_indicator[0] = ET_SECTION_HEADER_MORE;
@@ -324,6 +327,7 @@ cd9660_boot_setup_section_entry(struct c
 	if ((entry = cd9660_init_boot_catalog_entry()) == NULL)
 		return NULL;
 
+	entry->entry_type = ET_ENTRY_SE;
 	se = &entry->entry_data.SE;
 
 	se->boot_indicator[0] = ET_BOOTABLE;



CVS commit: src/sys

2017-11-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 01:02:56 UTC 2017

Modified Files:
src/sys/arch/x86/x86: x86_autoconf.c
src/sys/dev/raidframe: rf_netbsdkintf.c
src/sys/kern: kern_subr.c
src/sys/sys: device.h

Log Message:
add a "booted_method" string to aid in debugging double boot matches.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.350 -r1.351 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.217 -r1.218 src/sys/kern/kern_subr.c
cvs rdiff -u -r1.149 -r1.150 src/sys/sys/device.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/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.75 src/sys/arch/x86/x86/x86_autoconf.c:1.76
--- src/sys/arch/x86/x86/x86_autoconf.c:1.75	Tue Sep 20 20:00:07 2016
+++ src/sys/arch/x86/x86/x86_autoconf.c	Wed Nov  8 20:02:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_autoconf.c,v 1.75 2016/09/21 00:00:07 jmcneill Exp $	*/
+/*	$NetBSD: x86_autoconf.c,v 1.76 2017/11/09 01:02:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.75 2016/09/21 00:00:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.76 2017/11/09 01:02:56 christos Exp $");
 
 #include 
 #include 
@@ -71,11 +71,12 @@ int x86_ndisks;
 #endif
 
 static void
-dmatch(const char *func, device_t dv)
+dmatch(const char *func, device_t dv, const char *method)
 {
 
-	printf("WARNING: %s: double match for boot device (%s, %s)\n",
-	func, device_xname(booted_device), device_xname(dv));
+	printf("WARNING: %s: double match for boot device (%s:%s %s:%s)\n",
+	func, booted_method, device_xname(booted_device),
+	method, device_xname(dv));
 }
 
 static int
@@ -358,6 +359,7 @@ findroot(void)
 			if (strncmp(cd->cf_name, biv->devname, len) == 0 &&
 			biv->devname[len] - '0' == device_unit(dv)) {
 booted_device = dv;
+booted_method = "bootinfo/rootdevice";
 booted_partition = biv->devname[len + 1] - 'a';
 booted_nblks = 0;
 break;
@@ -405,10 +407,11 @@ findroot(void)
 			continue;
  bootwedge_found:
 			if (booted_device) {
-dmatch(__func__, dv);
+dmatch(__func__, dv, "bootinfo/bootwedge");
 continue;
 			}
 			booted_device = dv;
+			booted_method = "bootinfo/bootwedge";
 			booted_partition = bid != NULL ? bid->partition : 0;
 			booted_nblks = biw->nblks;
 			booted_startblk = biw->startblk;
@@ -463,10 +466,11 @@ findroot(void)
 			continue;
  bootdisk_found:
 			if (booted_device) {
-dmatch(__func__, dv);
+dmatch(__func__, dv, "bootinfo/bootdisk");
 continue;
 			}
 			booted_device = dv;
+			booted_method = "bootinfo/bootdisk";
 			booted_partition = bid->partition;
 			booted_nblks = 0;
 		}
@@ -507,6 +511,7 @@ findroot(void)
 if (device_class(dv) == DV_DISK &&
 device_is_a(dv, "cd")) {
 	booted_device = dv;
+	booted_method = "bootinfo/biosgeom";
 	booted_partition = 0;
 	booted_nblks = 0;
 	break;
@@ -552,7 +557,9 @@ device_register(device_t dev, void *aux)
 
 	if (booted_device != NULL) {
 		/* XXX should be a panic() */
-		dmatch(__func__, dev);
-	} else
+		dmatch(__func__, dev, "device/register");
+	} else {
 		booted_device = (isaboot != NULL) ? isaboot : pciboot;
+		booted_method = "device/register";
+	}
 }

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.350 src/sys/dev/raidframe/rf_netbsdkintf.c:1.351
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.350	Wed May 31 22:45:11 2017
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Nov  8 20:02:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.350 2017/06/01 02:45:11 chs Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.350 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -568,6 +568,7 @@ rf_buildroothack(RF_ConfigSet_t *config_
 		rsc->sc_r.root_partition == 1 ||
 		rf_containsboot(&rsc->sc_r, booted_device)) {
 			booted_device = candidate_root;
+			booted_method = "raidframe/single";
 			booted_partition = 0;	/* XXX assume 'a' */
 		}
 	} else if (num_root > 1) {
@@ -603,6 +604,7 @@ rf_buildroothack(RF_ConfigSet_t *config_
 
 		if (num_root == 1) {
 			booted_device = dksc->sc_dev;
+			booted_method = "raidframe/multi";
 			booted_partition = 0;	/* XXX assume 'a' */
 		} else {
 			/* we can't guess.. require the user to answer... */

Index: src/sys/kern/kern_

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

2017-11-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 01:01:33 UTC 2017

Modified Files:
src/sys/arch/x86/include: bootinfo.h

Log Message:
add "prekern" to the string list.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/include/bootinfo.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/bootinfo.h
diff -u src/sys/arch/x86/include/bootinfo.h:1.27 src/sys/arch/x86/include/bootinfo.h:1.28
--- src/sys/arch/x86/include/bootinfo.h:1.27	Sat Oct  7 06:26:38 2017
+++ src/sys/arch/x86/include/bootinfo.h	Wed Nov  8 20:01:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.27 2017/10/07 10:26:38 maxv Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.28 2017/11/09 01:01:33 christos Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -44,7 +44,7 @@
 
 #define BTINFO_STR "bootpath", "rootdevice", "bootdisk", "netif", \
 "console", "biosgeom", "symtab", "memmap", "bootwedge", "modulelist", \
-"framebuffer", "userconfcommands", "efi", "efimemmap",
+"framebuffer", "userconfcommands", "efi", "efimemmap", "prekern",
 
 #ifndef _LOCORE
 



CVS commit: [netbsd-8] src/doc

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 22:26:58 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
349, 350


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.74 -r1.1.2.75 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.74 src/doc/CHANGES-8.0:1.1.2.75
--- src/doc/CHANGES-8.0:1.1.2.74	Mon Nov  6 10:40:42 2017
+++ src/doc/CHANGES-8.0	Wed Nov  8 22:26:58 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.74 2017/11/06 10:40:42 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.75 2017/11/08 22:26:58 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -6731,3 +6731,19 @@ sys/compat/netbsd32/netbsd32_conv.h		1.3
 	PR kern/52681: fix msghdr conversion.
 	[martin, ticket #339]
 
+sys/net/if_l2tp.c1.14
+sys/net/if_tap.c1.101
+sys/net/if_tun.c1.141
+sys/net/if_vlan.c1.106
+
+	Set IFEF_NO_LINK_STATE_CHANGE flag to pseudo devices that
+	don't use if_link_state_change
+	[ozaki-r, ticket #349]
+
+sys/netinet6/icmp6.c1.214
+sys/netinet6/raw_ip6.c1.158
+
+	Fix usages of ipsec_used.  If IPsec isn't used, we must go
+	back to the normal path.  PR kern/52659
+	[ozaki-r, ticket #350]
+



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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 22:24:55 UTC 2017

Modified Files:
src/sys/netinet6 [netbsd-8]: icmp6.c raw_ip6.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #350):
sys/netinet6/icmp6.c: revision 1.214
sys/netinet6/raw_ip6.c: revision 1.158
Fix usages of ipsec_used
If IPsec isn't used, we must go back to the normal path.
PR kern/52659


To generate a diff of this commit:
cvs rdiff -u -r1.211.6.2 -r1.211.6.3 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.157 -r1.157.2.1 src/sys/netinet6/raw_ip6.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/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.211.6.2 src/sys/netinet6/icmp6.c:1.211.6.3
--- src/sys/netinet6/icmp6.c:1.211.6.2	Sat Oct 21 19:43:54 2017
+++ src/sys/netinet6/icmp6.c	Wed Nov  8 22:24:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.211.6.2 2017/10/21 19:43:54 snj Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.211.6.3 2017/11/08 22:24:55 snj Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.211.6.2 2017/10/21 19:43:54 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.211.6.3 2017/11/08 22:24:55 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2012,7 +2012,8 @@ icmp6_rip6_input(struct mbuf **mp, int o
 			/*
 			 * Check AH/ESP integrity
 			 */
-			if (ipsec_used && !ipsec6_in_reject(m, last))
+			if (!ipsec_used ||
+			(ipsec_used && !ipsec6_in_reject(m, last)))
 #endif /* IPSEC */
 			if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
 if (last->in6p_flags & IN6P_CONTROLOPTS)

Index: src/sys/netinet6/raw_ip6.c
diff -u src/sys/netinet6/raw_ip6.c:1.157 src/sys/netinet6/raw_ip6.c:1.157.2.1
--- src/sys/netinet6/raw_ip6.c:1.157	Thu Jun  1 02:45:14 2017
+++ src/sys/netinet6/raw_ip6.c	Wed Nov  8 22:24:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip6.c,v 1.157 2017/06/01 02:45:14 chs Exp $	*/
+/*	$NetBSD: raw_ip6.c,v 1.157.2.1 2017/11/08 22:24:55 snj Exp $	*/
 /*	$KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.157 2017/06/01 02:45:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.157.2.1 2017/11/08 22:24:55 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -205,7 +205,8 @@ rip6_input(struct mbuf **mp, int *offp, 
 			/*
 			 * Check AH/ESP integrity
 			 */
-			if (ipsec_used && !ipsec6_in_reject(m, last)) 
+			if (!ipsec_used ||
+			(ipsec_used && !ipsec6_in_reject(m, last)))
 #endif /* IPSEC */
 			if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
 if (last->in6p_flags & IN6P_CONTROLOPTS)



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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 22:20:59 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_l2tp.c if_tap.c if_tun.c if_vlan.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #349):
sys/net/if_l2tp.c: revision 1.14
sys/net/if_tap.c: revision 1.101
sys/net/if_tun.c: revision 1.141
sys/net/if_vlan.c: revision 1.106
Set IFEF_NO_LINK_STATE_CHANGE flag to pseudo devices that don't use
if_link_state_change


To generate a diff of this commit:
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.99 -r1.99.6.1 src/sys/net/if_tap.c
cvs rdiff -u -r1.139 -r1.139.2.1 src/sys/net/if_tun.c
cvs rdiff -u -r1.97.2.5 -r1.97.2.6 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.11.2.1 src/sys/net/if_l2tp.c:1.11.2.2
--- src/sys/net/if_l2tp.c:1.11.2.1	Mon Nov  6 09:59:01 2017
+++ src/sys/net/if_l2tp.c	Wed Nov  8 22:20:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.11.2.1 2017/11/06 09:59:01 snj Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.11.2.2 2017/11/08 22:20:59 snj Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.11.2.1 2017/11/06 09:59:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.11.2.2 2017/11/08 22:20:59 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -261,7 +261,8 @@ l2tpattach0(struct l2tp_softc *sc)
 	sc->l2tp_ec.ec_if.if_addrlen = 0;
 	sc->l2tp_ec.ec_if.if_mtu= L2TP_MTU;
 	sc->l2tp_ec.ec_if.if_flags  = IFF_POINTOPOINT|IFF_MULTICAST|IFF_SIMPLEX;
-	sc->l2tp_ec.ec_if.if_extflags  = IFEF_OUTPUT_MPSAFE|IFEF_START_MPSAFE;
+	sc->l2tp_ec.ec_if.if_extflags  = IFEF_OUTPUT_MPSAFE |
+	IFEF_START_MPSAFE | IFEF_NO_LINK_STATE_CHANGE;
 	sc->l2tp_ec.ec_if.if_ioctl  = l2tp_ioctl;
 	sc->l2tp_ec.ec_if.if_output = l2tp_output;
 	sc->l2tp_ec.ec_if.if_type   = IFT_L2TP;

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.99 src/sys/net/if_tap.c:1.99.6.1
--- src/sys/net/if_tap.c:1.99	Sun Feb 12 09:47:31 2017
+++ src/sys/net/if_tap.c	Wed Nov  8 22:20:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.99 2017/02/12 09:47:31 skrll Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.99.6.1 2017/11/08 22:20:59 snj Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.99 2017/02/12 09:47:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.99.6.1 2017/11/08 22:20:59 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -370,6 +370,7 @@ tap_attach(device_t parent, device_t sel
 	strcpy(ifp->if_xname, device_xname(self));
 	ifp->if_softc	= sc;
 	ifp->if_flags	= IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+	ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
 	ifp->if_ioctl	= tap_ioctl;
 	ifp->if_start	= tap_start;
 	ifp->if_stop	= tap_stop;

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.139 src/sys/net/if_tun.c:1.139.2.1
--- src/sys/net/if_tun.c:1.139	Wed May 24 06:52:14 2017
+++ src/sys/net/if_tun.c	Wed Nov  8 22:20:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.139 2017/05/24 06:52:14 pgoyette Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.139.2.1 2017/11/08 22:20:59 snj Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.139 2017/05/24 06:52:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.139.2.1 2017/11/08 22:20:59 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -247,6 +247,7 @@ tunattach0(struct tun_softc *tp)
 	ifp->if_start = tunstart;
 #endif
 	ifp->if_flags = IFF_POINTOPOINT;
+	ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
 	ifp->if_type = IFT_TUNNEL;
 	ifp->if_snd.ifq_maxlen = ifqmaxlen;
 	ifp->if_collisions = 0;

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.97.2.5 src/sys/net/if_vlan.c:1.97.2.6
--- src/sys/net/if_vlan.c:1.97.2.5	Mon Nov  6 09:57:39 2017
+++ src/sys/net/if_vlan.c	Wed Nov  8 22:20:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.97.2.5 2017/11/06 09:57:39 snj Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.97.2.6 2017/11/08 22:20:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.5 2017/11/06 09:57:39 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.6 2017/11/08 22:20:59 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -337,7 +337,7 @@ vlan_clone_create(struct if_clone *ifc, 
 	if_initname(ifp, ifc->ifc_name, unit);
 	ifp->if_softc = ifv;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-	ifp->if_extflags = IFEF_START_MPSAFE;
+	ifp->if_extflags = IFEF_START_MPSAFE | IFEF_NO_LINK_STATE_CHANGE;
 	ifp->if_start = vlan_start;
 	ifp->if_transmit = vlan_transmit;
 	if

CVS commit: src/sys/arch/evbarm/conf

2017-11-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Nov  8 21:44:29 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: SUNXI

Log Message:
add wskbd at gpiokeys


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/evbarm/conf/SUNXI

Please 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/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.50 src/sys/arch/evbarm/conf/SUNXI:1.51
--- src/sys/arch/evbarm/conf/SUNXI:1.50	Sun Oct 29 16:02:46 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Wed Nov  8 21:44:29 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.50 2017/10/29 16:02:46 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.51 2017/11/08 21:44:29 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -129,6 +129,7 @@ ffclock*	at fdt? pass 1
 fregulator*	at fdt? pass 4
 gregulator*	at fdt? pass 4
 gpiokeys*	at fdt?
+wskbd*		at gpiokeys? console ? mux 1
 gpioleds*	at fdt?
 
 # SRAM controller



CVS commit: [netbsd-6-1] src/doc

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:33:36 UTC 2017

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
1056, 1068, 1390


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.117 -r1.1.2.118 src/doc/CHANGES-6.1.6

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.117 src/doc/CHANGES-6.1.6:1.1.2.118
--- src/doc/CHANGES-6.1.6:1.1.2.117	Sun Nov  5 20:33:02 2017
+++ src/doc/CHANGES-6.1.6	Wed Nov  8 21:33:35 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.117 2017/11/05 20:33:02 snj Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.118 2017/11/08 21:33:35 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -14890,3 +14890,52 @@ xsrc/xfree/xc/programs/Xserver/render/re
 	apply fixes for CVEs 2017-12176 to 2017-12187
 	[mrg, ticket #1511]
 
+sys/arch/mips/mips/pmap.c			1.210-1.213
+sys/arch/mips/mips/vm_machdep.c			1.143
+
+	Fix a logic inversion introduced with the matt-nb5-mips64
+	branch for pmap_{zero,copy}_page cache alias handing.
+	Additionally flush the cache for the uarea va to avoid potential
+	(future) cache aliases in cpu_uarea_free when handing pages back
+	to uvm for later use.
+	Use pmap_tlb_asid_check to reduce code c&p.
+	
+	PR/44900 - R5000/Rm5200 mips ports are broken
+	PR/46170 - NetBSD/cobalt 6.0_BETA does not boot
+	PR/46890 - upcoming NetBSD 6.0 release is very unstable / unusable
+		   on cobalt qube 2
+	PR/48628 - cobalt and hpcmips ports are dead
+	[skrll, ticket #1056]
+
+sys/arch/mips/include/pmap.h			1.63
+sys/arch/mips/mips/pmap.c			1.214
+sys/arch/mips/mips/pmap_segtab.c		1.8
+
+	Deal with incompatible cache aliases.
+	PR#44900, PR#46890, and PR#48628.
+	[skrll, ticket #1068]
+
+sys/arch/mips/mips/pmap.c			1.221-1.223
+
+	Fix PR/51288 reproducable panic on evbmips64-eb (erlite)
+
+	pmap_page_remove from the previous change neglected to
+	terminate the pv list correctly when it started with an
+	initial unmanaged mapping and subsequent managed mappings.
+	Fix this.
+
+	Fix MIPS3_NO_PV_UNCACHED alias handling by looping through the
+	pv_list looking for bad aliases and removing the bad entries.
+	That is, revert to the code before the matt-mips64 merge.
+
+	Additionally, fix the pmap_update call to not use the (recently
+	removed/freed) pv for the pmap_t.
+
+	Fixes the following two PRs
+
+	PR/49903: Panic during installation on WorkPad Z50 (hpcmips)
+		  whilst uncompressing base.tgz
+	PR/51226: Install bug for hpcmips NetBSD V7 using FTP Full
+		  installation
+	[skrll, ticket #1390]
+



CVS commit: [netbsd-6-0] src/doc

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:32:14 UTC 2017

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
1056, 1068, 1390


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.120 -r1.1.2.121 src/doc/CHANGES-6.0.7

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.120 src/doc/CHANGES-6.0.7:1.1.2.121
--- src/doc/CHANGES-6.0.7:1.1.2.120	Sun Nov  5 20:34:36 2017
+++ src/doc/CHANGES-6.0.7	Wed Nov  8 21:32:14 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.120 2017/11/05 20:34:36 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.121 2017/11/08 21:32:14 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -15217,3 +15217,52 @@ xsrc/xfree/xc/programs/Xserver/render/re
 	apply fixes for CVEs 2017-12176 to 2017-12187
 	[mrg, ticket #1511]
 
+sys/arch/mips/mips/pmap.c			1.210-1.213
+sys/arch/mips/mips/vm_machdep.c			1.143
+
+	Fix a logic inversion introduced with the matt-nb5-mips64
+	branch for pmap_{zero,copy}_page cache alias handing.
+	Additionally flush the cache for the uarea va to avoid potential
+	(future) cache aliases in cpu_uarea_free when handing pages back
+	to uvm for later use.
+	Use pmap_tlb_asid_check to reduce code c&p.
+	
+	PR/44900 - R5000/Rm5200 mips ports are broken
+	PR/46170 - NetBSD/cobalt 6.0_BETA does not boot
+	PR/46890 - upcoming NetBSD 6.0 release is very unstable / unusable
+		   on cobalt qube 2
+	PR/48628 - cobalt and hpcmips ports are dead
+	[skrll, ticket #1056]
+
+sys/arch/mips/include/pmap.h			1.63
+sys/arch/mips/mips/pmap.c			1.214
+sys/arch/mips/mips/pmap_segtab.c		1.8
+
+	Deal with incompatible cache aliases.
+	PR#44900, PR#46890, and PR#48628.
+	[skrll, ticket #1068]
+
+sys/arch/mips/mips/pmap.c			1.221-1.223
+
+	Fix PR/51288 reproducable panic on evbmips64-eb (erlite)
+
+	pmap_page_remove from the previous change neglected to
+	terminate the pv list correctly when it started with an
+	initial unmanaged mapping and subsequent managed mappings.
+	Fix this.
+
+	Fix MIPS3_NO_PV_UNCACHED alias handling by looping through the
+	pv_list looking for bad aliases and removing the bad entries.
+	That is, revert to the code before the matt-mips64 merge.
+
+	Additionally, fix the pmap_update call to not use the (recently
+	removed/freed) pv for the pmap_t.
+
+	Fixes the following two PRs
+
+	PR/49903: Panic during installation on WorkPad Z50 (hpcmips)
+		  whilst uncompressing base.tgz
+   	PR/51226: Install bug for hpcmips NetBSD V7 using FTP Full
+		  installation
+	[skrll, ticket #1390]
+



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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:28:24 UTC 2017

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.207.2.1.6.2 -r1.207.2.1.6.3 src/sys/arch/mips/mips/pmap.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.207.2.1.6.2 src/sys/arch/mips/mips/pmap.c:1.207.2.1.6.3
--- src/sys/arch/mips/mips/pmap.c:1.207.2.1.6.2	Wed Nov  8 21:22:57 2017
+++ src/sys/arch/mips/mips/pmap.c	Wed Nov  8 21:28:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.207.2.1.6.2 2017/11/08 21:22:57 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.207.2.1.6.3 2017/11/08 21:28:24 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.6.2 2017/11/08 21:22:57 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.6.3 2017/11/08 21:28:24 snj Exp $");
 
 /*
  *	Manages physical address maps.
@@ -316,6 +316,7 @@ u_int		pmap_page_colormask;
 	 (pm) == curlwp->l_proc->p_vmspace->vm_map.pmap)
 
 /* Forward function declarations */
+void pmap_page_remove(struct vm_page *);
 void pmap_remove_pv(pmap_t, vaddr_t, struct vm_page *, bool);
 void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *, int);
 pt_entry_t *pmap_pte(pmap_t, vaddr_t);
@@ -1063,6 +1064,10 @@ pmap_page_protect(struct vm_page *pg, vm
 			while (pv != NULL) {
 const pmap_t pmap = pv->pv_pmap;
 const uint16_t gen = PG_MD_PVLIST_GEN(md);
+if (pv->pv_va & PV_KENTER) {
+	pv = pv->pv_next;
+	continue;
+}
 va = trunc_page(pv->pv_va);
 PG_MD_PVLIST_UNLOCK(md);
 pmap_protect(pmap, va, va + PAGE_SIZE, prot);
@@ -1087,17 +1092,7 @@ pmap_page_protect(struct vm_page *pg, vm
 		if (pmap_clear_mdpage_attributes(md, PG_MD_EXECPAGE)) {
 			PMAP_COUNT(exec_uncached_page_protect);
 		}
-		(void)PG_MD_PVLIST_LOCK(md, false);
-		pv = &md->pvh_first;
-		while (pv->pv_pmap != NULL) {
-			const pmap_t pmap = pv->pv_pmap;
-			va = trunc_page(pv->pv_va);
-			PG_MD_PVLIST_UNLOCK(md);
-			pmap_remove(pmap, va, va + PAGE_SIZE);
-			pmap_update(pmap);
-			(void)PG_MD_PVLIST_LOCK(md, false);
-		}
-		PG_MD_PVLIST_UNLOCK(md);
+		pmap_page_remove(pg);
 	}
 }
 
@@ -2069,6 +2064,32 @@ pmap_set_modified(paddr_t pa)
 / pv_entry management /
 
 static void
+pmap_check_alias(struct vm_page *pg)
+{
+#ifdef MIPS3_PLUS	/* XXX mmu XXX */
+#ifndef MIPS3_NO_PV_UNCACHED
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+
+	if (MIPS_HAS_R4K_MMU && PG_MD_UNCACHED_P(md)) {
+		/*
+		 * Page is currently uncached, check if alias mapping has been
+		 * removed.  If it was, then reenable caching.
+		 */
+		pv_entry_t pv = &md->pvh_first;
+		pv_entry_t pv0 = pv->pv_next;
+
+		for (; pv0; pv0 = pv0->pv_next) {
+			if (mips_cache_badalias(pv->pv_va, pv0->pv_va))
+break;
+		}
+		if (pv0 == NULL)
+			pmap_page_cache(pg, true);
+	}
+#endif
+#endif	/* MIPS3_PLUS */
+}
+
+static void
 pmap_check_pvlist(struct vm_page_md *md)
 {
 #ifdef PARANOIADIAG
@@ -2155,12 +2176,12 @@ again:
 			 * be mapped with one index at any given time.
 			 */
 
-			if (mips_cache_badalias(pv->pv_va, va)) {
-for (npv = pv; npv; npv = npv->pv_next) {
-	vaddr_t nva = trunc_page(npv->pv_va);
-	pmap_remove(npv->pv_pmap, nva,
-	nva + PAGE_SIZE);
-	pmap_update(npv->pv_pmap);
+			for (npv = pv; npv; npv = npv->pv_next) {
+vaddr_t nva = trunc_page(npv->pv_va);
+pmap_t npm = npv->pv_pmap;
+if (mips_cache_badalias(nva, va)) {
+	pmap_remove(npm, nva, nva + PAGE_SIZE);
+	pmap_update(npm);
 	goto again;
 }
 			}
@@ -2283,6 +2304,114 @@ again:
 }
 
 /*
+ * Remove this page from all physical maps in 

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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:28:18 UTC 2017

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.207.2.1.4.2 -r1.207.2.1.4.3 src/sys/arch/mips/mips/pmap.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.207.2.1.4.2 src/sys/arch/mips/mips/pmap.c:1.207.2.1.4.3
--- src/sys/arch/mips/mips/pmap.c:1.207.2.1.4.2	Wed Nov  8 21:22:48 2017
+++ src/sys/arch/mips/mips/pmap.c	Wed Nov  8 21:28:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.207.2.1.4.2 2017/11/08 21:22:48 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.207.2.1.4.3 2017/11/08 21:28:18 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.4.2 2017/11/08 21:22:48 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.4.3 2017/11/08 21:28:18 snj Exp $");
 
 /*
  *	Manages physical address maps.
@@ -316,6 +316,7 @@ u_int		pmap_page_colormask;
 	 (pm) == curlwp->l_proc->p_vmspace->vm_map.pmap)
 
 /* Forward function declarations */
+void pmap_page_remove(struct vm_page *);
 void pmap_remove_pv(pmap_t, vaddr_t, struct vm_page *, bool);
 void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *, int);
 pt_entry_t *pmap_pte(pmap_t, vaddr_t);
@@ -1063,6 +1064,10 @@ pmap_page_protect(struct vm_page *pg, vm
 			while (pv != NULL) {
 const pmap_t pmap = pv->pv_pmap;
 const uint16_t gen = PG_MD_PVLIST_GEN(md);
+if (pv->pv_va & PV_KENTER) {
+	pv = pv->pv_next;
+	continue;
+}
 va = trunc_page(pv->pv_va);
 PG_MD_PVLIST_UNLOCK(md);
 pmap_protect(pmap, va, va + PAGE_SIZE, prot);
@@ -1087,17 +1092,7 @@ pmap_page_protect(struct vm_page *pg, vm
 		if (pmap_clear_mdpage_attributes(md, PG_MD_EXECPAGE)) {
 			PMAP_COUNT(exec_uncached_page_protect);
 		}
-		(void)PG_MD_PVLIST_LOCK(md, false);
-		pv = &md->pvh_first;
-		while (pv->pv_pmap != NULL) {
-			const pmap_t pmap = pv->pv_pmap;
-			va = trunc_page(pv->pv_va);
-			PG_MD_PVLIST_UNLOCK(md);
-			pmap_remove(pmap, va, va + PAGE_SIZE);
-			pmap_update(pmap);
-			(void)PG_MD_PVLIST_LOCK(md, false);
-		}
-		PG_MD_PVLIST_UNLOCK(md);
+		pmap_page_remove(pg);
 	}
 }
 
@@ -2069,6 +2064,32 @@ pmap_set_modified(paddr_t pa)
 / pv_entry management /
 
 static void
+pmap_check_alias(struct vm_page *pg)
+{
+#ifdef MIPS3_PLUS	/* XXX mmu XXX */
+#ifndef MIPS3_NO_PV_UNCACHED
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+
+	if (MIPS_HAS_R4K_MMU && PG_MD_UNCACHED_P(md)) {
+		/*
+		 * Page is currently uncached, check if alias mapping has been
+		 * removed.  If it was, then reenable caching.
+		 */
+		pv_entry_t pv = &md->pvh_first;
+		pv_entry_t pv0 = pv->pv_next;
+
+		for (; pv0; pv0 = pv0->pv_next) {
+			if (mips_cache_badalias(pv->pv_va, pv0->pv_va))
+break;
+		}
+		if (pv0 == NULL)
+			pmap_page_cache(pg, true);
+	}
+#endif
+#endif	/* MIPS3_PLUS */
+}
+
+static void
 pmap_check_pvlist(struct vm_page_md *md)
 {
 #ifdef PARANOIADIAG
@@ -2155,12 +2176,12 @@ again:
 			 * be mapped with one index at any given time.
 			 */
 
-			if (mips_cache_badalias(pv->pv_va, va)) {
-for (npv = pv; npv; npv = npv->pv_next) {
-	vaddr_t nva = trunc_page(npv->pv_va);
-	pmap_remove(npv->pv_pmap, nva,
-	nva + PAGE_SIZE);
-	pmap_update(npv->pv_pmap);
+			for (npv = pv; npv; npv = npv->pv_next) {
+vaddr_t nva = trunc_page(npv->pv_va);
+pmap_t npm = npv->pv_pmap;
+if (mips_cache_badalias(nva, va)) {
+	pmap_remove(npm, nva, nva + PAGE_SIZE);
+	pmap_update(npm);
 	goto again;
 }
 			}
@@ -2283,6 +2304,114 @@ again:
 }
 
 /*
+ * Remove this page from all physical maps in 

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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:22:48 UTC 2017

Modified Files:
src/sys/arch/mips/include [netbsd-6-0]: pmap.h
src/sys/arch/mips/mips [netbsd-6-0]: pmap.c pmap_segtab.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1068):
sys/arch/mips/include/pmap.h: revision 1.63
sys/arch/mips/mips/pmap.c: revision 1.214
sys/arch/mips/mips/pmap_segtab.c: revision 1.8
Deal with incompatible cache aliases. Specifically,
- always flush an ephemeral page on unmap
- track unmanaged mappings (mappings entered via pmap_kenter_pa) for
aliases where required and handle appropriately (via pmap_enter_pv)
Hopefully this (finally) addresses the instability reported in the
following PRs:
PR/44900 - R5000/Rm5200 mips ports are broken
PR/46890 - upcoming NetBSD 6.0 release is very unstable / unusable on cobalt 
qube 2
PR/48628 - cobalt and hpcmips ports are dead


To generate a diff of this commit:
cvs rdiff -u -r1.61.8.1 -r1.61.8.1.4.1 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.207.2.1.4.1 -r1.207.2.1.4.2 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.4.2.1 -r1.4.2.1.4.1 src/sys/arch/mips/mips/pmap_segtab.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/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.61.8.1 src/sys/arch/mips/include/pmap.h:1.61.8.1.4.1
--- src/sys/arch/mips/include/pmap.h:1.61.8.1	Thu Jul  5 18:39:42 2012
+++ src/sys/arch/mips/include/pmap.h	Wed Nov  8 21:22:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.61.8.1 2012/07/05 18:39:42 riz Exp $	*/
+/*	$NetBSD: pmap.h,v 1.61.8.1.4.1 2017/11/08 21:22:48 snj Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -283,6 +283,7 @@ void	pmap_prefer(vaddr_t, vaddr_t *, vsi
 #endif /* MIPS3_PLUS */
 
 #define	PMAP_STEAL_MEMORY	/* enable pmap_steal_memory() */
+#define	PMAP_ENABLE_PMAP_KMPAGE	/* enable the PMAP_KMPAGE flag */
 
 /*
  * Alternate mapping hooks for pool pages.  Avoids thrashing the TLB.
@@ -329,6 +330,7 @@ typedef struct pv_entry {
 	struct pv_entry	*pv_next;	/* next pv_entry */
 	struct pmap	*pv_pmap;	/* pmap where mapping lies */
 	vaddr_t		pv_va;		/* virtual address for mapping */
+#define	PV_KENTER	0x001
 } *pv_entry_t;
 
 #define	PG_MD_UNCACHED		0x0001	/* page is mapped uncached */

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.207.2.1.4.1 src/sys/arch/mips/mips/pmap.c:1.207.2.1.4.2
--- src/sys/arch/mips/mips/pmap.c:1.207.2.1.4.1	Wed Nov  8 21:17:46 2017
+++ src/sys/arch/mips/mips/pmap.c	Wed Nov  8 21:22:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.207.2.1.4.1 2017/11/08 21:17:46 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.207.2.1.4.2 2017/11/08 21:22:48 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.4.1 2017/11/08 21:17:46 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.4.2 2017/11/08 21:22:48 snj Exp $");
 
 /*
  *	Manages physical address maps.
@@ -317,7 +317,7 @@ u_int		pmap_page_colormask;
 
 /* Forward function declarations */
 void pmap_remove_pv(pmap_t, vaddr_t, struct vm_page *, bool);
-void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *);
+void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *, int);
 pt_entry_t *pmap_pte(pmap_t, vaddr_t);
 
 /*
@@ -386,13 +386,13 @@ pmap_page_syncicache(struct vm_page *pg)
 	}
 	PG_MD_PVLIST_UNLOCK(md);
 	kpreempt_disable();
-	pmap_tlb_syncicache(md->pvh_first.pv_va, onproc);
+	pmap_tlb_syncicache(trunc_page(md->pvh_first.pv_va), onproc);
 	kpreempt_enable();
 #else
 	if (MIPS_HAS_R4K_MMU) {
 		if (PG_MD_CACHED_P(md)) {
 			mips_icache_sync_range_index(
-			md->pvh_first.pv_va, PAGE_SIZE);
+			trunc_page(md->pvh_first.pv_va), PAGE_SIZE);
 		}
 	} else {
 		mips_icache_sync_range(MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(pg)),
@@ -436,10 +436,10 @@ pmap_map_ephemeral_page(struct vm_page *
 		 */
 		(void)PG_MD_PVLIST_LOCK(md, false);
 		if (PG_MD_CACHED_P(md)
-		&& mips_cache_badalias(pv->pv_va, va))
-			mips_dcache_wbinv_range_index(pv->pv_va, PAGE_SIZE);
-		if (pv->pv_pmap == NULL)
-			pv->pv_va = va;
+		&& mips_cache_badalias(pv->pv_va, va)) {
+			mips_dcache_wbinv_range_index(trunc_page(pv->pv_va),
+			PAGE_SIZE);
+		}
 		PG_MD_PVLIST_UNLOCK(md);
 	}
 
@@ -450,23 +450,13 @@ static void
 pmap_unmap_ephemeral_page(struct vm_page *pg, vaddr_t va,
 	pt_entry_t old_pt_entry)
 {
-	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
-	pv_entry_t pv = &md->pvh_first;
-	
-	if (MIPS_CACHE_VIRTUAL_ALIAS) {
-		(void)PG_MD_PVLIST_LOCK(md, false);
-		if (PG_MD_CACHED_P(md)
-		|| (pv->pv_pmap != NULL
-			&& mips_cache_badalias(pv->pv_va, va))) {
 
-			/*
-			 * If this page was previously cached or we had to use an
-			 * incompatible alias and it has a valid mapping, flush it
-			 * from the cache.
-			 */
-			mips_dcache_wb

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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:22:58 UTC 2017

Modified Files:
src/sys/arch/mips/include [netbsd-6-1]: pmap.h
src/sys/arch/mips/mips [netbsd-6-1]: pmap.c pmap_segtab.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1068):
sys/arch/mips/include/pmap.h: revision 1.63
sys/arch/mips/mips/pmap.c: revision 1.214
sys/arch/mips/mips/pmap_segtab.c: revision 1.8
Deal with incompatible cache aliases. Specifically,
- always flush an ephemeral page on unmap
- track unmanaged mappings (mappings entered via pmap_kenter_pa) for
aliases where required and handle appropriately (via pmap_enter_pv)
Hopefully this (finally) addresses the instability reported in the
following PRs:
PR/44900 - R5000/Rm5200 mips ports are broken
PR/46890 - upcoming NetBSD 6.0 release is very unstable / unusable on cobalt 
qube 2
PR/48628 - cobalt and hpcmips ports are dead


To generate a diff of this commit:
cvs rdiff -u -r1.61.8.1 -r1.61.8.1.6.1 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.207.2.1.6.1 -r1.207.2.1.6.2 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.4.2.1 -r1.4.2.1.6.1 src/sys/arch/mips/mips/pmap_segtab.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/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.61.8.1 src/sys/arch/mips/include/pmap.h:1.61.8.1.6.1
--- src/sys/arch/mips/include/pmap.h:1.61.8.1	Thu Jul  5 18:39:42 2012
+++ src/sys/arch/mips/include/pmap.h	Wed Nov  8 21:22:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.61.8.1 2012/07/05 18:39:42 riz Exp $	*/
+/*	$NetBSD: pmap.h,v 1.61.8.1.6.1 2017/11/08 21:22:57 snj Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -283,6 +283,7 @@ void	pmap_prefer(vaddr_t, vaddr_t *, vsi
 #endif /* MIPS3_PLUS */
 
 #define	PMAP_STEAL_MEMORY	/* enable pmap_steal_memory() */
+#define	PMAP_ENABLE_PMAP_KMPAGE	/* enable the PMAP_KMPAGE flag */
 
 /*
  * Alternate mapping hooks for pool pages.  Avoids thrashing the TLB.
@@ -329,6 +330,7 @@ typedef struct pv_entry {
 	struct pv_entry	*pv_next;	/* next pv_entry */
 	struct pmap	*pv_pmap;	/* pmap where mapping lies */
 	vaddr_t		pv_va;		/* virtual address for mapping */
+#define	PV_KENTER	0x001
 } *pv_entry_t;
 
 #define	PG_MD_UNCACHED		0x0001	/* page is mapped uncached */

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.207.2.1.6.1 src/sys/arch/mips/mips/pmap.c:1.207.2.1.6.2
--- src/sys/arch/mips/mips/pmap.c:1.207.2.1.6.1	Wed Nov  8 21:19:46 2017
+++ src/sys/arch/mips/mips/pmap.c	Wed Nov  8 21:22:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.207.2.1.6.1 2017/11/08 21:19:46 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.207.2.1.6.2 2017/11/08 21:22:57 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.6.1 2017/11/08 21:19:46 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.6.2 2017/11/08 21:22:57 snj Exp $");
 
 /*
  *	Manages physical address maps.
@@ -317,7 +317,7 @@ u_int		pmap_page_colormask;
 
 /* Forward function declarations */
 void pmap_remove_pv(pmap_t, vaddr_t, struct vm_page *, bool);
-void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *);
+void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *, int);
 pt_entry_t *pmap_pte(pmap_t, vaddr_t);
 
 /*
@@ -386,13 +386,13 @@ pmap_page_syncicache(struct vm_page *pg)
 	}
 	PG_MD_PVLIST_UNLOCK(md);
 	kpreempt_disable();
-	pmap_tlb_syncicache(md->pvh_first.pv_va, onproc);
+	pmap_tlb_syncicache(trunc_page(md->pvh_first.pv_va), onproc);
 	kpreempt_enable();
 #else
 	if (MIPS_HAS_R4K_MMU) {
 		if (PG_MD_CACHED_P(md)) {
 			mips_icache_sync_range_index(
-			md->pvh_first.pv_va, PAGE_SIZE);
+			trunc_page(md->pvh_first.pv_va), PAGE_SIZE);
 		}
 	} else {
 		mips_icache_sync_range(MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(pg)),
@@ -436,10 +436,10 @@ pmap_map_ephemeral_page(struct vm_page *
 		 */
 		(void)PG_MD_PVLIST_LOCK(md, false);
 		if (PG_MD_CACHED_P(md)
-		&& mips_cache_badalias(pv->pv_va, va))
-			mips_dcache_wbinv_range_index(pv->pv_va, PAGE_SIZE);
-		if (pv->pv_pmap == NULL)
-			pv->pv_va = va;
+		&& mips_cache_badalias(pv->pv_va, va)) {
+			mips_dcache_wbinv_range_index(trunc_page(pv->pv_va),
+			PAGE_SIZE);
+		}
 		PG_MD_PVLIST_UNLOCK(md);
 	}
 
@@ -450,23 +450,13 @@ static void
 pmap_unmap_ephemeral_page(struct vm_page *pg, vaddr_t va,
 	pt_entry_t old_pt_entry)
 {
-	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
-	pv_entry_t pv = &md->pvh_first;
-	
-	if (MIPS_CACHE_VIRTUAL_ALIAS) {
-		(void)PG_MD_PVLIST_LOCK(md, false);
-		if (PG_MD_CACHED_P(md)
-		|| (pv->pv_pmap != NULL
-			&& mips_cache_badalias(pv->pv_va, va))) {
 
-			/*
-			 * If this page was previously cached or we had to use an
-			 * incompatible alias and it has a valid mapping, flush it
-			 * from the cache.
-			 */
-			mips_dcache_wb

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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:19:46 UTC 2017

Modified Files:
src/sys/arch/mips/mips [netbsd-6-1]: pmap.c vm_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1056):
sys/arch/mips/mips/pmap.c: revision 1.210-1.213
sys/arch/mips/mips/vm_machdep.c: revision 1.143
Fix a logic inversion introduced with the matt-nb5-mips64 for
pmap_{zero,copy}_page cache alias handing. The check previously used
PG_MD_UNCACHED_P, where it now uses PG_MD_CACHED_P, when considering if
a cache invalidation is required.
Additionally flush the cache for the uarea va to avoid potential (future)
cache aliases in cpu_uarea_free when handing pages back to uvm for later
use.
ok matt@
Hopefully this addresses the instability reported in the following PRs:
PR/44900 - R5000/Rm5200 mips ports are broken
PR/46170 - NetBSD/cobalt 6.0_BETA does not boot
PR/46890 - upcoming NetBSD 6.0 release is very unstable / unusable on cobalt 
qube 2
PR/48628 - cobalt and hpcmips ports are dead
Grab pv_list lock in pmap_unmap_ephemeral_page only when needed.
Make PARANOIADIAG compile.
Use pmap_tlb_asid_check to reduce code c&p.


To generate a diff of this commit:
cvs rdiff -u -r1.207.2.1 -r1.207.2.1.6.1 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.141 -r1.141.14.1 src/sys/arch/mips/mips/vm_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.207.2.1 src/sys/arch/mips/mips/pmap.c:1.207.2.1.6.1
--- src/sys/arch/mips/mips/pmap.c:1.207.2.1	Thu Jul  5 18:39:42 2012
+++ src/sys/arch/mips/mips/pmap.c	Wed Nov  8 21:19:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.207.2.1 2012/07/05 18:39:42 riz Exp $	*/
+/*	$NetBSD: pmap.c,v 1.207.2.1.6.1 2017/11/08 21:19:46 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1 2012/07/05 18:39:42 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.6.1 2017/11/08 21:19:46 snj Exp $");
 
 /*
  *	Manages physical address maps.
@@ -453,19 +453,21 @@ pmap_unmap_ephemeral_page(struct vm_page
 	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 	pv_entry_t pv = &md->pvh_first;
 	
-	(void)PG_MD_PVLIST_LOCK(md, false);
-	if (MIPS_CACHE_VIRTUAL_ALIAS
-	&& (PG_MD_UNCACHED_P(md)
-		|| (pv->pv_pmap != NULL
-		&& mips_cache_badalias(pv->pv_va, va {
-		/*
-		 * If this page was previously uncached or we had to use an
-		 * incompatible alias and it has a valid mapping, flush it
-		 * from the cache.
-		 */
-		mips_dcache_wbinv_range(va, PAGE_SIZE);
+	if (MIPS_CACHE_VIRTUAL_ALIAS) {
+		(void)PG_MD_PVLIST_LOCK(md, false);
+		if (PG_MD_CACHED_P(md)
+		|| (pv->pv_pmap != NULL
+			&& mips_cache_badalias(pv->pv_va, va))) {
+
+			/*
+			 * If this page was previously cached or we had to use an
+			 * incompatible alias and it has a valid mapping, flush it
+			 * from the cache.
+			 */
+			mips_dcache_wbinv_range(va, PAGE_SIZE);
+		}
+		PG_MD_PVLIST_UNLOCK(md);
 	}
-	PG_MD_PVLIST_UNLOCK(md);
 #ifndef _LP64
 	/*
 	 * If we had to map using a page table entry, unmap it now.
@@ -575,7 +577,7 @@ pmap_bootstrap(void)
 
 	/*
 	 * Now actually allocate the kernel PTE array (must be done
-	 * after virtual_end is initialized).
+	 * after mips_virtual_end is initialized).
 	 */
 	Sysmap = (pt_entry_t *)
 	uvm_pageboot_alloc(sizeof(pt_entry_t) * Sysmapsize);
@@ -1023,15 +1025,7 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
 	if (eva > VM_MAXUSER_ADDRESS)
 		panic("pmap_remove: uva not in range");
 	if (PMAP_IS_ACTIVE(pmap)) {
-		struct pmap_asid_info * const pai = PMAP_PAI(pmap, curcpu());
-		uint32_t asid;
-
-		__asm volatile("mfc0 %0,$10; nop" : "=r"(asid));
-		asid = (MIPS_HAS_R4K_MMU) ? (asid & 0xff) : (asid & 0xfc0) >> 6;
-		if (asid != pai->pai_asid) {
-			panic("inconsistency for active TLB flush: %d <-> %d",
-			asid, pai->pai_asid);
-		}
+		pmap_tlb_asid_check();
 	}
 #endif
 #ifdef PMAP_FAULTINFO
@@ -1214,15 +1208,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 	if (eva > VM_MAXUSER_ADDRESS)
 		panic("pmap_protect: uva not in range");
 	if (PMAP_IS_ACTIVE(pmap)) {
-		struct pmap_asid_info * const pai = PMAP_PAI(pmap, curcpu());
-		uint32_t asid;
-
-		__asm volatile("mfc0 %0,$10; nop" : "=r"(asid));
-		asid = (MIPS_HAS_R4K_MMU) ? (asid & 0xff) : (asid & 0xfc0) >> 6;
-		if (asid != pai->pai_asid) {
-			panic("inconsistency for active TLB update: %d <-> %d",
-			asid, pai->pai_asid);
-		}
+		pmap_tlb_asid_check();
 	}
 #endif
 
@@ -1586,6 +1572,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
 
 #ifdef PARANOIADIAG
 	if (PMAP_IS_ACTIVE(pmap)) {
+		struct pmap_asid_info * const pai = PMAP_PAI(pmap, curcpu());
 		uint32_t asid;
 
 		__asm volatile("mfc0 %0,$10; nop" : "=r"(asid));
@@ -1774,7 +1761,7 @@ pmap_unwire(pmap_t pmap, vaddr_t va)
 	if (pmap == pmap_kernel

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

2017-11-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Nov  8 21:17:46 UTC 2017

Modified Files:
src/sys/arch/mips/mips [netbsd-6-0]: pmap.c vm_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1056):
sys/arch/mips/mips/pmap.c: revision 1.210-1.213
sys/arch/mips/mips/vm_machdep.c: revision 1.143
Fix a logic inversion introduced with the matt-nb5-mips64 for
pmap_{zero,copy}_page cache alias handing. The check previously used
PG_MD_UNCACHED_P, where it now uses PG_MD_CACHED_P, when considering if
a cache invalidation is required.
Additionally flush the cache for the uarea va to avoid potential (future)
cache aliases in cpu_uarea_free when handing pages back to uvm for later
use.
ok matt@
Hopefully this addresses the instability reported in the following PRs:
PR/44900 - R5000/Rm5200 mips ports are broken
PR/46170 - NetBSD/cobalt 6.0_BETA does not boot
PR/46890 - upcoming NetBSD 6.0 release is very unstable / unusable on cobalt 
qube 2
PR/48628 - cobalt and hpcmips ports are dead
Grab pv_list lock in pmap_unmap_ephemeral_page only when needed.
Make PARANOIADIAG compile.
Use pmap_tlb_asid_check to reduce code c&p.


To generate a diff of this commit:
cvs rdiff -u -r1.207.2.1 -r1.207.2.1.4.1 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.141 -r1.141.12.1 src/sys/arch/mips/mips/vm_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.207.2.1 src/sys/arch/mips/mips/pmap.c:1.207.2.1.4.1
--- src/sys/arch/mips/mips/pmap.c:1.207.2.1	Thu Jul  5 18:39:42 2012
+++ src/sys/arch/mips/mips/pmap.c	Wed Nov  8 21:17:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.207.2.1 2012/07/05 18:39:42 riz Exp $	*/
+/*	$NetBSD: pmap.c,v 1.207.2.1.4.1 2017/11/08 21:17:46 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1 2012/07/05 18:39:42 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.1.4.1 2017/11/08 21:17:46 snj Exp $");
 
 /*
  *	Manages physical address maps.
@@ -453,19 +453,21 @@ pmap_unmap_ephemeral_page(struct vm_page
 	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 	pv_entry_t pv = &md->pvh_first;
 	
-	(void)PG_MD_PVLIST_LOCK(md, false);
-	if (MIPS_CACHE_VIRTUAL_ALIAS
-	&& (PG_MD_UNCACHED_P(md)
-		|| (pv->pv_pmap != NULL
-		&& mips_cache_badalias(pv->pv_va, va {
-		/*
-		 * If this page was previously uncached or we had to use an
-		 * incompatible alias and it has a valid mapping, flush it
-		 * from the cache.
-		 */
-		mips_dcache_wbinv_range(va, PAGE_SIZE);
+	if (MIPS_CACHE_VIRTUAL_ALIAS) {
+		(void)PG_MD_PVLIST_LOCK(md, false);
+		if (PG_MD_CACHED_P(md)
+		|| (pv->pv_pmap != NULL
+			&& mips_cache_badalias(pv->pv_va, va))) {
+
+			/*
+			 * If this page was previously cached or we had to use an
+			 * incompatible alias and it has a valid mapping, flush it
+			 * from the cache.
+			 */
+			mips_dcache_wbinv_range(va, PAGE_SIZE);
+		}
+		PG_MD_PVLIST_UNLOCK(md);
 	}
-	PG_MD_PVLIST_UNLOCK(md);
 #ifndef _LP64
 	/*
 	 * If we had to map using a page table entry, unmap it now.
@@ -575,7 +577,7 @@ pmap_bootstrap(void)
 
 	/*
 	 * Now actually allocate the kernel PTE array (must be done
-	 * after virtual_end is initialized).
+	 * after mips_virtual_end is initialized).
 	 */
 	Sysmap = (pt_entry_t *)
 	uvm_pageboot_alloc(sizeof(pt_entry_t) * Sysmapsize);
@@ -1023,15 +1025,7 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
 	if (eva > VM_MAXUSER_ADDRESS)
 		panic("pmap_remove: uva not in range");
 	if (PMAP_IS_ACTIVE(pmap)) {
-		struct pmap_asid_info * const pai = PMAP_PAI(pmap, curcpu());
-		uint32_t asid;
-
-		__asm volatile("mfc0 %0,$10; nop" : "=r"(asid));
-		asid = (MIPS_HAS_R4K_MMU) ? (asid & 0xff) : (asid & 0xfc0) >> 6;
-		if (asid != pai->pai_asid) {
-			panic("inconsistency for active TLB flush: %d <-> %d",
-			asid, pai->pai_asid);
-		}
+		pmap_tlb_asid_check();
 	}
 #endif
 #ifdef PMAP_FAULTINFO
@@ -1214,15 +1208,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 	if (eva > VM_MAXUSER_ADDRESS)
 		panic("pmap_protect: uva not in range");
 	if (PMAP_IS_ACTIVE(pmap)) {
-		struct pmap_asid_info * const pai = PMAP_PAI(pmap, curcpu());
-		uint32_t asid;
-
-		__asm volatile("mfc0 %0,$10; nop" : "=r"(asid));
-		asid = (MIPS_HAS_R4K_MMU) ? (asid & 0xff) : (asid & 0xfc0) >> 6;
-		if (asid != pai->pai_asid) {
-			panic("inconsistency for active TLB update: %d <-> %d",
-			asid, pai->pai_asid);
-		}
+		pmap_tlb_asid_check();
 	}
 #endif
 
@@ -1586,6 +1572,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
 
 #ifdef PARANOIADIAG
 	if (PMAP_IS_ACTIVE(pmap)) {
+		struct pmap_asid_info * const pai = PMAP_PAI(pmap, curcpu());
 		uint32_t asid;
 
 		__asm volatile("mfc0 %0,$10; nop" : "=r"(asid));
@@ -1774,7 +1761,7 @@ pmap_unwire(pmap_t pmap, vaddr_t va)
 	if (pmap == pmap_kernel

CVS commit: src/doc

2017-11-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov  8 20:24:53 UTC 2017

Modified Files:
src/doc: BRANCHES

Log Message:
Add matt-nb8-mediatek branch


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 src/doc/BRANCHES

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

Modified files:

Index: src/doc/BRANCHES
diff -u src/doc/BRANCHES:1.343 src/doc/BRANCHES:1.344
--- src/doc/BRANCHES:1.343	Fri Aug 25 15:06:51 2017
+++ src/doc/BRANCHES	Wed Nov  8 20:24:53 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: BRANCHES,v 1.343 2017/08/25 15:06:51 joerg Exp $
+#	$NetBSD: BRANCHES,v 1.344 2017/11/08 20:24:53 matt Exp $
 #
 # This file contains a list of branches that exist in the NetBSD CVS
 # tree and their current state.
@@ -570,7 +570,7 @@ Notes:		
 
 Branch:		matt-nb5-pq3
 Description:	Rototill the powerpc code to support mpc85xx
-Status:		Active
+Status:		Inactive
 Start Date:	2010-12-20
 End Date:
 Base Tag:	matt-nb5-pq3-base
@@ -578,6 +578,16 @@ Maintainer:	Matt Thomas 
+Scope:		kernel & userland
+Notes:		
+
 Branch:		mjf-devfs2
 Description:	device file system supporting dynamic device nodes
 Status:		Active



CVS commit: src/sys/arch/evbarm/sunxi

2017-11-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  8 19:49:26 UTC 2017

Modified Files:
src/sys/arch/evbarm/sunxi: genassym.cf sunxi_start.S

Log Message:
Use genassym.cf instead of #include 


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/sunxi/genassym.cf \
src/sys/arch/evbarm/sunxi/sunxi_start.S

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

Modified files:

Index: src/sys/arch/evbarm/sunxi/genassym.cf
diff -u src/sys/arch/evbarm/sunxi/genassym.cf:1.1 src/sys/arch/evbarm/sunxi/genassym.cf:1.2
--- src/sys/arch/evbarm/sunxi/genassym.cf:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/evbarm/sunxi/genassym.cf	Wed Nov  8 19:49:26 2017
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.1 2017/06/28 23:51:29 jmcneill Exp $
+# $NetBSD: genassym.cf,v 1.2 2017/11/08 19:49:26 skrll Exp $
 
 #-
 # Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,13 @@
 include 
 include 
 
+include 
+
 define	LSR_TXRDY		LSR_TXRDY
 define	LSR_TSRE		LSR_TSRE
 define	COM_DATA		com_data
 define	COM_LSR			com_lsr
+
+define	SUNXI_CORE_VBASE	SUNXI_CORE_VBASE
+define	SUNXI_CORE_PBASE	SUNXI_CORE_PBASE
+define	SUNXI_CORE_SIZE		SUNXI_CORE_SIZE
Index: src/sys/arch/evbarm/sunxi/sunxi_start.S
diff -u src/sys/arch/evbarm/sunxi/sunxi_start.S:1.1 src/sys/arch/evbarm/sunxi/sunxi_start.S:1.2
--- src/sys/arch/evbarm/sunxi/sunxi_start.S:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/evbarm/sunxi/sunxi_start.S	Wed Nov  8 19:49:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_start.S,v 1.1 2017/06/28 23:51:29 jmcneill Exp $ */
+/* $NetBSD: sunxi_start.S,v 1.2 2017/11/08 19:49:26 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014, 2015 The NetBSD Foundation, Inc.
@@ -40,9 +40,7 @@
 #include 
 #include "assym.h"
 
-#include 
-
-RCSID("$NetBSD: sunxi_start.S,v 1.1 2017/06/28 23:51:29 jmcneill Exp $")
+RCSID("$NetBSD: sunxi_start.S,v 1.2 2017/11/08 19:49:26 skrll Exp $")
 
 #if defined(VERBOSE_INIT_ARM) && defined(CONSADDR)
 #define	XPUTC(n)	mov r0, n; bl xputc



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

2017-11-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov  8 18:31:00 UTC 2017

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Add pkboot in "help".


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/i386/stand/boot/boot2.c

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

Modified files:

Index: src/sys/arch/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.68 src/sys/arch/i386/stand/boot/boot2.c:1.69
--- src/sys/arch/i386/stand/boot/boot2.c:1.68	Wed Oct 11 09:53:14 2017
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Nov  8 18:31:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.68 2017/10/11 09:53:14 maxv Exp $	*/
+/*	$NetBSD: boot2.c,v 1.69 2017/11/08 18:31:00 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -403,6 +403,7 @@ command_help(char *arg)
 	printf("commands are:\n"
 	   "boot [xdNx:][filename] [-12acdqsvxz]\n"
 	   " (ex. \"hd0a:netbsd.old -s\"\n"
+	   "pkboot [xdNx:][filename] [-12acdqsvxz]\n"
 #if LIBSA_ENABLE_LS_OP
 	   "ls [path]\n"
 #endif



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

2017-11-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov  8 18:29:04 UTC 2017

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

Log Message:
Don't fall through.


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

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

Modified files:

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.52 src/sys/arch/amd64/amd64/vector.S:1.53
--- src/sys/arch/amd64/amd64/vector.S:1.52	Mon Oct 30 17:06:42 2017
+++ src/sys/arch/amd64/amd64/vector.S	Wed Nov  8 18:29:04 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: vector.S,v 1.52 2017/10/30 17:06:42 maxv Exp $	*/
+/*	$NetBSD: vector.S,v 1.53 2017/11/08 18:29:04 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -140,6 +140,7 @@ IDTVEC(intr_lapic_ipi)
 	movl	CPUVAR(ILEVEL),%ebx
 	cmpl	$IPL_HIGH,%ebx
 	jae	2f
+	jmp	1f
 IDTVEC_END(intr_lapic_ipi)
 IDTVEC(resume_lapic_ipi)
 1:
@@ -223,6 +224,7 @@ IDTVEC(intr_lapic_ltimer)
 	movl	CPUVAR(ILEVEL),%ebx
 	cmpl	$IPL_CLOCK,%ebx
 	jae	2f
+	jmp	1f
 IDTVEC_END(intr_lapic_ltimer)
 IDTVEC(resume_lapic_ltimer)
 1:



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

2017-11-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov  8 17:55:54 UTC 2017

Modified Files:
src/sys/arch/x86/include: cpu_extended_state.h

Log Message:
remove vestige


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/include/cpu_extended_state.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/cpu_extended_state.h
diff -u src/sys/arch/x86/include/cpu_extended_state.h:1.14 src/sys/arch/x86/include/cpu_extended_state.h:1.15
--- src/sys/arch/x86/include/cpu_extended_state.h:1.14	Tue Oct 31 18:30:36 2017
+++ src/sys/arch/x86/include/cpu_extended_state.h	Wed Nov  8 17:55:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_extended_state.h,v 1.14 2017/10/31 18:30:36 maxv Exp $	*/
+/*	$NetBSD: cpu_extended_state.h,v 1.15 2017/11/08 17:55:54 maxv Exp $	*/
 
 #ifndef _X86_CPU_EXTENDED_STATE_H_
 #define _X86_CPU_EXTENDED_STATE_H_
@@ -114,8 +114,7 @@ struct fxsave {
 	uint32_t fx_mxcsr_mask;
 	struct fpaccfx fx_87_ac[8];	/* 8 x87 registers */
 	struct xmmreg fx_xmm[16];	/* XMM regs (8 in 32bit modes) */
-	uint8_t fx_rsvd[48];
-	uint8_t fx_kernel[48];	/* Not written by the hardware */
+	uint8_t fx_rsvd[96];
 } __aligned(16);
 __CTASSERT_NOLINT(sizeof(struct fxsave) == 512);
 



CVS commit: src/sys/arch

2017-11-08 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov  8 17:52:22 UTC 2017

Modified Files:
src/sys/arch/x86/x86: cpu.c fpu.c identcpu.c
src/sys/arch/xen/x86: cpu.c

Log Message:
Call fpuinit_mxcsr_mask in cpu_init, after cr4 is initialized, but before
touching xcr0. Then use clts/stts instead of modifying cr0, and enable the
mxcsr_mask detection on Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/xen/x86/cpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.138 src/sys/arch/x86/x86/cpu.c:1.139
--- src/sys/arch/x86/x86/cpu.c:1.138	Tue Oct 17 07:33:44 2017
+++ src/sys/arch/x86/x86/cpu.c	Wed Nov  8 17:52:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.138 2017/10/17 07:33:44 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.139 2017/11/08 17:52:22 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.138 2017/10/17 07:33:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.139 2017/11/08 17:52:22 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -541,6 +541,7 @@ cpu_childdetached(device_t self, device_
 void
 cpu_init(struct cpu_info *ci)
 {
+	extern int x86_fpu_save;
 	uint32_t cr4 = 0;
 
 	lcr0(rcr0() | CR0_WP);
@@ -584,6 +585,10 @@ cpu_init(struct cpu_info *ci)
 		lcr4(cr4);
 	}
 
+	if (x86_fpu_save >= FPU_SAVE_FXSAVE) {
+		fpuinit_mxcsr_mask();
+	}
+
 	/* If xsave is enabled, enable all fpu features */
 	if (cr4 & CR4_OSXSAVE)
 		wrxcr(0, x86_xsave_features & XCR0_FPU);

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.24 src/sys/arch/x86/x86/fpu.c:1.25
--- src/sys/arch/x86/x86/fpu.c:1.24	Sat Nov  4 08:58:30 2017
+++ src/sys/arch/x86/x86/fpu.c	Wed Nov  8 17:52:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.24 2017/11/04 08:58:30 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.25 2017/11/08 17:52:22 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.24 2017/11/04 08:58:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.25 2017/11/08 17:52:22 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -233,23 +233,21 @@ fpuinit(struct cpu_info *ci)
 void
 fpuinit_mxcsr_mask(void)
 {
-#ifndef XEN
 	union savefpu fpusave __aligned(16);
-	u_long cr0, psl;
+	u_long psl;
 
 	memset(&fpusave, 0, sizeof(fpusave));
 
 	/* Disable interrupts, and enable FPU */
 	psl = x86_read_psl();
 	x86_disable_intr();
-	cr0 = rcr0();
-	lcr0(cr0 & ~(CR0_EM|CR0_TS));
+	clts();
 
 	/* Fill in the FPU area */
 	fxsave(&fpusave);
 
 	/* Restore previous state */
-	lcr0(cr0);
+	stts();
 	x86_write_psl(psl);
 
 	if (fpusave.sv_xmm.fx_mxcsr_mask == 0) {
@@ -257,12 +255,6 @@ fpuinit_mxcsr_mask(void)
 	} else {
 		x86_fpu_mxcsr_mask = fpusave.sv_xmm.fx_mxcsr_mask;
 	}
-#else
-	/*
-	 * XXX: Does the detection above work on Xen?
-	 */
-	x86_fpu_mxcsr_mask = __INITIAL_MXCSR_MASK__;
-#endif
 }
 
 /*

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.64 src/sys/arch/x86/x86/identcpu.c:1.65
--- src/sys/arch/x86/x86/identcpu.c:1.64	Fri Nov  3 16:21:01 2017
+++ src/sys/arch/x86/x86/identcpu.c	Wed Nov  8 17:52:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.64 2017/11/03 16:21:01 kre Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.65 2017/11/08 17:52:22 maxv 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.64 2017/11/03 16:21:01 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.65 2017/11/08 17:52:22 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -753,8 +753,6 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	x86_fpu_save = FPU_SAVE_FXSAVE;
 
-	fpuinit_mxcsr_mask();
-
 	/* See if xsave (for AVX) is supported */
 	if ((ci->ci_feat_val[1] & CPUID2_XSAVE) == 0)
 		return;

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.112 src/sys/arch/xen/x86/cpu.c:1.113
--- src/sys/arch/xen/x86/cpu.c:1.112	Sun Sep 17 09:04:51 2017
+++ src/sys/arch/xen/x86/cpu.c	Wed Nov  8 17:52:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.112 2017/09/17 09:04:51 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.113 2017/11/08 17:52:22 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.112 2017/09/17 09:04:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.113 2017/11/08 17:52:22 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -525,6 +525,7 @@ cpu_attach_common(device_t parent, devic
 void
 cpu_init(s

CVS commit: src/sys/netipsec

2017-11-08 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov  8 10:35:30 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Mark key_timehandler_ch callout as MP-safe (just forgot to do so)


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.234 src/sys/netipsec/key.c:1.235
--- src/sys/netipsec/key.c:1.234	Tue Oct  3 08:56:52 2017
+++ src/sys/netipsec/key.c	Wed Nov  8 10:35:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.234 2017/10/03 08:56:52 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.235 2017/11/08 10:35:30 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.234 2017/10/03 08:56:52 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.235 2017/11/08 10:35:30 ozaki-r Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -8106,7 +8106,7 @@ key_do_init(void)
 
 	pfkeystat_percpu = percpu_alloc(sizeof(uint64_t) * PFKEY_NSTATS);
 
-	callout_init(&key_timehandler_ch, 0);
+	callout_init(&key_timehandler_ch, CALLOUT_MPSAFE);
 	error = workqueue_create(&key_timehandler_wq, "key_timehandler",
 	key_timehandler_work, NULL, PRI_SOFTNET, IPL_SOFTNET, WQ_MPSAFE);
 	if (error != 0)



CVS commit: src/sys/dev/pci/ixgbe

2017-11-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  8 08:41:13 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_x550.c

Log Message:
 Fix a bug that Denverton which uses firmware don't linkup if the media is
forced to 100baseTX-FDX or 10baseT-FDX. As I wrote in ixgbe_phy.c rev. 1.13,
popular switches and OSes don't use auto-negotiation if the media is forced to
100BASE-TX or 10BASE-T. Do the same thing. But, if we don't set
FW_PHY_ACT_SETUP_LINK_AN in ixgbe_setup_fw_link(), the firmware wrongly set
BMCR register. Two problems are observed:

a) FDX may not be set.
b) BMCR_SPEED1 (bit 6) is always cleard.

+ ---+--+---+-+
|request | BMCR | BMCR spd | BMCR |
|| (HEX)| (in bits)|  FDX |
++--+--+--+
|   10M  |  |  10M(00) |0 |
|   10M  | 2100 | 100M(01) |1 |
|  100M  |  |  10M(00) |0 |
|  100M  | 0100 |  10M(00) |1 |
+--+--+

 To avoid this problem, after sending request to firmware, check BMCR register
and fix the setting if it's required.

 Before this change:

+--+-+
|  |denverton|
|  +-++-++
|  |   auto  | 1G FDX | 100 FDX | 10 FDX |
+-++-++-++
| |   auto |  1G FDX | 1G FDX | 100 FDX | 10FDX/down(NG) |
| ++-++-++
| | 1G FDX |  1G FDX | 1G FDX |down |   down |
| link++-++-++
| partner |100 FDX | down(*1)|   down | down(NG)|   down |
| ++-++-++
| | 10 FDX | down(*1)|   down |down |   down(NG) |
+-++-++-++
(Observed on: NVM Image Version 0.05 ID 0x8, NVM Map version 1.16,
OEM NVM Image version 0.06, ETrackID 887c)

 After this change:

+--+-+
|  |denverton|
|  +-++-++
|  |   auto  | 1G FDX | 100 FDX | 10 FDX |
+-++-++-++
| |   auto |  1G FDX | 1G FDX | 100 FDX | 10 FDX |
| ++-++-++
| | 1G FDX |  1G FDX | 1G FDX |down |   down |
| link++-++-++
| partner |100 FDX | down(*1)|   down | 100 FDX |   down |
| ++-++-++
| | 10 FDX | down(*1)|   down |down | 10 FDX |
+-++-++-++
*1): may be correct because ixg doesn't support half duplex.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_x550.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.6 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.7
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.6	Wed Aug 30 08:49:18 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Wed Nov  8 08:41:13 2017
@@ -38,6 +38,7 @@
 #include "ixgbe_api.h"
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
+#include 
 
 static s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed);
 static s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
@@ -788,6 +789,8 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_h
 	return ret_val;
 }
 
+#define IXGBE_DENVERTON_WA 1
+
 /**
  * ixgbe_setup_fw_link - Setup firmware-controlled PHYs
  * @hw: pointer to hardware structure
@@ -796,6 +799,10 @@ static s32 ixgbe_setup_fw_link(struct ix
 {
 	u32 setup[FW_PHY_ACT_DATA_COUNT] = { 0 };
 	s32 rc;
+#ifdef IXGBE_DENVERTON_WA
+	s32 ret_val;
+	u16 phydata;
+#endif
 	u16 i;
 
 	if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw))
@@ -833,9 +840,67 @@ static s32 ixgbe_setup_fw_link(struct ix
 	if (hw->phy.eee_speeds_advertised)
 		setup[0] |= FW_PHY_ACT_SETUP_LINK_EEE;
 
+#ifdef IXGBE_DENVERTON_WA
+	/* Don't use auto-nego for 10/100Mbps */
+	if ((hw->phy.autoneg_advertised == IXGBE_LINK_SPEED_100_FULL)
+	|| (hw->phy.autoneg_advertised == IXGBE_LINK_SPEED_10_FULL)) {
+		setup[0] &= ~FW_PHY_ACT_SETUP_LINK_AN;
+		setup[0] &= ~FW_PHY