diff options
author | Ryan Grimm <grimm@linux.vnet.ibm.com> | 2014-09-29 18:48:18 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-09-30 14:46:07 +1000 |
commit | 26cb180c33ac64af3d5a600b9a2d8b6fdd74f35c (patch) | |
tree | 2819d0a451ef5c5769bc851b866567a01f5184cf /core/hmi.c | |
parent | 5aa2331ff59049be5410e69be3ee989672a15693 (diff) | |
download | skiboot-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.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; |