Browse Source

refactor(cm): enable S-EL2 globally for all contexts

Currently, S-EL2 is being enabled specifically while we are in
secure context and gets toggled up when we exit secure world.
This behavior is not ideal and needs correction.

Enabling the S-EL2 via SCR_EL3.EEL2 register setting should be
global and this patch addresses it.

Change-Id: If6c39ca258f2fefa835c4b51e0f6b68165fd2e35
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
pull/1993/merge
Jayanth Dodderi Chidanand 1 year ago
parent
commit
9f4b6259eb
  1. 17
      lib/el3_runtime/aarch64/context_mgmt.c

17
lib/el3_runtime/aarch64/context_mgmt.c

@ -135,16 +135,6 @@ static void setup_secure_context(cpu_context_t *ctx, const struct entry_point_in
}
#endif /* CTX_INCLUDE_MTE_REGS */
/* Enable S-EL2 if the next EL is EL2 and S-EL2 is present */
if ((GET_EL(ep->spsr) == MODE_EL2) && is_feat_sel2_supported()) {
if (GET_RW(ep->spsr) != MODE_RW_64) {
ERROR("S-EL2 can not be used in AArch32\n.");
panic();
}
scr_el3 |= SCR_EEL2_BIT;
}
write_ctx_reg(state, CTX_SCR_EL3, scr_el3);
/*
@ -485,6 +475,13 @@ static void setup_context_common(cpu_context_t *ctx, const entry_point_info_t *e
scr_el3 |= SCR_TWEDEn_BIT;
}
#if IMAGE_BL31 && defined(SPD_spmd) && SPMD_SPM_AT_SEL2
/* Enable S-EL2 if FEAT_SEL2 is implemented for all the contexts. */
if (is_feat_sel2_supported()) {
scr_el3 |= SCR_EEL2_BIT;
}
#endif /* (IMAGE_BL31 && defined(SPD_spmd) && SPMD_SPM_AT_SEL2) */
/*
* Populate EL3 state so that we've the right context
* before doing ERET

Loading…
Cancel
Save