Skip to content

Commit e5f5210

Browse files
committed
Merge branch 'for-next/trbe-errata' into for-next/core
* for-next/trbe-errata: arm64: errata: Add detection for TRBE write to out-of-range arm64: errata: Add workaround for TSB flush failures arm64: errata: Add detection for TRBE overwrite in FILL mode arm64: Add Neoverse-N2, Cortex-A710 CPU part definition
2 parents 655ee55 + 8d81b2a commit e5f5210

File tree

6 files changed

+213
-1
lines changed

6 files changed

+213
-1
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,24 @@ stable kernels.
9292
+----------------+-----------------+-----------------+-----------------------------+
9393
| ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 |
9494
+----------------+-----------------+-----------------+-----------------------------+
95+
| ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |
96+
+----------------+-----------------+-----------------+-----------------------------+
97+
| ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 |
98+
+----------------+-----------------+-----------------+-----------------------------+
99+
| ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_2224489 |
100+
+----------------+-----------------+-----------------+-----------------------------+
95101
| ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 |
96102
+----------------+-----------------+-----------------+-----------------------------+
97103
| ARM | Neoverse-N1 | #1349291 | N/A |
98104
+----------------+-----------------+-----------------+-----------------------------+
99105
| ARM | Neoverse-N1 | #1542419 | ARM64_ERRATUM_1542419 |
100106
+----------------+-----------------+-----------------+-----------------------------+
107+
| ARM | Neoverse-N2 | #2139208 | ARM64_ERRATUM_2139208 |
108+
+----------------+-----------------+-----------------+-----------------------------+
109+
| ARM | Neoverse-N2 | #2067961 | ARM64_ERRATUM_2067961 |
110+
+----------------+-----------------+-----------------+-----------------------------+
111+
| ARM | Neoverse-N2 | #2253138 | ARM64_ERRATUM_2253138 |
112+
+----------------+-----------------+-----------------+-----------------------------+
101113
| ARM | MMU-500 | #841119,826419 | N/A |
102114
+----------------+-----------------+-----------------+-----------------------------+
103115
+----------------+-----------------+-----------------+-----------------------------+

arch/arm64/Kconfig

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,121 @@ 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+
710+
config ARM64_WORKAROUND_TSB_FLUSH_FAILURE
711+
bool
712+
713+
config ARM64_ERRATUM_2054223
714+
bool "Cortex-A710: 2054223: workaround TSB instruction failing to flush trace"
715+
default y
716+
select ARM64_WORKAROUND_TSB_FLUSH_FAILURE
717+
help
718+
Enable workaround for ARM Cortex-A710 erratum 2054223
719+
720+
Affected cores may fail to flush the trace data on a TSB instruction, when
721+
the PE is in trace prohibited state. This will cause losing a few bytes
722+
of the trace cached.
723+
724+
Workaround is to issue two TSB consecutively on affected cores.
725+
726+
If unsure, say Y.
727+
728+
config ARM64_ERRATUM_2067961
729+
bool "Neoverse-N2: 2067961: workaround TSB instruction failing to flush trace"
730+
default y
731+
select ARM64_WORKAROUND_TSB_FLUSH_FAILURE
732+
help
733+
Enable workaround for ARM Neoverse-N2 erratum 2067961
734+
735+
Affected cores may fail to flush the trace data on a TSB instruction, when
736+
the PE is in trace prohibited state. This will cause losing a few bytes
737+
of the trace cached.
738+
739+
Workaround is to issue two TSB consecutively on affected cores.
740+
741+
If unsure, say Y.
742+
743+
config ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
744+
bool
745+
746+
config ARM64_ERRATUM_2253138
747+
bool "Neoverse-N2: 2253138: workaround TRBE writing to address out-of-range"
748+
depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
749+
depends on CORESIGHT_TRBE
750+
default y
751+
select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
752+
help
753+
This option adds the workaround for ARM Neoverse-N2 erratum 2253138.
754+
755+
Affected Neoverse-N2 cores might write to an out-of-range address, not reserved
756+
for TRBE. Under some conditions, the TRBE might generate a write to the next
757+
virtually addressed page following the last page of the TRBE address space
758+
(i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base.
759+
760+
Work around this in the driver by always making sure that there is a
761+
page beyond the TRBLIMITR_EL1.LIMIT, within the space allowed for the TRBE.
762+
763+
If unsure, say Y.
764+
765+
config ARM64_ERRATUM_2224489
766+
bool "Cortex-A710: 2224489: workaround TRBE writing to address out-of-range"
767+
depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
768+
depends on CORESIGHT_TRBE
769+
default y
770+
select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
771+
help
772+
This option adds the workaround for ARM Cortex-A710 erratum 2224489.
773+
774+
Affected Cortex-A710 cores might write to an out-of-range address, not reserved
775+
for TRBE. Under some conditions, the TRBE might generate a write to the next
776+
virtually addressed page following the last page of the TRBE address space
777+
(i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base.
778+
779+
Work around this in the driver by always making sure that there is a
780+
page beyond the TRBLIMITR_EL1.LIMIT, within the space allowed for the TRBE.
781+
782+
If unsure, say Y.
783+
669784
config CAVIUM_ERRATUM_22375
670785
bool "Cavium erratum 22375, 24313"
671786
default y

arch/arm64/include/asm/barrier.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define dsb(opt) asm volatile("dsb " #opt : : : "memory")
2424

2525
#define psb_csync() asm volatile("hint #17" : : : "memory")
26-
#define tsb_csync() asm volatile("hint #18" : : : "memory")
26+
#define __tsb_csync() asm volatile("hint #18" : : : "memory")
2727
#define csdb() asm volatile("hint #20" : : : "memory")
2828

2929
#ifdef CONFIG_ARM64_PSEUDO_NMI
@@ -46,6 +46,20 @@
4646
#define dma_rmb() dmb(oshld)
4747
#define dma_wmb() dmb(oshst)
4848

49+
50+
#define tsb_csync() \
51+
do { \
52+
/* \
53+
* CPUs affected by Arm Erratum 2054223 or 2067961 needs \
54+
* another TSB to ensure the trace is flushed. The barriers \
55+
* don't have to be strictly back to back, as long as the \
56+
* CPU is in trace prohibited state. \
57+
*/ \
58+
if (cpus_have_final_cap(ARM64_WORKAROUND_TSB_FLUSH_FAILURE)) \
59+
__tsb_csync(); \
60+
__tsb_csync(); \
61+
} while (0)
62+
4963
/*
5064
* Generate a mask for array_index__nospec() that is ~0UL when 0 <= idx < sz
5165
* and 0 otherwise.

arch/arm64/include/asm/cputype.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
#define ARM_CPU_PART_CORTEX_A76 0xD0B
7474
#define ARM_CPU_PART_NEOVERSE_N1 0xD0C
7575
#define ARM_CPU_PART_CORTEX_A77 0xD0D
76+
#define ARM_CPU_PART_CORTEX_A710 0xD47
77+
#define ARM_CPU_PART_NEOVERSE_N2 0xD49
7678

7779
#define APM_CPU_PART_POTENZA 0x000
7880

@@ -113,6 +115,8 @@
113115
#define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)
114116
#define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
115117
#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
118+
#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
119+
#define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)
116120
#define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
117121
#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
118122
#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)

arch/arm64/kernel/cpu_errata.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,42 @@ 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+
355+
#ifdef CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE
356+
static const struct midr_range tsb_flush_fail_cpus[] = {
357+
#ifdef CONFIG_ARM64_ERRATUM_2067961
358+
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
359+
#endif
360+
#ifdef CONFIG_ARM64_ERRATUM_2054223
361+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
362+
#endif
363+
{},
364+
};
365+
#endif /* CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE */
366+
367+
#ifdef CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
368+
static struct midr_range trbe_write_out_of_range_cpus[] = {
369+
#ifdef CONFIG_ARM64_ERRATUM_2253138
370+
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
371+
#endif
372+
#ifdef CONFIG_ARM64_ERRATUM_2224489
373+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
374+
#endif
375+
{},
376+
};
377+
#endif /* CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE */
378+
343379
const struct arm64_cpu_capabilities arm64_errata[] = {
344380
#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
345381
{
@@ -533,6 +569,34 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
533569
.capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP,
534570
ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL),
535571
},
572+
#endif
573+
#ifdef CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
574+
{
575+
/*
576+
* The erratum work around is handled within the TRBE
577+
* driver and can be applied per-cpu. So, we can allow
578+
* a late CPU to come online with this erratum.
579+
*/
580+
.desc = "ARM erratum 2119858 or 2139208",
581+
.capability = ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE,
582+
.type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
583+
CAP_MIDR_RANGE_LIST(trbe_overwrite_fill_mode_cpus),
584+
},
585+
#endif
586+
#ifdef CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE
587+
{
588+
.desc = "ARM erratum 2067961 or 2054223",
589+
.capability = ARM64_WORKAROUND_TSB_FLUSH_FAILURE,
590+
ERRATA_MIDR_RANGE_LIST(tsb_flush_fail_cpus),
591+
},
592+
#endif
593+
#ifdef CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
594+
{
595+
.desc = "ARM erratum 2253138 or 2224489",
596+
.capability = ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE,
597+
.type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
598+
CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus),
599+
},
536600
#endif
537601
{
538602
}

arch/arm64/tools/cpucaps

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ WORKAROUND_1418040
5555
WORKAROUND_1463225
5656
WORKAROUND_1508412
5757
WORKAROUND_1542419
58+
WORKAROUND_TRBE_OVERWRITE_FILL_MODE
59+
WORKAROUND_TSB_FLUSH_FAILURE
60+
WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
5861
WORKAROUND_CAVIUM_23154
5962
WORKAROUND_CAVIUM_27456
6063
WORKAROUND_CAVIUM_30115

0 commit comments

Comments
 (0)