Browse Source

feat(spm-mm): switch to simd_ctx_save/restore APIs

This patch demonstrates the trivial changes to transparently switch
the fpregs_context_* helpers to simd_ctx_* helpers.

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Signed-off-by: Okash Khawaja <okash@google.com>
Change-Id: I14bda6bd0ead1f34a570b59be8dec3ac40891c20
pull/2005/merge
Madhukar Pappireddy 5 months ago
parent
commit
e6e348689a
  1. 23
      services/std_svc/spm/spm_mm/spm_mm_main.c

23
services/std_svc/spm/spm_mm/spm_mm_main.c

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -13,6 +13,7 @@
#include <common/debug.h> #include <common/debug.h>
#include <common/runtime_svc.h> #include <common/runtime_svc.h>
#include <lib/el3_runtime/context_mgmt.h> #include <lib/el3_runtime/context_mgmt.h>
#include <lib/el3_runtime/simd_ctx.h>
#include <lib/smccc.h> #include <lib/smccc.h>
#include <lib/spinlock.h> #include <lib/spinlock.h>
#include <lib/utils.h> #include <lib/utils.h>
@ -190,13 +191,13 @@ uint64_t spm_mm_sp_call(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3)
uint64_t rc; uint64_t rc;
sp_context_t *sp_ptr = &sp_ctx; sp_context_t *sp_ptr = &sp_ctx;
#if CTX_INCLUDE_FPREGS #if CTX_INCLUDE_FPREGS || CTX_INCLUDE_SVE_REGS
/* /*
* SP runs to completion, no need to restore FP registers of secure context. * SP runs to completion, no need to restore FP/SVE registers of secure context.
* Save FP registers only for non secure context. * Save FP/SVE registers only for non secure context.
*/ */
fpregs_context_save(get_fpregs_ctx(cm_get_context(NON_SECURE))); simd_ctx_save(NON_SECURE, false);
#endif #endif /* CTX_INCLUDE_FPREGS || CTX_INCLUDE_SVE_REGS */
/* Wait until the Secure Partition is idle and set it to busy. */ /* Wait until the Secure Partition is idle and set it to busy. */
sp_state_wait_switch(sp_ptr, SP_STATE_IDLE, SP_STATE_BUSY); sp_state_wait_switch(sp_ptr, SP_STATE_IDLE, SP_STATE_BUSY);
@ -216,13 +217,13 @@ uint64_t spm_mm_sp_call(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3)
assert(sp_ptr->state == SP_STATE_BUSY); assert(sp_ptr->state == SP_STATE_BUSY);
sp_state_set(sp_ptr, SP_STATE_IDLE); sp_state_set(sp_ptr, SP_STATE_IDLE);
#if CTX_INCLUDE_FPREGS #if CTX_INCLUDE_FPREGS || CTX_INCLUDE_SVE_REGS
/* /*
* SP runs to completion, no need to save FP registers of secure context. * SP runs to completion, no need to save FP/SVE registers of secure context.
* Restore only non secure world FP registers. * Restore only non secure world FP/SVE registers.
*/ */
fpregs_context_restore(get_fpregs_ctx(cm_get_context(NON_SECURE))); simd_ctx_restore(NON_SECURE);
#endif #endif /* CTX_INCLUDE_FPREGS || CTX_INCLUDE_SVE_REGS */
return rc; return rc;
} }

Loading…
Cancel
Save