aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2022-03-16 16:09:17 +0000
committerMark Johnston <markj@FreeBSD.org>2022-03-24 15:42:11 +0000
commit9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2 (patch)
tree0a470f5c2d33c755c2dcd9996b16466b7beed97f
parentca2b1e3480ba689cf32345ba87b6bb5bf1fe7c27 (diff)
downloadsrc-9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2.tar.gz
src-9f83c6fa52fb7c5a256fed2f1a13735b66b8f7c2.zip
hdac: Handle interrupts racing with device suspend
- Avoid looping forever if a concurrent reset causes a read of the interrupt status register to return all ones. - Lock the softc before reading the interrupt status, so as to avoid a similar infinite loop in hdac_one_intr(). This fixes suspend-to-S3 on some laptops. Approved by: re (gjb) PR: 261207 Reviewed by: mav, imp Tested by: uqs Sponsored by: The FreeBSD Foundation (cherry picked from commit 077564cfdb7285ff7d256424715e563cbac36f8b) (cherry picked from commit 18a3bada308d89928f170f4098c85cd3f11db864)
-rw-r--r--sys/dev/sound/pci/hda/hdac.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c
index c7f5e9dd5b5c..4988a1a28fa2 100644
--- a/sys/dev/sound/pci/hda/hdac.c
+++ b/sys/dev/sound/pci/hda/hdac.c
@@ -384,13 +384,13 @@ hdac_intr_handler(void *context)
* re-examine GIS then we can leave it set and never get an interrupt
* again.
*/
+ hdac_lock(sc);
intsts = HDAC_READ_4(&sc->mem, HDAC_INTSTS);
- while ((intsts & HDAC_INTSTS_GIS) != 0) {
- hdac_lock(sc);
+ while (intsts != 0xffffffff && (intsts & HDAC_INTSTS_GIS) != 0) {
hdac_one_intr(sc, intsts);
- hdac_unlock(sc);
intsts = HDAC_READ_4(&sc->mem, HDAC_INTSTS);
}
+ hdac_unlock(sc);
}
static void