git: 0fcd9be111dd - main - gpioaei: mark the AEI ithread as sleepable

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 21 Apr 2025 16:28:33 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=0fcd9be111dd44d12a09805791a5597567602f8e

commit 0fcd9be111dd44d12a09805791a5597567602f8e
Author:     Ahmad Khalifa <ahmadkhalifa570@gmail.com>
AuthorDate: 2025-03-31 15:13:30 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-04-21 16:28:14 +0000

    gpioaei: mark the AEI ithread as sleepable
    
    We call an ACPICA function in the interrupt handler which may attempt to
    lock a mutex. If this is done while another instance of the handler
    already holds the lock, it would cause a kernel panic since sleeping
    isn't allowed.
    
    Reviewed-by: Warner Losh <imp@FreeBSD.org>
    Pull-request: https://github.com/freebsd/freebsd-src/pull/1667
    Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
---
 sys/dev/gpio/gpioaei.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/dev/gpio/gpioaei.c b/sys/dev/gpio/gpioaei.c
index 6cbb5f1bb7ed..ecae8ccaf2fa 100644
--- a/sys/dev/gpio/gpioaei.c
+++ b/sys/dev/gpio/gpioaei.c
@@ -120,8 +120,9 @@ gpio_aei_attach(device_t dev)
 		device_printf(dev, "Cannot allocate an IRQ\n");
 		return (ENOTSUP);
 	}
-	err = bus_setup_intr(dev, sc->intr_res, INTR_TYPE_MISC | INTR_MPSAFE,
-	    NULL, gpio_aei_intr, sc, &sc->intr_cookie);
+	err = bus_setup_intr(dev, sc->intr_res, INTR_TYPE_MISC | INTR_MPSAFE |
+	    INTR_EXCL | INTR_SLEEPABLE, NULL, gpio_aei_intr, sc,
+	    &sc->intr_cookie);
 	if (err != 0) {
 		device_printf(dev, "Cannot set up IRQ\n");
 		bus_release_resource(dev, SYS_RES_IRQ, sc->intr_rid,