mbox series

[0/2] target/nios2: Roll cpu_pic code into CPU itself

Message ID 20201127191233.11200-1-peter.maydell@linaro.org
Headers show
Series target/nios2: Roll cpu_pic code into CPU itself | expand

Message

Peter Maydell Nov. 27, 2020, 7:12 p.m. UTC
(As well as the listed nios2 maintainers, I've cc'd a couple
of the more recent contributors to this target in case they're
interested or wish to test the changes.)

The nios2 code uses an old style of interrupt handling, where a
separate standalone set of qemu_irqs invoke a function
nios2_pic_cpu_handler() which signals the interrupt to the CPU proper
by directly calling cpu_interrupt() and cpu_reset_interrupt().
Because CPU objects now inherit (indirectly) from TYPE_DEVICE, they
can have GPIO input lines themselves, and the neater modern way to
implement this is to simply have the CPU object itself provide the
input IRQ lines.

This allows us to roll all of the code in hw/nios/cpu_pic.c
into target/nios2 one way or another.

The motivation here is fixing a trivial Coverity-reported leak
(CID 1421916) of the IRQ array allocated in nios2_cpu_pic_init(),
and also part of the extremely slow refactoring of code away
from using qemu_allocate_irqs() at all.

Tested with 'make check' and 'make check-acceptance' (which does
include a boot test of a nios2 10m50 guest).

thanks
-- PMM

Peter Maydell (2):
  target/nios2: Move cpu_pic code into CPU object proper
  target/nios2: Move nios2_check_interrupts() into target/nios2

 target/nios2/cpu.h        |  3 --
 hw/nios2/10m50_devboard.c |  8 ++---
 hw/nios2/cpu_pic.c        | 67 ---------------------------------------
 target/nios2/cpu.c        | 34 ++++++++++++++++++++
 target/nios2/op_helper.c  |  9 ++++++
 hw/nios2/meson.build      |  2 +-
 6 files changed, 47 insertions(+), 76 deletions(-)
 delete mode 100644 hw/nios2/cpu_pic.c