From 16e3ddba1f049106387dfe21989243d2fc4cf061 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Fri, 3 Feb 2023 15:23:59 +0000 Subject: [PATCH] fix(spe): drop SPE EL2 context switch code At the moment we hardcode the SPE functionality to be available on the non-secure side only, by setting MDCR_EL3.NSPB accordingly. This also means that the secure world cannot use SPE, so there is no need to context switch the PMSCR_EL2 register. Drop the SPE bits from the EL2 context switch code. If any of the other EL2 worlds wish to start using SPE, this can be brought back. Change-Id: Ie0fedb2aeb722a2c9db316051fbbe57ca0e3c0c9 Signed-off-by: Andre Przywara --- include/lib/el3_runtime/aarch64/context.h | 4 ---- lib/el3_runtime/aarch64/context.S | 18 ------------------ lib/el3_runtime/aarch64/context_mgmt.c | 6 ------ 3 files changed, 28 deletions(-) diff --git a/include/lib/el3_runtime/aarch64/context.h b/include/lib/el3_runtime/aarch64/context.h index 31d8f070c..4cbda36b6 100644 --- a/include/lib/el3_runtime/aarch64/context.h +++ b/include/lib/el3_runtime/aarch64/context.h @@ -514,10 +514,6 @@ void el1_sysregs_context_restore(el1_sysregs_t *regs); #if CTX_INCLUDE_EL2_REGS void el2_sysregs_context_save_common(el2_sysregs_t *regs); void el2_sysregs_context_restore_common(el2_sysregs_t *regs); -#if ENABLE_SPE_FOR_LOWER_ELS -void el2_sysregs_context_save_spe(el2_sysregs_t *regs); -void el2_sysregs_context_restore_spe(el2_sysregs_t *regs); -#endif /* ENABLE_SPE_FOR_LOWER_ELS */ #if CTX_INCLUDE_MTE_REGS void el2_sysregs_context_save_mte(el2_sysregs_t *regs); void el2_sysregs_context_restore_mte(el2_sysregs_t *regs); diff --git a/lib/el3_runtime/aarch64/context.S b/lib/el3_runtime/aarch64/context.S index d43914848..b05833432 100644 --- a/lib/el3_runtime/aarch64/context.S +++ b/lib/el3_runtime/aarch64/context.S @@ -13,10 +13,6 @@ #if CTX_INCLUDE_EL2_REGS .global el2_sysregs_context_save_common .global el2_sysregs_context_restore_common -#if ENABLE_SPE_FOR_LOWER_ELS - .global el2_sysregs_context_save_spe - .global el2_sysregs_context_restore_spe -#endif /* ENABLE_SPE_FOR_LOWER_ELS */ #if CTX_INCLUDE_MTE_REGS .global el2_sysregs_context_save_mte .global el2_sysregs_context_restore_mte @@ -220,20 +216,6 @@ func el2_sysregs_context_restore_common ret endfunc el2_sysregs_context_restore_common -#if ENABLE_SPE_FOR_LOWER_ELS -func el2_sysregs_context_save_spe - mrs x13, PMSCR_EL2 - str x13, [x0, #CTX_PMSCR_EL2] - ret -endfunc el2_sysregs_context_save_spe - -func el2_sysregs_context_restore_spe - ldr x13, [x0, #CTX_PMSCR_EL2] - msr PMSCR_EL2, x13 - ret -endfunc el2_sysregs_context_restore_spe -#endif /* ENABLE_SPE_FOR_LOWER_ELS */ - #if CTX_INCLUDE_MTE_REGS func el2_sysregs_context_save_mte mrs x9, TFSR_EL2 diff --git a/lib/el3_runtime/aarch64/context_mgmt.c b/lib/el3_runtime/aarch64/context_mgmt.c index 507a8ce8a..e1c671d8b 100644 --- a/lib/el3_runtime/aarch64/context_mgmt.c +++ b/lib/el3_runtime/aarch64/context_mgmt.c @@ -856,9 +856,6 @@ void cm_el2_sysregs_context_save(uint32_t security_state) el2_sysregs_ctx = get_el2_sysregs_ctx(ctx); el2_sysregs_context_save_common(el2_sysregs_ctx); -#if ENABLE_SPE_FOR_LOWER_ELS - el2_sysregs_context_save_spe(el2_sysregs_ctx); -#endif #if CTX_INCLUDE_MTE_REGS el2_sysregs_context_save_mte(el2_sysregs_ctx); #endif @@ -919,9 +916,6 @@ void cm_el2_sysregs_context_restore(uint32_t security_state) el2_sysregs_ctx = get_el2_sysregs_ctx(ctx); el2_sysregs_context_restore_common(el2_sysregs_ctx); -#if ENABLE_SPE_FOR_LOWER_ELS - el2_sysregs_context_restore_spe(el2_sysregs_ctx); -#endif #if CTX_INCLUDE_MTE_REGS el2_sysregs_context_restore_mte(el2_sysregs_ctx); #endif -- 2.39.5