From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOpga-0007Aw-7R for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:08:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOpgU-00019s-LK for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:07:56 -0400 Date: Tue, 2 Sep 2014 18:07:43 +0300 From: "Michael S. Tsirkin" Message-ID: <1409670380-22943-13-git-send-email-mst@redhat.com> References: <1409670380-22943-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1409670380-22943-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 12/13] pci: avoid losing config updates to MSI/MSIX cap regs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Knut Omang , qemu-stable@nongnu.org, Anthony Liguori From: Knut Omang Since commit 95d658002401e2e47a5404298ebe9508846e8a39 msi: Invoke msi/msix_write_config from PCI core msix config writes are lost, the value written is always 0. Fix pci_default_write_config to avoid this. Cc: qemu-stable@nongnu.org Signed-off-by: Knut Omang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index daeaeac..d1e9a2a 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1146,9 +1146,10 @@ uint32_t pci_default_read_config(PCIDevice *d, return le32_to_cpu(val); } -void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) +void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val_in, int l) { int i, was_irq_disabled = pci_irq_disabled(d); + uint32_t val = val_in; for (i = 0; i < l; val >>= 8, ++i) { uint8_t wmask = d->wmask[addr + i]; @@ -1170,8 +1171,8 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) & PCI_COMMAND_MASTER); } - msi_write_config(d, addr, val, l); - msix_write_config(d, addr, val, l); + msi_write_config(d, addr, val_in, l); + msix_write_config(d, addr, val_in, l); } /***********************************************************/ -- MST