fix(cpus): workaround for Cortex-A720 erratum 3699561

Cortex-A720 erratum 3699561 that applies to all revisions <= r0p2
and is still Open.

The workaround is for EL3 software that performs context save/restore
on a change of Security state to use a value of SCR_EL3.NS when
accessing ICH_VMCR_EL2 that reflects the Security state that owns the
data being saved or restored.

SDEN documentation:
https://developer.arm.com/documentation/SDEN-2439421/latest/

Change-Id: I7ea3aaf3e7bf6b4f3648f6872e505a41247b14ba
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
This commit is contained in:
Govindraj Raja 2025-01-21 17:12:33 -06:00
parent 26437afde1
commit 050c4a38a3
5 changed files with 30 additions and 3 deletions

View file

@ -982,6 +982,10 @@ For Cortex-A720, the following errata build flags are defined :
Cortex-A720 CPU. This needs to be enabled for revisions r0p0 and r0p1. Cortex-A720 CPU. This needs to be enabled for revisions r0p0 and r0p1.
It is fixed in r0p2. 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.
DSU Errata Workarounds DSU Errata Workarounds
---------------------- ----------------------

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 * 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 S3_0_C15_C2_7
#define CORTEX_A720_CPUPWRCTLR_EL1_CORE_PWRDN_BIT U(1) #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 */ #endif /* CORTEX_A720_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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -22,6 +22,8 @@
#error "Cortex A720 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" #error "Cortex A720 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif #endif
.global check_erratum_cortex_a720_3699561
#if WORKAROUND_CVE_2022_23960 #if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table CORTEX_A720_BHB_LOOP_COUNT, cortex_a720 wa_cve_2022_23960_bhb_vector_table CORTEX_A720_BHB_LOOP_COUNT, cortex_a720
#endif /* WORKAROUND_CVE_2022_23960 */ #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 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 cpu_reset_func_start cortex_a720
/* Disable speculative loads */ /* Disable speculative loads */
msr SSBS, xzr msr SSBS, xzr

View file

@ -1010,12 +1010,17 @@ CPU_FLAG_LIST += ERRATA_A720_2926083
# to revisions r0p0 and r0p1. It is fixed in r0p2. # to revisions r0p0 and r0p1. It is fixed in r0p2.
CPU_FLAG_LIST += ERRATA_A720_2940794 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 DSU erratum 798953. This erratum applies to DSUs revision r0p0. # Flag to apply DSU erratum 798953. This erratum applies to DSUs revision r0p0.
# Applying the workaround results in higher DSU power consumption on idle. # Applying the workaround results in higher DSU power consumption on idle.
CPU_FLAG_LIST += ERRATA_DSU_798953 CPU_FLAG_LIST += ERRATA_DSU_798953
# Flag to apply DSU erratum 936184. This erratum applies to DSUs containing # 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. # higher DSU power consumption on idle.
CPU_FLAG_LIST += ERRATA_DSU_936184 CPU_FLAG_LIST += ERRATA_DSU_936184

View file

@ -12,6 +12,7 @@
#include <cortex_a520.h> #include <cortex_a520.h>
#include <cortex_a710.h> #include <cortex_a710.h>
#include <cortex_a715.h> #include <cortex_a715.h>
#include <cortex_a720.h>
#include <cortex_x4.h> #include <cortex_x4.h>
#include <lib/cpus/cpu_ops.h> #include <lib/cpus/cpu_ops.h>
#include <lib/cpus/errata.h> #include <lib/cpus/errata.h>
@ -60,6 +61,13 @@ bool errata_ich_vmcr_el2_applies(void)
break; break;
#endif /* ERRATA_A715_3699560 */ #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 */
default: default:
break; break;
} }