qemu-patch-raspberry4/hw
Paolo Bonzini 77a10d04d0 vfio: free dynamically-allocated data in instance_finalize
In order to enable out-of-BQL address space lookup, destruction of
devices needs to be split in two phases.

Unrealize is the first phase; once it complete no new accesses will
be started, but there may still be pending memory accesses can still
be completed.

The second part is freeing the device, which only happens once all memory
accesses are complete.  At this point the reference count has dropped to
zero, an RCU grace period must have completed (because the RCU-protected
FlatViews hold a reference to the device via memory_region_ref).  This is
when instance_finalize is called.

Freeing data belongs in an instance_finalize callback, because the
dynamically allocated memory can still be used after unrealize by the
pending memory accesses.

This starts the process by creating an instance_finalize callback and
freeing most of the dynamically-allocated data in instance_finalize.
Because instance_finalize is also called on error paths or also when
the device is actually not realized, the common code needs some changes
to be ready for this.  The error path in vfio_initfn can be simplified too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2015-02-10 10:25:44 -07:00
..
9pfs rcu: add rcu library 2015-02-02 16:55:10 +01:00
acpi pci, pc, virtio fixes and cleanups 2015-01-27 13:17:30 +00:00
alpha ide: Update ide_drive_get to be HBA agnostic 2014-10-03 10:30:33 +01:00
arm hw/arm/virt: explain device-to-transport mapping in create_virtio_devices() 2015-02-05 13:37:23 +00:00
audio sb16: fix interrupt acknowledgement 2015-01-22 11:04:18 +01:00
block - Many fixes from the floor as usual 2015-01-26 11:50:29 +00:00
bt l2cap: fix access to freed memory 2014-08-15 19:12:48 +04:00
char vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
core vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
cpu icc_bus: fix typo ICC_BRIGDE -> ICC_BRIDGE 2014-11-03 19:51:56 +03:00
cris hw: Convert from BlockDriverState to BlockBackend, mostly 2014-10-20 14:02:25 +02:00
display ui: Add dpy_gfx_check_format() to check backend shared surface support 2015-01-19 13:33:26 +01:00
dma vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
gpio PPC: Add MPC8XXX gpio controller 2014-11-04 23:26:12 +01:00
i2c Fix debug print warning 2014-09-02 22:38:16 +04:00
i386 pci, pc, virtio fixes and cleanups 2015-01-27 13:17:30 +00:00
ide ide: Implement VPD response for ATAPI 2015-01-13 13:43:29 +00:00
input vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
intc apic: do not dereference pointer before it is checked for NULL 2015-01-26 12:27:05 +01:00
ipack memory: remove memory_region_destroy 2014-08-18 12:06:21 +02:00
isa vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
lm32 acpi-build: make ROMs RAM blocks resizeable 2015-01-08 13:17:55 +02:00
m68k hw/core/loader: implement address translation in uimage loader 2014-11-03 00:59:10 +03:00
mem pc-dimm: Add Error argument to pc_existing_dimms_capacity 2015-01-27 14:46:18 +02:00
microblaze hw/core/loader: implement address translation in uimage loader 2014-11-03 00:59:10 +03:00
mips mips_mipssim: fix use-after-free for filename 2014-11-17 11:41:03 +01:00
misc hw: misc, add educational driver 2015-01-26 12:26:55 +01:00
moxie memory: add parameter errp to memory_region_init_ram 2014-09-09 13:41:43 +02:00
net rtl8139: simplify timer logic 2015-02-06 14:04:36 +00:00
nvram fw_cfg: fix endianness in fw_cfg_data_mem_read() / _write() 2015-01-16 11:54:30 +00:00
openrisc hw/core/loader: implement address translation in uimage loader 2014-11-03 00:59:10 +03:00
pci migration: Append JSON description of migration stream 2015-02-05 17:16:14 +01:00
pci-bridge qdev: HotplugHandler: Rename unplug callback to unplug_request 2014-10-15 05:03:13 +02:00
pci-host PPC: e500 pci host: Add support for ATMUs 2015-01-07 16:16:24 +01:00
pcmcia hmp: Remove "info pcmcia" 2014-10-24 12:19:11 +01:00
ppc hw/ppc/mac_newworld: simplify usb controller creation logic 2015-01-08 17:32:27 +00:00
s390x s390x/ipl: Improved code indentation in s390_ipl_init() 2015-02-03 13:42:40 +01:00
scsi migration: Append JSON description of migration stream 2015-02-05 17:16:14 +01:00
sd vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
sh4 hw: Convert from BlockDriverState to BlockBackend, mostly 2014-10-20 14:02:25 +02:00
sparc fw_cfg: move boards to fw_cfg_init_io() / fw_cfg_init_mem() 2014-12-22 23:39:15 +00:00
sparc64 fw_cfg: move boards to fw_cfg_init_io() / fw_cfg_init_mem() 2014-12-22 23:39:15 +00:00
ssi ssi: xilinx_spi: Initialise CS GPIOs as NULL 2014-08-15 18:54:40 +04:00
timer fix mc146818rtc wrong subsection name to avoid vmstate_subsection_load() fail 2015-02-05 17:16:14 +01:00
tpm Drop superfluous conditionals around g_strdup() 2014-12-10 11:30:55 +03:00
tricore target-tricore: check return value before using it 2014-11-02 10:04:34 +03:00
unicore32 memory: add parameter errp to memory_region_init_ram 2014-09-09 13:41:43 +02:00
usb vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
vfio vfio: free dynamically-allocated data in instance_finalize 2015-02-10 10:25:44 -07:00
virtio migration: Append JSON description of migration stream 2015-02-05 17:16:14 +01:00
watchdog vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
xen xen-pt: Fix PCI devices re-attach failed 2015-01-13 11:49:46 +00:00
xenpv hw: Convert from BlockDriverState to BlockBackend, mostly 2014-10-20 14:02:25 +02:00
xtensa hw/xtensa/xtfpga: treat uImage load address as virtual 2014-11-03 01:00:37 +03:00
Makefile.objs vfio: move hw/misc/vfio.c to hw/vfio/pci.c Move vfio.h into include/hw/vfio 2014-12-19 15:24:06 -07:00