diff mbox

[v2,2/4] pci: Avoid losing config updates to MSI/MSIX cap regs

Message ID 1409655606-19150-3-git-send-email-knut.omang@oracle.com
State New
Headers show

Commit Message

Knut Omang Sept. 2, 2014, 11 a.m. UTC
Introduce an extra local variable to avoid that the
shifting in the for loop causes updates to msi/msix capability
registers to get lost in pci_default_write_config.

Signed-off-by: Knut Omang <knut.omang@oracle.com>
---
 hw/pci/pci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Michael S. Tsirkin Sept. 2, 2014, 12:57 p.m. UTC | #1
On Tue, Sep 02, 2014 at 01:00:04PM +0200, Knut Omang wrote:
> Introduce an extra local variable to avoid that the
> shifting in the for loop causes updates to msi/msix capability
> registers to get lost in pci_default_write_config.
> 
> Signed-off-by: Knut Omang <knut.omang@oracle.com>

OK
So this is a regression introduced by:

commit 95d658002401e2e47a5404298ebe9508846e8a39
Author: Jan Kiszka <jan.kiszka@siemens.com>
Date:   Fri May 11 11:42:40 2012 -0300
    msi: Invoke msi/msix_write_config from PCI core

Will queue to qemu-stable as well.


> ---
>  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 6b21dee..af547dc 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);
>  }
>  
>  /***********************************************************/
> -- 
> 1.9.0
diff mbox

Patch

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 6b21dee..af547dc 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);
 }
 
 /***********************************************************/