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 <sys/cdefs.h>
-__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->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->sc_lock);
-
 	return true;
 }
 
@@ -1501,8 +1497,6 @@ ehci_resume(device_t dv, const pmf_qual_
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-	mutex_enter(&sc->sc_lock);
-
 	/* restore things in case the bios sucks */
 	EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0);
 	EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(&sc->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->sc_lock);
-
 	return true;
 }
 

Reply via email to