From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXXvk-0004SO-Ae for qemu-devel@nongnu.org; Mon, 16 Mar 2015 12:31:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXXva-0001QQ-Lo for qemu-devel@nongnu.org; Mon, 16 Mar 2015 12:31:52 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:47625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXXva-0001Pb-2N for qemu-devel@nongnu.org; Mon, 16 Mar 2015 12:31:42 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Mar 2015 22:01:39 +0530 From: Gavin Shan Date: Tue, 17 Mar 2015 03:31:26 +1100 Message-Id: <1426523486-9794-3-git-send-email-gwshan@linux.vnet.ibm.com> In-Reply-To: <1426523486-9794-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1426523486-9794-1-git-send-email-gwshan@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 3/3] sPAPR: Reenable EEH functionality on reboot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aik@ozlabs.ru, agraf@suse.de, Gavin Shan , alex.williamson@redhat.com, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au When rebooting the guest, some PEs might be in frozen state. The contained PCI devices won't work properly if their frozen states aren't cleared in time. One case running into this situation would be maximal EEH error times encountered in the guest. The patch reenables the EEH functinality on PEs on PHB's reset callback, which will clear their frozen states if needed. Signed-off-by: Gavin Shan --- hw/ppc/spapr_pci_vfio.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c index 99a1be5..0cd96d3 100644 --- a/hw/ppc/spapr_pci_vfio.c +++ b/hw/ppc/spapr_pci_vfio.c @@ -71,9 +71,21 @@ static void spapr_phb_vfio_finish_realize(sPAPRPHBState *sphb, Error **errp) spapr_tce_get_iommu(tcet)); } +/* + * The PE might be in frozen state. To reenable the EEH + * functionality on it will clean the frozen state, which + * ensures that the comtained PCI devices will work properly. + */ static void spapr_phb_vfio_reset(DeviceState *qdev) { - /* Do nothing */ + sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(qdev); + struct vfio_eeh_pe_op op = { + .argsz = sizeof(op), + .op = VFIO_EEH_PE_ENABLE, + }; + + vfio_container_ioctl(&svphb->phb.iommu_as, + svphb->iommugroupid, VFIO_EEH_PE_OP, &op); } static int spapr_phb_vfio_eeh_set_option(sPAPRPHBState *sphb, -- 1.8.3.2