RISC-V AIA IMSIC support
This is based on early work of Himanshu Chauhan on IMSIC support for IPI delivery. This, however, does not include IPI delivery support, instead it provides MSI support for *peripheral devices*.
IMSIC is a core-local interrupt controller with non-global interrupts, which means that interrupt identity is effectively (hart, interrupt ID).
When IMSIC present on hart, APLIC does not trap the CPU directly, instead it delivers the interrupt to the IMSIC instance associated with the target hart. Upon reception of interrupt, IMSIC on hart invokes APLIC for handling.
(Note that PCIe devices deliver interrupt directly to IMSIC).
Since IMSIC interrupt IDs are local to each hart, pre-allocating an intr_irqsrc for every possible (hart, interrupt ID) pair would result in static-space explosion.
Maintain a pool of pre-registered intr_irqsrc structures in the IMSIC driver and assign them to harts and interrupt IDs if required (interrupt sources handled by APLIC do not need an IMSIC intr_irqsrc).
Apart from IMSIC support, this includes APLIC changes:
- Obtain the interrupt trigger type from FDT and configure the interrupt accordingly (e.g. level or edge-triggered).
- Per the AIA requirement, level-triggered MSI interrupts must be retriggered manually after being handled. See the comment in aplic_post_ithread().
- Reorganize APLIC register definitions to have some structure.