fix(cpus): workaround for Cortex-X2 erratum 2136059
Cortex-X2 erratum 2136059 is a Cat B erratum that applies to
revisions r0p0, r1p0 and r2p0 and is fixed in r2p1.
The workaround is to set CPUACTLR5_EL1[44].
SDEN documentation:
https://developer.arm.com/documentation/SDEN-1775100/latest
Change-Id: I156467537c3f235b50fc8aa19a969f2798bd891b
Signed-off-by: John Powell <john.powell@arm.com>
diff --git a/docs/design/cpu-specific-build-macros.rst b/docs/design/cpu-specific-build-macros.rst
index 515cde3..430dc04 100644
--- a/docs/design/cpu-specific-build-macros.rst
+++ b/docs/design/cpu-specific-build-macros.rst
@@ -774,6 +774,10 @@
CPU. This needs to be enabled only for revisions r0p0, r1p0 and r2p0 of the
CPU, it is fixed in r2p1.
+- ``ERRATA_X2_2136059``: This applies errata 2136059 workaround to Cortex-X2
+ CPU. This needs to be enabled only for revisions r0p0, r1p0 and r2p0 of the
+ CPU, it is fixed in r2p1.
+
- ``ERRATA_X2_2216384``: This applies errata 2216384 workaround to Cortex-X2
CPU. This needs to be enabled only for revisions r0p0, r1p0 and r2p0 of the
CPU, it is fixed in r2p1.
diff --git a/lib/cpus/aarch64/cortex_x2.S b/lib/cpus/aarch64/cortex_x2.S
index 0873f7e..bcee06f 100644
--- a/lib/cpus/aarch64/cortex_x2.S
+++ b/lib/cpus/aarch64/cortex_x2.S
@@ -134,6 +134,12 @@
check_erratum_range cortex_x2, ERRATUM(2083908), CPU_REV(2, 0), CPU_REV(2, 0)
+workaround_reset_start cortex_x2, ERRATUM(2136059), ERRATA_X2_2136059
+ sysreg_bit_set CORTEX_X2_CPUACTLR5_EL1, BIT(44)
+workaround_reset_end cortex_x2, ERRATUM(2136059)
+
+check_erratum_ls cortex_x2, ERRATUM(2136059), CPU_REV(2, 0)
+
workaround_reset_start cortex_x2, ERRATUM(2147715), ERRATA_X2_2147715
/* Apply the workaround by setting bit 22 in CPUACTLR_EL1. */
sysreg_bit_set CORTEX_X2_CPUACTLR_EL1, CORTEX_X2_CPUACTLR_EL1_BIT_22
diff --git a/lib/cpus/cpu-ops.mk b/lib/cpus/cpu-ops.mk
index 3ab10f5..d9a136b 100644
--- a/lib/cpus/cpu-ops.mk
+++ b/lib/cpus/cpu-ops.mk
@@ -780,6 +780,11 @@
# r2p1.
CPU_FLAG_LIST += ERRATA_X2_2081180
+# Flag to apply erratum 2136059 workaround during reset. This erratum applies
+# only to revisions r0p0, r1p0 and r2p0 of the Cortex-X2 cpu, it is fixed in
+# r2p1.
+CPU_FLAG_LIST += ERRATA_X2_2136059
+
# Flag to apply erratum 2216384 workaround during reset. This erratum applies
# only to revisions r0p0, r1p0 and r2p0 of the Cortex-X2 cpu, it is fixed in
# r2p1.