diff mbox series

[2/3] xscom: Add a create_addr_elog parameter to _xscom_read/write() calls

Message ID 1575465990-25353-3-git-send-email-ego@linux.vnet.ibm.com
State Superseded
Headers show
Series xscom: Don't create PELs for non-severe read/write failures | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d75e82dbfbb9443efeb3f9a5921ac23605aab469)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Gautham R Shenoy Dec. 4, 2019, 1:26 p.m. UTC
From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Introduce an additional boolean parameter named create_addr_elog to
the _xscom_read() and _xscom_write() calls to indicate whether PEL
records should be created on xscom read/write failures pertaining to
invalid address. Currently all the callers of these calls set the
parameter to true.

This will be used in the next patch where the failures of xscom
read/write requests from the kernel will only be logged in the opal
msglog but not in PEL.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 hw/sbe-p8.c     |  7 ++++---
 hw/xscom.c      | 22 ++++++++++++++++------
 include/xscom.h | 10 ++++++----
 3 files changed, 26 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/hw/sbe-p8.c b/hw/sbe-p8.c
index a26883c..9972594 100644
--- a/hw/sbe-p8.c
+++ b/hw/sbe-p8.c
@@ -89,7 +89,8 @@  void p8_sbe_update_timer_expiry(uint64_t new_target)
 	do {
 		/* Grab generation and spin if odd */
 		for (;;) {
-			rc = _xscom_read(sbe_timer_chip, 0xE0006, &gen, false);
+			rc = _xscom_read(sbe_timer_chip, 0xE0006, &gen, false,
+					 true);
 			if (rc) {
 				prerror("SLW: Error %lld reading tmr gen "
 					" count\n", rc);
@@ -125,7 +126,7 @@  void p8_sbe_update_timer_expiry(uint64_t new_target)
 			}
 		}
 
-		rc = _xscom_write(sbe_timer_chip, 0x5003A, req, false);
+		rc = _xscom_write(sbe_timer_chip, 0x5003A, req, false, true);
 		if (rc) {
 			prerror("SLW: Error %lld writing tmr request\n", rc);
 			_xscom_unlock();
@@ -133,7 +134,7 @@  void p8_sbe_update_timer_expiry(uint64_t new_target)
 		}
 
 		/* Re-check gen count */
-		rc = _xscom_read(sbe_timer_chip, 0xE0006, &gen2, false);
+		rc = _xscom_read(sbe_timer_chip, 0xE0006, &gen2, false, true);
 		if (rc) {
 			prerror("SLW: Error %lld re-reading tmr gen "
 				" count\n", rc);
diff --git a/hw/xscom.c b/hw/xscom.c
index 0cbc23b..e8cdabc 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -599,7 +599,8 @@  void _xscom_unlock(void)
 /*
  * External API
  */
-int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_lock)
+int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_lock,
+		bool create_addr_elog)
 {
 	uint32_t gcid;
 	int rc;
@@ -639,8 +640,10 @@  int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_loc
 	}
 
 	/* HW822317 requires us to do global locking */
-	if (take_lock)
+	if (take_lock) {
 		lock(&xscom_lock);
+		create_xscom_rw_addr_elog = create_addr_elog;
+	}
 
 	/* Direct vs indirect access */
 	if (pcb_addr & XSCOM_ADDR_IND_FLAG)
@@ -649,14 +652,17 @@  int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_loc
 		rc = __xscom_read(gcid, pcb_addr & 0x7fffffff, val);
 
 	/* Unlock it */
-	if (take_lock)
+	if (take_lock) {
+		create_xscom_rw_addr_elog = true;
 		unlock(&xscom_lock);
+	}
 	return rc;
 }
 
 opal_call(OPAL_XSCOM_READ, xscom_read, 3);
 
-int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_lock)
+int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_lock,
+		 bool create_addr_elog)
 {
 	uint32_t gcid;
 	int rc;
@@ -684,8 +690,10 @@  int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_loc
 	}
 
 	/* HW822317 requires us to do global locking */
-	if (take_lock)
+	if (take_lock) {
 		lock(&xscom_lock);
+		create_xscom_rw_addr_elog = create_addr_elog;
+	}
 
 	/* Direct vs indirect access */
 	if (pcb_addr & XSCOM_ADDR_IND_FLAG)
@@ -694,8 +702,10 @@  int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_loc
 		rc = __xscom_write(gcid, pcb_addr & 0x7fffffff, val);
 
 	/* Unlock it */
-	if (take_lock)
+	if (take_lock) {
+		create_xscom_rw_addr_elog = true;
 		unlock(&xscom_lock);
+	}
 	return rc;
 }
 opal_call(OPAL_XSCOM_WRITE, xscom_write, 3);
diff --git a/include/xscom.h b/include/xscom.h
index 8a466d5..7325a16 100644
--- a/include/xscom.h
+++ b/include/xscom.h
@@ -166,18 +166,20 @@ 
 
 /* Use only in select places where multiple SCOMs are time/latency sensitive */
 extern void _xscom_lock(void);
-extern int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_lock);
-extern int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_lock);
+extern int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_lock,
+		       bool create_addr_elog);
+extern int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_lock,
+			bool create_addr_elog);
 extern void _xscom_unlock(void);
 
 
 /* Targeted SCOM access */
 static inline int xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val)
 {
-	return _xscom_read(partid, pcb_addr, val, true);
+	return _xscom_read(partid, pcb_addr, val, true, true);
 }
 static inline int xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val) {
-	return _xscom_write(partid, pcb_addr, val, true);
+	return _xscom_write(partid, pcb_addr, val, true, true);
 }
 extern int xscom_write_mask(uint32_t partid, uint64_t pcb_addr, uint64_t val, uint64_t mask);