arm64: Avoid Cavium TX2 erratum 219 when switching TTBR
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 9 Apr 2019 15:22:24 +0000 (16:22 +0100)
committerWill Deacon <will@kernel.org>
Tue, 8 Oct 2019 11:25:25 +0000 (12:25 +0100)
As a PRFM instruction racing against a TTBR update can have undesirable
effects on TX2, NOP-out such PRFM on cores that are affected by
the TX2-219 erratum.

Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/cpucaps.h
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/entry.S

index e81e0cbd728f82e792f1dba23748d04a18378edc..ac1dbca3d0cd3db0dc5396d05d38eb7dfb679da0 100644 (file)
@@ -53,7 +53,8 @@
 #define ARM64_HAS_DCPODP                       43
 #define ARM64_WORKAROUND_1463225               44
 #define ARM64_WORKAROUND_CAVIUM_TX2_219_TVM    45
+#define ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM   46
 
-#define ARM64_NCAPS                            46
+#define ARM64_NCAPS                            47
 
 #endif /* __ASM_CPUCAPS_H */
index d999ca2dd760e632b88d2f7a786d66b1515f7710..a19bb3e4bcfb0ce1fc886325cf81c5cb960d7a43 100644 (file)
@@ -884,6 +884,11 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
                ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
                .matches = needs_tx2_tvm_workaround,
        },
+       {
+               .desc = "Cavium ThunderX2 erratum 219 (PRFM removal)",
+               .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM,
+               ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
+       },
 #endif
        {
        }
index 84a822748c84e58c85fc19a62d63053b97f0b2c2..109894bd319483bc9048d3bf58951de220b2646b 100644 (file)
@@ -1070,7 +1070,9 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003
 #else
        ldr     x30, =vectors
 #endif
+alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM
        prfm    plil1strm, [x30, #(1b - tramp_vectors)]
+alternative_else_nop_endif
        msr     vbar_el1, x30
        add     x30, x30, #(1b - tramp_vectors)
        isb