qemu-e2k/hw/intc
Peter Maydell cd2528de2c target/nios2: Move IIC code into CPU object proper
The Nios2 architecture supports two different interrupt controller
options:

 * The IIC (Internal Interrupt Controller) is part of the CPU itself;
   it has 32 IRQ input lines and no NMI support.  Interrupt status is
   queried and controlled via the CPU's ipending and istatus
   registers.

 * The EIC (External Interrupt Controller) interface allows the CPU
   to connect to an external interrupt controller.  The interface
   allows the interrupt controller to present a packet of information
   containing:
    - handler address
    - interrupt level
    - register set
    - NMI mode

QEMU does not model an EIC currently.  We do model the IIC, but its
implementation is split across code in hw/nios2/cpu_pic.c and
hw/intc/nios2_iic.c.  The code in those two files has no state of its
own -- the IIC state is in the Nios2CPU state struct.

Because CPU objects now inherit (indirectly) from TYPE_DEVICE, they
can have GPIO input lines themselves, so we can implement the IIC
directly in the CPU object the same way that real hardware does.

Create named "IRQ" GPIO inputs to the Nios2 CPU object, and make the
only user of the IIC wire up directly to those instead.

Note that the old code had an "NMI" concept which was entirely unused
and also as far as I can see not architecturally correct, since only
the EIC has a concept of an NMI.

This fixes a Coverity-reported trivial memory leak of the IRQ array
allocated in nios2_cpu_pic_init().

Fixes: Coverity CID 1421916
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20201129174022.26530-2-peter.maydell@linaro.org
Reviewed-by: Wentong Wu <wentong.wu@intel.com>
Tested-by: Wentong Wu <wentong.wu@intel.com>
2020-12-15 12:04:30 +00:00
..
allwinner-a10-pic.c
apic_common.c
apic.c
arm_gic_common.c
arm_gic_kvm.c
arm_gic.c
arm_gicv2m.c
arm_gicv3_common.c
arm_gicv3_cpuif.c
arm_gicv3_dist.c
arm_gicv3_its_common.c
arm_gicv3_its_kvm.c
arm_gicv3_kvm.c
arm_gicv3_redist.c
arm_gicv3.c
armv7m_nvic.c
aspeed_vic.c
bcm2835_ic.c
bcm2836_control.c
etraxfs_pic.c
exynos4210_combiner.c
exynos4210_gic.c
gic_internal.h
gicv3_internal.h
grlib_irqmp.c
heathrow_pic.c
i8259_common.c
i8259.c
ibex_plic.c
imx_avic.c
imx_gpcv2.c
intc.c
ioapic_common.c
ioapic.c
Kconfig
lm32_pic.c
loongson_liointc.c
meson.build target/nios2: Move IIC code into CPU object proper 2020-12-15 12:04:30 +00:00
mips_gic.c
omap_intc.c
ompic.c
openpic_kvm.c
openpic.c
pl190.c
pnv_xive_regs.h
pnv_xive.c
puv3_intc.c
realview_gic.c
rx_icu.c
s390_flic_kvm.c
s390_flic.c
sh_intc.c
sifive_clint.c
sifive_plic.c
slavio_intctl.c
spapr_xive_kvm.c
spapr_xive.c
trace-events
trace.h
vgic_common.h
xics_kvm.c
xics_pnv.c
xics_spapr.c
xics.c
xilinx_intc.c
xive.c
xlnx-pmu-iomod-intc.c
xlnx-zynqmp-ipi.c