Merge "fix(rmmd/sve): enable/disable SVE/FPU for Realms" into integration

This commit is contained in:
Alexei Fedorov 2021-12-10 13:28:48 +01:00 committed by TrustedFirmware Code Review
commit 3082a33017
1 changed files with 27 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <services/rmi_svc.h>
#include <services/rmmd_svc.h>
#include <smccc_helpers.h>
#include <lib/extensions/sve.h>
#include "rmmd_initial_context.h"
#include "rmmd_private.h"
@ -111,6 +112,26 @@ static void rmm_el2_context_init(el2_sysregs_t *regs)
regs->ctx_regs[CTX_SCTLR_EL2 >> 3] = SCTLR_EL2_RES1;
}
/*******************************************************************************
* Enable architecture extensions on first entry to Realm world.
******************************************************************************/
static void manage_extensions_realm(cpu_context_t *ctx)
{
#if ENABLE_SVE_FOR_NS
/*
* Enable SVE and FPU in realm context when it is enabled for NS.
* Realm manager must ensure that the SVE and FPU register
* contexts are properly managed.
*/
sve_enable(ctx);
#else
/*
* Disable SVE and FPU in realm context when it is disabled for NS.
*/
sve_disable(ctx);
#endif /* ENABLE_SVE_FOR_NS */
}
/*******************************************************************************
* Jump to the RMM for the first time.
******************************************************************************/
@ -124,6 +145,9 @@ static int32_t rmm_init(void)
INFO("RMM init start.\n");
ctx->state = RMM_STATE_RESET;
/* Enable architecture extensions */
manage_extensions_realm(&ctx->cpu_ctx);
/* Initialize RMM EL2 context. */
rmm_el2_context_init(&ctx->cpu_ctx.el2_sysregs_ctx);
@ -281,6 +305,9 @@ static void *rmmd_cpu_on_finish_handler(const void *arg)
/* Initialise RMM context with this entry point information */
cm_setup_context(&ctx->cpu_ctx, rmm_ep_info);
/* Enable architecture extensions */
manage_extensions_realm(&ctx->cpu_ctx);
/* Initialize RMM EL2 context. */
rmm_el2_context_init(&ctx->cpu_ctx.el2_sysregs_ctx);