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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:14:34 UTC 2022

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

Log Message:
Print ECC, PHY and temp error log using with ratecheck().

 - The ratecheck() is for just in case. All of the interrupts might occur
   only once, but I don't know whether it's true or not. For the fan failure,
   it seems it occurs only once.
 - All of the interval is 60s.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pci/ixgbe/ixgbe.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/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.311 src/sys/dev/pci/ixgbe/ixgbe.c:1.312
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.311	Thu Mar 10 04:00:32 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 04:14:34 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.312 2022/03/10 04:14:34 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.312 2022/03/10 04:14:34 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -424,6 +424,9 @@ static int (*ixgbe_ring_empty)(struct if
 #endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
 
+/* Interval between reports of errors */
+static const struct timeval ixgbe_errlog_intrvl = { 60, 0 };	/* 60s */
+
 /
  * ixgbe_initialize_rss_mapping
  /
@@ -3230,10 +3233,10 @@ ixgbe_intr_admin_common(struct adapter *
 #endif
 
 		if (eicr & IXGBE_EICR_ECC) {
-			device_printf(adapter->dev,
-			"CRITICAL: ECC ERROR!! Please Reboot!!\n");
-			/* Disable interrupt to prevent log spam */
-			*eims_disable |= IXGBE_EICR_ECC;
+			if (ratecheck(>lasterr_time,
+			_errlog_intrvl))
+device_printf(adapter->dev,
+"CRITICAL: ECC ERROR!! Please Reboot!!\n");
 		}
 
 		/* Check for over temp condition */
@@ -3242,32 +3245,32 @@ ixgbe_intr_admin_common(struct adapter *
 			case ixgbe_mac_X550EM_a:
 if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a))
 	break;
-/* Disable interrupt to prevent log spam */
-*eims_disable |= IXGBE_EICR_GPI_SDP0_X550EM_a;
-
 retval = hw->phy.ops.check_overtemp(hw);
 if (retval != IXGBE_ERR_OVERTEMP)
 	break;
-device_printf(adapter->dev,
-"CRITICAL: OVER TEMP!! "
-"PHY IS SHUT DOWN!!\n");
-device_printf(adapter->dev,
-"System shutdown required!\n");
+if (ratecheck(>lasterr_time,
+_errlog_intrvl)) {
+	device_printf(adapter->dev,
+	"CRITICAL: OVER TEMP!! "
+	"PHY IS SHUT DOWN!!\n");
+	device_printf(adapter->dev,
+	"System shutdown required!\n");
+}
 break;
 			default:
 if (!(eicr & IXGBE_EICR_TS))
 	break;
-/* Disable interrupt to prevent log spam */
-*eims_disable |= IXGBE_EIMS_TS;
-
 retval = hw->phy.ops.check_overtemp(hw);
 if (retval != IXGBE_ERR_OVERTEMP)
 	break;
-device_printf(adapter->dev,
-"CRITICAL: OVER TEMP!! "
-"PHY IS SHUT DOWN!!\n");
-device_printf(adapter->dev,
-"System shutdown required!\n");
+if (ratecheck(>lasterr_time,
+_errlog_intrvl)) {
+	device_printf(adapter->dev,
+	"CRITICAL: OVER TEMP!! "
+	"PHY IS SHUT DOWN!!\n");
+	device_printf(adapter->dev,
+	"System shutdown required!\n");
+}
 break;
 			}
 		}
@@ -3281,13 +3284,8 @@ ixgbe_intr_admin_common(struct adapter *
 	}
 
 	/* Check for fan failure */
-	if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) {
-		retval = ixgbe_check_fan_failure(adapter, eicr, true);
-		if (retval == IXGBE_ERR_FAN_FAILURE) {
-			/* Disable interrupt to prevent log spam */
-			*eims_disable |= IXGBE_EIMS_GPI_SDP1_BY_MAC(hw);
-		}
-	}
+	if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL)
+		ixgbe_check_fan_failure(adapter, eicr, true);
 
 	/* External PHY interrupt */
 	if ((hw->phy.type == ixgbe_phy_x550em_ext_t) &&
@@ -6609,13 +6607,20 @@ ixgbe_check_fan_failure(struct adapter *
 	mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(>hw) :
 	IXGBE_ESDP_SDP1;
 
-	if (reg & mask) {
+	if ((reg & mask) == 0)
+		return IXGBE_SUCCESS;
+
+	/*
+	 * Use ratecheck() just in case interrupt occur frequently.
+	 * When EXPX9501AT's fan stopped, interrupt occurred only once,
+	 * an red LED on the board turned on and link never up until
+	 * power off.
+	 */
+	if (ratecheck(>lasterr_time, _errlog_intrvl))
 		device_printf(adapter->dev,
 		"\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
-		return IXGBE_ERR_FAN_FAILURE;
-	}
 
-	return IXGBE_SUCCESS;
+	

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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:14:34 UTC 2022

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

Log Message:
Print ECC, PHY and temp error log using with ratecheck().

 - The ratecheck() is for just in case. All of the interrupts might occur
   only once, but I don't know whether it's true or not. For the fan failure,
   it seems it occurs only once.
 - All of the interval is 60s.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pci/ixgbe/ixgbe.h

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:00:32 UTC 2022

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

Log Message:
 Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.311 src/sys/dev/pci/ixgbe/ixgbe.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.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.310 src/sys/dev/pci/ixgbe/ixgbe.c:1.311
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.310	Thu Mar 10 03:58:52 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 04:00:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3218,6 +3218,7 @@ ixgbe_intr_admin_common(struct adapter *
 	}
 
 	if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
+#ifdef IXGBE_FDIR
 		if ((adapter->feat_en & IXGBE_FEATURE_FDIR) &&
 		(eicr & IXGBE_EICR_FLOW_DIR)) {
 			if (!atomic_cas_uint(>fdir_reinit, 0, 1)) {
@@ -3226,6 +3227,7 @@ ixgbe_intr_admin_common(struct adapter *
 *eims_disable |= IXGBE_EIMS_FLOW_DIR;
 			}
 		}
+#endif
 
 		if (eicr & IXGBE_EICR_ECC) {
 			device_printf(adapter->dev,



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:00:32 UTC 2022

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

Log Message:
 Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR.


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

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:58:52 UTC 2022

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

Log Message:
 Move the definition of eicr_mask variable. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/dev/pci/ixgbe/ixgbe.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.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.309 src/sys/dev/pci/ixgbe/ixgbe.c:1.310
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.309	Thu Mar 10 03:57:33 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 03:58:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3179,7 +3179,6 @@ static void
 ixgbe_intr_admin_common(struct adapter *adapter, u32 eicr, u32 *eims_disable)
 {
 	struct ixgbe_hw *hw = >hw;
-	u32		eicr_mask;
 	u32		task_requests = 0;
 	s32		retval;
 
@@ -3190,6 +3189,8 @@ ixgbe_intr_admin_common(struct adapter *
 	}
 
 	if (ixgbe_is_sfp(hw)) {
+		u32 eicr_mask;
+
 		/* Pluggable optics-related interrupt */
 		if (hw->mac.type >= ixgbe_mac_X540)
 			eicr_mask = IXGBE_EICR_GPI_SDP0_X540;



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:58:52 UTC 2022

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

Log Message:
 Move the definition of eicr_mask variable. No functional change.


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

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:57:33 UTC 2022

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

Log Message:
 Modify comment to clarify EIAC setting.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/dev/pci/ixgbe/ixgbe.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.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.308 src/sys/dev/pci/ixgbe/ixgbe.c:1.309
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.308	Thu Mar 10 03:53:46 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 03:57:33 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5194,8 +5194,9 @@ ixgbe_enable_intr(struct adapter *adapte
 	/* With MSI-X we use auto clear */
 	if (adapter->msix_mem) {
 		/*
-		 * It's not required to set TCP_TIMER because we don't use
-		 * it.
+		 * We use auto clear for RTX_QUEUE only. Don't use other
+		 * interrupts (e.g. link interrupt). BTW, we don't use
+		 *  TCP_TIMER interrupt itself.
 		 */
 		IXGBE_WRITE_REG(hw, IXGBE_EIAC, IXGBE_EIMS_RTX_QUEUE);
 	}



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:57:33 UTC 2022

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

Log Message:
 Modify comment to clarify EIAC setting.


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

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:53:46 UTC 2022

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

Log Message:
Add IFF_RUNNING check in ixgbe_legacy_irq() again.

 - This change might fix small race between ifconfig down and an interrupt.
   If the race really exists, txeof() is called and it's not so dangerous.
   The rxeof is blocked in the beginning of ixgbe_handle_que().
 - This change makes consistent with ixgbe_handle_que().
 - Found and OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/sys/dev/pci/ixgbe/ixgbe.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.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.307 src/sys/dev/pci/ixgbe/ixgbe.c:1.308
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.307	Wed Feb 16 10:29:13 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 03:53:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.307 2022/02/16 10:29:13 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.307 2022/02/16 10:29:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5262,6 +5262,7 @@ ixgbe_legacy_irq(void *arg)
 	struct ix_queue *que = arg;
 	struct adapter	*adapter = que->adapter;
 	struct ixgbe_hw	*hw = >hw;
+	struct ifnet	*ifp = adapter->ifp;
 	struct		tx_ring *txr = adapter->tx_rings;
 	u32		eicr;
 	u32		eims_orig;
@@ -5286,7 +5287,8 @@ ixgbe_legacy_irq(void *arg)
 	IXGBE_EVC_ADD(>stats.pf.legint, 1);
 
 	/* Queue (0) intr */
-	if ((eicr & IXGBE_EIMC_RTX_QUEUE) != 0) {
+	if (((ifp->if_flags & IFF_RUNNING) != 0) &&
+	(eicr & IXGBE_EIMC_RTX_QUEUE) != 0) {
 		IXGBE_EVC_ADD(>irqs, 1);
 
 		/*



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:53:46 UTC 2022

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

Log Message:
Add IFF_RUNNING check in ixgbe_legacy_irq() again.

 - This change might fix small race between ifconfig down and an interrupt.
   If the race really exists, txeof() is called and it's not so dangerous.
   The rxeof is blocked in the beginning of ixgbe_handle_que().
 - This change makes consistent with ixgbe_handle_que().
 - Found and OK'd by knakahara.


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

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



CVS commit: src/sys/dev/pci

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 10 00:14:34 UTC 2022

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

Log Message:
gffb(4): Nix membar_sync and explain what's going on here.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/gffb.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/gffb.c
diff -u src/sys/dev/pci/gffb.c:1.18 src/sys/dev/pci/gffb.c:1.19
--- src/sys/dev/pci/gffb.c:1.18	Thu Mar 10 00:14:25 2022
+++ src/sys/dev/pci/gffb.c	Thu Mar 10 00:14:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $	*/
+/*	$NetBSD: gffb.c,v 1.19 2022/03/10 00:14:33 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Michael Lorenz
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.19 2022/03/10 00:14:33 riastradh Exp $");
 
 #include 
 #include 
@@ -1133,12 +1133,23 @@ gffb_putchar(void *cookie, int row, int 
 	if (rv == GC_OK)
 		return;
 
+	/*
+	 * Use gffb_sync to wait for the engine to become idle before
+	 * we start scribbling into VRAM -- we woudn't want to stomp on
+	 * a scroll in progress or a prior glyphcache_add that hasn't
+	 * completed yet on the GPU.
+	 */
 	mutex_enter(>sc_lock);
 	gffb_sync(sc);
 	sc->sc_putchar(cookie, row, col, c, attr);
-	membar_sync();
 	mutex_exit(>sc_lock);
 
+	/*
+	 * If glyphcache_try asked us to, cache the newly written
+	 * character.  This will issue a gffb_bitblt which will wait
+	 * for our CPU writes to the framebuffer in VRAM to complete
+	 * before triggering GPU reads from the framebuffer in VRAM.
+	 */
 	if (rv == GC_ADD) {
 		glyphcache_add(>sc_gc, c, x, y);
 	}



CVS commit: src/sys/dev/pci

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 10 00:14:34 UTC 2022

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

Log Message:
gffb(4): Nix membar_sync and explain what's going on here.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/gffb.c

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



CVS commit: src/sys/dev/pci

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 10 00:14:25 UTC 2022

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

Log Message:
gffb(4): Use bus_space_barrier, not membar_sync.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/gffb.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/gffb.c
diff -u src/sys/dev/pci/gffb.c:1.17 src/sys/dev/pci/gffb.c:1.18
--- src/sys/dev/pci/gffb.c:1.17	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/gffb.c	Thu Mar 10 00:14:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gffb.c,v 1.17 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Michael Lorenz
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.17 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.18 2022/03/10 00:14:25 riastradh Exp $");
 
 #include 
 #include 
@@ -684,10 +684,12 @@ gffb_dma_kickoff(struct gffb_softc *sc)
 
 	if (sc->sc_current != sc->sc_put) {
 		sc->sc_put = sc->sc_current;
-		membar_sync();
+		bus_space_barrier(sc->sc_memt, sc->sc_fbh, 0, 0x100,
+		BUS_SPACE_BARRIER_WRITE);
 		(void)*sc->sc_fbaddr;
 		GFFB_WRITE_4(GFFB_FIFO_PUT, sc->sc_put);
-		membar_sync();
+		bus_space_barrier(sc->sc_memt, sc->sc_regh, GFFB_FIFO_PUT, 4,
+		BUS_SPACE_BARRIER_WRITE);
 	}
 }
 



CVS commit: src/sys/dev/pci

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 10 00:14:25 UTC 2022

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

Log Message:
gffb(4): Use bus_space_barrier, not membar_sync.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/gffb.c

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



CVS commit: src/sys/arch

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 10 00:14:16 UTC 2022

Modified Files:
src/sys/arch/evbppc/virtex: dcr.c dcr.h
src/sys/arch/powerpc/include: bus_defs.h bus_funcs.h
src/sys/arch/powerpc/powerpc: bus_space.c

Log Message:
powerpc: Implement bus_space_barrier as eieio.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/virtex/dcr.c \
src/sys/arch/evbppc/virtex/dcr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/include/bus_defs.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/powerpc/include/bus_funcs.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/powerpc/bus_space.c

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

Modified files:

Index: src/sys/arch/evbppc/virtex/dcr.c
diff -u src/sys/arch/evbppc/virtex/dcr.c:1.2 src/sys/arch/evbppc/virtex/dcr.c:1.3
--- src/sys/arch/evbppc/virtex/dcr.c:1.2	Fri Jul  1 19:03:50 2011
+++ src/sys/arch/evbppc/virtex/dcr.c	Thu Mar 10 00:14:16 2022
@@ -1,4 +1,4 @@
-/* 	$NetBSD: dcr.c,v 1.2 2011/07/01 19:03:50 dyoung Exp $ */
+/* 	$NetBSD: dcr.c,v 1.3 2022/03/10 00:14:16 riastradh Exp $ */
 
 /*
  * Copyright (c) 2006 Jachym Holecek
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dcr.c,v 1.2 2011/07/01 19:03:50 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dcr.c,v 1.3 2022/03/10 00:14:16 riastradh Exp $");
 
 #include 
 #include 
@@ -66,3 +66,10 @@ dcr_subregion(bus_space_tag_t bst, bus_s
 
 	return (0);
 }
+
+void
+dcr_barrier(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t offset,
+bus_size_t size, int flags)
+{
+	/* XXX EIEIO? */
+}
Index: src/sys/arch/evbppc/virtex/dcr.h
diff -u src/sys/arch/evbppc/virtex/dcr.h:1.2 src/sys/arch/evbppc/virtex/dcr.h:1.3
--- src/sys/arch/evbppc/virtex/dcr.h:1.2	Thu Oct 21 13:21:54 2021
+++ src/sys/arch/evbppc/virtex/dcr.h	Thu Mar 10 00:14:16 2022
@@ -1,4 +1,4 @@
-/* 	$NetBSD: dcr.h,v 1.2 2021/10/21 13:21:54 andvar Exp $ */
+/* 	$NetBSD: dcr.h,v 1.3 2022/03/10 00:14:16 riastradh Exp $ */
 
 /*
  * Copyright (c) 2006 Jachym Holecek
@@ -52,6 +52,8 @@ int 	dcr_subregion(bus_space_tag_t, bus_
 int 	dcr_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
 	bus_space_handle_t *);
 void 	dcr_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
+void	dcr_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+	bus_size_t, int);
 
 /* Bus space tag contents, one tag per DCR device. */
 #define DCR_BST_BODY(base, read, write) \

Index: src/sys/arch/powerpc/include/bus_defs.h
diff -u src/sys/arch/powerpc/include/bus_defs.h:1.4 src/sys/arch/powerpc/include/bus_defs.h:1.5
--- src/sys/arch/powerpc/include/bus_defs.h:1.4	Mon Jul  6 09:34:17 2020
+++ src/sys/arch/powerpc/include/bus_defs.h	Thu Mar 10 00:14:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.4 2020/07/06 09:34:17 rin Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.5 2022/03/10 00:14:16 riastradh Exp $	*/
 /*	$OpenBSD: bus.h,v 1.1 1997/10/13 10:53:42 pefo Exp $	*/
 
 /*-
@@ -220,6 +220,9 @@ struct powerpc_bus_space {
 	const struct powerpc_bus_space_set *pbs_set;
 	const struct powerpc_bus_space_set *pbs_set_stream;
 	const struct powerpc_bus_space_copy *pbs_copy;
+
+	void (*pbs_barrier)(bus_space_tag_t, bus_space_handle_t, bus_size_t,
+	bus_size_t, int);
 };
 
 #define _BUS_SPACE_STRIDE(t, o) \

Index: src/sys/arch/powerpc/include/bus_funcs.h
diff -u src/sys/arch/powerpc/include/bus_funcs.h:1.1 src/sys/arch/powerpc/include/bus_funcs.h:1.2
--- src/sys/arch/powerpc/include/bus_funcs.h:1.1	Fri Jul  1 17:10:00 2011
+++ src/sys/arch/powerpc/include/bus_funcs.h	Thu Mar 10 00:14:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_funcs.h,v 1.1 2011/07/01 17:10:00 dyoung Exp $	*/
+/*	$NetBSD: bus_funcs.h,v 1.2 2022/03/10 00:14:16 riastradh Exp $	*/
 /*	$OpenBSD: bus.h,v 1.1 1997/10/13 10:53:42 pefo Exp $	*/
 
 /*-
@@ -485,7 +485,7 @@ void bus_space_mallocok(void);
  *
  */
 #define	bus_space_barrier(t, h, o, l, f)	\
-	((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
+	((*(t)->pbs_barrier)((t), (h), (o), (l), (f)))
 
 #endif	/* !__HAVE_LOCAL_BUS_SPACE */
 

Index: src/sys/arch/powerpc/powerpc/bus_space.c
diff -u src/sys/arch/powerpc/powerpc/bus_space.c:1.38 src/sys/arch/powerpc/powerpc/bus_space.c:1.39
--- src/sys/arch/powerpc/powerpc/bus_space.c:1.38	Mon Jul  6 10:31:24 2020
+++ src/sys/arch/powerpc/powerpc/bus_space.c	Thu Mar 10 00:14:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.38 2020/07/06 10:31:24 rin Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.39 2022/03/10 00:14:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _POWERPC_BUS_SPACE_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.38 2020/07/06 10:31:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.39 2022/03/10 00:14:16 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -395,6 +395,8 @@ static void memio_unmap(bus_space_tag_t,
 static int 

CVS commit: src/sys/arch

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 10 00:14:16 UTC 2022

Modified Files:
src/sys/arch/evbppc/virtex: dcr.c dcr.h
src/sys/arch/powerpc/include: bus_defs.h bus_funcs.h
src/sys/arch/powerpc/powerpc: bus_space.c

Log Message:
powerpc: Implement bus_space_barrier as eieio.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/virtex/dcr.c \
src/sys/arch/evbppc/virtex/dcr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/include/bus_defs.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/powerpc/include/bus_funcs.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/powerpc/bus_space.c

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



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

2022-03-09 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Mar  9 23:09:15 UTC 2022

Modified Files:
src/sys/arch/arm/xscale: pxa2x0_lcd.h

Log Message:
s/Horizontao/Horizontal/ in comment and removing misplaced "pxel" word.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/xscale/pxa2x0_lcd.h

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

Modified files:

Index: src/sys/arch/arm/xscale/pxa2x0_lcd.h
diff -u src/sys/arch/arm/xscale/pxa2x0_lcd.h:1.10 src/sys/arch/arm/xscale/pxa2x0_lcd.h:1.11
--- src/sys/arch/arm/xscale/pxa2x0_lcd.h:1.10	Fri Jul  1 20:32:51 2011
+++ src/sys/arch/arm/xscale/pxa2x0_lcd.h	Wed Mar  9 23:09:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_lcd.h,v 1.10 2011/07/01 20:32:51 dyoung Exp $ */
+/* $NetBSD: pxa2x0_lcd.h,v 1.11 2022/03/09 23:09:15 andvar Exp $ */
 /*
  * Copyright (c) 2002  Genetec Corporation.  All rights reserved.
  * Written by Hiroyuki Bessho for Genetec Corporation.
@@ -111,9 +111,9 @@ struct lcd_panel_geometry {
 	short pixel_clock_div;		/* pixel clock divider */
 	short ac_bias;			/* AC bias pin frequency */
 
-	short hsync_pulse_width;	/* Horizontao sync pulse width */
+	short hsync_pulse_width;	/* Horizontal sync pulse width */
 	short beg_line_wait;		/* beginning of line wait (BLW) */
-	short end_line_wait;		/* end of line pxel wait (ELW) */
+	short end_line_wait;		/* end of line wait (ELW) */
 
 	short vsync_pulse_width;	/* vertical sync pulse width */
 	short beg_frame_wait;		/* beginning of frame wait (BFW) */



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

2022-03-09 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Mar  9 23:09:15 UTC 2022

Modified Files:
src/sys/arch/arm/xscale: pxa2x0_lcd.h

Log Message:
s/Horizontao/Horizontal/ in comment and removing misplaced "pxel" word.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/xscale/pxa2x0_lcd.h

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



CVS commit: src/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:55:32 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add note on optical media lockup fix for UDF


To generate a diff of this commit:
cvs rdiff -u -r1.2863 -r1.2864 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2863 src/doc/CHANGES:1.2864
--- src/doc/CHANGES:1.2863	Wed Mar  9 22:52:28 2022
+++ src/doc/CHANGES	Wed Mar  9 22:55:32 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2863 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2864 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -462,7 +462,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		Motor Driver [brad 20211207]
 	acpi(4): Updated ACPICA to 20211217. [christos 20211218]
 	udf: Fix corruption when writing to Microsoft Windows 10 formatted
-		recordables [reinoud 20211216]
+		recordables. [reinoud 20211216]
 	mcommphy(4): Add driver for Motorcomm YT8511 GbE PHY.
 		[jmcneill 20220103]
 	eqos(4): Add driver for DesignWare Ethernet Quality-of-Service
@@ -478,5 +478,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	expat: Import 2.4.6 (security fixes). [christos 20220223]
 	OpenSSH: Import 8.9. [christos 20220223]
 	udf: Be bugcompatible with Microsoft Windows 10 so it can read our
-		updated recordable media [reinoud 20220309]
+		updated recordable media. [reinoud 20220309]
+	udf: Fix locking up CD/DVD burner issue that would lockup the FS.
+		[reinoud 20220309]
 



CVS commit: src/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:55:32 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add note on optical media lockup fix for UDF


To generate a diff of this commit:
cvs rdiff -u -r1.2863 -r1.2864 src/doc/CHANGES

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



CVS commit: src/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:52:28 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add notes on various UDF fixes concerning Windows10 interoperationability with
recordable media.


To generate a diff of this commit:
cvs rdiff -u -r1.2862 -r1.2863 src/doc/CHANGES

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



CVS commit: src/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:52:28 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add notes on various UDF fixes concerning Windows10 interoperationability with
recordable media.


To generate a diff of this commit:
cvs rdiff -u -r1.2862 -r1.2863 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2862 src/doc/CHANGES:1.2863
--- src/doc/CHANGES:1.2862	Wed Feb 23 19:08:48 2022
+++ src/doc/CHANGES	Wed Mar  9 22:52:28 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2862 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2863 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -461,6 +461,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	scmd: Driver and userland utility for the Sparkfun Serial Controlled
 		Motor Driver [brad 20211207]
 	acpi(4): Updated ACPICA to 20211217. [christos 20211218]
+	udf: Fix corruption when writing to Microsoft Windows 10 formatted
+		recordables [reinoud 20211216]
 	mcommphy(4): Add driver for Motorcomm YT8511 GbE PHY.
 		[jmcneill 20220103]
 	eqos(4): Add driver for DesignWare Ethernet Quality-of-Service
@@ -475,3 +477,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	blkdiscard(8): Add tool to access fdiscard(2). [mrg 20220207]
 	expat: Import 2.4.6 (security fixes). [christos 20220223]
 	OpenSSH: Import 8.9. [christos 20220223]
+	udf: Be bugcompatible with Microsoft Windows 10 so it can read our
+		updated recordable media [reinoud 20220309]
+



CVS commit: src/sys/dev/usb

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:19:07 UTC 2022

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

Log Message:
xhci(4): Avoid holding bus lock across usb_delay_ms.

We may still need a mechanism to serialize access to the portsc
registers between xhci_roothub_ctrl and xhci_suspend/resume, but the
bus lock is no longer that, and holding the bus lock across
usb_delay_ms may lead to deadlock by blocking the softints that wake
usb_delay_ms.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/dev/usb/xhci.c

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.159 src/sys/dev/usb/xhci.c:1.160
--- src/sys/dev/usb/xhci.c:1.159	Wed Mar  9 22:17:41 2022
+++ src/sys/dev/usb/xhci.c	Wed Mar  9 22:19:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.159 2022/03/09 22:17:41 riastradh Exp $	*/
+/*	$NetBSD: xhci.c,v 1.160 2022/03/09 22:19:07 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.159 2022/03/09 22:17:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.160 2022/03/09 22:19:07 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -696,16 +696,16 @@ xhci_suspend(device_t self, const pmf_qu
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
-	mutex_enter(>sc_lock);
-
 	/*
 	 * Block issuance of new commands, and wait for all pending
 	 * commands to complete.
 	 */
+	mutex_enter(>sc_lock);
 	KASSERT(sc->sc_suspender == NULL);
 	sc->sc_suspender = curlwp;
 	while (sc->sc_command_addr != 0)
 		cv_wait(>sc_cmdbusy_cv, >sc_lock);
+	mutex_exit(>sc_lock);
 
 	/*
 	 * xHCI Requirements Specification 1.2, May 2019, Sec. 4.23.2:
@@ -739,8 +739,10 @@ xhci_suspend(device_t self, const pmf_qu
 continue;
 
 			/* Stop endpoint.  */
+			mutex_enter(>sc_lock);
 			err = xhci_stop_endpoint_cmd(sc, xs, dci,
 			XHCI_TRB_3_SUSP_EP_BIT);
+			mutex_exit(>sc_lock);
 			if (err) {
 device_printf(self, "failed to stop endpoint"
 " slot %zu dci %zu err %d\n",
@@ -886,8 +888,7 @@ xhci_suspend(device_t self, const pmf_qu
 	/* Success!  */
 	ok = true;
 
-out:	mutex_exit(>sc_lock);
-	return ok;
+out:	return ok;
 }
 
 bool
@@ -901,7 +902,6 @@ xhci_resume(device_t self, const pmf_qua
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
-	mutex_enter(>sc_lock);
 	KASSERT(sc->sc_suspender);
 
 	/*
@@ -1079,14 +1079,16 @@ xhci_resume(device_t self, const pmf_qua
 	}
 
 	/* Resume command issuance.  */
+	mutex_enter(>sc_lock);
+	KASSERT(sc->sc_suspender);
 	sc->sc_suspender = NULL;
 	cv_broadcast(>sc_cmdbusy_cv);
+	mutex_exit(>sc_lock);
 
 	/* Success!  */
 	ok = true;
 
-out:	mutex_exit(>sc_lock);
-	return ok;
+out:	return ok;
 }
 
 bool



CVS commit: src/sys/dev/usb

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:19:07 UTC 2022

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

Log Message:
xhci(4): Avoid holding bus lock across usb_delay_ms.

We may still need a mechanism to serialize access to the portsc
registers between xhci_roothub_ctrl and xhci_suspend/resume, but the
bus lock is no longer that, and holding the bus lock across
usb_delay_ms may lead to deadlock by blocking the softints that wake
usb_delay_ms.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/dev/usb/xhci.c

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



CVS commit: src/sys/dev/usb

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:18:54 UTC 2022

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

Log Message:
ohci(4): Don't flail around with enabling polling in suspend/resume.

This doesn't work -- polling mode only works when all other CPUs are
quiesced and the current one is running sequentially without
preemption.

Also not clear whether this does anything useful.  Maybe we need a
mechanism to block new xfers until resumed, but this wasn't that.


To generate a diff of this commit:
cvs rdiff -u -r1.322 -r1.323 src/sys/dev/usb/ohci.c

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

Modified files:

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.322 src/sys/dev/usb/ohci.c:1.323
--- src/sys/dev/usb/ohci.c:1.322	Wed Mar  9 22:17:41 2022
+++ src/sys/dev/usb/ohci.c	Wed Mar  9 22:18:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.322 2022/03/09 22:17:41 riastradh Exp $	*/
+/*	$NetBSD: ohci.c,v 1.323 2022/03/09 22:18:54 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.322 2022/03/09 22:17:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.323 2022/03/09 22:18:54 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1147,10 +1147,6 @@ ohci_resume(device_t dv, const pmf_qual_
 	ohci_softc_t *sc = device_private(dv);
 	uint32_t ctl;
 
-	mutex_spin_enter(>sc_intr_lock);
-	sc->sc_bus.ub_usepolling++;
-	mutex_spin_exit(>sc_intr_lock);
-
 	/* Some broken BIOSes do not recover these values */
 	OWRITE4(sc, OHCI_HCCA, DMAADDR(>sc_hccadma, 0));
 	OWRITE4(sc, OHCI_CONTROL_HEAD_ED,
@@ -1172,10 +1168,6 @@ ohci_resume(device_t dv, const pmf_qual_
 	usb_delay_ms(>sc_bus, USB_RESUME_RECOVERY);
 	sc->sc_control = sc->sc_intre = 0;
 
-	mutex_spin_enter(>sc_intr_lock);
-	sc->sc_bus.ub_usepolling--;
-	mutex_spin_exit(>sc_intr_lock);
-
 	return true;
 }
 
@@ -1185,10 +1177,6 @@ ohci_suspend(device_t dv, const pmf_qual
 	ohci_softc_t *sc = device_private(dv);
 	uint32_t ctl;
 
-	mutex_spin_enter(>sc_intr_lock);
-	sc->sc_bus.ub_usepolling++;
-	mutex_spin_exit(>sc_intr_lock);
-
 	ctl = OREAD4(sc, OHCI_CONTROL) & ~OHCI_HCFS_MASK;
 	if (sc->sc_control == 0) {
 		/*
@@ -1203,10 +1191,6 @@ ohci_suspend(device_t dv, const pmf_qual
 	OWRITE4(sc, OHCI_CONTROL, ctl);
 	usb_delay_ms(>sc_bus, USB_RESUME_WAIT);
 
-	mutex_spin_enter(>sc_intr_lock);
-	sc->sc_bus.ub_usepolling--;
-	mutex_spin_exit(>sc_intr_lock);
-
 	return true;
 }
 



CVS commit: src/sys/dev/usb

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:18:54 UTC 2022

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

Log Message:
ohci(4): Don't flail around with enabling polling in suspend/resume.

This doesn't work -- polling mode only works when all other CPUs are
quiesced and the current one is running sequentially without
preemption.

Also not clear whether this does anything useful.  Maybe we need a
mechanism to block new xfers until resumed, but this wasn't that.


To generate a diff of this commit:
cvs rdiff -u -r1.322 -r1.323 src/sys/dev/usb/ohci.c

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



CVS commit: src/sys/dev/usb

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:18:13 UTC 2022

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

Log Message:
ehci(4): Omit bus lock around ehci_suspend/resume.

This no longer serializes access to the portsc registers, also used
by ehci_roothub_ctrl, but it does pose a potential deadlock with
softints to wake usb_delay_ms.  So the bus lock doesn't help here,
and may cause deadlock.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/dev/usb/ehci.c

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

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.306 src/sys/dev/usb/ehci.c:1.307
--- src/sys/dev/usb/ehci.c:1.306	Wed Mar  9 22:17:41 2022
+++ src/sys/dev/usb/ehci.c	Wed Mar  9 22:18:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.306 2022/03/09 22:17:41 riastradh Exp $ */
+/*	$NetBSD: ehci.c,v 1.307 2022/03/09 22:18:13 riastradh Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.306 2022/03/09 22:17:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.307 2022/03/09 22:18:13 riastradh Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1451,8 +1451,6 @@ ehci_suspend(device_t dv, const pmf_qual
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-	mutex_enter(>sc_lock);
-
 	for (i = 1; i <= sc->sc_noport; i++) {
 		cmd = EOREAD4(sc, EHCI_PORTSC(i)) & ~EHCI_PS_CLEAR;
 		if ((cmd & EHCI_PS_PO) == 0 && (cmd & EHCI_PS_PE) == EHCI_PS_PE)
@@ -1487,8 +1485,6 @@ ehci_suspend(device_t dv, const pmf_qual
 	if (hcr != EHCI_STS_HCH)
 		printf("%s: config timeout\n", device_xname(dv));
 
-	mutex_exit(>sc_lock);
-
 	return true;
 }
 
@@ -1501,8 +1497,6 @@ ehci_resume(device_t dv, const pmf_qual_
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-	mutex_enter(>sc_lock);
-
 	/* restore things in case the bios sucks */
 	EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0);
 	EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(>sc_fldma, 0));
@@ -1548,8 +1542,6 @@ ehci_resume(device_t dv, const pmf_qual_
 	if (hcr == EHCI_STS_HCH)
 		printf("%s: config timeout\n", device_xname(dv));
 
-	mutex_exit(>sc_lock);
-
 	return true;
 }
 



CVS commit: src/sys/dev/usb

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:18:13 UTC 2022

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

Log Message:
ehci(4): Omit bus lock around ehci_suspend/resume.

This no longer serializes access to the portsc registers, also used
by ehci_roothub_ctrl, but it does pose a potential deadlock with
softints to wake usb_delay_ms.  So the bus lock doesn't help here,
and may cause deadlock.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/dev/usb/ehci.c

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



CVS commit: src/sys

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:17:41 UTC 2022

Modified Files:
src/sys/arch/mips/adm5120/dev: ahci.c
src/sys/dev/ic: sl811hs.c
src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdivar.h usbroothub.c
xhci.c

Log Message:
usb: Provisionally release bus lock around ubm_rhctrl.

This isn't quite correct, but it avoids a deadlock:

- *_roothub_ctrl holds bus lock, waits in usb_delay_ms for kpause
- softint waits for bus lock, holds up kpause wakeup

The deadlock is new since recent changes to hold the bus lock over
upm_start/upm_transfer.  Making this change regresses to other
problems:

- *_suspend/resume and *_roothub_ctrl often touch the same portsc
   registers

- roothub_ctrl_abort needs to wait for ubm_rhctrl to complete.

  When the bus lock was held across both, a noop served here, but we
  can't hold the bus lock across both, so that doesn't work.

However, these problems -- which we've had for a long time -- seem to
be less bad than the deadlock.  So let's avoid the deadlock for now
and then work out another way to serialize suspend/resume/rhctrl and
aborts.

Candidate fix for PR kern/56739.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mips/adm5120/dev/ahci.c
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/ic/sl811hs.c
cvs rdiff -u -r1.305 -r1.306 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.321 -r1.322 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/usb/usbdivar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/usbroothub.c
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/usb/xhci.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/adm5120/dev/ahci.c
diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.30 src/sys/arch/mips/adm5120/dev/ahci.c:1.31
--- src/sys/arch/mips/adm5120/dev/ahci.c:1.30	Thu Mar  3 06:12:11 2022
+++ src/sys/arch/mips/adm5120/dev/ahci.c	Wed Mar  9 22:17:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahci.c,v 1.30 2022/03/03 06:12:11 riastradh Exp $	*/
+/*	$NetBSD: ahci.c,v 1.31 2022/03/09 22:17:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.30 2022/03/03 06:12:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.31 2022/03/09 22:17:41 riastradh Exp $");
 
 #include 
 #include 
@@ -569,8 +569,6 @@ ahci_roothub_ctrl(struct usbd_bus *bus, 
 
 	DPRINTF(D_TRACE, ("SLRCstart "));
 
-	KASSERT(bus->ub_polling || mutex_owned(bus->ub_lock));
-
 	len = UGETW(req->wLength);
 	value = UGETW(req->wValue);
 	index = UGETW(req->wIndex);

Index: src/sys/dev/ic/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.110 src/sys/dev/ic/sl811hs.c:1.111
--- src/sys/dev/ic/sl811hs.c:1.110	Thu Mar  3 06:12:11 2022
+++ src/sys/dev/ic/sl811hs.c	Wed Mar  9 22:17:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sl811hs.c,v 1.110 2022/03/03 06:12:11 riastradh Exp $	*/
+/*	$NetBSD: sl811hs.c,v 1.111 2022/03/09 22:17:41 riastradh Exp $	*/
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.110 2022/03/03 06:12:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.111 2022/03/09 22:17:41 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_slhci.h"
@@ -3195,8 +3195,6 @@ slhci_roothub_ctrl(struct usbd_bus *bus,
 	uint8_t type;
 	int actlen = 0;
 
-	KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
-
 	len = UGETW(req->wLength);
 	value = UGETW(req->wValue);
 	index = UGETW(req->wIndex);

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.305 src/sys/dev/usb/ehci.c:1.306
--- src/sys/dev/usb/ehci.c:1.305	Thu Mar  3 06:12:11 2022
+++ src/sys/dev/usb/ehci.c	Wed Mar  9 22:17:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.305 2022/03/03 06:12:11 riastradh Exp $ */
+/*	$NetBSD: ehci.c,v 1.306 2022/03/09 22:17:41 riastradh Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.305 2022/03/03 06:12:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.306 2022/03/09 22:17:41 riastradh Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1438,6 +1438,9 @@ ehci_activate(device_t self, enum devact
  *
  * Note that this power handler isn't to be registered directly; the
  * bus glue needs to call out to it.
+ *
+ * XXX This should be serialized with ehci_roothub_ctrl's access to the
+ * portsc registers.
  */
 bool
 ehci_suspend(device_t dv, const pmf_qual_t *qual)
@@ -2369,7 +2372,10 @@ ehci_roothub_ctrl(struct usbd_bus *bus, 
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-	KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
+	/*
+	 * XXX This should be serialized with ehci_suspend/resume's
+	 * access to the portsc registers.

CVS commit: src/sys

2022-03-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  9 22:17:41 UTC 2022

Modified Files:
src/sys/arch/mips/adm5120/dev: ahci.c
src/sys/dev/ic: sl811hs.c
src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdivar.h usbroothub.c
xhci.c

Log Message:
usb: Provisionally release bus lock around ubm_rhctrl.

This isn't quite correct, but it avoids a deadlock:

- *_roothub_ctrl holds bus lock, waits in usb_delay_ms for kpause
- softint waits for bus lock, holds up kpause wakeup

The deadlock is new since recent changes to hold the bus lock over
upm_start/upm_transfer.  Making this change regresses to other
problems:

- *_suspend/resume and *_roothub_ctrl often touch the same portsc
   registers

- roothub_ctrl_abort needs to wait for ubm_rhctrl to complete.

  When the bus lock was held across both, a noop served here, but we
  can't hold the bus lock across both, so that doesn't work.

However, these problems -- which we've had for a long time -- seem to
be less bad than the deadlock.  So let's avoid the deadlock for now
and then work out another way to serialize suspend/resume/rhctrl and
aborts.

Candidate fix for PR kern/56739.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mips/adm5120/dev/ahci.c
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/ic/sl811hs.c
cvs rdiff -u -r1.305 -r1.306 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.321 -r1.322 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/usb/usbdivar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/usbroothub.c
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/usb/xhci.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg6/dist/src

2022-03-09 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Mar  9 17:57:50 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_driver.c

Log Message:
Check the PROM for the amount of available VRAM instead of guessing, and use
it all, now that we know we can.

thanks foo bar


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c
diff -u xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.14 xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.15
--- xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.14	Thu Jul 18 18:02:10 2019
+++ xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c	Wed Mar  9 17:57:50 2022
@@ -442,7 +442,8 @@ CG6ScreenInit(SCREEN_INIT_ARGS_DECL)
 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 Cg6Ptr pCg6;
 sbusDevicePtr psdp;
-int ret;
+int ret, prom, len, vmsize;
+char *b;
 
 pCg6 = GET_CG6_FROM_SCRN(pScrn);
 psdp = pCg6->psdp;
@@ -457,6 +458,17 @@ CG6ScreenInit(SCREEN_INIT_ARGS_DECL)
  * usable VRAM ONLY. Works with NetBSD, may crash and burn on other OSes.
  */
 pCg6->vidmem = 2 * 1024 * 1024;
+
+prom = sparcPromInit();
+b = sparcPromGetProperty(>node, "vmsize", );
+if (len == 4 && b != NULL) {
+	memcpy(, b, 4);
+	pCg6->vidmem = vmsize * 1024 * 1024; 	
+}
+
+if (prom)
+	sparcPromClose();
+
 pCg6->fb = xf86MapSbusMem(psdp, CG6_RAM_VOFF, pCg6->vidmem);
 
 if (pCg6->fb == NULL) {



CVS commit: xsrc/external/mit/xf86-video-suncg6/dist/src

2022-03-09 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Mar  9 17:57:50 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_driver.c

Log Message:
Check the PROM for the amount of available VRAM instead of guessing, and use
it all, now that we know we can.

thanks foo bar


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c

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



CVS commit: src/sys/dev/sbus

2022-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar  9 17:53:40 UTC 2022

Modified Files:
src/sys/dev/sbus: cgsix_sbus.c

Log Message:
turns out we can map the full amount of VRAM on a 4MB board even when in
double buffer mode

thanks foo bar


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sbus/cgsix_sbus.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/sbus/cgsix_sbus.c
diff -u src/sys/dev/sbus/cgsix_sbus.c:1.30 src/sys/dev/sbus/cgsix_sbus.c:1.31
--- src/sys/dev/sbus/cgsix_sbus.c:1.30	Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/cgsix_sbus.c	Wed Mar  9 17:53:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgsix_sbus.c,v 1.30 2009/09/17 16:28:12 tsutsui Exp $ */
+/*	$NetBSD: cgsix_sbus.c,v 1.31 2022/03/09 17:53:39 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.30 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.31 2022/03/09 17:53:39 macallan Exp $");
 
 #include 
 #include 
@@ -172,7 +172,7 @@ cgsixattach(device_t parent, device_t se
 	 * we need the address of the framebuffer, no matter if we're console or
 	 * not.
 	 */
-	sc->sc_ramsize = prom_getpropint(node, "fbmapped", 1024 * 1024);
+	sc->sc_ramsize = prom_getpropint(node, "vmsize", 1) * 1024 * 1024;
 	if (sbus_bus_map(sa->sa_bustag,
 			sa->sa_slot,
 			sa->sa_offset + CGSIX_RAM_OFFSET,



CVS commit: src/sys/dev/sbus

2022-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar  9 17:53:40 UTC 2022

Modified Files:
src/sys/dev/sbus: cgsix_sbus.c

Log Message:
turns out we can map the full amount of VRAM on a 4MB board even when in
double buffer mode

thanks foo bar


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sbus/cgsix_sbus.c

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



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

2022-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar  9 10:06:36 UTC 2022

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c

Log Message:
in fdt_cpu_rootconf(), return without doing anything (like setting
"root=something" in boot_args, or booted_device), if booted_device
is already set to something.

this makes raidframe softroot work on evbarm.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/evbarm/fdt/fdt_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/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.87 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.88
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.87	Fri Mar 19 10:23:34 2021
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Wed Mar  9 10:06:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.87 2021/03/19 10:23:34 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.88 2022/03/09 10:06:36 mrg Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.87 2021/03/19 10:23:34 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.88 2022/03/09 10:06:36 mrg Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bootconfig.h"
@@ -879,6 +879,9 @@ fdt_cpu_rootconf(void)
 	deviter_t di;
 	char *ptr;
 
+	if (booted_device != NULL)
+		return;
+
 	for (dev = deviter_first(, 0); dev; dev = deviter_next()) {
 		if (device_class(dev) != DV_DISK)
 			continue;



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

2022-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar  9 10:06:36 UTC 2022

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c

Log Message:
in fdt_cpu_rootconf(), return without doing anything (like setting
"root=something" in boot_args, or booted_device), if booted_device
is already set to something.

this makes raidframe softroot work on evbarm.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/evbarm/fdt/fdt_machdep.c

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



CVS commit: src/sys/dev/raidframe

2022-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar  9 10:04:06 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
merge two debug lines in auto-root selection.


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.401 src/sys/dev/raidframe/rf_netbsdkintf.c:1.402
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.401	Thu Sep  9 23:26:37 2021
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Mar  9 10:04:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.401 2021/09/09 23:26:37 riastradh Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.402 2022/03/09 10:04:06 mrg 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.401 2021/09/09 23:26:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.402 2022/03/09 10:04:06 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -631,11 +631,11 @@ rf_buildroothack(RF_ConfigSet_t *config_
 			candidate_root);
 		} else
 			candidate_root = dksc->sc_dev;
-		DPRINTF("%s: candidate root=%p\n", __func__, candidate_root);
-		DPRINTF("%s: booted_device=%p root_partition=%d "
-			"contains_boot=%d",
-		__func__, booted_device, rsc->sc_r.root_partition,
-			   rf_containsboot(>sc_r, booted_device));
+		DPRINTF("%s: candidate root=%p booted_device=%p "
+			"root_partition=%d contains_boot=%d\n",
+		__func__, candidate_root, booted_device,
+		rsc->sc_r.root_partition,
+		rf_containsboot(>sc_r, booted_device));
 		/* XXX the check for booted_device == NULL can probably be
 		 * dropped, now that rf_containsboot handles that case.
 		 */



CVS commit: src/sys/dev/raidframe

2022-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar  9 10:04:06 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
merge two debug lines in auto-root selection.


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/kern

2022-03-09 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Mar  9 08:43:28 UTC 2022

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

Log Message:
vrelel(): after all locks are in place check for new reference again.

Should fix assertion "vp->v_iflag & VI_TEXT" under load.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/kern/vfs_vnode.c

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

Modified files:

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.134 src/sys/kern/vfs_vnode.c:1.135
--- src/sys/kern/vfs_vnode.c:1.134	Mon Feb 28 08:44:04 2022
+++ src/sys/kern/vfs_vnode.c	Wed Mar  9 08:43:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.134 2022/02/28 08:44:04 hannken Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.135 2022/03/09 08:43:28 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.134 2022/02/28 08:44:04 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.135 2022/03/09 08:43:28 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -898,6 +898,12 @@ retry:
 	}
 	KASSERT(lktype == LK_EXCLUSIVE);
 
+	/* If the node gained another reference, retry. */
+	use = atomic_load_relaxed(>v_usecount);
+	if ((use & VUSECOUNT_VGET) != 0 || (use & VUSECOUNT_MASK) != 1) {
+		goto retry;
+	}
+
 	if ((vp->v_iflag & (VI_TEXT|VI_EXECMAP|VI_WRMAP)) != 0 ||
 	(vp->v_vflag & VV_MAPPED) != 0) {
 		/* Take care of space accounting. */



CVS commit: src/sys/kern

2022-03-09 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Mar  9 08:43:28 UTC 2022

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

Log Message:
vrelel(): after all locks are in place check for new reference again.

Should fix assertion "vp->v_iflag & VI_TEXT" under load.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/kern/vfs_vnode.c

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