hw/arm/mps2-tz: Correct wrong interrupt numbers for DMA and SPI
commitfee887a7b067faf1f9bc2d6c1d5fef787aadaf4a
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 15 Feb 2021 11:51:25 +0000 (15 11:51 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Sat, 6 Mar 2021 13:30:39 +0000 (6 13:30 +0000)
tree6afbb7fca3a2b4b3935daa79e1c927dad6186414
parent8e4b4c1ca6a9d46ddc727d9485e1ae2e98226aca
hw/arm/mps2-tz: Correct wrong interrupt numbers for DMA and SPI

On the MPS2 boards, the first 32 interrupt lines are entirely
internal to the SSE; interrupt lines for devices outside the SSE
start at 32.  In the application notes that document each FPGA image,
the interrupt wiring is documented from the point of view of the CPU,
so '0' is the first of the SSE's interrupts and the devices in the
FPGA image itself are '32' and up: so the UART 0 Receive interrupt is
32, the SPI #0 interrupt is 51, and so on.

Within our implementation, because the external interrupts must be
connected to the EXP_IRQ[0...n] lines of the SSE object, we made the
get_sse_irq_in() function take an irqno whose values start at 0 for
the first FPGA device interrupt.  In this numbering scheme the UART 0
Receive interrupt is 0, the SPI #0 interrupt is 19, and so on.

The result of these two different numbering schemes has been that
half of the devices were wired up to the wrong IRQs: the UART IRQs
are wired up correctly, but the DMA and SPI devices were passing
start-at-32 values to get_sse_irq_in() and so being mis-connected.

Fix the bug by making get_sse_irq_in() take values specified with the
same scheme that the hardware manuals use, to avoid confusion.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210215115138.20465-12-peter.maydell@linaro.org
hw/arm/mps2-tz.c