sme.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef SME_H
  7. #define SME_H
  8. #include <stdbool.h>
  9. #include <context.h>
  10. /*
  11. * Maximum value of LEN field in SMCR_ELx. This is different than the maximum
  12. * supported value which is platform dependent. In the first version of SME the
  13. * LEN field is limited to 4 bits but will be expanded in future iterations.
  14. * To support different versions, the code that discovers the supported vector
  15. * lengths will write the max value into SMCR_ELx then read it back to see how
  16. * many bits are implemented.
  17. */
  18. #define SME_SMCR_LEN_MAX U(0x1FF)
  19. #if ENABLE_SME_FOR_NS
  20. void sme_init_el3(void);
  21. void sme_init_el2_unused(void);
  22. void sme_enable(cpu_context_t *context);
  23. void sme_disable(cpu_context_t *context);
  24. void sme_enable_per_world(per_world_context_t *per_world_ctx);
  25. void sme_disable_per_world(per_world_context_t *per_world_ctx);
  26. #else
  27. static inline void sme_init_el3(void)
  28. {
  29. }
  30. static inline void sme_init_el2_unused(void)
  31. {
  32. }
  33. static inline void sme_enable(cpu_context_t *context)
  34. {
  35. }
  36. static inline void sme_disable(cpu_context_t *context)
  37. {
  38. }
  39. static inline void sme_enable_per_world(per_world_context_t *per_world_ctx)
  40. {
  41. }
  42. static inline void sme_disable_per_world(per_world_context_t *per_world_ctx)
  43. {
  44. }
  45. #endif /* ENABLE_SME_FOR_NS */
  46. #endif /* SME_H */