Skip to contentSkip to conversation

x86/MMCFG: don't ignore error from intercept handler

PATCH In review Jan Beulich 3 participants 3 messages Apr 21, 2016 – Apr 25, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/MMCFG: don't ignore error from intercept handler

In commit 9256f66c16 ("x86/PCI: intercept all PV Dom0 MMCFG writes") for an unclear to me reason I left pci_conf_write_intercept()'s return value unchecked. Correct this.

xen/arch/x86/mm.c +5 -5
@@ -5430,11 +5430,11 @@ int mmcfg_intercept_write(
     }
 
     offset &= 0xfff;
-    pci_conf_write_intercept(mmio_ctxt->seg, mmio_ctxt->bdf, offset, bytes,
-                             p_data);
-    pci_mmcfg_write(mmio_ctxt->seg, PCI_BUS(mmio_ctxt->bdf),
-                    PCI_DEVFN2(mmio_ctxt->bdf), offset, bytes,
-                    *(uint32_t *)p_data);
+    if ( pci_conf_write_intercept(mmio_ctxt->seg, mmio_ctxt->bdf,
+                                  offset, bytes, p_data) >= 0 )
+        pci_mmcfg_write(mmio_ctxt->seg, PCI_BUS(mmio_ctxt->bdf),
+                        PCI_DEVFN2(mmio_ctxt->bdf), offset, bytes,
+                        *(uint32_t *)p_data);
 
     return X86EMUL_OKAY;
 }

x86/MMCFG: don't ignore error from intercept handler

In commit 9256f66c16 ("x86/PCI: intercept all PV Dom0 MMCFG writes") for an unclear to me reason I left pci_conf_write_intercept()'s return value unchecked. Correct this.

xen/arch/x86/mm.c +5 -5
@@ -5430,11 +5430,11 @@ int mmcfg_intercept_write(
     }
 
     offset &= 0xfff;
-    pci_conf_write_intercept(mmio_ctxt->seg, mmio_ctxt->bdf, offset, bytes,
-                             p_data);
-    pci_mmcfg_write(mmio_ctxt->seg, PCI_BUS(mmio_ctxt->bdf),
-                    PCI_DEVFN2(mmio_ctxt->bdf), offset, bytes,
-                    *(uint32_t *)p_data);
+    if ( pci_conf_write_intercept(mmio_ctxt->seg, mmio_ctxt->bdf,
+                                  offset, bytes, p_data) >= 0 )
+        pci_mmcfg_write(mmio_ctxt->seg, PCI_BUS(mmio_ctxt->bdf),
+                        PCI_DEVFN2(mmio_ctxt->bdf), offset, bytes,
+                        *(uint32_t *)p_data);
 
     return X86EMUL_OKAY;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel