1 /*
2  * Copyright 2021 The Hafnium Authors.
3  *
4  * Use of this source code is governed by a BSD-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/BSD-3-Clause.
7  */
8 
9 #include "hf/arch/types.h"
10 
11 #include "hf/vcpu.h"
12 
13 /** Max SVE vector length supported by the architecture. */
14 #define HF_SVE_VECTOR_LEN_MAX UINT32_C(2048)
15 
16 /**
17  * The checkpatch script is not able to handle C23 attribute notation syntax,
18  * and clang-format inserts a space.
19  */
20 /* clang-format off */
21 struct[[gnu::aligned(16)]] sve_context {
22 	/* FFR and predicates are one-eigth of the SVE vector length */
23 	uint8_t ffr[HF_SVE_VECTOR_LEN_MAX / 64];
24 
25 	uint8_t predicates[16][HF_SVE_VECTOR_LEN_MAX / 64];
26 
27 	uint8_t vectors[32][HF_SVE_VECTOR_LEN_MAX / 8];
28 };
29 /* clang-format on */
30 
31 void arch_sve_disable_traps(void);
32 void arch_sve_enable_traps(void);
33 void arch_sve_configure_vector_length(void);
34