fix(cpus): workaround for Neoverse-N2 erratum 3701773

Neoverse-N2 erratum 3701773 that applies to r0p0, r0p1, r0p2 and r0p3
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-1982442/latest/

Change-Id: If95bd67363228c8083724b31f630636fb27f3b61
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
This commit is contained in:
Govindraj Raja 2025-01-21 18:56:25 -06:00
parent 511148ef50
commit adea6e52a7
5 changed files with 30 additions and 2 deletions

View file

@ -728,6 +728,10 @@ 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 CPU. This needs to be enabled for revisions r0p0, r0p1 and r0p2. It is fixed
in r0p3. 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 Cortex-X2, the following errata build flags are defined : For Cortex-X2, the following errata build flags are defined :
- ``ERRATA_X2_2002765``: This applies errata 2002765 workaround to Cortex-X2 - ``ERRATA_X2_2002765``: This applies errata 2002765 workaround to Cortex-X2

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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -69,4 +69,8 @@
#define CPUECTLR2_EL1_TXREQ_LSB U(0) #define CPUECTLR2_EL1_TXREQ_LSB U(0)
#define CPUECTLR2_EL1_TXREQ_WIDTH U(3) #define CPUECTLR2_EL1_TXREQ_WIDTH U(3)
#ifndef __ASSEMBLER__
long check_erratum_neoverse_n2_3701773(long cpu_rev);
#endif /* __ASSEMBLER__ */
#endif /* NEOVERSE_N2_H */ #endif /* NEOVERSE_N2_H */

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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -20,6 +20,12 @@
#error "Neoverse-N2 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" #error "Neoverse-N2 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
#endif #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 #if WORKAROUND_CVE_2022_23960
wa_cve_2022_23960_bhb_vector_table NEOVERSE_N2_BHB_LOOP_COUNT, neoverse_n2 wa_cve_2022_23960_bhb_vector_table NEOVERSE_N2_BHB_LOOP_COUNT, neoverse_n2
#endif /* WORKAROUND_CVE_2022_23960 */ #endif /* WORKAROUND_CVE_2022_23960 */

View file

@ -728,6 +728,11 @@ CPU_FLAG_LIST += ERRATA_N2_2743089
# to r0p0, r0p1, r0p2 of the Neoverse N2 cpu, it is fixed in r0p3. # to r0p0, r0p1, r0p2 of the Neoverse N2 cpu, it is fixed in r0p3.
CPU_FLAG_LIST += ERRATA_N2_2779511 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 2002765 workaround during reset. This erratum applies # 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. # to revisions r0p0, r1p0, and r2p0 of the Cortex-X2 cpu and is still open.
CPU_FLAG_LIST += ERRATA_X2_2002765 CPU_FLAG_LIST += ERRATA_X2_2002765

View file

@ -21,6 +21,7 @@
#include <cortex_x925.h> #include <cortex_x925.h>
#include <lib/cpus/cpu_ops.h> #include <lib/cpus/cpu_ops.h>
#include <lib/cpus/errata.h> #include <lib/cpus/errata.h>
#include <neoverse_n2.h>
#if ERRATA_A520_2938996 || ERRATA_X4_2726228 #if ERRATA_A520_2938996 || ERRATA_X4_2726228
unsigned int check_if_affected_core(void) unsigned int check_if_affected_core(void)
@ -114,6 +115,14 @@ bool errata_ich_vmcr_el2_applies(void)
return true; return true;
break; break;
#endif /* ERRATA_X925_3701747 */ #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 */
default: default:
break; break;
} }