qemu-patch-raspberry4/hw/ppc
Alexey Kardashevskiy f1c2dc7c86 spapr-pci: rework MSI/MSIX
On the sPAPR platform a guest allocates MSI/MSIX vectors via RTAS
hypercalls which return global IRQ numbers to a guest so it only
operates with those and never touches MSIMessage.

Therefore MSIMessage handling is completely hidden in QEMU.

Previously every sPAPR PCI host bridge implemented its own MSI window
to catch msi_notify()/msix_notify() calls from QEMU devices (virtio-pci
or vfio) and route them to the guest via qemu_pulse_irq().
MSIMessage used to be encoded as:
	.addr - address within the PHB MSI window;
	.data - the device index on PHB plus vector number.
The MSI MR write function translated this MSIMessage to a global IRQ
number and called qemu_pulse_irq().

However the total number of IRQs is not really big (at the moment it is
1024 IRQs starting from 4096) and even 16bit data field of MSIMessage
seems to be enough to store an IRQ number there.

This simplifies MSI handling in sPAPR PHB. Specifically, this does:
1. remove a MSI window from a PHB;
2. add a single memory region for all MSIs to sPAPREnvironment
and spapr_pci_msi_init() to initialize it;
3. encode MSIMessage as:
    * .addr - a fixed address of SPAPR_PCI_MSI_WINDOW==0x40000000000ULL;
    * .data as an IRQ number.
4. change IRQ allocator to align first IRQ number in a block for MSI.
MSI uses lower bits to specify the vector number so the first IRQ has to
be aligned. MSIX does not need any special allocator though.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2013-09-02 10:06:42 +02:00
..
e500-ccsr.h ppc: do not use ../ in include files 2013-03-01 13:57:33 +01:00
e500.c PPC: E500: Generate device tree on reset 2013-09-02 10:06:40 +02:00
e500.h ppc: Don't duplicate QEMUMachineInitArgs in PPCE500Params 2013-08-21 23:22:22 +03:00
e500plat.c ppc: Don't duplicate QEMUMachineInitArgs in PPCE500Params 2013-08-21 23:22:22 +03:00
mac.h PPC: dbdma: Wait for DMA until we have data 2013-07-11 18:51:25 +02:00
mac_newworld.c ppc_newworld: do not use isa_mmio 2013-07-25 08:12:26 -05:00
mac_oldworld.c ppc_oldworld: do not use isa_mmio 2013-07-25 08:12:25 -05:00
Makefile.objs pseries: move interrupt controllers to hw/intc/ 2013-07-11 18:51:23 +02:00
mpc8544_guts.c cpu: Replace cpu_single_env with CPUState current_cpu 2013-07-09 21:20:28 +02:00
mpc8544ds.c ppc: Don't duplicate QEMUMachineInitArgs in PPCE500Params 2013-08-21 23:22:22 +03:00
ppc.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
ppc4xx_devs.c memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
ppc4xx_pci.c hw/p*: pass owner to memory_region_init* functions 2013-07-04 17:42:48 +02:00
ppc405.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
ppc405_boards.c ppc405_boards: Don't enforce presence of firmware for qtest 2013-09-02 10:06:41 +02:00
ppc405_uc.c ppc405_uc: Disable debug output 2013-09-02 10:06:41 +02:00
ppc440_bamboo.c ppc440_bamboo: do not use isa_mmio 2013-07-25 08:12:27 -05:00
ppc_booke.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
ppce500_spin.c ppce500_spin: QOM cast cleanup 2013-07-29 21:07:00 +02:00
prep.c prep: fix I/O port endianness 2013-07-25 08:12:26 -05:00
spapr.c spapr-pci: rework MSI/MSIX 2013-09-02 10:06:42 +02:00
spapr_events.c spapr-rtas: add CPU argument to RTAS calls 2013-07-01 01:11:16 +02:00
spapr_hcall.c pseries: savevm support for pseries machine 2013-07-29 10:37:08 -05:00
spapr_iommu.c spapr-tce: make sPAPRTCETable a proper device 2013-07-29 10:37:08 -05:00
spapr_pci.c spapr-pci: rework MSI/MSIX 2013-09-02 10:06:42 +02:00
spapr_rtas.c spapr-rtas: add CPU argument to RTAS calls 2013-07-01 01:11:16 +02:00
spapr_vio.c spapr: Rename 'dprintf' to 'DPRINTF' 2013-07-29 19:56:46 -05:00
virtex_ml507.c ppc: virtex_ml507: QEMU_OPTION_dtb support for this machine. 2013-09-02 10:06:41 +02:00