qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 7/9] msi: Invoke msi/msix_uninit from PCI core


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH v2 7/9] msi: Invoke msi/msix_uninit from PCI core
Date: Wed, 8 Jun 2011 18:21:50 +0200

Again less boilerplate: Clean up MSI/MSI-X unconditionally from the PCI
PCI core. Both services do nothing if there was no support registered.
Eliminates virtio_exit_pci among other things.

CC: Alexander Graf <address@hidden>
CC: Gerd Hoffmann <address@hidden>
CC: Isaku Yamahata <address@hidden>
Signed-off-by: Jan Kiszka <address@hidden>
---
 hw/ide/ich.c            |    1 -
 hw/intel-hda.c          |    1 -
 hw/ioh3420.c            |    5 +----
 hw/pci.c                |    2 ++
 hw/virtio-pci.c         |   12 +++---------
 hw/xio3130_downstream.c |    5 +----
 hw/xio3130_upstream.c   |    5 +----
 7 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 2aaef10..016bca0 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -109,7 +109,6 @@ static int pci_ich9_uninit(PCIDevice *dev)
     struct AHCIPCIState *d;
     d = DO_UPCAST(struct AHCIPCIState, card, dev);
 
-    msi_uninit(dev);
     qemu_unregister_reset(ahci_reset, d);
     ahci_uninit(&d->ahci);
 
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 99d9b98..174f201 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -1165,7 +1165,6 @@ static int intel_hda_exit(PCIDevice *pci)
 {
     IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci);
 
-    msi_uninit(&d->pci);
     cpu_unregister_io_memory(d->mmio_addr);
     return 0;
 }
diff --git a/hw/ioh3420.c b/hw/ioh3420.c
index 3c28648..1667e66 100644
--- a/hw/ioh3420.c
+++ b/hw/ioh3420.c
@@ -122,7 +122,7 @@ static int ioh3420_initfn(PCIDevice *d)
     }
     rc = pcie_cap_init(d, IOH_EP_EXP_OFFSET, PCI_EXP_TYPE_ROOT_PORT, p->port);
     if (rc < 0) {
-        goto err_msi;
+        goto err_bridge;
     }
     pcie_cap_deverr_init(d);
     pcie_cap_slot_init(d, s->slot);
@@ -145,8 +145,6 @@ err:
     pcie_chassis_del_slot(s);
 err_pcie_cap:
     pcie_cap_exit(d);
-err_msi:
-    msi_uninit(d);
 err_bridge:
     tmp = pci_bridge_exitfn(d);
     assert(!tmp);
@@ -162,7 +160,6 @@ static int ioh3420_exitfn(PCIDevice *d)
     pcie_aer_exit(d);
     pcie_chassis_del_slot(s);
     pcie_cap_exit(d);
-    msi_uninit(d);
     return pci_bridge_exitfn(d);
 }
 
diff --git a/hw/pci.c b/hw/pci.c
index fc2b555..f77ae26 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -783,6 +783,8 @@ static PCIDevice *do_pci_register_device(PCIDevice 
*pci_dev, PCIBus *bus,
 
 static void do_pci_unregister_device(PCIDevice *pci_dev)
 {
+    msi_uninit(pci_dev);
+    msix_uninit(pci_dev);
     qemu_free_irqs(pci_dev->irq);
     pci_dev->bus->devices[pci_dev->devfn] = NULL;
     pci_config_free(pci_dev);
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index a181291..1044fce 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -742,11 +742,6 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)
     return 0;
 }
 
-static int virtio_exit_pci(PCIDevice *pci_dev)
-{
-    return msix_uninit(pci_dev);
-}
-
 static int virtio_blk_exit_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
@@ -754,7 +749,7 @@ static int virtio_blk_exit_pci(PCIDevice *pci_dev)
     virtio_pci_stop_ioeventfd(proxy);
     virtio_blk_exit(proxy->vdev);
     blockdev_mark_auto_del(proxy->block.bs);
-    return virtio_exit_pci(pci_dev);
+    return 0;
 }
 
 static int virtio_serial_init_pci(PCIDevice *pci_dev)
@@ -788,7 +783,7 @@ static int virtio_serial_exit_pci(PCIDevice *pci_dev)
 
     virtio_pci_stop_ioeventfd(proxy);
     virtio_serial_exit(proxy->vdev);
-    return virtio_exit_pci(pci_dev);
+    return 0;
 }
 
 static int virtio_net_init_pci(PCIDevice *pci_dev)
@@ -816,7 +811,7 @@ static int virtio_net_exit_pci(PCIDevice *pci_dev)
 
     virtio_pci_stop_ioeventfd(proxy);
     virtio_net_exit(proxy->vdev);
-    return virtio_exit_pci(pci_dev);
+    return 0;
 }
 
 static int virtio_balloon_init_pci(PCIDevice *pci_dev)
@@ -913,7 +908,6 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.alias = "virtio-balloon",
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_balloon_init_pci,
-        .exit      = virtio_exit_pci,
         .qdev.props = (Property[]) {
             DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
             DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/xio3130_downstream.c b/hw/xio3130_downstream.c
index 933a1ee..62bc7db 100644
--- a/hw/xio3130_downstream.c
+++ b/hw/xio3130_downstream.c
@@ -86,7 +86,7 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM,
                        p->port);
     if (rc < 0) {
-        goto err_msi;
+        goto err_bridge;
     }
     pcie_cap_flr_init(d);
     pcie_cap_deverr_init(d);
@@ -108,8 +108,6 @@ err:
     pcie_chassis_del_slot(s);
 err_pcie_cap:
     pcie_cap_exit(d);
-err_msi:
-    msi_uninit(d);
 err_bridge:
     tmp = pci_bridge_exitfn(d);
     assert(!tmp);
@@ -125,7 +123,6 @@ static int xio3130_downstream_exitfn(PCIDevice *d)
     pcie_aer_exit(d);
     pcie_chassis_del_slot(s);
     pcie_cap_exit(d);
-    msi_uninit(d);
     return pci_bridge_exitfn(d);
 }
 
diff --git a/hw/xio3130_upstream.c b/hw/xio3130_upstream.c
index 584ffa2..3587aa6 100644
--- a/hw/xio3130_upstream.c
+++ b/hw/xio3130_upstream.c
@@ -81,7 +81,7 @@ static int xio3130_upstream_initfn(PCIDevice *d)
     rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_UPSTREAM,
                        p->port);
     if (rc < 0) {
-        goto err_msi;
+        goto err_bridge;
     }
     pcie_cap_flr_init(d);
     pcie_cap_deverr_init(d);
@@ -94,8 +94,6 @@ static int xio3130_upstream_initfn(PCIDevice *d)
 
 err:
     pcie_cap_exit(d);
-err_msi:
-    msi_uninit(d);
 err_bridge:
     tmp =  pci_bridge_exitfn(d);
     assert(!tmp);
@@ -106,7 +104,6 @@ static int xio3130_upstream_exitfn(PCIDevice *d)
 {
     pcie_aer_exit(d);
     pcie_cap_exit(d);
-    msi_uninit(d);
     return pci_bridge_exitfn(d);
 }
 
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]