Skip to content

Commit b9d216f

Browse files
Suzuki K Poulosewilldeacon
authored andcommitted
arm64: errata: Add detection for TRBE overwrite in FILL mode
Arm Neoverse-N2 and the Cortex-A710 cores are affected by a CPU erratum where the TRBE will overwrite the trace buffer in FILL mode. The TRBE doesn't stop (as expected in FILL mode) when it reaches the limit and wraps to the base to continue writing upto 3 cache lines. This will overwrite any trace that was written previously. Add the Neoverse-N2 erratum(#2139208) and Cortex-A710 erratum (#2119858) to the detection logic. This will be used by the TRBE driver in later patches to work around the issue. The detection has been kept with the core arm64 errata framework list to make sure : - We don't duplicate the framework in TRBE driver - The errata detection is advertised like the rest of the CPU errata. Note that the Kconfig entries are not fully active until the TRBE driver implements the work around. Cc: Will Deacon <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Mike Leach <[email protected]> cc: Leo Yan <[email protected]> Acked-by: Catalin Marinas <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 2d0d656 commit b9d216f

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ stable kernels.
9292
+----------------+-----------------+-----------------+-----------------------------+
9393
| ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 |
9494
+----------------+-----------------+-----------------+-----------------------------+
95+
| ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |
96+
+----------------+-----------------+-----------------+-----------------------------+
9597
| ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 |
9698
+----------------+-----------------+-----------------+-----------------------------+
9799
| ARM | Neoverse-N1 | #1349291 | N/A |
98100
+----------------+-----------------+-----------------+-----------------------------+
99101
| ARM | Neoverse-N1 | #1542419 | ARM64_ERRATUM_1542419 |
100102
+----------------+-----------------+-----------------+-----------------------------+
103+
| ARM | Neoverse-N2 | #2139208 | ARM64_ERRATUM_2139208 |
104+
+----------------+-----------------+-----------------+-----------------------------+
101105
| ARM | MMU-500 | #841119,826419 | N/A |
102106
+----------------+-----------------+-----------------+-----------------------------+
103107
+----------------+-----------------+-----------------+-----------------------------+

arch/arm64/Kconfig

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,47 @@ config ARM64_ERRATUM_1508412
666666

667667
If unsure, say Y.
668668

669+
config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
670+
bool
671+
672+
config ARM64_ERRATUM_2119858
673+
bool "Cortex-A710: 2119858: workaround TRBE overwriting trace data in FILL mode"
674+
default y
675+
depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
676+
depends on CORESIGHT_TRBE
677+
select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
678+
help
679+
This option adds the workaround for ARM Cortex-A710 erratum 2119858.
680+
681+
Affected Cortex-A710 cores could overwrite up to 3 cache lines of trace
682+
data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in
683+
the event of a WRAP event.
684+
685+
Work around the issue by always making sure we move the TRBPTR_EL1 by
686+
256 bytes before enabling the buffer and filling the first 256 bytes of
687+
the buffer with ETM ignore packets upon disabling.
688+
689+
If unsure, say Y.
690+
691+
config ARM64_ERRATUM_2139208
692+
bool "Neoverse-N2: 2139208: workaround TRBE overwriting trace data in FILL mode"
693+
default y
694+
depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
695+
depends on CORESIGHT_TRBE
696+
select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
697+
help
698+
This option adds the workaround for ARM Neoverse-N2 erratum 2139208.
699+
700+
Affected Neoverse-N2 cores could overwrite up to 3 cache lines of trace
701+
data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in
702+
the event of a WRAP event.
703+
704+
Work around the issue by always making sure we move the TRBPTR_EL1 by
705+
256 bytes before enabling the buffer and filling the first 256 bytes of
706+
the buffer with ETM ignore packets upon disabling.
707+
708+
If unsure, say Y.
709+
669710
config CAVIUM_ERRATUM_22375
670711
bool "Cavium erratum 22375, 24313"
671712
default y

arch/arm64/kernel/cpu_errata.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,18 @@ static const struct midr_range erratum_1463225[] = {
340340
};
341341
#endif
342342

343+
#ifdef CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
344+
static const struct midr_range trbe_overwrite_fill_mode_cpus[] = {
345+
#ifdef CONFIG_ARM64_ERRATUM_2139208
346+
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
347+
#endif
348+
#ifdef CONFIG_ARM64_ERRATUM_2119858
349+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
350+
#endif
351+
{},
352+
};
353+
#endif /* CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE */
354+
343355
const struct arm64_cpu_capabilities arm64_errata[] = {
344356
#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
345357
{
@@ -533,6 +545,19 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
533545
.capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP,
534546
ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL),
535547
},
548+
#endif
549+
#ifdef CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
550+
{
551+
/*
552+
* The erratum work around is handled within the TRBE
553+
* driver and can be applied per-cpu. So, we can allow
554+
* a late CPU to come online with this erratum.
555+
*/
556+
.desc = "ARM erratum 2119858 or 2139208",
557+
.capability = ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE,
558+
.type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
559+
CAP_MIDR_RANGE_LIST(trbe_overwrite_fill_mode_cpus),
560+
},
536561
#endif
537562
{
538563
}

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ WORKAROUND_1418040
5353
WORKAROUND_1463225
5454
WORKAROUND_1508412
5555
WORKAROUND_1542419
56+
WORKAROUND_TRBE_OVERWRITE_FILL_MODE
5657
WORKAROUND_CAVIUM_23154
5758
WORKAROUND_CAVIUM_27456
5859
WORKAROUND_CAVIUM_30115

0 commit comments

Comments
 (0)