1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4  */
5 
6 #include <arch_helpers.h>
7 #include <assert.h>
8 #include <sve.h>
9 
10 /*
11  * Save the SVE context to memory.
12  * The function saves the maximum implemented
13  * SVE context size.
14  */
save_sve_state(struct sve_state * sve)15 void save_sve_state(struct sve_state *sve)
16 {
17 	assert(sve != NULL);
18 
19 	save_sve_zcr_fpu_state(sve->zcr_fpu);
20 	save_sve_z_state(sve->z);
21 	save_sve_p_ffr_state(sve->p_ffr);
22 }
23 
24 /*
25  * Restore the SVE context from memory.
26  * The function restores the maximum implemented
27  * SVE context size.
28  */
restore_sve_state(struct sve_state * sve)29 void restore_sve_state(struct sve_state *sve)
30 {
31 	assert(sve != NULL);
32 
33 	restore_sve_z_state(sve->z);
34 	restore_sve_p_ffr_state(sve->p_ffr);
35 	restore_sve_zcr_fpu_state(sve->zcr_fpu);
36 }
37