From patchwork Wed Jun 8 16:21:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 99512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 11A74B6F9F for ; Thu, 9 Jun 2011 03:27:57 +1000 (EST) Received: from localhost ([::1]:53029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUMXq-0006IN-Ax for incoming@patchwork.ozlabs.org; Wed, 08 Jun 2011 13:27:54 -0400 Received: from eggs.gnu.org ([140.186.70.92]:58079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QULW5-0005rh-Je for qemu-devel@nongnu.org; Wed, 08 Jun 2011 12:22:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QULW1-0004I7-GQ for qemu-devel@nongnu.org; Wed, 08 Jun 2011 12:22:01 -0400 Received: from david.siemens.de ([192.35.17.14]:24297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QULW0-0004Gl-3E for qemu-devel@nongnu.org; Wed, 08 Jun 2011 12:21:56 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.13.6/8.13.6) with ESMTP id p58GLrcP031978; Wed, 8 Jun 2011 18:21:53 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p58GLqII019245; Wed, 8 Jun 2011 18:21:53 +0200 From: Jan Kiszka To: "Michael S. Tsirkin" Date: Wed, 8 Jun 2011 18:21:50 +0200 Message-Id: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.14 Cc: Isaku Yamahata , Gerd Hoffmann , qemu-devel , Alexander Graf Subject: [Qemu-devel] [PATCH v2 7/9] msi: Invoke msi/msix_uninit from PCI core X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 CC: Gerd Hoffmann CC: Isaku Yamahata Signed-off-by: Jan Kiszka --- 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); }