]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
vpci: reduce verboseness of BAR write warnings
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 18 Feb 2019 16:24:28 +0000 (17:24 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 19 Feb 2019 10:34:58 +0000 (10:34 +0000)
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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/drivers/vpci/header.c

index 106e8af8b2811b428e963accb8e59086d42590d6..efb6ca90e370042b91ab5bb73fd3a4efb0b134cb 100644 (file)
@@ -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.