1/* 2 * Copyright (c) 2021-2025, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7#include <arch.h> 8#include <asm_macros.S> 9#include <common/bl_common.h> 10#include <cortex_a720.h> 11#include <cpu_macros.S> 12#include <dsu_macros.S> 13#include <plat_macros.S> 14#include "wa_cve_2022_23960_bhb_vector.S" 15 16/* Hardware handled coherency */ 17#if HW_ASSISTED_COHERENCY == 0 18#error "Cortex A720 must be compiled with HW_ASSISTED_COHERENCY enabled" 19#endif 20 21/* 64-bit only core */ 22#if CTX_INCLUDE_AARCH32_REGS == 1 23#error "Cortex A720 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" 24#endif 25 26cpu_reset_prologue cortex_a720 27 28.global check_erratum_cortex_a720_3699561 29 30#if WORKAROUND_CVE_2022_23960 31 wa_cve_2022_23960_bhb_vector_table CORTEX_A720_BHB_LOOP_COUNT, cortex_a720 32#endif /* WORKAROUND_CVE_2022_23960 */ 33 34workaround_reset_start cortex_a720, ERRATUM(2792132), ERRATA_A720_2792132 35 sysreg_bit_set CORTEX_A720_CPUACTLR2_EL1, BIT(26) 36workaround_reset_end cortex_a720, ERRATUM(2792132) 37 38check_erratum_ls cortex_a720, ERRATUM(2792132), CPU_REV(0, 1) 39 40workaround_reset_start cortex_a720, ERRATUM(2844092), ERRATA_A720_2844092 41 sysreg_bit_set CORTEX_A720_CPUACTLR4_EL1, BIT(11) 42workaround_reset_end cortex_a720, ERRATUM(2844092) 43 44check_erratum_ls cortex_a720, ERRATUM(2844092), CPU_REV(0, 1) 45 46workaround_reset_start cortex_a720, ERRATUM(2900952), ERRATA_DSU_2900952 47 errata_dsu_2900952_wa_apply 48workaround_reset_end cortex_a720, ERRATUM(2900952) 49 50check_erratum_custom_start cortex_a720, ERRATUM(2900952) 51 check_errata_dsu_2900952_applies 52 ret 53check_erratum_custom_end cortex_a720, ERRATUM(2900952) 54 55workaround_reset_start cortex_a720, ERRATUM(2926083), ERRATA_A720_2926083 56/* Erratum 2926083 workaround is required only if SPE is enabled */ 57#if ENABLE_SPE_FOR_NS != 0 58 /* Check if Static profiling extension is implemented or present. */ 59 mrs x1, id_aa64dfr0_el1 60 ubfx x0, x1, ID_AA64DFR0_PMS_SHIFT, #4 61 cbz x0, 1f 62 /* Apply the workaround by setting CPUACTLR_EL1[58:57] = 0b11. */ 63 sysreg_bit_set CORTEX_A720_CPUACTLR_EL1, BIT(57) 64 sysreg_bit_set CORTEX_A720_CPUACTLR_EL1, BIT(58) 651: 66#endif 67workaround_reset_end cortex_a720, ERRATUM(2926083) 68 69check_erratum_ls cortex_a720, ERRATUM(2926083), CPU_REV(0, 1) 70 71workaround_reset_start cortex_a720, ERRATUM(2940794), ERRATA_A720_2940794 72 sysreg_bit_set CORTEX_A720_CPUACTLR2_EL1, BIT(37) 73workaround_reset_end cortex_a720, ERRATUM(2940794) 74 75check_erratum_ls cortex_a720, ERRATUM(2940794), CPU_REV(0, 1) 76 77workaround_reset_start cortex_a720, ERRATUM(3711910), ERRATA_A720_3711910 78 mov x0, #5 79 msr CORTEX_A720_CPUPSELR_EL3, x0 80 ldr x0, =0xD503329F 81 msr CORTEX_A720_CPUPOR_EL3, x0 82 ldr x0, =0xFFFFF3FF 83 msr CORTEX_A720_CPUPMR_EL3, x0 84 ldr x0, =0x1004003F1 85 msr CORTEX_A720_CPUPCR_EL3, x0 86workaround_reset_end cortex_a720, ERRATUM(3711910) 87 88check_erratum_ls cortex_a720, ERRATUM(3711910), CPU_REV(0, 2) 89 90workaround_reset_start cortex_a720, CVE(2022, 23960), WORKAROUND_CVE_2022_23960 91#if IMAGE_BL31 92 /* 93 * The Cortex A720 generic vectors are overridden to apply errata 94 * mitigation on exception entry from lower ELs. 95 */ 96 override_vector_table wa_cve_vbar_cortex_a720 97#endif /* IMAGE_BL31 */ 98workaround_reset_end cortex_a720, CVE(2022, 23960) 99 100check_erratum_chosen cortex_a720, CVE(2022, 23960), WORKAROUND_CVE_2022_23960 101 102add_erratum_entry cortex_a720, ERRATUM(3699561), ERRATA_A720_3699561 103 104check_erratum_ls cortex_a720, ERRATUM(3699561), CPU_REV(0, 2) 105 106cpu_reset_func_start cortex_a720 107 /* Disable speculative loads */ 108 msr SSBS, xzr 109 enable_mpmm 110cpu_reset_func_end cortex_a720 111 112 /* ---------------------------------------------------- 113 * HW will do the cache maintenance while powering down 114 * ---------------------------------------------------- 115 */ 116func cortex_a720_core_pwr_dwn 117 /* --------------------------------------------------- 118 * Enable CPU power down bit in power control register 119 * --------------------------------------------------- 120 */ 121 sysreg_bit_set CORTEX_A720_CPUPWRCTLR_EL1, CORTEX_A720_CPUPWRCTLR_EL1_CORE_PWRDN_BIT 122 123 isb 124 ret 125endfunc cortex_a720_core_pwr_dwn 126 127 /* --------------------------------------------- 128 * This function provides Cortex A720-specific 129 * register information for crash reporting. 130 * It needs to return with x6 pointing to 131 * a list of register names in ascii and 132 * x8 - x15 having values of registers to be 133 * reported. 134 * --------------------------------------------- 135 */ 136.section .rodata.cortex_a720_regs, "aS" 137cortex_a720_regs: /* The ascii list of register names to be reported */ 138 .asciz "cpuectlr_el1", "" 139 140func cortex_a720_cpu_reg_dump 141 adr x6, cortex_a720_regs 142 mrs x8, CORTEX_A720_CPUECTLR_EL1 143 ret 144endfunc cortex_a720_cpu_reg_dump 145 146declare_cpu_ops cortex_a720, CORTEX_A720_MIDR, \ 147 cortex_a720_reset_func, \ 148 cortex_a720_core_pwr_dwn 149