Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Oct 2023 13:43:37 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: 32ca3712a8c4 - stable/13 - hdac: Defer interrupt allocation in hdac_attach()
Message-ID:  <202310041343.394Dhbjo019685@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=32ca3712a8c4295d14770ad9cc55c1c837d834ad

commit 32ca3712a8c4295d14770ad9cc55c1c837d834ad
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-09-27 12:23:58 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-04 13:43:14 +0000

    hdac: Defer interrupt allocation in hdac_attach()
    
    hdac_attach() registers an interrupt handler before allocating various
    driver resources which are accessed by the interrupt handler.  On some
    platforms we observe what appear to be spurious interrupts upon a cold
    boot, resulting in panics.
    
    Partially work around the problem by deferring irq allocation until
    after other resources are allocated.  I think this is not a complete
    solution, but is correct and sufficient to work around the problems
    reported in the PR.
    
    PR:             268393
    Tested by:      Alexander Sherikov <asherikov@yandex.com>
    Tested by:      Oleh Hushchenkov <o.hushchenkov@gmail.com>
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D41883
    
    (cherry picked from commit 015daf5221f7588b9258fe0242cee09bde39fe21)
---
 sys/dev/sound/pci/hda/hdac.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c
index 82b1baacfa98..3d2c4001d68d 100644
--- a/sys/dev/sound/pci/hda/hdac.c
+++ b/sys/dev/sound/pci/hda/hdac.c
@@ -1272,9 +1272,6 @@ hdac_attach(device_t dev)
 
 	/* Allocate resources */
 	result = hdac_mem_alloc(sc);
-	if (result != 0)
-		goto hdac_attach_fail;
-	result = hdac_irq_alloc(sc);
 	if (result != 0)
 		goto hdac_attach_fail;
 
@@ -1349,6 +1346,10 @@ hdac_attach(device_t dev)
 	hdac_corb_init(sc);
 	hdac_rirb_init(sc);
 
+	result = hdac_irq_alloc(sc);
+	if (result != 0)
+		goto hdac_attach_fail;
+
 	/* Defer remaining of initialization until interrupts are enabled */
 	sc->intrhook.ich_func = hdac_attach2;
 	sc->intrhook.ich_arg = (void *)sc;



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