From 077564cfdb7285ff7d256424715e563cbac36f8b Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 16 Mar 2022 12:09:17 -0400 Subject: 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. PR: 261207 Reviewed by: mav, imp Tested by: uqs MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34117 --- sys/dev/sound/pci/hda/hdac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index dc5a03e9807c..8415d63daa69 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 -- cgit v1.2.3