diff mbox series

[1/3] xscom: Conditionally create elogs for read/write addr failures

Message ID 1575465990-25353-2-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>

Currently we unconditionally create elogs for all xscom read/write
failures. However some of the xscom read/write failures related to
invalid address are not severe enough to cause a checkstop and it is
sufficient to log these errors in opal msglog but not in elogs.

This patch defines a new variable to indicate whether xscom read/write
errors pertaining to invalid address should be logged in elogs.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 hw/xscom.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hw/xscom.c b/hw/xscom.c
index f3f4e10..0cbc23b 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -54,6 +54,32 @@  static struct {
  */
 static struct lock xscom_lock = LOCK_UNLOCKED;
 
+static bool create_xscom_rw_addr_elog = true;
+
+static inline void log_xscom_rw_error(uint32_t gcid, uint32_t pcb_addr,
+				      unsigned int stat,
+				      bool is_write)
+{
+	/*
+	 * If the failure is due to incorrect address, and we the
+	 * caller doesn't want elog to be created, log the error in
+	 * msglog and return.
+	 */
+	if (stat == 4 && !create_xscom_rw_addr_elog) {
+		prlog(PR_WARNING,
+		      "XSCOM: %s error gcid=0x%x pcb_addr=0x%x stat=0x%x\n",
+		      is_write ? "write" : "read",
+		      gcid, pcb_addr, stat);
+
+		return;
+	}
+
+	log_simple_error(&e_info(OPAL_RC_XSCOM_RW),
+			 "XSCOM: %s error gcid=0x%x pcb_addr=0x%x stat=0x%x\n",
+			 is_write ? "write" : "read",
+			 gcid, pcb_addr, stat);
+}
+
 static inline void *xscom_addr(uint32_t gcid, uint32_t pcb_addr)
 {
 	struct proc_chip *chip = get_chip(gcid);
@@ -272,10 +298,7 @@  static int64_t xscom_handle_error(uint64_t hmer, uint32_t gcid, uint32_t pcb_add
 		break;
 	}
 
-	/* XXX: Create error log entry ? */
-	log_simple_error(&e_info(OPAL_RC_XSCOM_RW),
-		"XSCOM: %s error gcid=0x%x pcb_addr=0x%x stat=0x%x\n",
-		is_write ? "write" : "read", gcid, pcb_addr, stat);
+	log_xscom_rw_error(gcid, pcb_addr, stat, is_write);
 
 	/* We need to reset the XSCOM or we'll hang on the next access */
 	xscom_reset(gcid, false);