From e6e348689a4b25089145abb798fc2b2aabf6f90b Mon Sep 17 00:00:00 2001 From: Madhukar Pappireddy Date: Mon, 17 Jun 2024 19:26:55 -0500 Subject: [PATCH] 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 Signed-off-by: Okash Khawaja Change-Id: I14bda6bd0ead1f34a570b59be8dec3ac40891c20 --- services/std_svc/spm/spm_mm/spm_mm_main.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/services/std_svc/spm/spm_mm/spm_mm_main.c b/services/std_svc/spm/spm_mm/spm_mm_main.c index 1ff7bb77c..34e2c00f9 100644 --- a/services/std_svc/spm/spm_mm/spm_mm_main.c +++ b/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 */ @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -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; 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. - * Save FP registers only for non secure context. + * SP runs to completion, no need to restore FP/SVE registers of secure context. + * Save FP/SVE registers only for non secure context. */ - fpregs_context_save(get_fpregs_ctx(cm_get_context(NON_SECURE))); -#endif + simd_ctx_save(NON_SECURE, false); +#endif /* CTX_INCLUDE_FPREGS || CTX_INCLUDE_SVE_REGS */ /* Wait until the Secure Partition is idle and set it to 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); 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. - * Restore only non secure world FP registers. + * SP runs to completion, no need to save FP/SVE registers of secure context. + * Restore only non secure world FP/SVE registers. */ - fpregs_context_restore(get_fpregs_ctx(cm_get_context(NON_SECURE))); -#endif + simd_ctx_restore(NON_SECURE); +#endif /* CTX_INCLUDE_FPREGS || CTX_INCLUDE_SVE_REGS */ return rc; }