From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZASPY-00029c-1v for qemu-devel@nongnu.org; Wed, 01 Jul 2015 20:31:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZASPP-00036b-77 for qemu-devel@nongnu.org; Wed, 01 Jul 2015 20:31:28 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:48796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZASPO-00033r-C5 for qemu-devel@nongnu.org; Wed, 01 Jul 2015 20:31:18 -0400 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Jul 2015 10:31:15 +1000 From: Gavin Shan Date: Thu, 2 Jul 2015 10:30:10 +1000 Message-Id: <1435797012-6069-2-git-send-email-gwshan@linux.vnet.ibm.com> In-Reply-To: <1435797012-6069-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1435797012-6069-1-git-send-email-gwshan@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v4 1/3] sPAPR: Don't enable EEH on emulated PCI devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org Cc: alex.williamson@redhat.com, qemu-devel@nongnu.org, Gavin Shan , david@gibson.dropbear.id.au There might have emulated PCI devices, together with VFIO PCI devices under one PHB. The EEH capability shouldn't enabled on emulated PCI devices. The patch returns error when enabling EEH capability on emulated PCI devices by RTAS call "ibm,set-eeh-option". Signed-off-by: Gavin Shan --- hw/ppc/spapr_pci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index a139aea..a8f79d8 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -429,6 +429,7 @@ static void rtas_ibm_set_eeh_option(PowerPCCPU *cpu, { sPAPRPHBState *sphb; sPAPRPHBClass *spc; + PCIDevice *pdev; uint32_t addr, option; uint64_t buid; int ret; @@ -446,6 +447,12 @@ static void rtas_ibm_set_eeh_option(PowerPCCPU *cpu, goto param_error_exit; } + pdev = pci_find_device(PCI_HOST_BRIDGE(sphb)->bus, + (addr >> 16) & 0xFF, (addr >> 8) & 0xFF); + if (!pdev || !object_dynamic_cast(OBJECT(pdev), "vfio-pci")) { + goto param_error_exit; + } + spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); if (!spc->eeh_set_option) { goto param_error_exit; -- 2.1.0