From patchwork Wed Jun 28 11:26:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 781572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wyL8v2fHdz9s5L for ; Wed, 28 Jun 2017 21:26:39 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wyL8v1PznzDr4Q for ; Wed, 28 Jun 2017 21:26:39 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wyL8l6s05zDr3T for ; Wed, 28 Jun 2017 21:26:31 +1000 (AEST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v5SBODiA103640 for ; Wed, 28 Jun 2017 07:26:29 -0400 Received: from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bc8wmys9e-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Jun 2017 07:26:28 -0400 Received: from localhost by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Jun 2017 21:26:25 +1000 Received: from d23relay09.au.ibm.com (202.81.31.228) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Jun 2017 21:26:23 +1000 Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v5SBQNWU5898724 for ; Wed, 28 Jun 2017 21:26:23 +1000 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v5SBQNfr027245 for ; Wed, 28 Jun 2017 21:26:23 +1000 Received: from jupiter.in.ibm.com ([9.202.5.86]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v5SBQLS0027210; Wed, 28 Jun 2017 21:26:22 +1000 From: Mahesh J Salgaonkar To: skiboot list Date: Wed, 28 Jun 2017 16:56:16 +0530 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable x-cbid: 17062811-0008-0000-0000-00000148926A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062811-0009-0000-0000-000009786A89 Message-Id: <149864917619.21097.6423165766607140076.stgit@jupiter.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-28_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706280184 Subject: [Skiboot] [PATCH v2] opal/xscom: Clear the xscom status bits from HMER register. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Mahesh Salgaonkar The completion status of each scom read/write operation is reported through HMER bits 8,9 and 21-23. These HMER bits are sticky and they remain set until they are cleared. The current opal code do not care to clear this until next scom read/write operation is kicked in. Though this may be ok as long as corresponding bits of HMEER are masked to avoid HMI getting triggered, but it is always good to clear them as soon as scom operations are completed. Signed-off-by: Mahesh Salgaonkar --- Change in V2: - Clear the HMER scom status bits in fail path of xscom_reset(). --- hw/xscom.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/xscom.c b/hw/xscom.c index 63813f1..92f9743 100644 --- a/hw/xscom.c +++ b/hw/xscom.c @@ -126,12 +126,18 @@ static void xscom_reset(uint32_t gcid) hmer = xscom_wait_done(); if (hmer & SPR_HMER_XSCOM_FAIL) goto fail; + + /* Clear the scom status in HMER */ + mtspr(SPR_HMER, HMER_CLR_MASK); return; fail: /* Fatal error resetting XSCOM */ log_simple_error(&e_info(OPAL_RC_XSCOM_RESET), "XSCOM: Fatal error resetting engine after failed access !\n"); + /* Clear the scom status in HMER */ + mtspr(SPR_HMER, HMER_CLR_MASK); + /* XXX Generate error log ? attn ? panic ? * If we decide to panic, change the above severity to PANIC */ @@ -265,8 +271,11 @@ static int __xscom_read(uint32_t gcid, uint32_t pcb_addr, uint64_t *val) hmer = xscom_wait_done(); /* Check for error */ - if (!(hmer & SPR_HMER_XSCOM_FAIL)) + if (!(hmer & SPR_HMER_XSCOM_FAIL)) { + /* Clear the scom status in HMER */ + mtspr(SPR_HMER, HMER_CLR_MASK); return OPAL_SUCCESS; + } /* Handle error and possibly eventually retry */ ret = xscom_handle_error(hmer, gcid, pcb_addr, false, retries); @@ -301,8 +310,11 @@ static int __xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val) hmer = xscom_wait_done(); /* Check for error */ - if (!(hmer & SPR_HMER_XSCOM_FAIL)) + if (!(hmer & SPR_HMER_XSCOM_FAIL)) { + /* Clear the scom status in HMER */ + mtspr(SPR_HMER, HMER_CLR_MASK); return OPAL_SUCCESS; + } /* Handle error and possibly eventually retry */ ret = xscom_handle_error(hmer, gcid, pcb_addr, true, retries);