Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2022 15:23:24 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 18a3bada308d - stable/13 - hdac: Handle interrupts racing with device suspend
Message-ID:  <202203241523.22OFNOeg008587@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=18a3bada308d89928f170f4098c85cd3f11db864

commit 18a3bada308d89928f170f4098c85cd3f11db864
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-16 16:09:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-24 14:28:14 +0000

    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
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 077564cfdb7285ff7d256424715e563cbac36f8b)
---
 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 beed29e955d2..92af1a79ccd2 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203241523.22OFNOeg008587>