fgt2.c 578 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <arch_features.h>
  8. #include <arch_helpers.h>
  9. #include <lib/extensions/fgt2.h>
  10. void fgt2_enable(cpu_context_t *context)
  11. {
  12. u_register_t reg;
  13. el3_state_t *state;
  14. state = get_el3state_ctx(context);
  15. /* Set the FGTEN2 bit in SCR_EL3 to enable access to HFGITR2_EL2,
  16. * HFGRTR2_EL2, HFGWTR_EL2, HDFGRTR2_EL2, and HDFGWTR2_EL2.
  17. */
  18. reg = read_ctx_reg(state, CTX_SCR_EL3);
  19. reg |= SCR_FGTEN2_BIT;
  20. write_ctx_reg(state, CTX_SCR_EL3, reg);
  21. }