Skip to content

Commit 3bd94a8

Browse files
Anshuman Khandualmathieupoirier
authored andcommitted
arm64: errata: Add detection for TRBE invalid prohibited states
TRBE implementations affected by Arm erratum #2038923 might get TRBE into an inconsistent view on whether trace is prohibited within the CPU. As a result, the trace buffer or trace buffer state might be corrupted. This happens after TRBE buffer has been enabled by setting TRBLIMITR_EL1.E, followed by just a single context synchronization event before execution changes from a context, in which trace is prohibited to one where it isn't, or vice versa. In these mentioned conditions, the view of whether trace is prohibited is inconsistent between parts of the CPU, and the trace buffer or the trace buffer state might be corrupted. This adds a new errata ARM64_ERRATUM_2038923 in arm64 errata framework. Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Suzuki Poulose <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Reviewed-by: Suzuki K Poulose <[email protected]> Acked-by: Catalin Marinas <[email protected]> Signed-off-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 607a9af commit 3bd94a8

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ stable kernels.
5454
+----------------+-----------------+-----------------+-----------------------------+
5555
| ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_2064142 |
5656
+----------------+-----------------+-----------------+-----------------------------+
57+
| ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_2038923 |
58+
+----------------+-----------------+-----------------+-----------------------------+
5759
| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
5860
+----------------+-----------------+-----------------+-----------------------------+
5961
| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |

arch/arm64/Kconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,29 @@ config ARM64_ERRATUM_2064142
796796

797797
If unsure, say Y.
798798

799+
config ARM64_ERRATUM_2038923
800+
bool "Cortex-A510: 2038923: workaround TRBE corruption with enable"
801+
depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in
802+
default y
803+
help
804+
This option adds the workaround for ARM Cortex-A510 erratum 2038923.
805+
806+
Affected Cortex-A510 core might cause an inconsistent view on whether trace is
807+
prohibited within the CPU. As a result, the trace buffer or trace buffer state
808+
might be corrupted. This happens after TRBE buffer has been enabled by setting
809+
TRBLIMITR_EL1.E, followed by just a single context synchronization event before
810+
execution changes from a context, in which trace is prohibited to one where it
811+
isn't, or vice versa. In these mentioned conditions, the view of whether trace
812+
is prohibited is inconsistent between parts of the CPU, and the trace buffer or
813+
the trace buffer state might be corrupted.
814+
815+
Work around this in the driver by preventing an inconsistent view of whether the
816+
trace is prohibited or not based on TRBLIMITR_EL1.E by immediately following a
817+
change to TRBLIMITR_EL1.E with at least one ISB instruction before an ERET, or
818+
two ISB instructions if no ERET is to take place.
819+
820+
If unsure, say Y.
821+
799822
config CAVIUM_ERRATUM_22375
800823
bool "Cavium erratum 22375, 24313"
801824
default y

arch/arm64/kernel/cpu_errata.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
607607
ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2)
608608
},
609609
#endif
610+
#ifdef CONFIG_ARM64_ERRATUM_2038923
611+
{
612+
.desc = "ARM erratum 2038923",
613+
.capability = ARM64_WORKAROUND_2038923,
614+
615+
/* Cortex-A510 r0p0 - r0p2 */
616+
ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2)
617+
},
618+
#endif
610619
{
611620
}
612621
};

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ WORKAROUND_1463225
5656
WORKAROUND_1508412
5757
WORKAROUND_1542419
5858
WORKAROUND_2064142
59+
WORKAROUND_2038923
5960
WORKAROUND_TRBE_OVERWRITE_FILL_MODE
6061
WORKAROUND_TSB_FLUSH_FAILURE
6162
WORKAROUND_TRBE_WRITE_OUT_OF_RANGE

0 commit comments

Comments
 (0)