diff mbox

[2/2] sPAPR: Enable EEH on VFIO PCI device only

Message ID 1442561444-31787-2-git-send-email-gwshan@linux.vnet.ibm.com
State New
Headers show

Commit Message

Gavin Shan Sept. 18, 2015, 7:30 a.m. UTC
This checks if the PCI device retrieved from the PCI device address
is VFIO PCI device when enabling EEH functionality. If it's not
VFIO PCI device, the EEH functonality isn't enabled.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 hw/ppc/spapr_pci_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Gibson Sept. 18, 2015, 7:43 a.m. UTC | #1
On Fri, Sep 18, 2015 at 05:30:44PM +1000, Gavin Shan wrote:
> This checks if the PCI device retrieved from the PCI device address
> is VFIO PCI device when enabling EEH functionality. If it's not
> VFIO PCI device, the EEH functonality isn't enabled.
> 
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

Applied to spapr-dev, thanks.
diff mbox

Patch

diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c
index a99c7b3..b20e6e9 100644
--- a/hw/ppc/spapr_pci_vfio.c
+++ b/hw/ppc/spapr_pci_vfio.c
@@ -131,7 +131,7 @@  int spapr_phb_vfio_eeh_set_option(sPAPRPHBState *sphb,
         phb = PCI_HOST_BRIDGE(sphb);
         pdev = pci_find_device(phb->bus,
                                (addr >> 16) & 0xFF, (addr >> 8) & 0xFF);
-        if (!pdev) {
+        if (!pdev || !object_dynamic_cast(OBJECT(pdev), "vfio-pci")) {
             return RTAS_OUT_PARAM_ERROR;
         }