summaryrefslogtreecommitdiff
path: root/lib/el3_runtime/aarch64/context_mgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/el3_runtime/aarch64/context_mgmt.c')
-rw-r--r--lib/el3_runtime/aarch64/context_mgmt.c68
1 files changed, 35 insertions, 33 deletions
diff --git a/lib/el3_runtime/aarch64/context_mgmt.c b/lib/el3_runtime/aarch64/context_mgmt.c
index 7fbbd8171..42166eb99 100644
--- a/lib/el3_runtime/aarch64/context_mgmt.c
+++ b/lib/el3_runtime/aarch64/context_mgmt.c
@@ -492,11 +492,10 @@ static void manage_extensions_nonsecure(bool el2_unused, cpu_context_t *ctx)
/* Enable SME, SVE, and FPU/SIMD for non-secure world. */
if (is_feat_sme_supported()) {
sme_enable(ctx);
+ } else if (is_feat_sve_supported()) {
+ /* Enable SVE and FPU/SIMD for non-secure world. */
+ sve_enable(ctx);
}
-#if ENABLE_SVE_FOR_NS
- /* Enable SVE and FPU/SIMD for non-secure world. */
- sve_enable(ctx);
-#endif
if (is_feat_mpam_supported()) {
mpam_enable(el2_unused);
@@ -526,35 +525,38 @@ static void manage_extensions_nonsecure(bool el2_unused, cpu_context_t *ctx)
static void manage_extensions_secure(cpu_context_t *ctx)
{
#if IMAGE_BL31
- #if ENABLE_SME_FOR_NS
- #if ENABLE_SME_FOR_SWD
- /*
- * Enable SME, SVE, FPU/SIMD in secure context, secure manager must
- * ensure SME, SVE, and FPU/SIMD context properly managed.
- */
- sme_enable(ctx);
- #else /* ENABLE_SME_FOR_SWD */
- /*
- * Disable SME, SVE, FPU/SIMD in secure context so non-secure world can
- * safely use the associated registers.
- */
- sme_disable(ctx);
- #endif /* ENABLE_SME_FOR_SWD */
- #elif ENABLE_SVE_FOR_NS
- #if ENABLE_SVE_FOR_SWD
- /*
- * Enable SVE and FPU in secure context, secure manager must ensure that
- * the SVE and FPU register contexts are properly managed.
- */
- sve_enable(ctx);
- #else /* ENABLE_SVE_FOR_SWD */
- /*
- * Disable SVE and FPU in secure context so non-secure world can safely
- * use them.
- */
- sve_disable(ctx);
- #endif /* ENABLE_SVE_FOR_SWD */
- #endif /* ENABLE_SVE_FOR_NS */
+
+ if (is_feat_sme_supported()) {
+ if (ENABLE_SME_FOR_SWD) {
+ /*
+ * Enable SME, SVE, FPU/SIMD in secure context, secure manager
+ * must ensure SME, SVE, and FPU/SIMD context properly managed.
+ */
+ sme_enable(ctx);
+ } else {
+ /*
+ * Disable SME, SVE, FPU/SIMD in secure context so non-secure
+ * world can safely use the associated registers.
+ */
+ sme_disable(ctx);
+ }
+ } else if (is_feat_sve_supported()) {
+ if (ENABLE_SVE_FOR_SWD) {
+ /*
+ * Enable SVE and FPU in secure context, secure manager must
+ * ensure that the SVE and FPU register contexts are properly
+ * managed.
+ */
+ sve_enable(ctx);
+ } else {
+ /*
+ * Disable SVE and FPU in secure context so non-secure world
+ * can safely use them.
+ */
+ sve_disable(ctx);
+ }
+ }
+
#endif /* IMAGE_BL31 */
}