From patchwork Mon Oct 17 09:27:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 120149 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 36F44B6FA2 for ; Mon, 17 Oct 2011 21:39:04 +1100 (EST) Received: from localhost ([::1]:53749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFjWg-0000cS-CQ for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2011 05:30:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:33063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFjUq-0005Fc-AG for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:28:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFjUi-0004J4-Qy for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:28:36 -0400 Received: from goliath.siemens.de ([192.35.17.28]:16023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFjUi-0004GY-8L for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:28:28 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id p9H9SOgj011678; Mon, 17 Oct 2011 11:28:26 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p9H9SKVL023511; Mon, 17 Oct 2011 11:28:24 +0200 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Mon, 17 Oct 2011 11:27:39 +0200 Message-Id: <8656d46e5140cdb28d27c303a7a235115c011332.1318843693.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.7.3.4 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.28 Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Alexander Graf , qemu-devel@nongnu.org, Isaku Yamahata , Alex Williamson , Gerd Hoffmann Subject: [Qemu-devel] [RFC][PATCH 05/45] msi: Invoke msi/msix_write_config 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 Also this functions is better invoked by the core than by each and every device. This allows to drop the config_write callbacks from ich and intel-hda. CC: Alexander Graf CC: Gerd Hoffmann CC: Isaku Yamahata Signed-off-by: Jan Kiszka --- hw/ide/ich.c | 8 -------- hw/intel-hda.c | 12 ------------ hw/ioh3420.c | 1 - hw/msi.c | 2 +- hw/pci.c | 3 +++ hw/virtio-pci.c | 2 -- hw/xio3130_downstream.c | 1 - hw/xio3130_upstream.c | 1 - 8 files changed, 4 insertions(+), 26 deletions(-) diff --git a/hw/ide/ich.c b/hw/ide/ich.c index 3f7510f..a470c01 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -139,13 +139,6 @@ static int pci_ich9_uninit(PCIDevice *dev) return 0; } -static void pci_ich9_write_config(PCIDevice *pci, uint32_t addr, - uint32_t val, int len) -{ - pci_default_write_config(pci, addr, val, len); - msi_write_config(pci, addr, val, len); -} - static PCIDeviceInfo ich_ahci_info[] = { { .qdev.name = "ich9-ahci", @@ -154,7 +147,6 @@ static PCIDeviceInfo ich_ahci_info[] = { .qdev.vmsd = &vmstate_ahci, .init = pci_ich9_ahci_init, .exit = pci_ich9_uninit, - .config_write = pci_ich9_write_config, .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82801IR, .revision = 0x02, diff --git a/hw/intel-hda.c b/hw/intel-hda.c index 4272204..0453039 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -1156,17 +1156,6 @@ static int intel_hda_exit(PCIDevice *pci) return 0; } -static void intel_hda_write_config(PCIDevice *pci, uint32_t addr, - uint32_t val, int len) -{ - IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci); - - pci_default_write_config(pci, addr, val, len); - if (d->msi) { - msi_write_config(pci, addr, val, len); - } -} - static int intel_hda_post_load(void *opaque, int version) { IntelHDAState* d = opaque; @@ -1250,7 +1239,6 @@ static PCIDeviceInfo intel_hda_info = { .qdev.reset = intel_hda_reset, .init = intel_hda_init, .exit = intel_hda_exit, - .config_write = intel_hda_write_config, .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = 0x2668, .revision = 1, diff --git a/hw/ioh3420.c b/hw/ioh3420.c index fc2fb3b..886ede8 100644 --- a/hw/ioh3420.c +++ b/hw/ioh3420.c @@ -71,7 +71,6 @@ static void ioh3420_write_config(PCIDevice *d, pci_get_long(d->config + d->exp.aer_cap + PCI_ERR_ROOT_COMMAND); pci_bridge_write_config(d, address, val, len); - msi_write_config(d, address, val, len); ioh3420_aer_vector_update(d); pcie_cap_slot_write_config(d, address, val, len); pcie_aer_write_config(d, address, val, len); diff --git a/hw/msi.c b/hw/msi.c index b117f69..c924e38 100644 --- a/hw/msi.c +++ b/hw/msi.c @@ -369,7 +369,7 @@ void msi_notify(PCIDevice *dev, unsigned int vector) stl_le_phys(address, data); } -/* call this function after updating configs by pci_default_write_config(). */ +/* Normally called by pci_default_write_config(). */ void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len) { uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev)); diff --git a/hw/pci.c b/hw/pci.c index 933d49e..6673989 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1154,6 +1154,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) if (range_covers_byte(addr, l, PCI_COMMAND)) pci_update_irq_disabled(d, was_irq_disabled); + + msi_write_config(d, addr, val, l); + msix_write_config(d, addr, val, l); } /***********************************************************/ diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 3fb250f..615295e 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -502,8 +502,6 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, virtio_set_status(proxy->vdev, proxy->vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK); } - - msix_write_config(pci_dev, address, val, len); } static unsigned virtio_pci_get_features(void *opaque) diff --git a/hw/xio3130_downstream.c b/hw/xio3130_downstream.c index 464eefa..8e9117d 100644 --- a/hw/xio3130_downstream.c +++ b/hw/xio3130_downstream.c @@ -41,7 +41,6 @@ static void xio3130_downstream_write_config(PCIDevice *d, uint32_t address, pci_bridge_write_config(d, address, val, len); pcie_cap_flr_write_config(d, address, val, len); pcie_cap_slot_write_config(d, address, val, len); - msi_write_config(d, address, val, len); pcie_aer_write_config(d, address, val, len); } diff --git a/hw/xio3130_upstream.c b/hw/xio3130_upstream.c index 0d8d254..707401e 100644 --- a/hw/xio3130_upstream.c +++ b/hw/xio3130_upstream.c @@ -40,7 +40,6 @@ static void xio3130_upstream_write_config(PCIDevice *d, uint32_t address, { pci_bridge_write_config(d, address, val, len); pcie_cap_flr_write_config(d, address, val, len); - msi_write_config(d, address, val, len); pcie_aer_write_config(d, address, val, len); }