diff --git a/sys/riscv/riscv/aplic.c b/sys/riscv/riscv/aplic.c --- a/sys/riscv/riscv/aplic.c +++ b/sys/riscv/riscv/aplic.c @@ -224,21 +224,23 @@ { struct aplic_softc *sc; struct trapframe *tf; - u_int claimi, prio, irq; + uint32_t claimi; + u_int prio, irq; int cpu; sc = arg; cpu = PCPU_GET(cpuid); - /* Claim any pending interrupt. */ - claimi = aplic_read(sc, APLIC_IDC_CLAIMI(sc, cpu)); - prio = APLIC_IDC_CLAIMI_PRIO(claimi); - irq = APLIC_IDC_CLAIMI_IRQ(claimi); + /* Claim all pending interrupts. */ + while ((claimi = aplic_read(sc, APLIC_IDC_CLAIMI(sc, cpu))) != 0) { + prio = APLIC_IDC_CLAIMI_PRIO(claimi); + irq = APLIC_IDC_CLAIMI_IRQ(claimi); - KASSERT((irq != 0), ("Invalid IRQ 0")); + KASSERT((irq != 0), ("Invalid IRQ 0")); - tf = curthread->td_intr_frame; - aplic_irq_dispatch(sc, irq, prio, tf); + tf = curthread->td_intr_frame; + aplic_irq_dispatch(sc, irq, prio, tf); + } return (FILTER_HANDLED); } diff --git a/sys/riscv/riscv/plic.c b/sys/riscv/riscv/plic.c --- a/sys/riscv/riscv/plic.c +++ b/sys/riscv/riscv/plic.c @@ -175,9 +175,8 @@ sc = arg; cpu = PCPU_GET(cpuid); - /* Claim any pending interrupt. */ - pending = RD4(sc, PLIC_CLAIM(sc, cpu)); - if (pending) { + /* Claim all pending interrupts. */ + while ((pending = RD4(sc, PLIC_CLAIM(sc, cpu))) != 0) { tf = curthread->td_intr_frame; plic_irq_dispatch(sc, pending, tf); }