cortex_a75.S 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <cortex_a75.h>
  9. #include <cpuamu.h>
  10. #include <cpu_macros.S>
  11. .global check_erratum_cortex_a75_764081
  12. /* Hardware handled coherency */
  13. #if HW_ASSISTED_COHERENCY == 0
  14. #error "Cortex-A75 must be compiled with HW_ASSISTED_COHERENCY enabled"
  15. #endif
  16. workaround_reset_start cortex_a75, ERRATUM(764081), ERRATA_A75_764081
  17. sysreg_bit_set sctlr_el3, SCTLR_IESB_BIT
  18. workaround_reset_end cortex_a75, ERRATUM(764081)
  19. check_erratum_ls cortex_a75, ERRATUM(764081), CPU_REV(0, 0)
  20. workaround_reset_start cortex_a75, ERRATUM(790748), ERRATA_A75_790748
  21. sysreg_bit_set CORTEX_A75_CPUACTLR_EL1, (1 << 13)
  22. workaround_reset_end cortex_a75, ERRATUM(790748)
  23. check_erratum_ls cortex_a75, ERRATUM(790748), CPU_REV(0, 0)
  24. /* ERRATA_DSU_798953 :
  25. * The errata is defined in dsu_helpers.S but applies to cortex_a75
  26. * as well. Henceforth creating symbolic names to the already existing errata
  27. * workaround functions to get them registered under the Errata Framework.
  28. */
  29. .equ check_erratum_cortex_a75_798953, check_errata_dsu_798953
  30. .equ erratum_cortex_a75_798953_wa, errata_dsu_798953_wa
  31. add_erratum_entry cortex_a75, ERRATUM(798953), ERRATA_DSU_798953, APPLY_AT_RESET
  32. /* ERRATA_DSU_936184 :
  33. * The errata is defined in dsu_helpers.S but applies to cortex_a75
  34. * as well. Henceforth creating symbolic names to the already existing errata
  35. * workaround functions to get them registered under the Errata Framework.
  36. */
  37. .equ check_erratum_cortex_a75_936184, check_errata_dsu_936184
  38. .equ erratum_cortex_a75_936184_wa, errata_dsu_936184_wa
  39. add_erratum_entry cortex_a75, ERRATUM(936184), ERRATA_DSU_936184, APPLY_AT_RESET
  40. workaround_reset_start cortex_a75, CVE(2017, 5715), WORKAROUND_CVE_2017_5715
  41. #if IMAGE_BL31
  42. override_vector_table wa_cve_2017_5715_bpiall_vbar
  43. #endif /* IMAGE_BL31 */
  44. workaround_reset_end cortex_a75, CVE(2017, 5715)
  45. check_erratum_custom_start cortex_a75, CVE(2017, 5715)
  46. cpu_check_csv2 x0, 1f
  47. #if WORKAROUND_CVE_2017_5715
  48. mov x0, #ERRATA_APPLIES
  49. #else
  50. mov x0, #ERRATA_MISSING
  51. #endif
  52. ret
  53. 1:
  54. mov x0, #ERRATA_NOT_APPLIES
  55. ret
  56. check_erratum_custom_end cortex_a75, CVE(2017, 5715)
  57. workaround_reset_start cortex_a75, CVE(2018, 3639), WORKAROUND_CVE_2018_3639
  58. sysreg_bit_set CORTEX_A75_CPUACTLR_EL1, CORTEX_A75_CPUACTLR_EL1_DISABLE_LOAD_PASS_STORE
  59. workaround_reset_end cortex_a75, CVE(2018, 3639)
  60. check_erratum_chosen cortex_a75, CVE(2018, 3639), WORKAROUND_CVE_2018_3639
  61. workaround_reset_start cortex_a75, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
  62. #if IMAGE_BL31
  63. /* Skip installing vector table again if already done for CVE(2017, 5715) */
  64. adr x0, wa_cve_2017_5715_bpiall_vbar
  65. mrs x1, vbar_el3
  66. cmp x0, x1
  67. b.eq 1f
  68. msr vbar_el3, x0
  69. 1:
  70. #endif /* IMAGE_BL31 */
  71. workaround_reset_end cortex_a75, CVE(2022, 23960)
  72. check_erratum_custom_start cortex_a75, CVE(2022, 23960)
  73. #if WORKAROUND_CVE_2017_5715 || WORKAROUND_CVE_2022_23960
  74. cpu_check_csv2 x0, 1f
  75. mov x0, #ERRATA_APPLIES
  76. ret
  77. 1:
  78. # if WORKAROUND_CVE_2022_23960
  79. mov x0, #ERRATA_APPLIES
  80. # else
  81. mov x0, #ERRATA_MISSING
  82. # endif /* WORKAROUND_CVE_2022_23960 */
  83. ret
  84. #endif /* WORKAROUND_CVE_2017_5715 || WORKAROUND_CVE_2022_23960 */
  85. mov x0, #ERRATA_MISSING
  86. ret
  87. check_erratum_custom_end cortex_a75, CVE(2022, 23960)
  88. /* -------------------------------------------------
  89. * The CPU Ops reset function for Cortex-A75.
  90. * -------------------------------------------------
  91. */
  92. cpu_reset_func_start cortex_a75
  93. #if ENABLE_FEAT_AMU
  94. /* Make sure accesses from EL0/EL1 and EL2 are not trapped to EL3 */
  95. sysreg_bit_set actlr_el3, CORTEX_A75_ACTLR_AMEN_BIT
  96. isb
  97. /* Make sure accesses from EL0/EL1 are not trapped to EL2 */
  98. sysreg_bit_set actlr_el2, CORTEX_A75_ACTLR_AMEN_BIT
  99. isb
  100. /* Enable group0 counters */
  101. mov x0, #CORTEX_A75_AMU_GROUP0_MASK
  102. msr CPUAMCNTENSET_EL0, x0
  103. isb
  104. /* Enable group1 counters */
  105. mov x0, #CORTEX_A75_AMU_GROUP1_MASK
  106. msr CPUAMCNTENSET_EL0, x0
  107. /* isb included in cpu_reset_func_end macro */
  108. #endif
  109. cpu_reset_func_end cortex_a75
  110. func check_smccc_arch_workaround_3
  111. mov x0, #ERRATA_APPLIES
  112. ret
  113. endfunc check_smccc_arch_workaround_3
  114. /* ---------------------------------------------
  115. * HW will do the cache maintenance while powering down
  116. * ---------------------------------------------
  117. */
  118. func cortex_a75_core_pwr_dwn
  119. /* ---------------------------------------------
  120. * Enable CPU power down bit in power control register
  121. * ---------------------------------------------
  122. */
  123. sysreg_bit_set CORTEX_A75_CPUPWRCTLR_EL1, \
  124. CORTEX_A75_CORE_PWRDN_EN_MASK
  125. isb
  126. ret
  127. endfunc cortex_a75_core_pwr_dwn
  128. /* ---------------------------------------------
  129. * This function provides cortex_a75 specific
  130. * register information for crash reporting.
  131. * It needs to return with x6 pointing to
  132. * a list of register names in ascii and
  133. * x8 - x15 having values of registers to be
  134. * reported.
  135. * ---------------------------------------------
  136. */
  137. .section .rodata.cortex_a75_regs, "aS"
  138. cortex_a75_regs: /* The ascii list of register names to be reported */
  139. .asciz "cpuectlr_el1", ""
  140. func cortex_a75_cpu_reg_dump
  141. adr x6, cortex_a75_regs
  142. mrs x8, CORTEX_A75_CPUECTLR_EL1
  143. ret
  144. endfunc cortex_a75_cpu_reg_dump
  145. declare_cpu_ops_wa cortex_a75, CORTEX_A75_MIDR, \
  146. cortex_a75_reset_func, \
  147. check_erratum_cortex_a75_5715, \
  148. CPU_NO_EXTRA2_FUNC, \
  149. check_smccc_arch_workaround_3, \
  150. cortex_a75_core_pwr_dwn