johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 1 | /* |
Jayanth Dodderi Chidanand | 605419a | 2023-03-06 23:56:14 +0000 | [diff] [blame] | 2 | * Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved. |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef SME_H |
| 8 | #define SME_H |
| 9 | |
| 10 | #include <stdbool.h> |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 11 | #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 Chidanand | 605419a | 2023-03-06 23:56:14 +0000 | [diff] [blame] | 23 | #if ENABLE_SME_FOR_NS |
Boyan Karatotev | 6468d4a | 2023-02-16 15:12:45 +0000 | [diff] [blame] | 24 | void sme_init_el3(void); |
| 25 | void sme_init_el2_unused(void); |
Elizabeth Ho | 4fc00d2 | 2023-07-18 14:10:25 +0100 | [diff] [blame] | 26 | void sme_enable(cpu_context_t *context); |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 27 | void sme_disable(cpu_context_t *context); |
Elizabeth Ho | 4fc00d2 | 2023-07-18 14:10:25 +0100 | [diff] [blame] | 28 | void sme_enable_per_world(per_world_context_t *per_world_ctx); |
| 29 | void sme_disable_per_world(per_world_context_t *per_world_ctx); |
Jayanth Dodderi Chidanand | 605419a | 2023-03-06 23:56:14 +0000 | [diff] [blame] | 30 | #else |
Boyan Karatotev | 6468d4a | 2023-02-16 15:12:45 +0000 | [diff] [blame] | 31 | static inline void sme_init_el3(void) |
| 32 | { |
| 33 | } |
| 34 | static inline void sme_init_el2_unused(void) |
| 35 | { |
| 36 | } |
Elizabeth Ho | 4fc00d2 | 2023-07-18 14:10:25 +0100 | [diff] [blame] | 37 | static inline void sme_enable(cpu_context_t *context) |
| 38 | { |
| 39 | } |
Jayanth Dodderi Chidanand | 605419a | 2023-03-06 23:56:14 +0000 | [diff] [blame] | 40 | static inline void sme_disable(cpu_context_t *context) |
| 41 | { |
| 42 | } |
Elizabeth Ho | 4fc00d2 | 2023-07-18 14:10:25 +0100 | [diff] [blame] | 43 | static inline void sme_enable_per_world(per_world_context_t *per_world_ctx) |
| 44 | { |
| 45 | } |
| 46 | static inline void sme_disable_per_world(per_world_context_t *per_world_ctx) |
| 47 | { |
| 48 | } |
Jayanth Dodderi Chidanand | 605419a | 2023-03-06 23:56:14 +0000 | [diff] [blame] | 49 | #endif /* ENABLE_SME_FOR_NS */ |
johpow01 | 9baade3 | 2021-07-08 14:14:00 -0500 | [diff] [blame] | 50 | |
| 51 | #endif /* SME_H */ |