diff mbox

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

Message ID 571911CA02000078000E46CD@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich April 21, 2016, 3:45 p.m. UTC
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.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
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.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -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;
 }

Comments

Andrew Cooper April 22, 2016, 5:18 p.m. UTC | #1
On 21/04/16 16:45, Jan Beulich wrote:
> 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.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Wei Liu April 25, 2016, 11:29 a.m. UTC | #2
On Thu, Apr 21, 2016 at 09:45:46AM -0600, Jan Beulich wrote:
> 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.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 

Release-acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -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;
 }