xemu/hw
Alexey Kardashevskiy 8c37faa475 vfio-pci, ppc64/spapr: Reorder group-to-container attaching
At the moment VFIO PCI device initialization works as follows:
vfio_realize
	vfio_get_group
		vfio_connect_container
			register memory listeners (1)
			update QEMU groups lists
		vfio_kvm_device_add_group

Then (example for pseries) the machine reset hook triggers region_add()
for all regions where listeners from (1) are listening:

ppc_spapr_reset
	spapr_phb_reset
		spapr_tce_table_enable
			memory_region_add_subregion
				vfio_listener_region_add
					vfio_spapr_create_window

This scheme works fine until we need to handle VFIO PCI device hotplug
and we want to enable PPC64/sPAPR in-kernel TCE acceleration on,
i.e. after PCI hotplug we need a place to call
ioctl(vfio_kvm_device_fd, KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE).
Since the ioctl needs a LIOBN fd (from sPAPRTCETable) and a IOMMU group fd
(from VFIOGroup), vfio_listener_region_add() seems to be the only place
for this ioctl().

However this only works during boot time because the machine reset
happens strictly after all devices are finalized. When hotplug happens,
vfio_listener_region_add() is called when a memory listener is registered
but when this happens:
1. new group is not added to the container->group_list yet;
2. VFIO KVM device is unaware of the new IOMMU group.

This moves bits around to have all necessary VFIO infrastructure
in place for both initial startup and hotplug cases.

[aw: ie, register vfio groups with kvm prior to memory listener
registration such that kvm-vfio pseudo device ioctls are available
during the region_add callback]

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2017-07-17 12:39:09 -06:00
..
9pfs Convert error_report() to warn_report() 2017-07-13 13:49:58 +02:00
acpi include/exec/poison: Mark CONFIG_KVM as poisoned, too 2017-07-04 14:30:03 +02:00
adc
alpha memory/iommu: introduce IOMMUMemoryRegionClass 2017-07-14 12:04:41 +02:00
arm hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
audio audio/adlib: remove limitation of one adlib card 2017-07-17 11:09:02 +02:00
block hw/block/pflash_cfi01, pflash_cfi02: Use memory_region_init_rom_device() 2017-07-14 17:59:42 +01:00
bt be-hci: use backend functions 2017-06-02 11:33:53 +04:00
char chardev: fix parallel device can't be reconnect 2017-07-14 12:04:41 +02:00
core * gdbstub fixes (Alex) 2017-07-14 12:16:09 +01:00
cpu hw/cpu: core.c can be compiled as common object 2017-06-09 12:02:55 +10:00
cris hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
display virtio-gpu migration fix for 2.10 2017-07-17 17:12:41 +01:00
dma * gdbstub fixes (Alex) 2017-07-14 12:16:09 +01:00
gpio qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
i2c migration/next for 20170601 2017-06-02 14:07:53 +01:00
i386 hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
ide pci: Replace pci_add_capability2() with pci_add_capability() 2017-07-03 22:29:49 +03:00
input memory: Rename memory_region_init_ram() to memory_region_init_ram_nomigrate() 2017-07-14 17:59:42 +01:00
intc s390x/flic: migrate ais states 2017-07-14 12:29:49 +02:00
ipack
ipmi qom: enforce readonly nature of link's check callback 2017-07-14 12:04:42 +02:00
isa chardev: move headers to include/chardev 2017-06-02 11:33:52 +04:00
lm32 char: rename CharDriverState Chardev 2017-01-27 18:07:59 +01:00
m68k hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
mem dimm: Convert to DEFINE_PROP_LINK 2017-07-14 12:04:43 +02:00
microblaze hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
mips hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
misc * gdbstub fixes (Alex) 2017-07-14 12:16:09 +01:00
moxie hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
net memory: Rename memory_region_init_ram() to memory_region_init_ram_nomigrate() 2017-07-14 17:59:42 +01:00
nios2 hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
nvram Convert error_report() to warn_report() 2017-07-13 13:49:58 +02:00
openrisc hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
pci hw/pci/pci.c: Use memory_region_init_rom() 2017-07-14 17:59:42 +01:00
pci-bridge pci: Convert shpc_init() to Error 2017-07-03 22:29:49 +03:00
pci-host memory: Rename memory_region_init_ram() to memory_region_init_ram_nomigrate() 2017-07-14 17:59:42 +01:00
pcmcia
ppc ppc patch queue 2017-07-17 2017-07-17 12:52:59 +01:00
s390x hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
scsi * gdbstub fixes (Alex) 2017-07-14 12:16:09 +01:00
sd generic-sdhci: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
sh4 hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
smbios
sparc hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
sparc64 memory: Rename memory_region_init_ram() to memory_region_init_ram_nomigrate() 2017-07-14 17:59:42 +01:00
ssi xilinx_spips: allow mmio execution 2017-06-27 15:09:15 +02:00
timer timer/aspeed: fix timer enablement when a reload is not set 2017-06-13 14:57:00 +01:00
tpm
tricore hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
unicore32 hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
usb ehci fix for 2.10 2017-07-17 17:54:17 +01:00
vfio vfio-pci, ppc64/spapr: Reorder group-to-container attaching 2017-07-17 12:39:09 -06:00
virtio virtio-crypto: Convert to DEFINE_PROP_LINK 2017-07-14 12:04:43 +02:00
watchdog shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
xen xen/pt: Fixup addr validation in xen_pt_pci_config_access_check 2017-07-07 11:13:10 -07:00
xenpv xenfb: remove xen_init_display "temporary" hack 2017-07-07 11:10:03 -07:00
xtensa hw: Use new memory_region_init_{ram, rom, rom_device}() functions 2017-07-14 17:59:42 +01:00
Makefile.objs