summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBandan Das <bsd@redhat.com>2013-11-06 17:52:17 -0500
committerMichael Roth <mdroth@linux.vnet.ibm.com>2013-12-09 11:40:30 -0600
commit0f6298786f0d88a29d150a19870f2ea7bc5c01a5 (patch)
tree714fdfc88ad5f55ed774e330724660b58cda370a
parent03060dc086ec8a75929b7bb58df9e67a305a810d (diff)
downloadqemu-0f6298786f0d88a29d150a19870f2ea7bc5c01a5.tar.gz
pci: unregister vmstate_pcibus on unplug
PCIBus registers a vmstate during init. Unregister it upon removal/unplug. Signed-off-by: Bandan Das <bsd@redhat.com> Cc: qemu-stable@nongnu.org Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 5c397242d5d53c1adecce31817bb439383cf8228) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--hw/pci/pci.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 4c004f5daa..dc5b7880b8 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -47,6 +47,7 @@ static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
static char *pcibus_get_dev_path(DeviceState *dev);
static char *pcibus_get_fw_dev_path(DeviceState *dev);
static int pcibus_reset(BusState *qbus);
+static void pci_bus_finalize(Object *obj);
static Property pci_props[] = {
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
@@ -73,6 +74,7 @@ static const TypeInfo pci_bus_info = {
.name = TYPE_PCI_BUS,
.parent = TYPE_BUS,
.instance_size = sizeof(PCIBus),
+ .instance_finalize = pci_bus_finalize,
.class_init = pci_bus_class_init,
};
@@ -375,6 +377,12 @@ int pci_bus_num(PCIBus *s)
return s->parent_dev->config[PCI_SECONDARY_BUS];
}
+static void pci_bus_finalize(Object *obj)
+{
+ PCIBus *bus = PCI_BUS(obj);
+ vmstate_unregister(NULL, &vmstate_pcibus, bus);
+}
+
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
{
PCIDevice *s = container_of(pv, PCIDevice, config);