feat(cm): handle asymmetry for SPE feature

With introduction of FEAT_STATE_CHECK_ASYMMETRIC, the asymmetry of cores
can be handled. SPE is one of the features which can be asymmetric
across cores.

Add a function to handle this asymmetry by re-visting the feature
presence on running core.
There are two possible cases:
 - If the primary has the feature and secondary does not have it then,
   the feature needs to be disabled.
 - If the primary does not have the feature and secondary has it then,
   the feature need to be enabled

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ibb2b88b5ef63b3efcb80801898ae8d8967e5c271
This commit is contained in:
Manish Pandey 2024-07-18 16:27:13 +01:00
parent 2f41c9a7be
commit 188f8c4b60

View file

@ -1537,6 +1537,17 @@ void cm_el2_sysregs_context_restore(uint32_t security_state)
*********************************************************************************/
void cm_handle_asymmetric_features(void)
{
#if ENABLE_SPE_FOR_NS == FEAT_STATE_CHECK_ASYMMETRIC
cpu_context_t *spe_ctx = cm_get_context(NON_SECURE);
assert(spe_ctx != NULL);
if (is_feat_spe_supported()) {
spe_enable(spe_ctx);
} else {
spe_disable(spe_ctx);
}
#endif
}
#endif