[Skiboot] [PATCH] opal/xscom: Clear the xscom status bits from HMER register.

Mahesh J Salgaonkar mahesh at linux.vnet.ibm.com
Wed Jun 28 03:50:36 AEST 2017


From: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>

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 <mahesh at linux.vnet.ibm.com>
---
 hw/xscom.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/hw/xscom.c b/hw/xscom.c
index 63813f1..943a254 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -126,6 +126,9 @@ 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 */
@@ -265,8 +268,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 +307,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);



More information about the Skiboot mailing list