RTEMS | bsps/leon3: Add support for IRQMP IRQMAP (!1332)

Matteo Concas (@matteo.concas) gitlab at rtems.org
Tue Jun 23 16:59:13 UTC 2026



Matteo Concas created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1332

Project:Branches: matteo.concas/rtems-gaisler:matteo/irqmp-irqmap-support to rtems/rtos/rtems:main
Author:   Matteo Concas
Assignee: Matteo Concas


## Summary

bsps/leon3: Add support for IRQMP IRQMAP

This support is added in the form of two public functions,
`leon3_irqmap_get_unchecked()` that will directly return the mapped
interrupt and `leon3_irqmap_get()` that will perform a check (<63) before
reading the mapping.

>From the [GRLIB IP Core User’s Manual](https://download.gaisler.com/products/GRLIB/doc/grip.pdf) section 95.2.6 _Interrupt (re)map functionality_:
> The interrupt controller can optionally be implemented (as an alternative to the two-level interrupt scheme) with functionality to allow dynamic remapping between bus interrupt lines and interrupt controller interrupt lines. [...]

> The interrupt map registers contain one field for each bus interrupt line in the system. The value within this field determines to which interrupt controller line the bus interrupt line is connected. In case several bus interrupt lines are mapped to the same controller interrupt line (several fields in the Interrupt map registers have the same value) then the bus interrupt lines will be OR:ed together.

> Note that if bus interrupt line X is remapped to controller interrupt line Y then bit Y of the pending register will be set when a peripheral asserts interrupt X. Remapping interrupt lines via the Interrupt map registers has the same effect as changing the interrupt assignments in the RTL code.

Implementation wise this translates to a 64 byte array of byte values: `IRQMAP[n] = X` where `n` is the interrupt bus line (as can be read from PnP) and `X` is the interrupt controller line, i.e. the interrupt that will be shown as pending in the Interrupt Pending Register when a device with interrupt line `n` raises an interrupt.

This implementation is pretty simple so it reads the mapping once at initialization and then treats it as constant. It does not allow for modifying the mapping during RTEMS runtime (although a previous booting stage could do it).

Any user registering an interrupt for a device on a system with IRQ (re-)mapping implemented is expected to first translate that interrupt with `leon3_irqmap_get()` or `leon3_irqmap_get_unchecked()`, similarly to what one would do with `RISCV_INTERRUPT_VECTOR_EXTERNAL()`. The driver manager uses the AMBA PnP interface to register device interrupts so it will work natively with those systems.

<!-- Default settings, if it is a dropdown it will set after submission -->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1332
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/4-0smdw59hncijqj0ms2o9ufxd4-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/20260623/466da95c/attachment-0001.htm>


More information about the bugs mailing list