cortex_a720.S 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <common/bl_common.h>
  9. #include <cortex_a720.h>
  10. #include <cpu_macros.S>
  11. #include <plat_macros.S>
  12. #include "wa_cve_2022_23960_bhb_vector.S"
  13. /* Hardware handled coherency */
  14. #if HW_ASSISTED_COHERENCY == 0
  15. #error "Cortex A720 must be compiled with HW_ASSISTED_COHERENCY enabled"
  16. #endif
  17. /* 64-bit only core */
  18. #if CTX_INCLUDE_AARCH32_REGS == 1
  19. #error "Cortex A720 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
  20. #endif
  21. #if WORKAROUND_CVE_2022_23960
  22. wa_cve_2022_23960_bhb_vector_table CORTEX_A720_BHB_LOOP_COUNT, cortex_a720
  23. #endif /* WORKAROUND_CVE_2022_23960 */
  24. workaround_reset_start cortex_a720, ERRATUM(2792132), ERRATA_A720_2792132
  25. sysreg_bit_set CORTEX_A720_CPUACTLR2_EL1, BIT(26)
  26. workaround_reset_end cortex_a720, ERRATUM(2792132)
  27. check_erratum_ls cortex_a720, ERRATUM(2792132), CPU_REV(0, 1)
  28. workaround_reset_start cortex_a720, ERRATUM(2844092), ERRATA_A720_2844092
  29. sysreg_bit_set CORTEX_A720_CPUACTLR4_EL1, BIT(11)
  30. workaround_reset_end cortex_a720, ERRATUM(2844092)
  31. check_erratum_ls cortex_a720, ERRATUM(2844092), CPU_REV(0, 1)
  32. workaround_reset_start cortex_a720, ERRATUM(2926083), ERRATA_A720_2926083
  33. /* Erratum 2926083 workaround is required only if SPE is enabled */
  34. #if ENABLE_SPE_FOR_NS != 0
  35. /* Check if Static profiling extension is implemented or present. */
  36. mrs x1, id_aa64dfr0_el1
  37. ubfx x0, x1, ID_AA64DFR0_PMS_SHIFT, #4
  38. cbz x0, 1f
  39. /* Apply the workaround by setting CPUACTLR_EL1[58:57] = 0b11. */
  40. sysreg_bit_set CORTEX_A720_CPUACTLR_EL1, BIT(57)
  41. sysreg_bit_set CORTEX_A720_CPUACTLR_EL1, BIT(58)
  42. 1:
  43. #endif
  44. workaround_reset_end cortex_a720, ERRATUM(2926083)
  45. check_erratum_ls cortex_a720, ERRATUM(2926083), CPU_REV(0, 1)
  46. workaround_reset_start cortex_a720, ERRATUM(2940794), ERRATA_A720_2940794
  47. sysreg_bit_set CORTEX_A720_CPUACTLR2_EL1, BIT(37)
  48. workaround_reset_end cortex_a720, ERRATUM(2940794)
  49. check_erratum_ls cortex_a720, ERRATUM(2940794), CPU_REV(0, 1)
  50. workaround_reset_start cortex_a720, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
  51. #if IMAGE_BL31
  52. /*
  53. * The Cortex A720 generic vectors are overridden to apply errata
  54. * mitigation on exception entry from lower ELs.
  55. */
  56. override_vector_table wa_cve_vbar_cortex_a720
  57. #endif /* IMAGE_BL31 */
  58. workaround_reset_end cortex_a720, CVE(2022, 23960)
  59. check_erratum_chosen cortex_a720, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
  60. cpu_reset_func_start cortex_a720
  61. /* Disable speculative loads */
  62. msr SSBS, xzr
  63. cpu_reset_func_end cortex_a720
  64. /* ----------------------------------------------------
  65. * HW will do the cache maintenance while powering down
  66. * ----------------------------------------------------
  67. */
  68. func cortex_a720_core_pwr_dwn
  69. /* ---------------------------------------------------
  70. * Enable CPU power down bit in power control register
  71. * ---------------------------------------------------
  72. */
  73. sysreg_bit_set CORTEX_A720_CPUPWRCTLR_EL1, CORTEX_A720_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
  74. isb
  75. ret
  76. endfunc cortex_a720_core_pwr_dwn
  77. /* ---------------------------------------------
  78. * This function provides Cortex A720-specific
  79. * register information for crash reporting.
  80. * It needs to return with x6 pointing to
  81. * a list of register names in ascii and
  82. * x8 - x15 having values of registers to be
  83. * reported.
  84. * ---------------------------------------------
  85. */
  86. .section .rodata.cortex_a720_regs, "aS"
  87. cortex_a720_regs: /* The ascii list of register names to be reported */
  88. .asciz "cpuectlr_el1", ""
  89. func cortex_a720_cpu_reg_dump
  90. adr x6, cortex_a720_regs
  91. mrs x8, CORTEX_A720_CPUECTLR_EL1
  92. ret
  93. endfunc cortex_a720_cpu_reg_dump
  94. declare_cpu_ops cortex_a720, CORTEX_A720_MIDR, \
  95. cortex_a720_reset_func, \
  96. cortex_a720_core_pwr_dwn