blob: dbefdfc95cb96f7fe38846d52e47d0aa670e43e1 [file] [log] [blame]
johpow019baade32021-07-08 14:14:00 -05001/*
Jayanth Dodderi Chidanand605419a2023-03-06 23:56:14 +00002 * Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
johpow019baade32021-07-08 14:14:00 -05003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SME_H
8#define SME_H
9
10#include <stdbool.h>
johpow019baade32021-07-08 14:14:00 -050011#include <context.h>
12
13/*
14 * Maximum value of LEN field in SMCR_ELx. This is different than the maximum
15 * supported value which is platform dependent. In the first version of SME the
16 * LEN field is limited to 4 bits but will be expanded in future iterations.
17 * To support different versions, the code that discovers the supported vector
18 * lengths will write the max value into SMCR_ELx then read it back to see how
19 * many bits are implemented.
20 */
21#define SME_SMCR_LEN_MAX U(0x1FF)
22
Jayanth Dodderi Chidanand605419a2023-03-06 23:56:14 +000023#if ENABLE_SME_FOR_NS
johpow019baade32021-07-08 14:14:00 -050024void sme_enable(cpu_context_t *context);
Boyan Karatotev6468d4a2023-02-16 15:12:45 +000025void sme_init_el3(void);
26void sme_init_el2_unused(void);
johpow019baade32021-07-08 14:14:00 -050027void sme_disable(cpu_context_t *context);
Jayanth Dodderi Chidanand605419a2023-03-06 23:56:14 +000028#else
29static inline void sme_enable(cpu_context_t *context)
30{
31}
Boyan Karatotev6468d4a2023-02-16 15:12:45 +000032static inline void sme_init_el3(void)
33{
34}
35static inline void sme_init_el2_unused(void)
36{
37}
Jayanth Dodderi Chidanand605419a2023-03-06 23:56:14 +000038static inline void sme_disable(cpu_context_t *context)
39{
40}
41#endif /* ENABLE_SME_FOR_NS */
johpow019baade32021-07-08 14:14:00 -050042
43#endif /* SME_H */