From 08a0f6acaa327b0de868a2fdff9fcdf5880de9db Mon Sep 17 00:00:00 2001 From: Sona Mathew Date: Thu, 2 Mar 2023 15:07:55 -0600 Subject: fix(cpus): workaround for Neoverse V1 errata 2743233 Neoverse V1 erratum 2743233 is a Cat B erratum that applies to all revisions <= r1p2 and is still open. The workaround sets CPUACTLR5_EL1[56:55] to 2'b01. SDEN documentation: https://developer.arm.com/documentation/SDEN1401781/latest Change-Id: If51a6f4293fa8b5b35c44edd564ebb715ba309a1 Signed-off-by: Sona Mathew (cherry picked from commit f1c3eae9e091a63b42eebae8b03d4d470c9c3f75) --- docs/design/cpu-specific-build-macros.rst | 4 ++++ include/lib/cpus/aarch64/neoverse_v1.h | 2 ++ lib/cpus/aarch64/neoverse_v1.S | 37 +++++++++++++++++++++++++++++++ lib/cpus/cpu-ops.mk | 9 ++++++++ 4 files changed, 52 insertions(+) diff --git a/docs/design/cpu-specific-build-macros.rst b/docs/design/cpu-specific-build-macros.rst index 0f6277860..8a201862c 100644 --- a/docs/design/cpu-specific-build-macros.rst +++ b/docs/design/cpu-specific-build-macros.rst @@ -484,6 +484,10 @@ For Neoverse V1, the following errata build flags are defined : CPU. This needs to be enabled for revisions r0p0, r1p0, r1p1 and r1p2 of the CPU. It is still open. +- ``ERRATA_V1_2743233``: This applies erratum 2743233 workaround to Neoverse-V1 + CPU. This needs to be enabled for revisions r0p0, r1p0, r1p1, and r1p2 of the + CPU. It is still open. + - ``ERRATA_V1_2779461``: This applies erratum 2779461 workaround to Neoverse-V1 CPU. This needs to be enabled for revisions r0p0, r1p0, r1p1, r1p2 of the CPU. It is still open. diff --git a/include/lib/cpus/aarch64/neoverse_v1.h b/include/lib/cpus/aarch64/neoverse_v1.h index 4c10484f5..3d486230f 100644 --- a/include/lib/cpus/aarch64/neoverse_v1.h +++ b/include/lib/cpus/aarch64/neoverse_v1.h @@ -43,4 +43,6 @@ #define NEOVERSE_V1_ACTLR3_EL1 S3_0_C15_C1_2 +#define NEOVERSE_V1_ACTLR5_EL1 S3_0_C15_C9_0 + #endif /* NEOVERSE_V1_H */ diff --git a/lib/cpus/aarch64/neoverse_v1.S b/lib/cpus/aarch64/neoverse_v1.S index f9a578985..363c2e6f2 100644 --- a/lib/cpus/aarch64/neoverse_v1.S +++ b/lib/cpus/aarch64/neoverse_v1.S @@ -486,6 +486,37 @@ func check_errata_2743093 b cpu_rev_var_ls endfunc check_errata_2743093 + /* --------------------------------------------------- + * Errata Workaround for Neoverse V1 Errata #2743233. + * This applies to revisions r0p0, r1p0, r1p1 and r1p2. + * It is still open. + * x0: variant[4:7] and revisions[0:3] of current cpu. + * Shall clobber: x0-x1, x17 + * --------------------------------------------------- + */ +func errata_neoverse_v1_2743233_wa + /* Check revision. */ + mov x17, x30 + bl check_errata_2743233 + cbz x0, 1f + + /* Apply the workaround */ + mrs x1, NEOVERSE_V1_ACTLR5_EL1 + bic x1, x1, #BIT(56) + orr x1, x1, #BIT(55) + msr NEOVERSE_V1_ACTLR5_EL1, x1 + +1: + ret x17 +endfunc errata_neoverse_v1_2743233_wa + +func check_errata_2743233 + /* Applies to r0p0, r1p0, r1p1 and r1p2 */ + mov x1, #CPU_REV(1,2) + b cpu_rev_var_ls +endfunc check_errata_2743233 + + /* ---------------------------------------------------- * Errata Workaround for Neoverse V1 Errata #2779461. * This applies to revisions r0p0, r1p0, r1p1, and r1p2. @@ -573,6 +604,7 @@ func neoverse_v1_errata_report report_errata ERRATA_V1_2294912, neoverse_v1, 2294912 report_errata ERRATA_V1_2372203, neoverse_v1, 2372203 report_errata ERRATA_V1_2743093, neoverse_v1, 2743093 + report_errata ERRATA_V1_2743233, neoverse_v1, 2743233 report_errata ERRATA_V1_2779461, neoverse_v1, 2779461 report_errata WORKAROUND_CVE_2022_23960, neoverse_v1, cve_2022_23960 @@ -652,6 +684,11 @@ func neoverse_v1_reset_func bl errata_neoverse_v1_2372203_wa #endif +#if ERRATA_V1_2743233 + mov x0, x18 + bl errata_neoverse_v1_2743233_wa +#endif + #if ERRATA_V1_2779461 mov x0, x18 bl errata_neoverse_v1_2779461_wa diff --git a/lib/cpus/cpu-ops.mk b/lib/cpus/cpu-ops.mk index 0f10061a1..51b21757d 100644 --- a/lib/cpus/cpu-ops.mk +++ b/lib/cpus/cpu-ops.mk @@ -539,6 +539,11 @@ ERRATA_V1_2372203 ?=0 # still open. ERRATA_V1_2743093 ?=0 +# Flag to apply erratum 2743233 workaround during powerdown. This erratum +# applies to revisions r0p0, r1p0, r1p1 and r1p2 of the Neoverse V1 cpu and is +# still open. +ERRATA_V1_2743233 ?=0 + # Flag to apply erratum 2779461 workaround during powerdown. This erratum # applies to revisions r0p0, r1p0, r1p1 and r1p2 of the Neoverse V1 cpu and is # still open. @@ -1229,6 +1234,10 @@ $(eval $(call add_define,ERRATA_V1_2372203)) $(eval $(call assert_boolean,ERRATA_V1_2743093)) $(eval $(call add_define,ERRATA_V1_2743093)) +# Process ERRATA_V1_2743233 flag +$(eval $(call assert_boolean,ERRATA_V1_2743233)) +$(eval $(call add_define,ERRATA_V1_2743233)) + # Process ERRATA_V1_2779461 flag $(eval $(call assert_boolean,ERRATA_V1_2779461)) $(eval $(call add_define,ERRATA_V1_2779461)) -- cgit v1.2.1