mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 01:24:27 +00:00

Cortex-A510 erratum 2971420 applies to revisions r0p1, r0p2, r0p3, r1p0, r1p1, r1p2 and r1p3, and is still open. Under some conditions, data might be corrupted if Trace Buffer Extension (TRBE) is enabled. The workaround is to disable trace collection via TRBE by programming MDCR_EL3.NSTB[1] to the opposite value of SCR_EL3.NS on a security state switch. Since we only enable TRBE for non-secure world, the workaround is to disable TRBE by setting the NSTB field to 00 so accesses are trapped to EL3 and secure state owns the buffer. SDEN: https://developer.arm.com/documentation/SDEN-1873361/latest/ Signed-off-by: John Powell <john.powell@arm.com> Change-Id: Ia77051f6b64c726a8c50596c78f220d323ab7d97
153 lines
3.9 KiB
C
153 lines
3.9 KiB
C
/*
|
|
* Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
/* Runtime C routines for errata workarounds and common routines */
|
|
|
|
#include <arch.h>
|
|
#include <arch_helpers.h>
|
|
#include <cortex_a75.h>
|
|
#include <cortex_a510.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>
|
|
|
|
bool check_if_trbe_disable_affected_core(void)
|
|
{
|
|
switch (EXTRACT_PARTNUM(read_midr())) {
|
|
#if ERRATA_A520_2938996
|
|
case EXTRACT_PARTNUM(CORTEX_A520_MIDR):
|
|
return check_erratum_cortex_a520_2938996(cpu_get_rev_var()) == ERRATA_APPLIES;
|
|
#endif
|
|
#if ERRATA_X4_2726228
|
|
case EXTRACT_PARTNUM(CORTEX_X4_MIDR):
|
|
return check_erratum_cortex_x4_2726228(cpu_get_rev_var()) == ERRATA_APPLIES;
|
|
#endif
|
|
#if ERRATA_A510_2971420
|
|
case EXTRACT_PARTNUM(CORTEX_A510_MIDR):
|
|
return check_erratum_cortex_a510_2971420(cpu_get_rev_var()) == ERRATA_APPLIES;
|
|
#endif
|
|
default:
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
#if ERRATA_A75_764081
|
|
bool errata_a75_764081_applies(void)
|
|
{
|
|
long rev_var = cpu_get_rev_var();
|
|
if (check_erratum_cortex_a75_764081(rev_var) == ERRATA_APPLIES) {
|
|
return true;
|
|
}
|
|
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;
|
|
}
|