aboutsummaryrefslogtreecommitdiff
path: root/core/hmi.c
diff options
context:
space:
mode:
authorRyan Grimm <grimm@linux.vnet.ibm.com>2014-09-29 18:48:18 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-09-30 14:46:07 +1000
commit26cb180c33ac64af3d5a600b9a2d8b6fdd74f35c (patch)
tree2819d0a451ef5c5769bc851b866567a01f5184cf /core/hmi.c
parent5aa2331ff59049be5410e69be3ee989672a15693 (diff)
downloadskiboot-26cb180c33ac64af3d5a600b9a2d8b6fdd74f35c.zip
skiboot-26cb180c33ac64af3d5a600b9a2d8b6fdd74f35c.tar.gz
skiboot-26cb180c33ac64af3d5a600b9a2d8b6fdd74f35c.tar.bz2
hmi: Add locking to hmi handler
Take a lock before handle_hmi_event per Ben's suggestion. So, when we clear events, only one thread per core will report it. Signed-off-by: Ryan Grimm <grimm@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'core/hmi.c')
-rw-r--r--core/hmi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/hmi.c b/core/hmi.c
index 3ba7082..7e5ada4 100644
--- a/core/hmi.c
+++ b/core/hmi.c
@@ -18,6 +18,7 @@
#include <opal-msg.h>
#include <processor.h>
#include <chiptod.h>
+#include <lock.h>
/*
* HMER register layout:
@@ -140,6 +141,8 @@
* NOTE: Per Dave Larson, never enable 8,9,21-23
*/
+static struct lock hmi_lock = LOCK_UNLOCKED;
+
int handle_hmi_exception(uint64_t hmer, struct OpalHMIEvent *hmi_evt)
{
int recover = 1;
@@ -250,8 +253,10 @@ static int64_t opal_handle_hmi(void)
memset(&hmi_evt, 0, sizeof(struct OpalHMIEvent));
hmi_evt.version = OpalHMIEvt_V1;
+ lock(&hmi_lock);
hmer = mfspr(SPR_HMER); /* Get HMER register value */
recover = handle_hmi_exception(hmer, &hmi_evt);
+ unlock(&hmi_lock);
if (recover)
hmi_evt.disposition = OpalHMI_DISPOSITION_RECOVERED;