[v2,10/15] opal/hmi: Stop flooding HMI event for TOD errors.

Message ID 152390004290.2566.6881086010339053229.stgit@jupiter.in.ibm.com
State Accepted
Headers show
Series
  • opal/hmi: Rework HMI handling.
Related show

Commit Message

Mahesh J Salgaonkar April 16, 2018, 5:34 p.m.
From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

Fix the issue where every thread on the chip sends HMI event to host for
TOD errors. TOD errors are reported to all the core/threads on the chip.
Any one thread can fix the error and send event. Rest of the threads don't
need to send HMI event unnecessarily.

This patch fixes this by modifying __chiptod_recover_tod_errors() function
to return -1 if no errors found. Without this change every thread that
see TFMR[51]=1 sends HMI event to the host kernel.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
---
 hw/chiptod.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/chiptod.c b/hw/chiptod.c
index 33d553956..28ed8973a 100644
--- a/hw/chiptod.c
+++ b/hw/chiptod.c
@@ -974,7 +974,7 @@  static int __chiptod_recover_tod_errors(void)
 {
 	uint64_t terr;
 	uint64_t treset = 0;
-	int i;
+	int i, rc = -1;
 	int32_t chip_id = this_cpu()->chip_id;
 
 	/* Read TOD error register */
@@ -990,6 +990,7 @@  static int __chiptod_recover_tod_errors(void)
 		(terr & TOD_ERR_DELAY_COMPL_PARITY) ||
 		(terr & TOD_ERR_TOD_REGISTER_PARITY)) {
 		chiptod_reset_tod_errors();
+		rc = 1;
 	}
 
 	/*
@@ -1023,7 +1024,9 @@  static int __chiptod_recover_tod_errors(void)
 		return 0;
 	}
 	/* We have handled all the TOD errors routed to hypervisor */
-	return 1;
+	if (treset)
+		rc = 1;
+	return rc;
 }
 
 int chiptod_recover_tod_errors(void)