From aca5da5f8cf3663d9f6f680dc0f1f186125d7d4b Mon Sep 17 00:00:00 2001 From: riastradh Date: Wed, 9 Mar 2022 22:18:13 +0000 Subject: [PATCH] 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. --- sys/dev/usb/ehci.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 9d62fd2c7214..40d7d45720c0 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -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_t *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_t *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_t *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_t *qual) if (hcr == EHCI_STS_HCH) printf("%s: config timeout\n", device_xname(dv)); - mutex_exit(&sc->sc_lock); - return true; }