xref: /rk3399_ARM-atf/include/lib/extensions/sme.h (revision 956201137588c99483a36df5f3fbb3dedc45a2a0)
1dc78e62dSjohpow01 /*
245007acdSJayanth Dodderi Chidanand  * Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
3dc78e62dSjohpow01  *
4dc78e62dSjohpow01  * SPDX-License-Identifier: BSD-3-Clause
5dc78e62dSjohpow01  */
6dc78e62dSjohpow01 
7dc78e62dSjohpow01 #ifndef SME_H
8dc78e62dSjohpow01 #define SME_H
9dc78e62dSjohpow01 
10dc78e62dSjohpow01 #include <stdbool.h>
11dc78e62dSjohpow01 #include <context.h>
12dc78e62dSjohpow01 
13dc78e62dSjohpow01 /*
14dc78e62dSjohpow01  * Maximum value of LEN field in SMCR_ELx. This is different than the maximum
15dc78e62dSjohpow01  * supported value which is platform dependent. In the first version of SME the
16dc78e62dSjohpow01  * LEN field is limited to 4 bits but will be expanded in future iterations.
17dc78e62dSjohpow01  * To support different versions, the code that discovers the supported vector
18dc78e62dSjohpow01  * lengths will write the max value into SMCR_ELx then read it back to see how
19dc78e62dSjohpow01  * many bits are implemented.
20dc78e62dSjohpow01  */
21dc78e62dSjohpow01 #define SME_SMCR_LEN_MAX	U(0x1FF)
22dc78e62dSjohpow01 
2345007acdSJayanth Dodderi Chidanand #if ENABLE_SME_FOR_NS
2460d330dcSBoyan Karatotev void sme_init_el3(void);
2560d330dcSBoyan Karatotev void sme_init_el2_unused(void);
26*461c0a5dSElizabeth Ho void sme_enable(cpu_context_t *context);
27dc78e62dSjohpow01 void sme_disable(cpu_context_t *context);
28*461c0a5dSElizabeth Ho void sme_enable_per_world(per_world_context_t *per_world_ctx);
29*461c0a5dSElizabeth Ho void sme_disable_per_world(per_world_context_t *per_world_ctx);
3045007acdSJayanth Dodderi Chidanand #else
sme_init_el3(void)3160d330dcSBoyan Karatotev static inline void sme_init_el3(void)
3260d330dcSBoyan Karatotev {
3360d330dcSBoyan Karatotev }
sme_init_el2_unused(void)3460d330dcSBoyan Karatotev static inline void sme_init_el2_unused(void)
3560d330dcSBoyan Karatotev {
3660d330dcSBoyan Karatotev }
sme_enable(cpu_context_t * context)37*461c0a5dSElizabeth Ho static inline void sme_enable(cpu_context_t *context)
38*461c0a5dSElizabeth Ho {
39*461c0a5dSElizabeth Ho }
sme_disable(cpu_context_t * context)4045007acdSJayanth Dodderi Chidanand static inline void sme_disable(cpu_context_t *context)
4145007acdSJayanth Dodderi Chidanand {
4245007acdSJayanth Dodderi Chidanand }
sme_enable_per_world(per_world_context_t * per_world_ctx)43*461c0a5dSElizabeth Ho static inline void sme_enable_per_world(per_world_context_t *per_world_ctx)
44*461c0a5dSElizabeth Ho {
45*461c0a5dSElizabeth Ho }
sme_disable_per_world(per_world_context_t * per_world_ctx)46*461c0a5dSElizabeth Ho static inline void sme_disable_per_world(per_world_context_t *per_world_ctx)
47*461c0a5dSElizabeth Ho {
48*461c0a5dSElizabeth Ho }
4945007acdSJayanth Dodderi Chidanand #endif /* ENABLE_SME_FOR_NS */
50dc78e62dSjohpow01 
51dc78e62dSjohpow01 #endif /* SME_H */
52