git: cffbc16cc509 - main - axp209: Allow the interrupt handler to sleep

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Fri, 13 Nov 2026 07:29:46 UTC
The branch main has been updated by manu:

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

commit cffbc16cc5090c4ff31d91bacfd944d6374e1111
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-13 06:27:54 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-13 07:29:30 +0000

    axp209: Allow the interrupt handler to sleep
    
    The interrupt handler reads and writes the registers of the PMU with
    IIC_INTRWAIT, which can sleep when the bus is busy, and the I2C
    controller the AXP209 is on in the A10 and A20 waits for the end of the
    transfer.  The handler runs in an interrupt thread, which cannot sleep
    unless the interrupt is marked as sleepable, so an interrupt of the PMU
    would panic a kernel with INVARIANTS.  Mark it, the interrupt is not
    shared, like it was done for the axp81x driver.
    
    Reported by:    llm-postcr
    Fixes:          30068a1de9e3 ("Add support for interrupts, sensors and GPIO for AXP209 PMIC")
---
 sys/arm/allwinner/axp209.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/arm/allwinner/axp209.c b/sys/arm/allwinner/axp209.c
index ff999a0f9b9b..09cc03280d47 100644
--- a/sys/arm/allwinner/axp209.c
+++ b/sys/arm/allwinner/axp209.c
@@ -1271,7 +1271,8 @@ axp2xx_start(void *pdev)
 		    sc->sensors[i].desc);
 	}
 
-	if ((bus_setup_intr(dev, sc->res[0], INTR_TYPE_MISC | INTR_MPSAFE,
+	if ((bus_setup_intr(dev, sc->res[0],
+	      INTR_TYPE_MISC | INTR_MPSAFE | INTR_EXCL | INTR_SLEEPABLE,
 	      NULL, axp2xx_intr, sc, &sc->intrcookie)))
 		device_printf(dev, "unable to register interrupt handler\n");