diff --git a/docs/design/cpu-specific-build-macros.rst b/docs/design/cpu-specific-build-macros.rst index 57875da13..00cfe191c 100644 --- a/docs/design/cpu-specific-build-macros.rst +++ b/docs/design/cpu-specific-build-macros.rst @@ -782,6 +782,10 @@ For Cortex-X2, the following errata build flags are defined : CPU. This needs to be enabled for revisions r0p0, r1p0, r2p0 and r2p1 of the CPU and it is still open. +- ``ERRATA_X2_3701772``: This applies errata 3701772 workaround to Cortex-X2 + CPU. This needs to be enabled for revisions r0p0, r1p0, r2p0 and r2p1 of the + CPU and it is still open. + For Cortex-X3, the following errata build flags are defined : - ``ERRATA_X3_2070301``: This applies errata 2070301 workaround to the Cortex-X3 diff --git a/include/lib/cpus/aarch64/cortex_x2.h b/include/lib/cpus/aarch64/cortex_x2.h index 0f97b1e11..9ec51775e 100644 --- a/include/lib/cpus/aarch64/cortex_x2.h +++ b/include/lib/cpus/aarch64/cortex_x2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023, Arm Limited. All rights reserved. + * Copyright (c) 2021-2025, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -64,4 +64,8 @@ #define CORTEX_X2_IMP_CPUPOR_EL3 S3_6_C15_C8_2 #define CORTEX_X2_IMP_CPUPMR_EL3 S3_6_C15_C8_3 +#ifndef __ASSEMBLER__ +long check_erratum_cortex_x2_3701772(long cpu_rev); +#endif /* __ASSEMBLER__ */ + #endif /* CORTEX_X2_H */ diff --git a/lib/cpus/aarch64/cortex_x2.S b/lib/cpus/aarch64/cortex_x2.S index 2fc357ab5..c18ce3c0f 100644 --- a/lib/cpus/aarch64/cortex_x2.S +++ b/lib/cpus/aarch64/cortex_x2.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024, Arm Limited. All rights reserved. + * Copyright (c) 2021-2025, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -22,6 +22,12 @@ #error "Cortex X2 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" #endif +.global check_erratum_cortex_x2_3701772 + +add_erratum_entry cortex_x2, ERRATUM(3701772), ERRATA_X2_3701772, NO_APPLY_AT_RESET + +check_erratum_ls cortex_x2, ERRATUM(3701772), CPU_REV(2, 1) + #if WORKAROUND_CVE_2022_23960 wa_cve_2022_23960_bhb_vector_table CORTEX_X2_BHB_LOOP_COUNT, cortex_x2 #endif /* WORKAROUND_CVE_2022_23960 */ diff --git a/lib/cpus/cpu-ops.mk b/lib/cpus/cpu-ops.mk index 747edf4e3..a879bb0c7 100644 --- a/lib/cpus/cpu-ops.mk +++ b/lib/cpus/cpu-ops.mk @@ -786,6 +786,11 @@ CPU_FLAG_LIST += ERRATA_X2_2768515 # to revisions r0p0, r1p0, r2p0, r2p1 of the Cortex-X2 cpu and it is still open. CPU_FLAG_LIST += ERRATA_X2_2778471 +# Flag to apply erratum 3701772 workaround during context save/restore of +# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r1p0, r2p0 and r2p1 +# of the Cortex-X2 cpu and is still open. +CPU_FLAG_LIST += ERRATA_X2_3701772 + # Flag to apply erratum 2070301 workaround on reset. This erratum applies # to revisions r0p0, r1p0, r1p1 and r1p2 of the Cortex-X3 cpu and is # still open. diff --git a/lib/cpus/errata_common.c b/lib/cpus/errata_common.c index d9f83391f..5dbc50d61 100644 --- a/lib/cpus/errata_common.c +++ b/lib/cpus/errata_common.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,14 @@ bool errata_ich_vmcr_el2_applies(void) return true; break; #endif /* ERRATA_A725_3699564 */ + +#if ERRATA_X2_3701772 + case EXTRACT_PARTNUM(CORTEX_X2_MIDR): + if (check_erratum_cortex_x2_3701772(cpu_get_rev_var()) == ERRATA_APPLIES) + return true; + break; +#endif /* ERRATA_X2_3701772 */ + default: break; }