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

[Xen-changelog] [xen staging] vpci: reduce verboseness of BAR write warnings



commit 1bcd0b43a16b7a48ec9afce3887c6c841b687abb
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Feb 18 17:24:28 2019 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Feb 19 10:34:58 2019 +0000

    vpci: reduce verboseness of BAR write warnings
    
    Avoid printing a warning message when writing to a BAR register with
    memory decoding enabled if the value written is the same as the
    current one.
    
    No functional change.
    
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/drivers/vpci/header.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 106e8af8b2..efb6ca90e3 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -362,16 +362,6 @@ static void bar_write(const struct pci_dev *pdev, unsigned 
int reg,
     uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     bool hi = false;
 
-    if ( pci_conf_read16(pdev->seg, pdev->bus, slot, func, PCI_COMMAND) &
-         PCI_COMMAND_MEMORY )
-    {
-        gprintk(XENLOG_WARNING,
-                "%04x:%02x:%02x.%u: ignored BAR %lu write with memory decoding 
enabled\n",
-                pdev->seg, pdev->bus, slot, func,
-                bar - pdev->vpci->header.bars);
-        return;
-    }
-
     if ( bar->type == VPCI_BAR_MEM64_HI )
     {
         ASSERT(reg > PCI_BASE_ADDRESS_0);
@@ -381,6 +371,19 @@ static void bar_write(const struct pci_dev *pdev, unsigned 
int reg,
     else
         val &= PCI_BASE_ADDRESS_MEM_MASK;
 
+    if ( pci_conf_read16(pdev->seg, pdev->bus, slot, func, PCI_COMMAND) &
+         PCI_COMMAND_MEMORY )
+    {
+        /* If the value written is the current one avoid printing a warning. */
+        if ( val != (uint32_t)(bar->addr >> (hi ? 32 : 0)) )
+            gprintk(XENLOG_WARNING,
+                    "%04x:%02x:%02x.%u: ignored BAR %lu write with memory 
decoding enabled\n",
+                    pdev->seg, pdev->bus, slot, func,
+                    bar - pdev->vpci->header.bars + hi);
+        return;
+    }
+
+
     /*
      * Update the cached address, so that when memory decoding is enabled
      * Xen can map the BAR into the guest p2m.
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.