RTEMS | bsps/riscv: The interrupt support rejects the last PLIC source (#5791)
Sebastian Huber (@sebhub)
gitlab at rtems.org
Thu Oct 1 07:07:52 UTC 2026
Issue created by Sebastian Huber: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5791
## Summary
The device tree property `riscv,ndev` gives the number of PLIC interrupt
sources. The PLIC reserves ID 0, so the sources have the IDs 1 to `ndev`.
`bsps/riscv/riscv/irq/irq.c` treats them so in two places.
`riscv_plic_cpu_0_init()` gives a priority to the IDs 1 to `ndev`. The
enable register count includes ID `ndev`.
`bsp_interrupt_is_valid_vector()` accepts only vectors below
`RISCV_INTERRUPT_VECTOR_EXTERNAL(ndev)`. It thus rejects source `ndev`. A
call of `rtems_interrupt_handler_install()` for this source returns
`RTEMS_INVALID_ID`, and the source cannot be enabled.
The bound came with commit 2f81156210a ("riscv/irq: read maximum
interrupts from FDT"). The check before it had the same defect at the
compile-time bound. `BSP_INTERRUPT_VECTOR_COUNT` is
`RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS)`. The
dispatch table therefore has no entry for source
`RISCV_MAXIMUM_EXTERNAL_INTERRUPTS`, which the driver accepts as `ndev`.
## Fix
Accept the vectors up to `RISCV_INTERRUPT_VECTOR_EXTERNAL(ndev)`
inclusive. Extend `BSP_INTERRUPT_VECTOR_COUNT` by one vector.
This description was created with Claude Code assistance.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5791
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-136s8udepeyzg2gfkdjpra0pb-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20261001/0ef9d3b5/attachment.htm>
More information about the bugs
mailing list