fix(cpus): workaround for Cortex-X2 erratum 2291219
Cortex-X2 erratum 2291219 is a Cat B erratum that applies to
revisions r0p0, r1p0 and r2p0 and is fixed in r2p1.
The workaround is to set CPUACTLR2_EL1[36] before the power
down sequence that sets PWRDN_EN and executes WFI. This bit
should be be cleared after exiting WFI.
SDEN documentation:
https://developer.arm.com/documentation/SDEN-1775100/latest
Change-Id: I43af57961feba3a1c001d09ad804740b996f1db7
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 77549ac..d47d082 100644
--- a/docs/design/cpu-specific-build-macros.rst
+++ b/docs/design/cpu-specific-build-macros.rst
@@ -794,6 +794,10 @@
CPU. This needs to be enabled for revisions r0p0, r1p0, r2p0 and r2p1 of the
CPU and is still open.
+- ``ERRATA_X2_2291219``: This applies errata 2291219 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_2371105``: This applies errata 2371105 workaround to Cortex-X2
CPU. This needs to be enabled for revisions r0p0, r1p0 and r2p0 of the CPU
and is fixed in r2p1.
diff --git a/lib/cpus/aarch64/cortex_x2.S b/lib/cpus/aarch64/cortex_x2.S
index 264a035..d1289ce 100644
--- a/lib/cpus/aarch64/cortex_x2.S
+++ b/lib/cpus/aarch64/cortex_x2.S
@@ -176,6 +176,16 @@
check_erratum_ls cortex_x2, ERRATUM(2282622), CPU_REV(2, 1)
+workaround_runtime_start cortex_x2, ERRATUM(2291219), ERRATA_X2_2291219
+ /*
+ * Set/unset bit 36 in ACTLR2_EL1. The first call will set it, applying
+ * the workaround. Second call clears it to undo it.
+ */
+ sysreg_bit_toggle CORTEX_X2_CPUACTLR2_EL1, BIT(36)
+workaround_runtime_end cortex_x2, ERRATUM(2291219), NO_ISB
+
+check_erratum_ls cortex_x2, ERRATUM(2291219), CPU_REV(2, 0)
+
workaround_reset_start cortex_x2, ERRATUM(2313941), ERRATA_DSU_2313941
errata_dsu_2313941_wa_impl
workaround_reset_end cortex_x2, ERRATUM(2313941)
@@ -241,6 +251,8 @@
* ----------------------------------------------------
*/
func cortex_x2_core_pwr_dwn
+ apply_erratum cortex_x2, ERRATUM(2291219), ERRATA_X2_2291219, NO_GET_CPU_REV
+
/* ---------------------------------------------------
* Enable CPU power down bit in power control register
* ---------------------------------------------------
diff --git a/lib/cpus/cpu-ops.mk b/lib/cpus/cpu-ops.mk
index 1a47738..9948cd4 100644
--- a/lib/cpus/cpu-ops.mk
+++ b/lib/cpus/cpu-ops.mk
@@ -804,6 +804,11 @@
# open.
CPU_FLAG_LIST += ERRATA_X2_2282622
+# Flag to apply erratum 2291219 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_2291219
+
# Flag to apply erratum 2371105 workaround during reset. This erratum applies
# to revision r0p0, r1p0 and r2p0 of the Cortex-X2 cpu and is fixed in r2p1.
CPU_FLAG_LIST += ERRATA_X2_2371105