Commit 2ccfcb2e authored by Jeenu Viswambharan's avatar Jeenu Viswambharan
Browse files

SDEI: Determine client EL from NS context's SCR_EL3



Currently, the dispatcher reads from SCR_EL3 register directly to
determine the EL of SDEI client. This is with the assumption that
SCR_EL3 is not modified throughout. However, with RAS work flows, it's
possible that SCR_EL3 register contains values corresponding to Secure
world, and therefore EL determination can go wrong. To mitigate this,
always read the register from the saved Non-secure context.

Change-Id: Ic85e4021deb18eb58757f676f9a001174998543a
Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
parent af2c9ecd
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <assert.h> #include <assert.h>
#include <bl_common.h> #include <bl_common.h>
#include <cassert.h> #include <cassert.h>
#include <context_mgmt.h>
#include <debug.h> #include <debug.h>
#include <ehf.h> #include <ehf.h>
#include <interrupt_mgmt.h> #include <interrupt_mgmt.h>
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <bl_common.h> #include <bl_common.h>
#include <cassert.h> #include <cassert.h>
#include <context.h> #include <context.h>
#include <context_mgmt.h>
#include <debug.h> #include <debug.h>
#include <ehf.h> #include <ehf.h>
#include <interrupt_mgmt.h> #include <interrupt_mgmt.h>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define __SDEI_PRIVATE_H__ #define __SDEI_PRIVATE_H__
#include <arch_helpers.h> #include <arch_helpers.h>
#include <context_mgmt.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <interrupt_mgmt.h> #include <interrupt_mgmt.h>
...@@ -159,7 +160,11 @@ static inline int is_secure_sgi(unsigned int intr) ...@@ -159,7 +160,11 @@ static inline int is_secure_sgi(unsigned int intr)
*/ */
static inline unsigned int sdei_client_el(void) static inline unsigned int sdei_client_el(void)
{ {
return read_scr_el3() & SCR_HCE_BIT ? MODE_EL2 : MODE_EL1; cpu_context_t *ns_ctx = cm_get_context(NON_SECURE);
el3_state_t *el3_ctx = get_el3state_ctx(ns_ctx);
return read_ctx_reg(el3_ctx, CTX_SPSR_EL3) & SCR_HCE_BIT ? MODE_EL2 :
MODE_EL1;
} }
static inline unsigned int sdei_event_priority(sdei_ev_map_t *map) static inline unsigned int sdei_event_priority(sdei_ev_map_t *map)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment