target/openrisc: Move pic_cpu code into CPU object proper
commit71b3254dd227f4c5e0a1a4005175a98e0a2cdc19
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 27 Nov 2020 22:51:27 +0000 (27 22:51 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 15 Dec 2020 12:04:30 +0000 (15 12:04 +0000)
treead123d831762600e09163a4a9e3303ef05af4a3f
parenteaca43a0f7a3548a527e74b7d14d69eeb31dc339
target/openrisc: Move pic_cpu code into CPU object proper

The openrisc code uses an old style of interrupt handling, where a
separate standalone set of qemu_irqs invoke a function
openrisc_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.

Create GPIO inputs to the OpenRISC CPU object, and make the only user
of cpu_openrisc_pic_init() wire up directly to those instead.

This allows us to delete the hw/openrisc/pic_cpu.c file entirely.

This fixes a trivial memory leak reported by Coverity of the IRQs
allocated in cpu_openrisc_pic_init().

Fixes: Coverity CID 1421934
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stafford Horne <shorne@gmail.com>
Message-id: 20201127225127.14770-4-peter.maydell@linaro.org
hw/openrisc/meson.build
hw/openrisc/openrisc_sim.c
hw/openrisc/pic_cpu.c [deleted file]
target/openrisc/cpu.c
target/openrisc/cpu.h