Merge changes from topic "gr/errata_ICH_VMCR_EL2" into integration

* changes:
  fix(cpus): workaround for Neoverse-V3 erratum 3701767
  fix(cpus): workaround for Neoverse-N3 erratum 3699563
  fix(cpus): workaround for Neoverse-N2 erratum 3701773
  fix(cpus): workaround for Cortex-X925 erratum 3701747
  fix(cpus): workaround for Cortex-X4 erratum 3701758
  fix(cpus): workaround for Cortex-X3 erratum 3701769
  fix(cpus): workaround for Cortex-X2 erratum 3701772
  fix(cpus): workaround for Cortex-A725 erratum 3699564
  fix(cpus): workaround for Cortex-A720-AE erratum 3699562
  fix(cpus): workaround for Cortex-A720 erratum 3699561
  fix(cpus): workaround for Cortex-A715 erratum 3699560
  fix(cpus): workaround for Cortex-A710 erratum 3701772
  fix(cpus): workaround for accessing ICH_VMCR_EL2
  chore(cpus): fix incorrect header macro
This commit is contained in:
Lauren Wehrmeister 2025-02-03 21:00:07 +01:00 committed by TrustedFirmware Code Review
commit bfecea005f
29 changed files with 421 additions and 47 deletions

View file

@ -578,6 +578,12 @@ For Neoverse V2, the following errata build flags are defined :
CPU, this affects all configurations. This needs to be enabled for revisions
r0p0 and r0p1. It has been fixed in r0p2.
For Neoverse V3, the following errata build flags are defined :
- ``ERRATA_V3_3701767``: This applies errata 3701767 workaround to Neoverse-V3
CPU. This needs to be enabled for revisions r0p0, r0p1, r0p2 of the CPU and
is still open.
For Cortex-A710, the following errata build flags are defined :
- ``ERRATA_A710_1987031``: This applies errata 1987031 workaround to
@ -653,6 +659,10 @@ For Cortex-A710, the following errata build flags are defined :
CPU. This needs to be enabled for revisions r0p0, r1p0, r2p0 and r2p1 of the
CPU and is still open.
- ``ERRATA_A710_3701772``: This applies errata 3701772 workaround to Cortex-A710
CPU. This needs to be enabled for revisions r0p0, r1p0, r2p0, r2p1 of the
CPU and is still open.
For Neoverse N2, the following errata build flags are defined :
- ``ERRATA_N2_2002655``: This applies errata 2002655 workaround to Neoverse-N2
@ -724,6 +734,15 @@ For Neoverse N2, the following errata build flags are defined :
CPU. This needs to be enabled for revisions r0p0, r0p1 and r0p2. It is fixed
in r0p3.
- ``ERRATA_N2_3701773``: This applies errata 3701773 workaround to Neoverse-N2
CPU. This needs to be enabled for revisions r0p0, r0p1, r0p2, r0p3 and is
still open.
For Neoverse N3, the following errata build flags are defined :
- ``ERRATA_N3_3699563``: This applies errata 3699563 workaround to Neoverse-N3
CPU. This needs to be enabled for revisions r0p0 and is still open.
For Cortex-X2, the following errata build flags are defined :
- ``ERRATA_X2_2002765``: This applies errata 2002765 workaround to Cortex-X2
@ -778,6 +797,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
@ -825,6 +848,10 @@ For Cortex-X3, the following errata build flags are defined :
CPU. This needs to be enabled only for revisions r0p0, r1p0 and r1p1 of the
CPU. It is fixed in r1p2.
- ``ERRATA_X3_3701769``: This applies errata 3701769 workaround to Cortex-X3
CPU. This needs to be enabled only for revisions r0p0, r1p0, r1p1 and r1p2
of the CPU and it is still open.
For Cortex-X4, the following errata build flags are defined :
- ``ERRATA_X4_2701112``: This applies erratum 2701112 workaround to Cortex-X4
@ -858,6 +885,15 @@ For Cortex-X4, the following errata build flags are defined :
- ``ERRATA_X4_3076789``: This applies errata 3076789 workaround to Cortex-X4
CPU. This needs to be enabled for revisions r0p0 and r0p1. It is fixed in r0p2.
- ``ERRATA_X4_3701758``: This applies errata 3701758 workaround to Cortex-X4
CPU. This needs to be enabled for revisions r0p0, r0p1, r0p2 and r0p3.
It is still open.
For Cortex-X925, the following errata build flags are defined :
- ``ERRATA_X925_3701747``: This applies errata 3701747 workaround to Cortex-X925
CPU. This needs to be enabled for revisions r0p0 and r0p1. It is still open.
For Cortex-A510, the following errata build flags are defined :
- ``ERRATA_A510_1922240``: This applies errata 1922240 workaround to
@ -956,6 +992,10 @@ For Cortex-A715, the following errata build flags are defined :
Cortex-A715 CPU. This needs to be enabled for revisions r0p0, r1p0
and r1p1. It is fixed in r1p2.
- ``ERRATA_A715_3699560``: This applies errata 3699560 workaround to
Cortex-A715 CPU. This needs to be enabled for revisions r0p0, r1p0,
r1p2, r1p3. It is still open.
For Cortex-A720, the following errata build flags are defined :
- ``ERRATA_A720_2792132``: This applies errata 2792132 workaround to
@ -974,6 +1014,22 @@ For Cortex-A720, the following errata build flags are defined :
Cortex-A720 CPU. This needs to be enabled for revisions r0p0 and r0p1.
It is fixed in r0p2.
- ``ERRATA_A720_3699561``: This applies errata 3699561 workaround to
Cortex-A720 CPU. This needs to be enabled for revisions r0p0, r0p1
and r0p2. It is still open.
For Cortex-A720_AE, the following errata build flags are defined :
- ``ERRATA_A720_AE_3699562``: This applies errata 3699562 workaround
to Cortex-A715_AE CPU. This needs to be enabled for revisions r0p0.
It is still open.
For Cortex-A725, the following errata build flags are defined :
- ``ERRATA_A725_3699564``: This applies errata 3699564 workaround to
Cortex-A725 CPU. This needs to be enabled for revisions r0p0 and r0p1.
It is fixed in r0p2.
DSU Errata Workarounds
----------------------

View file

@ -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
*/
@ -67,4 +67,8 @@
#define CORTEX_A710_CPUPOR_EL3 S3_6_C15_C8_2
#define CORTEX_A710_CPUPMR_EL3 S3_6_C15_C8_3
#ifndef __ASSEMBLER__
long check_erratum_cortex_a710_3701772(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_A710_H */

View file

@ -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
*/
@ -38,4 +38,8 @@
#define CORTEX_A715_CPUPWRCTLR_EL1 S3_0_C15_C2_7
#define CORTEX_A715_CPUPWRCTLR_EL1_CORE_PWRDN_BIT U(1)
#ifndef __ASSEMBLER__
long check_erratum_cortex_a715_3699560(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_A715_H */

View file

@ -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
*/
@ -38,4 +38,8 @@
#define CORTEX_A720_CPUPWRCTLR_EL1 S3_0_C15_C2_7
#define CORTEX_A720_CPUPWRCTLR_EL1_CORE_PWRDN_BIT U(1)
#ifndef __ASSEMBLER__
long check_erratum_cortex_a720_3699561(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_A720_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Arm Limited. All rights reserved.
* Copyright (c) 2024-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -20,4 +20,8 @@
#define CORTEX_A720_AE_CPUPWRCTLR_EL1 S3_0_C15_C2_7
#define CORTEX_A720_AE_CPUPWRCTLR_EL1_CORE_PWRDN_BIT U(1)
#ifndef __ASSEMBLER__
long check_erratum_cortex_a720_ae_3699562(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_A720_AE_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, Arm Limited. All rights reserved.
* Copyright (c) 2023-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -21,4 +21,8 @@
#define CORTEX_A725_CPUPWRCTLR_EL1 S3_0_C15_C2_7
#define CORTEX_A725_CPUPWRCTLR_EL1_CORE_PWRDN_BIT U(1)
#ifndef __ASSEMBLER__
long check_erratum_cortex_a725_3699564(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_A725_H */

View file

@ -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 */

View file

@ -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
*/
@ -63,4 +63,8 @@
#define CORTEX_X3_CPUACTLR3_EL1 S3_0_C15_C1_2
#define CORTEX_X3_CPUACTLR3_EL1_BIT_47 (ULL(1) << 47)
#ifndef __ASSEMBLER__
long check_erratum_cortex_x3_3701769(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_X3_H */

View file

@ -50,6 +50,8 @@ static inline long check_erratum_cortex_x4_2726228(long cpu_rev)
return 0;
}
#endif /* ERRATA_X4_2726228 */
long check_erratum_cortex_x4_3701758(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_X4_H */

View file

@ -26,4 +26,8 @@
******************************************************************************/
#define CORTEX_X925_CPUACTLR6_EL1 S3_0_C15_C8_1
#ifndef __ASSEMBLER__
long check_erratum_cortex_x925_3701747(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* CORTEX_X925_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023, Arm Limited. All rights reserved.
* Copyright (c) 2020-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -69,4 +69,8 @@
#define CPUECTLR2_EL1_TXREQ_LSB U(0)
#define CPUECTLR2_EL1_TXREQ_WIDTH U(3)
#ifndef __ASSEMBLER__
long check_erratum_neoverse_n2_3701773(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* NEOVERSE_N2_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, Arm Limited. All rights reserved.
* Copyright (c) 2023-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -21,4 +21,8 @@
#define NEOVERSE_N3_CPUPWRCTLR_EL1 S3_0_C15_C2_7
#define NEOVERSE_N3_CPUPWRCTLR_EL1_CORE_PWRDN_BIT U(1)
#ifndef __ASSEMBLER__
long check_erratum_neoverse_n3_3699563(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* NEOVERSE_N3_H */

View file

@ -30,4 +30,8 @@
******************************************************************************/
#define NEOVERSE_V3_CPUACTLR6_EL1 S3_0_C15_C8_1
#ifndef __ASSEMBLER__
long check_erratum_neoverse_v3_3701767(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* NEOVERSE_V3_H */

View file

@ -4,12 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef ERRATA_REPORT_H
#define ERRATA_REPORT_H
#ifndef ERRATA_H
#define ERRATA_H
#include <lib/cpus/cpu_ops.h>
#define ERRATUM_WA_FUNC_SIZE CPU_WORD_SIZE
#define ERRATUM_CHECK_FUNC_SIZE CPU_WORD_SIZE
#define ERRATUM_ID_SIZE 4
@ -35,21 +34,6 @@
void print_errata_status(void);
#if ERRATA_A75_764081
bool errata_a75_764081_applies(void);
#else
static inline bool errata_a75_764081_applies(void)
{
return false;
}
#endif
#if ERRATA_A520_2938996 || ERRATA_X4_2726228
unsigned int check_if_affected_core(void);
#endif
int check_wa_cve_2024_7881(void);
/*
* NOTE that this structure will be different on AArch32 and AArch64. The
* uintptr_t will reflect the change and the alignment will be correct in both.
@ -68,6 +52,26 @@ struct erratum_entry {
CASSERT(sizeof(struct erratum_entry) == ERRATUM_ENTRY_SIZE,
assert_erratum_entry_asm_c_different_sizes);
/*
* Runtime errata helpers.
*/
#if ERRATA_A75_764081
bool errata_a75_764081_applies(void);
#else
static inline bool errata_a75_764081_applies(void)
{
return false;
}
#endif
#if ERRATA_A520_2938996 || ERRATA_X4_2726228
unsigned int check_if_affected_core(void);
#endif
int check_wa_cve_2024_7881(void);
bool errata_ich_vmcr_el2_applies(void);
#else
/*
@ -96,4 +100,4 @@ CASSERT(sizeof(struct erratum_entry) == ERRATUM_ENTRY_SIZE,
/* Macro to get CPU revision code for checking errata version compatibility. */
#define CPU_REV(r, p) ((r << 4) | p)
#endif /* ERRATA_REPORT_H */
#endif /* ERRATA_H */

View file

@ -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,8 @@
#error "Cortex A710 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_cortex_a710_3701772
#if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table CORTEX_A710_BHB_LOOP_COUNT, cortex_a710
#endif /* WORKAROUND_CVE_2022_23960 */
@ -218,6 +220,10 @@ workaround_reset_end cortex_a710, CVE(2022, 23960)
check_erratum_chosen cortex_a710, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
add_erratum_entry cortex_a710, ERRATUM(3701772), ERRATA_A710_3701772, NO_APPLY_AT_RESET
check_erratum_ls cortex_a710, ERRATUM(3701772), CPU_REV(2, 1)
/* ----------------------------------------------------
* HW will do the cache maintenance while powering down
* ----------------------------------------------------

View file

@ -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,8 @@
#error "Cortex-A715 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_cortex_a715_3699560
#if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table CORTEX_A715_BHB_LOOP_COUNT, cortex_a715
#endif /* WORKAROUND_CVE_2022_23960 */
@ -127,6 +129,10 @@ workaround_reset_end cortex_a715, CVE(2022, 23960)
check_erratum_chosen cortex_a715, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
add_erratum_entry cortex_a715, ERRATUM(3699560), ERRATA_A715_3699560, NO_APPLY_AT_RESET
check_erratum_ls cortex_a715, ERRATUM(3699560), CPU_REV(1, 3)
cpu_reset_func_start cortex_a715
/* Disable speculative loads */
msr SSBS, xzr

View file

@ -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,8 @@
#error "Cortex A720 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_cortex_a720_3699561
#if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table CORTEX_A720_BHB_LOOP_COUNT, cortex_a720
#endif /* WORKAROUND_CVE_2022_23960 */
@ -72,6 +74,10 @@ workaround_reset_end cortex_a720, CVE(2022, 23960)
check_erratum_chosen cortex_a720, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
add_erratum_entry cortex_a720, ERRATUM(3699561), ERRATA_A720_3699561, NO_APPLY_AT_RESET
check_erratum_ls cortex_a720, ERRATUM(3699561), CPU_REV(0, 2)
cpu_reset_func_start cortex_a720
/* Disable speculative loads */
msr SSBS, xzr

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Arm Limited. All rights reserved.
* Copyright (c) 2024-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -21,6 +21,12 @@
#error "Cortex-A720AE supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_cortex_a720_ae_3699562
add_erratum_entry cortex_a720_ae, ERRATUM(3699562), ERRATA_A720_AE_3699562, NO_APPLY_AT_RESET
check_erratum_ls cortex_a720_ae, ERRATUM(3699562), CPU_REV(0, 0)
cpu_reset_func_start cortex_a720_ae
/* Disable speculative loads */
msr SSBS, xzr

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, Arm Limited. All rights reserved.
* Copyright (c) 2023-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -21,6 +21,12 @@
#error "Cortex-A725 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_cortex_a725_3699564
add_erratum_entry cortex_a725, ERRATUM(3699564), ERRATA_A725_3699564, NO_APPLY_AT_RESET
check_erratum_ls cortex_a725, ERRATUM(3699564), CPU_REV(0, 1)
cpu_reset_func_start cortex_a725
/* Disable speculative loads */
msr SSBS, xzr

View file

@ -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 */

View file

@ -22,6 +22,12 @@
#error "Cortex-X3 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_cortex_x3_3701769
add_erratum_entry cortex_x3, ERRATUM(3701769), ERRATA_X3_3701769, NO_APPLY_AT_RESET
check_erratum_ls cortex_x3, ERRATUM(3701769), CPU_REV(1, 2)
#if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table CORTEX_X3_BHB_LOOP_COUNT, cortex_x3
#endif /* WORKAROUND_CVE_2022_23960 */

View file

@ -23,6 +23,7 @@
#endif
.global check_erratum_cortex_x4_2726228
.global check_erratum_cortex_x4_3701758
#if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table CORTEX_X4_BHB_LOOP_COUNT, cortex_x4
@ -119,6 +120,10 @@ workaround_reset_end cortex_x4, CVE(2024, 7881)
check_erratum_chosen cortex_x4, CVE(2024, 7881), WORKAROUND_CVE_2024_7881
add_erratum_entry cortex_x4, ERRATUM(3701758), ERRATA_X4_3701758, NO_APPLY_AT_RESET
check_erratum_ls cortex_x4, ERRATUM(3701758), CPU_REV(0, 3)
cpu_reset_func_start cortex_x4
/* Disable speculative loads */
msr SSBS, xzr

View file

@ -21,6 +21,12 @@
#error "Cortex-X925 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_cortex_x925_3701747
add_erratum_entry cortex_x925, ERRATUM(3701747), ERRATA_X925_3701747, NO_APPLY_AT_RESET
check_erratum_ls cortex_x925, ERRATUM(3701747), CPU_REV(0, 1)
/* Disable hardware page aggregation. Enables mitigation for `CVE-2024-5660` */
workaround_reset_start cortex_x925, CVE(2024, 5660), WORKAROUND_CVE_2024_5660
sysreg_bit_set CORTEX_X925_CPUECTLR_EL1, BIT(46)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2024, Arm Limited. All rights reserved.
* Copyright (c) 2020-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -20,6 +20,12 @@
#error "Neoverse-N2 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_neoverse_n2_3701773
add_erratum_entry neoverse_n2, ERRATUM(3701773), ERRATA_N2_3701773, NO_APPLY_AT_RESET
check_erratum_ls neoverse_n2, ERRATUM(3701773), CPU_REV(0, 3)
#if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table NEOVERSE_N2_BHB_LOOP_COUNT, neoverse_n2
#endif /* WORKAROUND_CVE_2022_23960 */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, Arm Limited. All rights reserved.
* Copyright (c) 2023-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -21,6 +21,12 @@
#error "Neoverse-N3 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_neoverse_n3_3699563
add_erratum_entry neoverse_n3, ERRATUM(3699563), ERRATA_N3_3699563, NO_APPLY_AT_RESET
check_erratum_ls neoverse_n3, ERRATUM(3699563), CPU_REV(0, 0)
cpu_reset_func_start neoverse_n3
/* Disable speculative loads */
msr SSBS, xzr

View file

@ -22,6 +22,12 @@
#error "Neoverse V3 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif
.global check_erratum_neoverse_v3_3701767
add_erratum_entry neoverse_v3, ERRATUM(3701767), ERRATA_V3_3701767, NO_APPLY_AT_RESET
check_erratum_ls neoverse_v3, ERRATUM(3701767), CPU_REV(0, 2)
#if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table NEOVERSE_V3_BHB_LOOP_COUNT, neoverse_v3
#endif /* WORKAROUND_CVE_2022_23960 */

View file

@ -564,6 +564,11 @@ CPU_FLAG_LIST += ERRATA_V1_2743233
# still open.
CPU_FLAG_LIST += ERRATA_V1_2779461
# Flag to apply erratum 3701767 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r0p1 and r0p2 of
# the Neoverse V3 cpu and is still open.
CPU_FLAG_LIST += ERRATA_V3_3701767
# Flag to apply erratum 1987031 workaround during reset. This erratum applies
# to revisions r0p0, r1p0 and r2p0 of the Cortex-A710 cpu and is still open.
CPU_FLAG_LIST += ERRATA_A710_1987031
@ -642,6 +647,11 @@ CPU_FLAG_LIST += ERRATA_A710_2768515
# open.
CPU_FLAG_LIST += ERRATA_A710_2778471
# Flag to apply erratum 3701772 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r1p0, r2p0, r2p1
# of the Cortex-A710 cpu and is still open.
CPU_FLAG_LIST += ERRATA_A710_3701772
# Flag to apply erratum 2002655 workaround during reset. This erratum applies
# to revisions r0p0 of the Neoverse-N2 cpu and is fixed in r0p1.
CPU_FLAG_LIST += ERRATA_N2_2002655
@ -723,6 +733,16 @@ CPU_FLAG_LIST += ERRATA_N2_2743089
# to r0p0, r0p1, r0p2 of the Neoverse N2 cpu, it is fixed in r0p3.
CPU_FLAG_LIST += ERRATA_N2_2779511
# Flag to apply erratum 3701773 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r0p1, r0p2 and r0p3
# of the Neoverse N2 cpu and is still open.
CPU_FLAG_LIST += ERRATA_N2_3701773
# Flag to apply erratum 3699563 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revision r0p0 of the Neoverse N3
# cpu and is still open.
CPU_FLAG_LIST += ERRATA_N3_3699563
# Flag to apply erratum 2002765 workaround during reset. This erratum applies
# to revisions r0p0, r1p0, and r2p0 of the Cortex-X2 cpu and is still open.
CPU_FLAG_LIST += ERRATA_X2_2002765
@ -781,6 +801,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.
@ -822,6 +847,11 @@ CPU_FLAG_LIST += ERRATA_X3_2742421
# to revisions r0p0, r1p0 and r1p1 of the Cortex-X3 cpu, it is fixed in r1p2.
CPU_FLAG_LIST += ERRATA_X3_2743088
# Flag to apply erratum 3701769 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r1p0, r1p1 and r1p2
# of the Cortex-X3 cpu and is still open.
CPU_FLAG_LIST += ERRATA_X3_3701769
# Flag to apply erratum 2779509 workaround on reset. This erratum applies
# to revisions r0p0, r1p0, r1p1 of the Cortex-X3 cpu, it is fixed in r1p2.
CPU_FLAG_LIST += ERRATA_X3_2779509
@ -859,6 +889,16 @@ CPU_FLAG_LIST += ERRATA_X4_2923985
# to revisions r0p0 and r0p1 of the Cortex-X4 cpu. It is fixed in r0p2.
CPU_FLAG_LIST += ERRATA_X4_3076789
# Flag to apply erratum 3701758 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r0p1, r0p2 and r0p3
# of the Cortex-X4 cpu and is still open.
CPU_FLAG_LIST += ERRATA_X4_3701758
# Flag to apply erratum 3701747 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r0p1 of the
# Cortex-X925 cpu and is still open.
CPU_FLAG_LIST += ERRATA_X925_3701747
# Flag to apply erratum 1922240 workaround during reset. This erratum applies
# to revision r0p0 of the Cortex-A510 cpu and is fixed in r0p1.
CPU_FLAG_LIST += ERRATA_A510_1922240
@ -984,6 +1024,11 @@ CPU_FLAG_LIST += ERRATA_A715_2561034
# only to revision r0p0, r1p0 and r1p1. It is fixed in r1p2.
CPU_FLAG_LIST += ERRATA_A715_2728106
# Flag to apply erratum 3699560 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r1p0, r1p2, r1p3
# of the Cortex-A715 cpu and is still open.
CPU_FLAG_LIST += ERRATA_A715_3699560
# Flag to apply erratum 2792132 workaround during reset. This erratum applies
# to revisions r0p0 and r0p1. It is fixed in r0p2.
CPU_FLAG_LIST += ERRATA_A720_2792132
@ -1000,12 +1045,27 @@ CPU_FLAG_LIST += ERRATA_A720_2926083
# to revisions r0p0 and r0p1. It is fixed in r0p2.
CPU_FLAG_LIST += ERRATA_A720_2940794
# Flag to apply erratum 3699561 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r0p1, r0p2 of
# the Cortex-A720 cpu and is still open.
CPU_FLAG_LIST += ERRATA_A720_3699561
# Flag to apply erratum 3699562 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revision r0p0 the Cortex-A720-AE
# cpu and is still open.
CPU_FLAG_LIST += ERRATA_A720_AE_3699562
# Flag to apply erratum 3699564 workaround during context save/restore of
# ICH_VMCR_EL2 reg. This erratum applies to revisions r0p0, r0p1 of
# the Cortex-A725 cpu and is fixed in r0p2
CPU_FLAG_LIST += ERRATA_A725_3699564
# Flag to apply DSU erratum 798953. This erratum applies to DSUs revision r0p0.
# Applying the workaround results in higher DSU power consumption on idle.
CPU_FLAG_LIST += ERRATA_DSU_798953
# Flag to apply DSU erratum 936184. This erratum applies to DSUs containing
# the ACP interface and revision < r2p0. Applying the workaround results in
# the ACP interface and revision < r0p0. Applying the workaround results in
# higher DSU power consumption on idle.
CPU_FLAG_LIST += ERRATA_DSU_936184

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -8,11 +8,22 @@
#include <arch.h>
#include <arch_helpers.h>
#include <cortex_a520.h>
#include <cortex_x4.h>
#include <cortex_a75.h>
#include <cortex_a520.h>
#include <cortex_a710.h>
#include <cortex_a715.h>
#include <cortex_a720.h>
#include <cortex_a720_ae.h>
#include <cortex_a725.h>
#include <cortex_x2.h>
#include <cortex_x3.h>
#include <cortex_x4.h>
#include <cortex_x925.h>
#include <lib/cpus/cpu_ops.h>
#include <lib/cpus/errata.h>
#include <neoverse_n2.h>
#include <neoverse_n3.h>
#include <neoverse_v3.h>
#if ERRATA_A520_2938996 || ERRATA_X4_2726228
unsigned int check_if_affected_core(void)
@ -40,3 +51,97 @@ bool errata_a75_764081_applies(void)
return false;
}
#endif /* ERRATA_A75_764081 */
bool errata_ich_vmcr_el2_applies(void)
{
switch (EXTRACT_PARTNUM(read_midr())) {
#if ERRATA_A710_3701772
case EXTRACT_PARTNUM(CORTEX_A710_MIDR):
if (check_erratum_cortex_a710_3701772(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_A710_3701772 */
#if ERRATA_A715_3699560
case EXTRACT_PARTNUM(CORTEX_A715_MIDR):
if (check_erratum_cortex_a715_3699560(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_A715_3699560 */
#if ERRATA_A720_3699561
case EXTRACT_PARTNUM(CORTEX_A720_MIDR):
if (check_erratum_cortex_a720_3699561(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;;
break;
#endif /* ERRATA_A720_3699561 */
#if ERRATA_A720_AE_3699562
case EXTRACT_PARTNUM(CORTEX_A720_AE_MIDR):
if (check_erratum_cortex_a720_ae_3699562(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_A720_AE_3699562 */
#if ERRATA_A725_3699564
case EXTRACT_PARTNUM(CORTEX_A725_MIDR):
if (check_erratum_cortex_a725_3699564(cpu_get_rev_var()) == ERRATA_APPLIES)
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 */
#if ERRATA_X3_3701769
case EXTRACT_PARTNUM(CORTEX_X3_MIDR):
if (check_erratum_cortex_x3_3701769(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_X3_3701769 */
#if ERRATA_X4_3701758
case EXTRACT_PARTNUM(CORTEX_X4_MIDR):
if (check_erratum_cortex_x4_3701758(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_X4_3701758 */
#if ERRATA_X925_3701747
case EXTRACT_PARTNUM(CORTEX_X925_MIDR):
if (check_erratum_cortex_x925_3701747(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_X925_3701747 */
#if ERRATA_N2_3701773
case EXTRACT_PARTNUM(NEOVERSE_N2_MIDR):
if (check_erratum_neoverse_n2_3701773(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_N2_3701773 */
#if ERRATA_N3_3699563
case EXTRACT_PARTNUM(NEOVERSE_N3_MIDR):
if (check_erratum_neoverse_n3_3699563(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_N3_3699563 */
#if ERRATA_V3_3701767
case EXTRACT_PARTNUM(NEOVERSE_V3_MIDR):
if (check_erratum_neoverse_v3_3701767(cpu_get_rev_var()) == ERRATA_APPLIES)
return true;
break;
#endif /* ERRATA_V3_3701767 */
default:
break;
}
return false;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2025, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2022, NVIDIA Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@ -1291,12 +1291,13 @@ static void el2_sysregs_context_restore_mpam(el2_sysregs_t *ctx)
* SCR_EL3.NS = 1 before accessing this register.
* ---------------------------------------------------------------------------
*/
static void el2_sysregs_context_save_gic(el2_sysregs_t *ctx)
static void el2_sysregs_context_save_gic(el2_sysregs_t *ctx, uint32_t security_state)
{
u_register_t scr_el3 = read_scr_el3();
#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2
write_el2_ctx_common(ctx, icc_sre_el2, read_icc_sre_el2());
#else
u_register_t scr_el3 = read_scr_el3();
write_scr_el3(scr_el3 | SCR_NS_BIT);
isb();
@ -1306,15 +1307,31 @@ static void el2_sysregs_context_save_gic(el2_sysregs_t *ctx)
isb();
#endif
write_el2_ctx_common(ctx, ich_hcr_el2, read_ich_hcr_el2());
if (errata_ich_vmcr_el2_applies()) {
if (security_state == SECURE) {
write_scr_el3(scr_el3 & ~SCR_NS_BIT);
} else {
write_scr_el3(scr_el3 | SCR_NS_BIT);
}
isb();
}
write_el2_ctx_common(ctx, ich_vmcr_el2, read_ich_vmcr_el2());
if (errata_ich_vmcr_el2_applies()) {
write_scr_el3(scr_el3);
isb();
}
}
static void el2_sysregs_context_restore_gic(el2_sysregs_t *ctx)
static void el2_sysregs_context_restore_gic(el2_sysregs_t *ctx, uint32_t security_state)
{
u_register_t scr_el3 = read_scr_el3();
#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2
write_icc_sre_el2(read_el2_ctx_common(ctx, icc_sre_el2));
#else
u_register_t scr_el3 = read_scr_el3();
write_scr_el3(scr_el3 | SCR_NS_BIT);
isb();
@ -1324,7 +1341,22 @@ static void el2_sysregs_context_restore_gic(el2_sysregs_t *ctx)
isb();
#endif
write_ich_hcr_el2(read_el2_ctx_common(ctx, ich_hcr_el2));
if (errata_ich_vmcr_el2_applies()) {
if (security_state == SECURE) {
write_scr_el3(scr_el3 & ~SCR_NS_BIT);
} else {
write_scr_el3(scr_el3 | SCR_NS_BIT);
}
isb();
}
write_ich_vmcr_el2(read_el2_ctx_common(ctx, ich_vmcr_el2));
if (errata_ich_vmcr_el2_applies()) {
write_scr_el3(scr_el3);
isb();
}
}
/* -----------------------------------------------------
@ -1416,7 +1448,7 @@ void cm_el2_sysregs_context_save(uint32_t security_state)
el2_sysregs_ctx = get_el2_sysregs_ctx(ctx);
el2_sysregs_context_save_common(el2_sysregs_ctx);
el2_sysregs_context_save_gic(el2_sysregs_ctx);
el2_sysregs_context_save_gic(el2_sysregs_ctx, security_state);
if (is_feat_mte2_supported()) {
write_el2_ctx_mte2(el2_sysregs_ctx, tfsr_el2, read_tfsr_el2());
@ -1507,7 +1539,7 @@ void cm_el2_sysregs_context_restore(uint32_t security_state)
el2_sysregs_ctx = get_el2_sysregs_ctx(ctx);
el2_sysregs_context_restore_common(el2_sysregs_ctx);
el2_sysregs_context_restore_gic(el2_sysregs_ctx);
el2_sysregs_context_restore_gic(el2_sysregs_ctx, security_state);
if (is_feat_mte2_supported()) {
write_tfsr_el2(read_el2_ctx_mte2(el2_sysregs_ctx, tfsr_el2));