blob: e4a1182deff7f2ef24bce12082a0868f36715a1c [file] [log] [blame]
Andre Przywarae116a372014-11-14 15:54:09 +00001/*
2 * Contains CPU specific errata definitions
3 *
4 * Copyright (C) 2014 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
Andre Przywarae116a372014-11-14 15:54:09 +000019#include <linux/types.h>
20#include <asm/cpu.h>
21#include <asm/cputype.h>
22#include <asm/cpufeature.h>
23
Andre Przywara301bcfa2014-11-14 15:54:10 +000024static bool __maybe_unused
Suzuki K Poulose92406f02016-04-22 12:25:31 +010025is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope)
Andre Przywara301bcfa2014-11-14 15:54:10 +000026{
Ard Biesheuvele8002e02018-03-06 17:15:34 +000027 const struct arm64_midr_revidr *fix;
28 u32 midr = read_cpuid_id(), revidr;
29
Suzuki K Poulose92406f02016-04-22 12:25:31 +010030 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
Suzuki K Poulose1df31052018-03-26 15:12:44 +010031 if (!is_midr_in_range(midr, &entry->midr_range))
Ard Biesheuvele8002e02018-03-06 17:15:34 +000032 return false;
33
34 midr &= MIDR_REVISION_MASK | MIDR_VARIANT_MASK;
35 revidr = read_cpuid(REVIDR_EL1);
36 for (fix = entry->fixed_revs; fix && fix->revidr_mask; fix++)
37 if (midr == fix->midr_rv && (revidr & fix->revidr_mask))
38 return false;
39
40 return true;
Andre Przywara301bcfa2014-11-14 15:54:10 +000041}
42
Stephen Boydbb487112017-12-13 14:19:37 -080043static bool __maybe_unused
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +010044is_affected_midr_range_list(const struct arm64_cpu_capabilities *entry,
45 int scope)
46{
47 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
48 return is_midr_in_range_list(read_cpuid_id(), entry->midr_range_list);
Andre Przywara301bcfa2014-11-14 15:54:10 +000049}
50
Stephen Boydbb487112017-12-13 14:19:37 -080051static bool __maybe_unused
52is_kryo_midr(const struct arm64_cpu_capabilities *entry, int scope)
53{
54 u32 model;
55
56 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
57
58 model = read_cpuid_id();
59 model &= MIDR_IMPLEMENTOR_MASK | (0xf00 << MIDR_PARTNUM_SHIFT) |
60 MIDR_ARCHITECTURE_MASK;
61
Suzuki K Poulose1df31052018-03-26 15:12:44 +010062 return model == entry->midr_range.model;
Stephen Boydbb487112017-12-13 14:19:37 -080063}
64
Suzuki K Poulose116c81f2016-09-09 14:07:16 +010065static bool
66has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry,
67 int scope)
68{
69 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
70 return (read_cpuid_cachetype() & arm64_ftr_reg_ctrel0.strict_mask) !=
71 (arm64_ftr_reg_ctrel0.sys_val & arm64_ftr_reg_ctrel0.strict_mask);
72}
73
Dave Martinc0cda3b2018-03-26 15:12:28 +010074static void
75cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused)
Suzuki K Poulose116c81f2016-09-09 14:07:16 +010076{
77 /* Clear SCTLR_EL1.UCT */
78 config_sctlr_el1(SCTLR_EL1_UCT, 0);
79}
80
Marc Zyngier4205a892018-03-13 12:40:39 +000081atomic_t arm64_el2_vector_last_slot = ATOMIC_INIT(-1);
82
Will Deacon0f15adb2018-01-03 11:17:58 +000083#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
84#include <asm/mmu_context.h>
85#include <asm/cacheflush.h>
86
87DEFINE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data);
88
Marc Zyngiere8b22d0f2018-04-10 11:36:45 +010089#ifdef CONFIG_KVM_INDIRECT_VECTORS
Marc Zyngierb0922012018-02-06 17:56:20 +000090extern char __smccc_workaround_1_smc_start[];
91extern char __smccc_workaround_1_smc_end[];
Will Deaconaa6acde2018-01-03 12:46:21 +000092
Will Deacon0f15adb2018-01-03 11:17:58 +000093static void __copy_hyp_vect_bpi(int slot, const char *hyp_vecs_start,
94 const char *hyp_vecs_end)
95{
96 void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K);
97 int i;
98
99 for (i = 0; i < SZ_2K; i += 0x80)
100 memcpy(dst + i, hyp_vecs_start, hyp_vecs_end - hyp_vecs_start);
101
102 flush_icache_range((uintptr_t)dst, (uintptr_t)dst + SZ_2K);
103}
104
105static void __install_bp_hardening_cb(bp_hardening_cb_t fn,
106 const char *hyp_vecs_start,
107 const char *hyp_vecs_end)
108{
Will Deacon0f15adb2018-01-03 11:17:58 +0000109 static DEFINE_SPINLOCK(bp_lock);
110 int cpu, slot = -1;
111
112 spin_lock(&bp_lock);
113 for_each_possible_cpu(cpu) {
114 if (per_cpu(bp_hardening_data.fn, cpu) == fn) {
115 slot = per_cpu(bp_hardening_data.hyp_vectors_slot, cpu);
116 break;
117 }
118 }
119
120 if (slot == -1) {
Marc Zyngier4205a892018-03-13 12:40:39 +0000121 slot = atomic_inc_return(&arm64_el2_vector_last_slot);
122 BUG_ON(slot >= BP_HARDEN_EL2_SLOTS);
Will Deacon0f15adb2018-01-03 11:17:58 +0000123 __copy_hyp_vect_bpi(slot, hyp_vecs_start, hyp_vecs_end);
124 }
125
126 __this_cpu_write(bp_hardening_data.hyp_vectors_slot, slot);
127 __this_cpu_write(bp_hardening_data.fn, fn);
128 spin_unlock(&bp_lock);
129}
130#else
Marc Zyngierb0922012018-02-06 17:56:20 +0000131#define __smccc_workaround_1_smc_start NULL
132#define __smccc_workaround_1_smc_end NULL
Will Deaconaa6acde2018-01-03 12:46:21 +0000133
Will Deacon0f15adb2018-01-03 11:17:58 +0000134static void __install_bp_hardening_cb(bp_hardening_cb_t fn,
135 const char *hyp_vecs_start,
136 const char *hyp_vecs_end)
137{
138 __this_cpu_write(bp_hardening_data.fn, fn);
139}
Marc Zyngiere8b22d0f2018-04-10 11:36:45 +0100140#endif /* CONFIG_KVM_INDIRECT_VECTORS */
Will Deacon0f15adb2018-01-03 11:17:58 +0000141
142static void install_bp_hardening_cb(const struct arm64_cpu_capabilities *entry,
143 bp_hardening_cb_t fn,
144 const char *hyp_vecs_start,
145 const char *hyp_vecs_end)
146{
147 u64 pfr0;
148
149 if (!entry->matches(entry, SCOPE_LOCAL_CPU))
150 return;
151
152 pfr0 = read_cpuid(ID_AA64PFR0_EL1);
153 if (cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_CSV2_SHIFT))
154 return;
155
156 __install_bp_hardening_cb(fn, hyp_vecs_start, hyp_vecs_end);
157}
Will Deaconaa6acde2018-01-03 12:46:21 +0000158
Marc Zyngierb0922012018-02-06 17:56:20 +0000159#include <uapi/linux/psci.h>
160#include <linux/arm-smccc.h>
Will Deaconaa6acde2018-01-03 12:46:21 +0000161#include <linux/psci.h>
162
Marc Zyngierb0922012018-02-06 17:56:20 +0000163static void call_smc_arch_workaround_1(void)
164{
165 arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL);
166}
167
168static void call_hvc_arch_workaround_1(void)
169{
170 arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL);
171}
172
Shanker Donthineni4bc352f2018-04-10 11:36:42 +0100173static void qcom_link_stack_sanitization(void)
174{
175 u64 tmp;
176
177 asm volatile("mov %0, x30 \n"
178 ".rept 16 \n"
179 "bl . + 4 \n"
180 ".endr \n"
181 "mov x30, %0 \n"
182 : "=&r" (tmp));
183}
184
Dave Martinc0cda3b2018-03-26 15:12:28 +0100185static void
186enable_smccc_arch_workaround_1(const struct arm64_cpu_capabilities *entry)
Marc Zyngierb0922012018-02-06 17:56:20 +0000187{
188 bp_hardening_cb_t cb;
189 void *smccc_start, *smccc_end;
190 struct arm_smccc_res res;
Shanker Donthineni4bc352f2018-04-10 11:36:42 +0100191 u32 midr = read_cpuid_id();
Marc Zyngierb0922012018-02-06 17:56:20 +0000192
193 if (!entry->matches(entry, SCOPE_LOCAL_CPU))
Dave Martinc0cda3b2018-03-26 15:12:28 +0100194 return;
Marc Zyngierb0922012018-02-06 17:56:20 +0000195
196 if (psci_ops.smccc_version == SMCCC_VERSION_1_0)
Dave Martinc0cda3b2018-03-26 15:12:28 +0100197 return;
Marc Zyngierb0922012018-02-06 17:56:20 +0000198
199 switch (psci_ops.conduit) {
200 case PSCI_CONDUIT_HVC:
201 arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
202 ARM_SMCCC_ARCH_WORKAROUND_1, &res);
Marc Zyngiere21da1c2018-03-09 15:40:50 +0000203 if ((int)res.a0 < 0)
Dave Martinc0cda3b2018-03-26 15:12:28 +0100204 return;
Marc Zyngierb0922012018-02-06 17:56:20 +0000205 cb = call_hvc_arch_workaround_1;
Marc Zyngier22765f32018-04-10 11:36:44 +0100206 /* This is a guest, no need to patch KVM vectors */
207 smccc_start = NULL;
208 smccc_end = NULL;
Marc Zyngierb0922012018-02-06 17:56:20 +0000209 break;
210
211 case PSCI_CONDUIT_SMC:
212 arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
213 ARM_SMCCC_ARCH_WORKAROUND_1, &res);
Marc Zyngiere21da1c2018-03-09 15:40:50 +0000214 if ((int)res.a0 < 0)
Dave Martinc0cda3b2018-03-26 15:12:28 +0100215 return;
Marc Zyngierb0922012018-02-06 17:56:20 +0000216 cb = call_smc_arch_workaround_1;
217 smccc_start = __smccc_workaround_1_smc_start;
218 smccc_end = __smccc_workaround_1_smc_end;
219 break;
220
221 default:
Dave Martinc0cda3b2018-03-26 15:12:28 +0100222 return;
Marc Zyngierb0922012018-02-06 17:56:20 +0000223 }
224
Shanker Donthineni4bc352f2018-04-10 11:36:42 +0100225 if (((midr & MIDR_CPU_MODEL_MASK) == MIDR_QCOM_FALKOR) ||
226 ((midr & MIDR_CPU_MODEL_MASK) == MIDR_QCOM_FALKOR_V1))
227 cb = qcom_link_stack_sanitization;
228
Marc Zyngierb0922012018-02-06 17:56:20 +0000229 install_bp_hardening_cb(entry, cb, smccc_start, smccc_end);
230
Dave Martinc0cda3b2018-03-26 15:12:28 +0100231 return;
Will Deaconaa6acde2018-01-03 12:46:21 +0000232}
Will Deacon0f15adb2018-01-03 11:17:58 +0000233#endif /* CONFIG_HARDEN_BRANCH_PREDICTOR */
234
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100235#define CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max) \
236 .matches = is_affected_midr_range, \
Suzuki K Poulose1df31052018-03-26 15:12:44 +0100237 .midr_range = MIDR_RANGE(model, v_min, r_min, v_max, r_max)
Andre Przywara301bcfa2014-11-14 15:54:10 +0000238
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100239#define CAP_MIDR_ALL_VERSIONS(model) \
240 .matches = is_affected_midr_range, \
Suzuki K Poulose1df31052018-03-26 15:12:44 +0100241 .midr_range = MIDR_ALL_VERSIONS(model)
Marc Zyngier06f14942017-02-01 14:38:46 +0000242
Ard Biesheuvele8002e02018-03-06 17:15:34 +0000243#define MIDR_FIXED(rev, revidr_mask) \
244 .fixed_revs = (struct arm64_midr_revidr[]){{ (rev), (revidr_mask) }, {}}
245
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100246#define ERRATA_MIDR_RANGE(model, v_min, r_min, v_max, r_max) \
247 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \
248 CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max)
249
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +0100250#define CAP_MIDR_RANGE_LIST(list) \
251 .matches = is_affected_midr_range_list, \
252 .midr_range_list = list
253
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100254/* Errata affecting a range of revisions of given model variant */
255#define ERRATA_MIDR_REV_RANGE(m, var, r_min, r_max) \
256 ERRATA_MIDR_RANGE(m, var, r_min, var, r_max)
257
258/* Errata affecting a single variant/revision of a model */
259#define ERRATA_MIDR_REV(model, var, rev) \
260 ERRATA_MIDR_RANGE(model, var, rev, var, rev)
261
262/* Errata affecting all variants/revisions of a given a model */
263#define ERRATA_MIDR_ALL_VERSIONS(model) \
264 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \
265 CAP_MIDR_ALL_VERSIONS(model)
266
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +0100267/* Errata affecting a list of midr ranges, with same work around */
268#define ERRATA_MIDR_RANGE_LIST(midr_list) \
269 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \
270 CAP_MIDR_RANGE_LIST(midr_list)
271
Suzuki K Pouloseba7d9232018-03-26 15:12:46 +0100272/*
273 * Generic helper for handling capabilties with multiple (match,enable) pairs
274 * of call backs, sharing the same capability bit.
275 * Iterate over each entry to see if at least one matches.
276 */
Will Deacon12eb3692018-03-27 11:51:12 +0100277static bool __maybe_unused
278multi_entry_cap_matches(const struct arm64_cpu_capabilities *entry, int scope)
Suzuki K Pouloseba7d9232018-03-26 15:12:46 +0100279{
280 const struct arm64_cpu_capabilities *caps;
281
282 for (caps = entry->match_list; caps->matches; caps++)
283 if (caps->matches(caps, scope))
284 return true;
285
286 return false;
287}
288
289/*
290 * Take appropriate action for all matching entries in the shared capability
291 * entry.
292 */
Will Deacon12eb3692018-03-27 11:51:12 +0100293static void __maybe_unused
Suzuki K Pouloseba7d9232018-03-26 15:12:46 +0100294multi_entry_cap_cpu_enable(const struct arm64_cpu_capabilities *entry)
295{
296 const struct arm64_cpu_capabilities *caps;
297
298 for (caps = entry->match_list; caps->matches; caps++)
299 if (caps->matches(caps, SCOPE_LOCAL_CPU) &&
300 caps->cpu_enable)
301 caps->cpu_enable(caps);
302}
303
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +0100304#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
305
306/*
307 * List of CPUs where we need to issue a psci call to
308 * harden the branch predictor.
309 */
310static const struct midr_range arm64_bp_harden_smccc_cpus[] = {
311 MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
312 MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
313 MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
314 MIDR_ALL_VERSIONS(MIDR_CORTEX_A75),
315 MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
316 MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +0100317 MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR_V1),
318 MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR),
David Gilhooley0583a4e2018-05-08 15:49:43 -0700319 MIDR_ALL_VERSIONS(MIDR_NVIDIA_DENVER),
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +0100320 {},
321};
322
323#endif
Andre Przywara301bcfa2014-11-14 15:54:10 +0000324
Marc Zyngier8892b712018-04-10 11:36:43 +0100325#ifdef CONFIG_HARDEN_EL2_VECTORS
326
327static const struct midr_range arm64_harden_el2_vectors[] = {
328 MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
329 MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
330 {},
331};
332
Marc Zyngierdc6ed612018-03-28 12:46:07 +0100333#endif
334
Andre Przywarae116a372014-11-14 15:54:09 +0000335const struct arm64_cpu_capabilities arm64_errata[] = {
336#if defined(CONFIG_ARM64_ERRATUM_826319) || \
337 defined(CONFIG_ARM64_ERRATUM_827319) || \
338 defined(CONFIG_ARM64_ERRATUM_824069)
Andre Przywara301bcfa2014-11-14 15:54:10 +0000339 {
340 /* Cortex-A53 r0p[012] */
341 .desc = "ARM errata 826319, 827319, 824069",
342 .capability = ARM64_WORKAROUND_CLEAN_CACHE,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100343 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 2),
Dave Martinc0cda3b2018-03-26 15:12:28 +0100344 .cpu_enable = cpu_enable_cache_maint_trap,
Andre Przywara301bcfa2014-11-14 15:54:10 +0000345 },
Andre Przywarac0a01b82014-11-14 15:54:12 +0000346#endif
347#ifdef CONFIG_ARM64_ERRATUM_819472
348 {
349 /* Cortex-A53 r0p[01] */
350 .desc = "ARM errata 819472",
351 .capability = ARM64_WORKAROUND_CLEAN_CACHE,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100352 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 1),
Dave Martinc0cda3b2018-03-26 15:12:28 +0100353 .cpu_enable = cpu_enable_cache_maint_trap,
Andre Przywarac0a01b82014-11-14 15:54:12 +0000354 },
355#endif
356#ifdef CONFIG_ARM64_ERRATUM_832075
Andre Przywara301bcfa2014-11-14 15:54:10 +0000357 {
Andre Przywara5afaa1f2014-11-14 15:54:11 +0000358 /* Cortex-A57 r0p0 - r1p2 */
359 .desc = "ARM erratum 832075",
360 .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100361 ERRATA_MIDR_RANGE(MIDR_CORTEX_A57,
362 0, 0,
363 1, 2),
Andre Przywara5afaa1f2014-11-14 15:54:11 +0000364 },
Andre Przywarac0a01b82014-11-14 15:54:12 +0000365#endif
Marc Zyngier498cd5c2015-11-16 10:28:18 +0000366#ifdef CONFIG_ARM64_ERRATUM_834220
367 {
368 /* Cortex-A57 r0p0 - r1p2 */
369 .desc = "ARM erratum 834220",
370 .capability = ARM64_WORKAROUND_834220,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100371 ERRATA_MIDR_RANGE(MIDR_CORTEX_A57,
372 0, 0,
373 1, 2),
Marc Zyngier498cd5c2015-11-16 10:28:18 +0000374 },
375#endif
Ard Biesheuvelca79acc2018-03-06 17:15:35 +0000376#ifdef CONFIG_ARM64_ERRATUM_843419
377 {
378 /* Cortex-A53 r0p[01234] */
379 .desc = "ARM erratum 843419",
380 .capability = ARM64_WORKAROUND_843419,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100381 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
Ard Biesheuvelca79acc2018-03-06 17:15:35 +0000382 MIDR_FIXED(0x4, BIT(8)),
Will Deacon905e8c52015-03-23 19:07:02 +0000383 },
Robert Richter6d4e11c2015-09-21 22:58:35 +0200384#endif
385#ifdef CONFIG_ARM64_ERRATUM_845719
386 {
387 /* Cortex-A53 r0p[01234] */
388 .desc = "ARM erratum 845719",
389 .capability = ARM64_WORKAROUND_845719,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100390 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
Marc Zyngier359b7062015-03-27 13:09:23 +0000391 },
Andre Przywarae116a372014-11-14 15:54:09 +0000392#endif
Robert Richter6d4e11c2015-09-21 22:58:35 +0200393#ifdef CONFIG_CAVIUM_ERRATUM_23154
394 {
395 /* Cavium ThunderX, pass 1.x */
396 .desc = "Cavium erratum 23154",
397 .capability = ARM64_WORKAROUND_CAVIUM_23154,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100398 ERRATA_MIDR_REV_RANGE(MIDR_THUNDERX, 0, 0, 1),
Robert Richter6d4e11c2015-09-21 22:58:35 +0200399 },
400#endif
Andrew Pinski104a0c02016-02-24 17:44:57 -0800401#ifdef CONFIG_CAVIUM_ERRATUM_27456
402 {
403 /* Cavium ThunderX, T88 pass 1.x - 2.1 */
404 .desc = "Cavium erratum 27456",
405 .capability = ARM64_WORKAROUND_CAVIUM_27456,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100406 ERRATA_MIDR_RANGE(MIDR_THUNDERX,
407 0, 0,
408 1, 1),
Andrew Pinski104a0c02016-02-24 17:44:57 -0800409 },
Ganapatrao Kulkarni47c459b2016-07-07 10:18:17 +0530410 {
411 /* Cavium ThunderX, T81 pass 1.0 */
412 .desc = "Cavium erratum 27456",
413 .capability = ARM64_WORKAROUND_CAVIUM_27456,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100414 ERRATA_MIDR_REV(MIDR_THUNDERX_81XX, 0, 0),
Ganapatrao Kulkarni47c459b2016-07-07 10:18:17 +0530415 },
Andrew Pinski104a0c02016-02-24 17:44:57 -0800416#endif
David Daney690a3412017-06-09 12:49:48 +0100417#ifdef CONFIG_CAVIUM_ERRATUM_30115
418 {
419 /* Cavium ThunderX, T88 pass 1.x - 2.2 */
420 .desc = "Cavium erratum 30115",
421 .capability = ARM64_WORKAROUND_CAVIUM_30115,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100422 ERRATA_MIDR_RANGE(MIDR_THUNDERX,
423 0, 0,
424 1, 2),
David Daney690a3412017-06-09 12:49:48 +0100425 },
426 {
427 /* Cavium ThunderX, T81 pass 1.0 - 1.2 */
428 .desc = "Cavium erratum 30115",
429 .capability = ARM64_WORKAROUND_CAVIUM_30115,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100430 ERRATA_MIDR_REV_RANGE(MIDR_THUNDERX_81XX, 0, 0, 2),
David Daney690a3412017-06-09 12:49:48 +0100431 },
432 {
433 /* Cavium ThunderX, T83 pass 1.0 */
434 .desc = "Cavium erratum 30115",
435 .capability = ARM64_WORKAROUND_CAVIUM_30115,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100436 ERRATA_MIDR_REV(MIDR_THUNDERX_83XX, 0, 0),
David Daney690a3412017-06-09 12:49:48 +0100437 },
438#endif
Andre Przywarae116a372014-11-14 15:54:09 +0000439 {
Suzuki K Poulose116c81f2016-09-09 14:07:16 +0100440 .desc = "Mismatched cache line size",
441 .capability = ARM64_MISMATCHED_CACHE_LINE_SIZE,
442 .matches = has_mismatched_cache_line_size,
Suzuki K Poulose5b4747c2018-03-26 15:12:32 +0100443 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
Dave Martinc0cda3b2018-03-26 15:12:28 +0100444 .cpu_enable = cpu_enable_trap_ctr_access,
Suzuki K Poulose116c81f2016-09-09 14:07:16 +0100445 },
Christopher Covington38fd94b2017-02-08 15:08:37 -0500446#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
447 {
448 .desc = "Qualcomm Technologies Falkor erratum 1003",
449 .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100450 ERRATA_MIDR_REV(MIDR_QCOM_FALKOR_V1, 0, 0),
Christopher Covington38fd94b2017-02-08 15:08:37 -0500451 },
Stephen Boydbb487112017-12-13 14:19:37 -0800452 {
453 .desc = "Qualcomm Technologies Kryo erratum 1003",
454 .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003,
Suzuki K Poulose5b4747c2018-03-26 15:12:32 +0100455 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
Suzuki K Poulose1df31052018-03-26 15:12:44 +0100456 .midr_range.model = MIDR_QCOM_KRYO,
Stephen Boydbb487112017-12-13 14:19:37 -0800457 .matches = is_kryo_midr,
458 },
Christopher Covington38fd94b2017-02-08 15:08:37 -0500459#endif
Christopher Covingtond9ff80f2017-01-31 12:50:19 -0500460#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1009
461 {
462 .desc = "Qualcomm Technologies Falkor erratum 1009",
463 .capability = ARM64_WORKAROUND_REPEAT_TLBI,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100464 ERRATA_MIDR_REV(MIDR_QCOM_FALKOR_V1, 0, 0),
Christopher Covingtond9ff80f2017-01-31 12:50:19 -0500465 },
466#endif
Marc Zyngiereeb1efb2017-03-20 17:18:06 +0000467#ifdef CONFIG_ARM64_ERRATUM_858921
468 {
469 /* Cortex-A73 all versions */
470 .desc = "ARM erratum 858921",
471 .capability = ARM64_WORKAROUND_858921,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100472 ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
Marc Zyngiereeb1efb2017-03-20 17:18:06 +0000473 },
474#endif
Will Deaconaa6acde2018-01-03 12:46:21 +0000475#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
476 {
477 .capability = ARM64_HARDEN_BRANCH_PREDICTOR,
Suzuki K Pouloseba7d9232018-03-26 15:12:46 +0100478 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
Shanker Donthineni4bc352f2018-04-10 11:36:42 +0100479 .cpu_enable = enable_smccc_arch_workaround_1,
480 ERRATA_MIDR_RANGE_LIST(arm64_bp_harden_smccc_cpus),
Jayachandran Cf3d795d2018-01-19 04:22:47 -0800481 },
Will Deaconaa6acde2018-01-03 12:46:21 +0000482#endif
Marc Zyngier4b472ff2018-02-15 11:49:20 +0000483#ifdef CONFIG_HARDEN_EL2_VECTORS
484 {
Marc Zyngier8892b712018-04-10 11:36:43 +0100485 .desc = "EL2 vector hardening",
Marc Zyngier4b472ff2018-02-15 11:49:20 +0000486 .capability = ARM64_HARDEN_EL2_VECTORS,
Marc Zyngier8892b712018-04-10 11:36:43 +0100487 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
488 ERRATA_MIDR_RANGE_LIST(arm64_harden_el2_vectors),
Marc Zyngier4b472ff2018-02-15 11:49:20 +0000489 },
490#endif
Suzuki K Poulose116c81f2016-09-09 14:07:16 +0100491 {
Andre Przywarae116a372014-11-14 15:54:09 +0000492 }
493};