[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 38/39] xen_pt: use instance_finalize instead of exit
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 38/39] xen_pt: use instance_finalize instead of exit |
Date: |
Tue, 4 Jun 2013 20:52:33 +0200 |
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/xen/xen_pt.c | 10 ++++++++++
hw/xen/xen_pt_config_init.c | 3 ---
hw/xen/xen_pt_msi.c | 8 +++++++-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index be1fd52..f40e761 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -805,7 +805,16 @@ static void xen_pt_unregister_device(PCIDevice *d)
}
}
+ xen_pt_msix_delete(s);
+}
+
+static void xen_pt_instance_finalize(Object *obj)
+{
+ PCIDevice *d = PCI_DEVICE(obj);
+ XenPCIPassthroughState *s = DO_UPCAST(XenPCIPassthroughState, dev, d);
+
/* delete all emulated config registers */
+ xen_pt_msix_free(s);
xen_pt_config_delete(s);
xen_pt_unregister_regions(s);
@@ -838,6 +847,7 @@ static const TypeInfo xen_pci_passthrough_info = {
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(XenPCIPassthroughState),
.class_init = xen_pci_passthrough_class_init,
+ .instance_finalize = xen_pt_instance_finalize,
};
static void xen_pci_passthrough_register_types(void)
diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c
index 01872db..94870c7 100644
--- a/hw/xen/xen_pt_config_init.c
+++ b/hw/xen/xen_pt_config_init.c
@@ -1861,9 +1861,6 @@ void xen_pt_config_delete(XenPCIPassthroughState *s)
struct XenPTReg *reg, *next_reg;
/* free MSI/MSI-X info table */
- if (s->msix) {
- xen_pt_msix_delete(s);
- }
if (s->msi) {
g_free(s->msi);
}
diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
index db2c842..026a8e1 100644
--- a/hw/xen/xen_pt_msi.c
+++ b/hw/xen/xen_pt_msi.c
@@ -604,6 +604,17 @@ void xen_pt_msix_delete(XenPCIPassthroughState *s)
return;
}
+ memory_region_del_subregion(&s->bar[msix->bar_index], &msix->mmio);
+}
+
+void xen_pt_msix_free(XenPCIPassthroughState *s)
+{
+ XenPTMSIX *msix = s->msix;
+
+ if (!msix) {
+ return;
+ }
+
/* unmap the MSI-X memory mapped register area */
if (msix->phys_iomem_base) {
XEN_PT_LOG(&s->dev, "unmapping physical MSI-X table from %p\n",
@@ -612,7 +619,6 @@ void xen_pt_msix_delete(XenPCIPassthroughState *s)
+ msix->table_offset_adjust);
}
- memory_region_del_subregion(&s->bar[msix->bar_index], &msix->mmio);
memory_region_destroy(&msix->mmio);
g_free(s->msix);
--
1.8.1.4
- [Qemu-devel] [PATCH 28/39] ioh4320: split exit and instance_finalize, (continued)
- [Qemu-devel] [PATCH 28/39] ioh4320: split exit and instance_finalize, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 29/39] xio3130-downstream: split exit and instance_finalize, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 30/39] xio3130-upstream: split exit and instance_finalize, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 31/39] pcie: do not recreate mmcfg I/O region, use an alias instead, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 32/39] esp: use instance_finalize instead of exit, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 33/39] lsi: use instance_finalize instead of exit, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 34/39] pvscsi: split exit and instance_finalize, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 35/39] usb-uhci: use instance_finalize instead of exit, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 36/39] virtio-pci: split exit and instance_finalize, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 37/39] wdt_i6300esb: use instance_finalize instead of exit, Paolo Bonzini, 2013/06/04
- [Qemu-devel] [PATCH 38/39] xen_pt: use instance_finalize instead of exit,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 39/39] tpm: move add/del_subregion to realize/unrealize, Paolo Bonzini, 2013/06/04
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Andreas Färber, 2013/06/05
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Michael S. Tsirkin, 2013/06/05
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Andreas Färber, 2013/06/05
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Michael S. Tsirkin, 2013/06/05
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Andreas Färber, 2013/06/05
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Michael S. Tsirkin, 2013/06/05
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Andreas Färber, 2013/06/05
- Re: [Qemu-devel] [PATCH 00/39] Delay destruction of memory regions to instance_finalize, Peter Maydell, 2013/06/05