Skip to content

Commit d9ff80f

Browse files
covracerwildea01
authored andcommitted
arm64: Work around Falkor erratum 1009
During a TLB invalidate sequence targeting the inner shareable domain, Falkor may prematurely complete the DSB before all loads and stores using the old translation are observed. Instruction fetches are not subject to the conditions of this erratum. If the original code sequence includes multiple TLB invalidate instructions followed by a single DSB, onle one of the TLB instructions needs to be repeated to work around this erratum. While the erratum only applies to cases in which the TLBI specifies the inner-shareable domain (*IS form of TLBI) and the DSB is ISH form or stronger (OSH, SYS), this changes applies the workaround overabundantly-- to local TLBI, DSB NSH sequences as well--for simplicity. Based on work by Shanker Donthineni <shankerd@codeaurora.org> Signed-off-by: Christopher Covington <cov@codeaurora.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent ec663d9 commit d9ff80f

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

Documentation/arm64/silicon-errata.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ stable kernels.
6363
| Cavium | ThunderX SMMUv2 | #27704 | N/A |
6464
| | | | |
6565
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
66+
| Qualcomm Tech. | Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009|

arch/arm64/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,16 @@ config CAVIUM_ERRATUM_27456
480480

481481
If unsure, say Y.
482482

483+
config QCOM_FALKOR_ERRATUM_1009
484+
bool "Falkor E1009: Prematurely complete a DSB after a TLBI"
485+
default y
486+
help
487+
On Falkor v1, the CPU may prematurely complete a DSB following a
488+
TLBI xxIS invalidate maintenance operation. Repeat the TLBI operation
489+
one more time to fix the issue.
490+
491+
If unsure, say Y.
492+
483493
endmenu
484494

485495

arch/arm64/include/asm/cpucaps.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
#define ARM64_HYP_OFFSET_LOW 14
3636
#define ARM64_MISMATCHED_CACHE_LINE_SIZE 15
3737
#define ARM64_HAS_NO_FPSIMD 16
38+
#define ARM64_WORKAROUND_REPEAT_TLBI 17
3839

39-
#define ARM64_NCAPS 17
40+
#define ARM64_NCAPS 18
4041

4142
#endif /* __ASM_CPUCAPS_H */

arch/arm64/include/asm/tlbflush.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,21 @@
3636
* not. The macros handles invoking the asm with or without the
3737
* register argument as appropriate.
3838
*/
39-
#define __TLBI_0(op, arg) asm ("tlbi " #op)
40-
#define __TLBI_1(op, arg) asm ("tlbi " #op ", %0" : : "r" (arg))
41-
#define __TLBI_N(op, arg, n, ...) __TLBI_##n(op, arg)
39+
#define __TLBI_0(op, arg) asm ("tlbi " #op "\n" \
40+
ALTERNATIVE("nop\n nop", \
41+
"dsb ish\n tlbi " #op, \
42+
ARM64_WORKAROUND_REPEAT_TLBI, \
43+
CONFIG_QCOM_FALKOR_ERRATUM_1009) \
44+
: : )
45+
46+
#define __TLBI_1(op, arg) asm ("tlbi " #op ", %0\n" \
47+
ALTERNATIVE("nop\n nop", \
48+
"dsb ish\n tlbi " #op ", %0", \
49+
ARM64_WORKAROUND_REPEAT_TLBI, \
50+
CONFIG_QCOM_FALKOR_ERRATUM_1009) \
51+
: : "r" (arg))
52+
53+
#define __TLBI_N(op, arg, n, ...) __TLBI_##n(op, arg)
4254

4355
#define __tlbi(op, ...) __TLBI_N(op, ##__VA_ARGS__, 1, 0)
4456

arch/arm64/kernel/cpu_errata.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
133133
.def_scope = SCOPE_LOCAL_CPU,
134134
.enable = cpu_enable_trap_ctr_access,
135135
},
136+
#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1009
137+
{
138+
.desc = "Qualcomm Technologies Falkor erratum 1009",
139+
.capability = ARM64_WORKAROUND_REPEAT_TLBI,
140+
MIDR_RANGE(MIDR_QCOM_FALKOR_V1,
141+
MIDR_CPU_VAR_REV(0, 0),
142+
MIDR_CPU_VAR_REV(0, 0)),
143+
},
144+
#endif
136145
{
137146
}
138147
};

0 commit comments

Comments
 (0)