mirror_qemu/hw
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
..
9pfs hw/9pfs: Fix Kconfig dependency problem between 9pfs and Xen 2020-11-05 15:21:11 +01:00
acpi x86: acpi: let the firmware handle pending "CPU remove" events in SMM 2020-12-09 13:04:17 -05:00
adc meson: convert hw/adc 2020-08-21 06:30:32 -04:00
alpha vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
arm ads7846: moves from the hw/display folder to the hw/input folder. 2020-12-13 17:54:55 +01:00
audio nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
avr vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
block hw/ssi: Rename SSI 'slave' as 'peripheral' 2020-12-10 12:15:03 -05:00
char hw/char/serial: Clean up unnecessary code 2020-12-10 12:15:10 -05:00
core * Fix for NULL segments (Bin Meng) 2020-12-11 13:50:35 +00:00
cpu cpu/core: Register core-id and nr-threads as class properties 2020-09-22 16:48:29 -04:00
cris cris: do not use ram_size global 2020-12-10 12:15:07 -05:00
display ads7846: moves from the hw/display folder to the hw/input folder. 2020-12-13 17:54:55 +01:00
dma hw/dma/xilinx_axidma: Rename StreamSlave as StreamSink 2020-12-10 12:15:04 -05:00
gpio nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
hppa vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
hyperv qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
i2c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
i386 vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
ide ide: atapi: assert that the buffer pointer is in range 2020-12-01 15:23:05 +00:00
input ads7846: moves from the hw/display folder to the hw/input folder. 2020-12-13 17:54:55 +01:00
intc target/nios2: Move IIC code into CPU object proper 2020-12-15 12:04:30 +00:00
ipack Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
ipmi Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
isa x86: ich9: let firmware negotiate 'CPU hot-unplug with SMI' feature 2020-12-09 13:04:17 -05:00
lm32 vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
m68k hw/m68k/q800.c: Make the GLUE chip an actual QOM device 2020-12-12 18:06:01 +01:00
mem nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
microblaze vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
mips hw/mips/malta: Rewrite CP0_MVPConf0 access using deposit() 2020-12-13 20:26:02 +01:00
misc hw/ssi: Rename SSI 'slave' as 'peripheral' 2020-12-10 12:15:03 -05:00
moxie moxie: do not use ram_size global 2020-12-10 12:15:08 -05:00
net hw/net/xilinx_axienet: Rename StreamSlave as StreamSink 2020-12-10 12:15:04 -05:00
nios2 target/nios2: Move IIC code into CPU object proper 2020-12-15 12:04:30 +00:00
nubus meson: convert hw/nubus 2020-08-21 06:30:25 -04:00
nvram vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
openrisc target/openrisc: Move pic_cpu code into CPU object proper 2020-12-15 12:04:30 +00:00
pci vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
pci-bridge nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
pci-host hw/pci-host/pam: Replace magic number by PAM_REGIONS_COUNT definition 2020-12-13 17:07:05 +01:00
pcmcia pxa2xx: Move QOM macros to header 2020-08-27 14:04:55 -04:00
ppc spapr.c: set a 'kvm-type' default value instead of relying on NULL 2020-12-14 15:54:12 +11:00
rdma qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
riscv vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
rtc m48t59: remove legacy m48t59_init() function 2020-10-18 16:21:42 +01:00
rx rx: move BIOS load from MCU to board 2020-12-10 12:15:06 -05:00
s390x * Fix for NULL segments (Bin Meng) 2020-12-11 13:50:35 +00:00
scsi scsi-disk: convert more errno values back to SCSI statuses 2020-11-16 13:22:17 -05:00
sd hw/ssi: Rename SSI 'slave' as 'peripheral' 2020-12-10 12:15:03 -05:00
semihosting meson: convert hw/semihosting 2020-08-21 06:30:25 -04:00
sh4 sh4: remove bios_name 2020-12-10 12:15:06 -05:00
smbios i386: do not use ram_size global 2020-12-10 12:15:08 -05:00
sparc vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
sparc64 vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
ssi hw/core/stream: Rename StreamSlave as StreamSink 2020-12-10 12:15:04 -05:00
timer exynos: Fix bad printf format specifiers 2020-11-17 12:56:32 +00:00
tpm tpm: Fix Lesser GPL version number 2020-11-15 16:44:18 +01:00
tricore tricore tcg cpus: Fix Lesser GPL version number 2020-11-15 16:40:30 +01:00
unicore32 meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
usb usb: fix kconfig for usb-xhci-sysbus 2020-11-20 10:43:41 -05:00
vfio vfio: Change default dirty pages tracking behavior during migration 2020-11-23 10:05:58 -07:00
virtio make ram_size local to vl.c 2020-12-10 12:15:10 -05:00
watchdog hw/watchdog/wdt_diag288: Remove unnecessary includes 2020-12-11 11:38:10 +01:00
xen hw/xen: Don't use '#' flag of printf format 2020-12-13 17:02:42 +01:00
xenpv meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
xtensa load_elf: Remove unused address variables from callers 2020-09-25 16:52:08 -07:00
Kconfig hw/net/can: Introduce Xilinx ZynqMP CAN controller 2020-12-10 11:30:44 +00:00
meson.build meson: convert hw/arch* 2020-08-21 06:30:33 -04:00