Andre Przywara | e116a37 | 2014-11-14 15:54:09 +0000 | [diff] [blame] | 1 | /* |
| 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 Przywara | e116a37 | 2014-11-14 15:54:09 +0000 | [diff] [blame] | 19 | #include <linux/types.h> |
| 20 | #include <asm/cpu.h> |
| 21 | #include <asm/cputype.h> |
| 22 | #include <asm/cpufeature.h> |
| 23 | |
Andre Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 24 | static bool __maybe_unused |
Suzuki K Poulose | 92406f0 | 2016-04-22 12:25:31 +0100 | [diff] [blame] | 25 | is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) |
Andre Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 26 | { |
Ard Biesheuvel | e8002e0 | 2018-03-06 17:15:34 +0000 | [diff] [blame] | 27 | const struct arm64_midr_revidr *fix; |
| 28 | u32 midr = read_cpuid_id(), revidr; |
| 29 | |
Suzuki K Poulose | 92406f0 | 2016-04-22 12:25:31 +0100 | [diff] [blame] | 30 | WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); |
Suzuki K Poulose | 1df3105 | 2018-03-26 15:12:44 +0100 | [diff] [blame] | 31 | if (!is_midr_in_range(midr, &entry->midr_range)) |
Ard Biesheuvel | e8002e0 | 2018-03-06 17:15:34 +0000 | [diff] [blame] | 32 | 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 Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Stephen Boyd | bb48711 | 2017-12-13 14:19:37 -0800 | [diff] [blame] | 43 | static bool __maybe_unused |
Suzuki K Poulose | be5b299 | 2018-03-26 15:12:45 +0100 | [diff] [blame] | 44 | is_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 Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 49 | } |
| 50 | |
Stephen Boyd | bb48711 | 2017-12-13 14:19:37 -0800 | [diff] [blame] | 51 | static bool __maybe_unused |
| 52 | is_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 Poulose | 1df3105 | 2018-03-26 15:12:44 +0100 | [diff] [blame] | 62 | return model == entry->midr_range.model; |
Stephen Boyd | bb48711 | 2017-12-13 14:19:37 -0800 | [diff] [blame] | 63 | } |
| 64 | |
Suzuki K Poulose | 116c81f | 2016-09-09 14:07:16 +0100 | [diff] [blame] | 65 | static bool |
| 66 | has_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 Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 74 | static void |
| 75 | cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused) |
Suzuki K Poulose | 116c81f | 2016-09-09 14:07:16 +0100 | [diff] [blame] | 76 | { |
| 77 | /* Clear SCTLR_EL1.UCT */ |
| 78 | config_sctlr_el1(SCTLR_EL1_UCT, 0); |
| 79 | } |
| 80 | |
Marc Zyngier | 4205a89 | 2018-03-13 12:40:39 +0000 | [diff] [blame] | 81 | atomic_t arm64_el2_vector_last_slot = ATOMIC_INIT(-1); |
| 82 | |
Will Deacon | 0f15adb | 2018-01-03 11:17:58 +0000 | [diff] [blame] | 83 | #ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
| 84 | #include <asm/mmu_context.h> |
| 85 | #include <asm/cacheflush.h> |
| 86 | |
| 87 | DEFINE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data); |
| 88 | |
Marc Zyngier | e8b22d0f | 2018-04-10 11:36:45 +0100 | [diff] [blame] | 89 | #ifdef CONFIG_KVM_INDIRECT_VECTORS |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 90 | extern char __smccc_workaround_1_smc_start[]; |
| 91 | extern char __smccc_workaround_1_smc_end[]; |
Will Deacon | aa6acde | 2018-01-03 12:46:21 +0000 | [diff] [blame] | 92 | |
Will Deacon | 0f15adb | 2018-01-03 11:17:58 +0000 | [diff] [blame] | 93 | static 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 | |
| 105 | static void __install_bp_hardening_cb(bp_hardening_cb_t fn, |
| 106 | const char *hyp_vecs_start, |
| 107 | const char *hyp_vecs_end) |
| 108 | { |
Will Deacon | 0f15adb | 2018-01-03 11:17:58 +0000 | [diff] [blame] | 109 | 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 Zyngier | 4205a89 | 2018-03-13 12:40:39 +0000 | [diff] [blame] | 121 | slot = atomic_inc_return(&arm64_el2_vector_last_slot); |
| 122 | BUG_ON(slot >= BP_HARDEN_EL2_SLOTS); |
Will Deacon | 0f15adb | 2018-01-03 11:17:58 +0000 | [diff] [blame] | 123 | __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 Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 131 | #define __smccc_workaround_1_smc_start NULL |
| 132 | #define __smccc_workaround_1_smc_end NULL |
Will Deacon | aa6acde | 2018-01-03 12:46:21 +0000 | [diff] [blame] | 133 | |
Will Deacon | 0f15adb | 2018-01-03 11:17:58 +0000 | [diff] [blame] | 134 | static 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 Zyngier | e8b22d0f | 2018-04-10 11:36:45 +0100 | [diff] [blame] | 140 | #endif /* CONFIG_KVM_INDIRECT_VECTORS */ |
Will Deacon | 0f15adb | 2018-01-03 11:17:58 +0000 | [diff] [blame] | 141 | |
| 142 | static 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 Deacon | aa6acde | 2018-01-03 12:46:21 +0000 | [diff] [blame] | 158 | |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 159 | #include <uapi/linux/psci.h> |
| 160 | #include <linux/arm-smccc.h> |
Will Deacon | aa6acde | 2018-01-03 12:46:21 +0000 | [diff] [blame] | 161 | #include <linux/psci.h> |
| 162 | |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 163 | static void call_smc_arch_workaround_1(void) |
| 164 | { |
| 165 | arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL); |
| 166 | } |
| 167 | |
| 168 | static void call_hvc_arch_workaround_1(void) |
| 169 | { |
| 170 | arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL); |
| 171 | } |
| 172 | |
Shanker Donthineni | 4bc352f | 2018-04-10 11:36:42 +0100 | [diff] [blame] | 173 | static 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 Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 185 | static void |
| 186 | enable_smccc_arch_workaround_1(const struct arm64_cpu_capabilities *entry) |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 187 | { |
| 188 | bp_hardening_cb_t cb; |
| 189 | void *smccc_start, *smccc_end; |
| 190 | struct arm_smccc_res res; |
Shanker Donthineni | 4bc352f | 2018-04-10 11:36:42 +0100 | [diff] [blame] | 191 | u32 midr = read_cpuid_id(); |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 192 | |
| 193 | if (!entry->matches(entry, SCOPE_LOCAL_CPU)) |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 194 | return; |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 195 | |
| 196 | if (psci_ops.smccc_version == SMCCC_VERSION_1_0) |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 197 | return; |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 198 | |
| 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 Zyngier | e21da1c | 2018-03-09 15:40:50 +0000 | [diff] [blame] | 203 | if ((int)res.a0 < 0) |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 204 | return; |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 205 | cb = call_hvc_arch_workaround_1; |
Marc Zyngier | 22765f3 | 2018-04-10 11:36:44 +0100 | [diff] [blame] | 206 | /* This is a guest, no need to patch KVM vectors */ |
| 207 | smccc_start = NULL; |
| 208 | smccc_end = NULL; |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 209 | 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 Zyngier | e21da1c | 2018-03-09 15:40:50 +0000 | [diff] [blame] | 214 | if ((int)res.a0 < 0) |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 215 | return; |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 216 | 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 Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 222 | return; |
Marc Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 223 | } |
| 224 | |
Shanker Donthineni | 4bc352f | 2018-04-10 11:36:42 +0100 | [diff] [blame] | 225 | 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 Zyngier | b092201 | 2018-02-06 17:56:20 +0000 | [diff] [blame] | 229 | install_bp_hardening_cb(entry, cb, smccc_start, smccc_end); |
| 230 | |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 231 | return; |
Will Deacon | aa6acde | 2018-01-03 12:46:21 +0000 | [diff] [blame] | 232 | } |
Will Deacon | 0f15adb | 2018-01-03 11:17:58 +0000 | [diff] [blame] | 233 | #endif /* CONFIG_HARDEN_BRANCH_PREDICTOR */ |
| 234 | |
Marc Zyngier | 8e29062 | 2018-05-29 13:11:06 +0100 | [diff] [blame] | 235 | #ifdef CONFIG_ARM64_SSBD |
Marc Zyngier | 5cf9ce6 | 2018-05-29 13:11:07 +0100 | [diff] [blame] | 236 | DEFINE_PER_CPU_READ_MOSTLY(u64, arm64_ssbd_callback_required); |
| 237 | |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 238 | int ssbd_state __read_mostly = ARM64_SSBD_KERNEL; |
| 239 | |
| 240 | static const struct ssbd_options { |
| 241 | const char *str; |
| 242 | int state; |
| 243 | } ssbd_options[] = { |
| 244 | { "force-on", ARM64_SSBD_FORCE_ENABLE, }, |
| 245 | { "force-off", ARM64_SSBD_FORCE_DISABLE, }, |
| 246 | { "kernel", ARM64_SSBD_KERNEL, }, |
| 247 | }; |
| 248 | |
| 249 | static int __init ssbd_cfg(char *buf) |
| 250 | { |
| 251 | int i; |
| 252 | |
| 253 | if (!buf || !buf[0]) |
| 254 | return -EINVAL; |
| 255 | |
| 256 | for (i = 0; i < ARRAY_SIZE(ssbd_options); i++) { |
| 257 | int len = strlen(ssbd_options[i].str); |
| 258 | |
| 259 | if (strncmp(buf, ssbd_options[i].str, len)) |
| 260 | continue; |
| 261 | |
| 262 | ssbd_state = ssbd_options[i].state; |
| 263 | return 0; |
| 264 | } |
| 265 | |
| 266 | return -EINVAL; |
| 267 | } |
| 268 | early_param("ssbd", ssbd_cfg); |
| 269 | |
Marc Zyngier | 8e29062 | 2018-05-29 13:11:06 +0100 | [diff] [blame] | 270 | void __init arm64_update_smccc_conduit(struct alt_instr *alt, |
| 271 | __le32 *origptr, __le32 *updptr, |
| 272 | int nr_inst) |
| 273 | { |
| 274 | u32 insn; |
| 275 | |
| 276 | BUG_ON(nr_inst != 1); |
| 277 | |
| 278 | switch (psci_ops.conduit) { |
| 279 | case PSCI_CONDUIT_HVC: |
| 280 | insn = aarch64_insn_get_hvc_value(); |
| 281 | break; |
| 282 | case PSCI_CONDUIT_SMC: |
| 283 | insn = aarch64_insn_get_smc_value(); |
| 284 | break; |
| 285 | default: |
| 286 | return; |
| 287 | } |
| 288 | |
| 289 | *updptr = cpu_to_le32(insn); |
| 290 | } |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 291 | |
Marc Zyngier | 986372c | 2018-05-29 13:11:11 +0100 | [diff] [blame^] | 292 | void __init arm64_enable_wa2_handling(struct alt_instr *alt, |
| 293 | __le32 *origptr, __le32 *updptr, |
| 294 | int nr_inst) |
| 295 | { |
| 296 | BUG_ON(nr_inst != 1); |
| 297 | /* |
| 298 | * Only allow mitigation on EL1 entry/exit and guest |
| 299 | * ARCH_WORKAROUND_2 handling if the SSBD state allows it to |
| 300 | * be flipped. |
| 301 | */ |
| 302 | if (arm64_get_ssbd_state() == ARM64_SSBD_KERNEL) |
| 303 | *updptr = cpu_to_le32(aarch64_insn_gen_nop()); |
| 304 | } |
| 305 | |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 306 | static void arm64_set_ssbd_mitigation(bool state) |
| 307 | { |
| 308 | switch (psci_ops.conduit) { |
| 309 | case PSCI_CONDUIT_HVC: |
| 310 | arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_WORKAROUND_2, state, NULL); |
| 311 | break; |
| 312 | |
| 313 | case PSCI_CONDUIT_SMC: |
| 314 | arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_2, state, NULL); |
| 315 | break; |
| 316 | |
| 317 | default: |
| 318 | WARN_ON_ONCE(1); |
| 319 | break; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | static bool has_ssbd_mitigation(const struct arm64_cpu_capabilities *entry, |
| 324 | int scope) |
| 325 | { |
| 326 | struct arm_smccc_res res; |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 327 | bool required = true; |
| 328 | s32 val; |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 329 | |
| 330 | WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); |
| 331 | |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 332 | if (psci_ops.smccc_version == SMCCC_VERSION_1_0) { |
| 333 | ssbd_state = ARM64_SSBD_UNKNOWN; |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 334 | return false; |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 335 | } |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 336 | |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 337 | switch (psci_ops.conduit) { |
| 338 | case PSCI_CONDUIT_HVC: |
| 339 | arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, |
| 340 | ARM_SMCCC_ARCH_WORKAROUND_2, &res); |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 341 | break; |
| 342 | |
| 343 | case PSCI_CONDUIT_SMC: |
| 344 | arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, |
| 345 | ARM_SMCCC_ARCH_WORKAROUND_2, &res); |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 346 | break; |
| 347 | |
| 348 | default: |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 349 | ssbd_state = ARM64_SSBD_UNKNOWN; |
| 350 | return false; |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 351 | } |
| 352 | |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 353 | val = (s32)res.a0; |
| 354 | |
| 355 | switch (val) { |
| 356 | case SMCCC_RET_NOT_SUPPORTED: |
| 357 | ssbd_state = ARM64_SSBD_UNKNOWN; |
| 358 | return false; |
| 359 | |
| 360 | case SMCCC_RET_NOT_REQUIRED: |
| 361 | pr_info_once("%s mitigation not required\n", entry->desc); |
| 362 | ssbd_state = ARM64_SSBD_MITIGATED; |
| 363 | return false; |
| 364 | |
| 365 | case SMCCC_RET_SUCCESS: |
| 366 | required = true; |
| 367 | break; |
| 368 | |
| 369 | case 1: /* Mitigation not required on this CPU */ |
| 370 | required = false; |
| 371 | break; |
| 372 | |
| 373 | default: |
| 374 | WARN_ON(1); |
| 375 | return false; |
| 376 | } |
| 377 | |
| 378 | switch (ssbd_state) { |
| 379 | case ARM64_SSBD_FORCE_DISABLE: |
| 380 | pr_info_once("%s disabled from command-line\n", entry->desc); |
| 381 | arm64_set_ssbd_mitigation(false); |
| 382 | required = false; |
| 383 | break; |
| 384 | |
| 385 | case ARM64_SSBD_KERNEL: |
| 386 | if (required) { |
| 387 | __this_cpu_write(arm64_ssbd_callback_required, 1); |
| 388 | arm64_set_ssbd_mitigation(true); |
| 389 | } |
| 390 | break; |
| 391 | |
| 392 | case ARM64_SSBD_FORCE_ENABLE: |
| 393 | pr_info_once("%s forced from command-line\n", entry->desc); |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 394 | arm64_set_ssbd_mitigation(true); |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 395 | required = true; |
| 396 | break; |
| 397 | |
| 398 | default: |
| 399 | WARN_ON(1); |
| 400 | break; |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 401 | } |
| 402 | |
Marc Zyngier | a43ae4d | 2018-05-29 13:11:09 +0100 | [diff] [blame] | 403 | return required; |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 404 | } |
Marc Zyngier | 8e29062 | 2018-05-29 13:11:06 +0100 | [diff] [blame] | 405 | #endif /* CONFIG_ARM64_SSBD */ |
| 406 | |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 407 | #define CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max) \ |
| 408 | .matches = is_affected_midr_range, \ |
Suzuki K Poulose | 1df3105 | 2018-03-26 15:12:44 +0100 | [diff] [blame] | 409 | .midr_range = MIDR_RANGE(model, v_min, r_min, v_max, r_max) |
Andre Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 410 | |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 411 | #define CAP_MIDR_ALL_VERSIONS(model) \ |
| 412 | .matches = is_affected_midr_range, \ |
Suzuki K Poulose | 1df3105 | 2018-03-26 15:12:44 +0100 | [diff] [blame] | 413 | .midr_range = MIDR_ALL_VERSIONS(model) |
Marc Zyngier | 06f1494 | 2017-02-01 14:38:46 +0000 | [diff] [blame] | 414 | |
Ard Biesheuvel | e8002e0 | 2018-03-06 17:15:34 +0000 | [diff] [blame] | 415 | #define MIDR_FIXED(rev, revidr_mask) \ |
| 416 | .fixed_revs = (struct arm64_midr_revidr[]){{ (rev), (revidr_mask) }, {}} |
| 417 | |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 418 | #define ERRATA_MIDR_RANGE(model, v_min, r_min, v_max, r_max) \ |
| 419 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \ |
| 420 | CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max) |
| 421 | |
Suzuki K Poulose | be5b299 | 2018-03-26 15:12:45 +0100 | [diff] [blame] | 422 | #define CAP_MIDR_RANGE_LIST(list) \ |
| 423 | .matches = is_affected_midr_range_list, \ |
| 424 | .midr_range_list = list |
| 425 | |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 426 | /* Errata affecting a range of revisions of given model variant */ |
| 427 | #define ERRATA_MIDR_REV_RANGE(m, var, r_min, r_max) \ |
| 428 | ERRATA_MIDR_RANGE(m, var, r_min, var, r_max) |
| 429 | |
| 430 | /* Errata affecting a single variant/revision of a model */ |
| 431 | #define ERRATA_MIDR_REV(model, var, rev) \ |
| 432 | ERRATA_MIDR_RANGE(model, var, rev, var, rev) |
| 433 | |
| 434 | /* Errata affecting all variants/revisions of a given a model */ |
| 435 | #define ERRATA_MIDR_ALL_VERSIONS(model) \ |
| 436 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \ |
| 437 | CAP_MIDR_ALL_VERSIONS(model) |
| 438 | |
Suzuki K Poulose | be5b299 | 2018-03-26 15:12:45 +0100 | [diff] [blame] | 439 | /* Errata affecting a list of midr ranges, with same work around */ |
| 440 | #define ERRATA_MIDR_RANGE_LIST(midr_list) \ |
| 441 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \ |
| 442 | CAP_MIDR_RANGE_LIST(midr_list) |
| 443 | |
Suzuki K Poulose | ba7d923 | 2018-03-26 15:12:46 +0100 | [diff] [blame] | 444 | /* |
| 445 | * Generic helper for handling capabilties with multiple (match,enable) pairs |
| 446 | * of call backs, sharing the same capability bit. |
| 447 | * Iterate over each entry to see if at least one matches. |
| 448 | */ |
Will Deacon | 12eb369 | 2018-03-27 11:51:12 +0100 | [diff] [blame] | 449 | static bool __maybe_unused |
| 450 | multi_entry_cap_matches(const struct arm64_cpu_capabilities *entry, int scope) |
Suzuki K Poulose | ba7d923 | 2018-03-26 15:12:46 +0100 | [diff] [blame] | 451 | { |
| 452 | const struct arm64_cpu_capabilities *caps; |
| 453 | |
| 454 | for (caps = entry->match_list; caps->matches; caps++) |
| 455 | if (caps->matches(caps, scope)) |
| 456 | return true; |
| 457 | |
| 458 | return false; |
| 459 | } |
| 460 | |
| 461 | /* |
| 462 | * Take appropriate action for all matching entries in the shared capability |
| 463 | * entry. |
| 464 | */ |
Will Deacon | 12eb369 | 2018-03-27 11:51:12 +0100 | [diff] [blame] | 465 | static void __maybe_unused |
Suzuki K Poulose | ba7d923 | 2018-03-26 15:12:46 +0100 | [diff] [blame] | 466 | multi_entry_cap_cpu_enable(const struct arm64_cpu_capabilities *entry) |
| 467 | { |
| 468 | const struct arm64_cpu_capabilities *caps; |
| 469 | |
| 470 | for (caps = entry->match_list; caps->matches; caps++) |
| 471 | if (caps->matches(caps, SCOPE_LOCAL_CPU) && |
| 472 | caps->cpu_enable) |
| 473 | caps->cpu_enable(caps); |
| 474 | } |
| 475 | |
Suzuki K Poulose | be5b299 | 2018-03-26 15:12:45 +0100 | [diff] [blame] | 476 | #ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
| 477 | |
| 478 | /* |
| 479 | * List of CPUs where we need to issue a psci call to |
| 480 | * harden the branch predictor. |
| 481 | */ |
| 482 | static const struct midr_range arm64_bp_harden_smccc_cpus[] = { |
| 483 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), |
| 484 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), |
| 485 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), |
| 486 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A75), |
| 487 | MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN), |
| 488 | MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), |
Suzuki K Poulose | be5b299 | 2018-03-26 15:12:45 +0100 | [diff] [blame] | 489 | MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR_V1), |
| 490 | MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR), |
| 491 | {}, |
| 492 | }; |
| 493 | |
| 494 | #endif |
Andre Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 495 | |
Marc Zyngier | 8892b71 | 2018-04-10 11:36:43 +0100 | [diff] [blame] | 496 | #ifdef CONFIG_HARDEN_EL2_VECTORS |
| 497 | |
| 498 | static const struct midr_range arm64_harden_el2_vectors[] = { |
| 499 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), |
| 500 | MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), |
| 501 | {}, |
| 502 | }; |
| 503 | |
Marc Zyngier | dc6ed61 | 2018-03-28 12:46:07 +0100 | [diff] [blame] | 504 | #endif |
| 505 | |
Andre Przywara | e116a37 | 2014-11-14 15:54:09 +0000 | [diff] [blame] | 506 | const struct arm64_cpu_capabilities arm64_errata[] = { |
| 507 | #if defined(CONFIG_ARM64_ERRATUM_826319) || \ |
| 508 | defined(CONFIG_ARM64_ERRATUM_827319) || \ |
| 509 | defined(CONFIG_ARM64_ERRATUM_824069) |
Andre Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 510 | { |
| 511 | /* Cortex-A53 r0p[012] */ |
| 512 | .desc = "ARM errata 826319, 827319, 824069", |
| 513 | .capability = ARM64_WORKAROUND_CLEAN_CACHE, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 514 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 2), |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 515 | .cpu_enable = cpu_enable_cache_maint_trap, |
Andre Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 516 | }, |
Andre Przywara | c0a01b8 | 2014-11-14 15:54:12 +0000 | [diff] [blame] | 517 | #endif |
| 518 | #ifdef CONFIG_ARM64_ERRATUM_819472 |
| 519 | { |
| 520 | /* Cortex-A53 r0p[01] */ |
| 521 | .desc = "ARM errata 819472", |
| 522 | .capability = ARM64_WORKAROUND_CLEAN_CACHE, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 523 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 1), |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 524 | .cpu_enable = cpu_enable_cache_maint_trap, |
Andre Przywara | c0a01b8 | 2014-11-14 15:54:12 +0000 | [diff] [blame] | 525 | }, |
| 526 | #endif |
| 527 | #ifdef CONFIG_ARM64_ERRATUM_832075 |
Andre Przywara | 301bcfa | 2014-11-14 15:54:10 +0000 | [diff] [blame] | 528 | { |
Andre Przywara | 5afaa1f | 2014-11-14 15:54:11 +0000 | [diff] [blame] | 529 | /* Cortex-A57 r0p0 - r1p2 */ |
| 530 | .desc = "ARM erratum 832075", |
| 531 | .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 532 | ERRATA_MIDR_RANGE(MIDR_CORTEX_A57, |
| 533 | 0, 0, |
| 534 | 1, 2), |
Andre Przywara | 5afaa1f | 2014-11-14 15:54:11 +0000 | [diff] [blame] | 535 | }, |
Andre Przywara | c0a01b8 | 2014-11-14 15:54:12 +0000 | [diff] [blame] | 536 | #endif |
Marc Zyngier | 498cd5c | 2015-11-16 10:28:18 +0000 | [diff] [blame] | 537 | #ifdef CONFIG_ARM64_ERRATUM_834220 |
| 538 | { |
| 539 | /* Cortex-A57 r0p0 - r1p2 */ |
| 540 | .desc = "ARM erratum 834220", |
| 541 | .capability = ARM64_WORKAROUND_834220, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 542 | ERRATA_MIDR_RANGE(MIDR_CORTEX_A57, |
| 543 | 0, 0, |
| 544 | 1, 2), |
Marc Zyngier | 498cd5c | 2015-11-16 10:28:18 +0000 | [diff] [blame] | 545 | }, |
| 546 | #endif |
Ard Biesheuvel | ca79acc | 2018-03-06 17:15:35 +0000 | [diff] [blame] | 547 | #ifdef CONFIG_ARM64_ERRATUM_843419 |
| 548 | { |
| 549 | /* Cortex-A53 r0p[01234] */ |
| 550 | .desc = "ARM erratum 843419", |
| 551 | .capability = ARM64_WORKAROUND_843419, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 552 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4), |
Ard Biesheuvel | ca79acc | 2018-03-06 17:15:35 +0000 | [diff] [blame] | 553 | MIDR_FIXED(0x4, BIT(8)), |
Will Deacon | 905e8c5 | 2015-03-23 19:07:02 +0000 | [diff] [blame] | 554 | }, |
Robert Richter | 6d4e11c | 2015-09-21 22:58:35 +0200 | [diff] [blame] | 555 | #endif |
| 556 | #ifdef CONFIG_ARM64_ERRATUM_845719 |
| 557 | { |
| 558 | /* Cortex-A53 r0p[01234] */ |
| 559 | .desc = "ARM erratum 845719", |
| 560 | .capability = ARM64_WORKAROUND_845719, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 561 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4), |
Marc Zyngier | 359b706 | 2015-03-27 13:09:23 +0000 | [diff] [blame] | 562 | }, |
Andre Przywara | e116a37 | 2014-11-14 15:54:09 +0000 | [diff] [blame] | 563 | #endif |
Robert Richter | 6d4e11c | 2015-09-21 22:58:35 +0200 | [diff] [blame] | 564 | #ifdef CONFIG_CAVIUM_ERRATUM_23154 |
| 565 | { |
| 566 | /* Cavium ThunderX, pass 1.x */ |
| 567 | .desc = "Cavium erratum 23154", |
| 568 | .capability = ARM64_WORKAROUND_CAVIUM_23154, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 569 | ERRATA_MIDR_REV_RANGE(MIDR_THUNDERX, 0, 0, 1), |
Robert Richter | 6d4e11c | 2015-09-21 22:58:35 +0200 | [diff] [blame] | 570 | }, |
| 571 | #endif |
Andrew Pinski | 104a0c0 | 2016-02-24 17:44:57 -0800 | [diff] [blame] | 572 | #ifdef CONFIG_CAVIUM_ERRATUM_27456 |
| 573 | { |
| 574 | /* Cavium ThunderX, T88 pass 1.x - 2.1 */ |
| 575 | .desc = "Cavium erratum 27456", |
| 576 | .capability = ARM64_WORKAROUND_CAVIUM_27456, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 577 | ERRATA_MIDR_RANGE(MIDR_THUNDERX, |
| 578 | 0, 0, |
| 579 | 1, 1), |
Andrew Pinski | 104a0c0 | 2016-02-24 17:44:57 -0800 | [diff] [blame] | 580 | }, |
Ganapatrao Kulkarni | 47c459b | 2016-07-07 10:18:17 +0530 | [diff] [blame] | 581 | { |
| 582 | /* Cavium ThunderX, T81 pass 1.0 */ |
| 583 | .desc = "Cavium erratum 27456", |
| 584 | .capability = ARM64_WORKAROUND_CAVIUM_27456, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 585 | ERRATA_MIDR_REV(MIDR_THUNDERX_81XX, 0, 0), |
Ganapatrao Kulkarni | 47c459b | 2016-07-07 10:18:17 +0530 | [diff] [blame] | 586 | }, |
Andrew Pinski | 104a0c0 | 2016-02-24 17:44:57 -0800 | [diff] [blame] | 587 | #endif |
David Daney | 690a341 | 2017-06-09 12:49:48 +0100 | [diff] [blame] | 588 | #ifdef CONFIG_CAVIUM_ERRATUM_30115 |
| 589 | { |
| 590 | /* Cavium ThunderX, T88 pass 1.x - 2.2 */ |
| 591 | .desc = "Cavium erratum 30115", |
| 592 | .capability = ARM64_WORKAROUND_CAVIUM_30115, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 593 | ERRATA_MIDR_RANGE(MIDR_THUNDERX, |
| 594 | 0, 0, |
| 595 | 1, 2), |
David Daney | 690a341 | 2017-06-09 12:49:48 +0100 | [diff] [blame] | 596 | }, |
| 597 | { |
| 598 | /* Cavium ThunderX, T81 pass 1.0 - 1.2 */ |
| 599 | .desc = "Cavium erratum 30115", |
| 600 | .capability = ARM64_WORKAROUND_CAVIUM_30115, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 601 | ERRATA_MIDR_REV_RANGE(MIDR_THUNDERX_81XX, 0, 0, 2), |
David Daney | 690a341 | 2017-06-09 12:49:48 +0100 | [diff] [blame] | 602 | }, |
| 603 | { |
| 604 | /* Cavium ThunderX, T83 pass 1.0 */ |
| 605 | .desc = "Cavium erratum 30115", |
| 606 | .capability = ARM64_WORKAROUND_CAVIUM_30115, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 607 | ERRATA_MIDR_REV(MIDR_THUNDERX_83XX, 0, 0), |
David Daney | 690a341 | 2017-06-09 12:49:48 +0100 | [diff] [blame] | 608 | }, |
| 609 | #endif |
Andre Przywara | e116a37 | 2014-11-14 15:54:09 +0000 | [diff] [blame] | 610 | { |
Suzuki K Poulose | 116c81f | 2016-09-09 14:07:16 +0100 | [diff] [blame] | 611 | .desc = "Mismatched cache line size", |
| 612 | .capability = ARM64_MISMATCHED_CACHE_LINE_SIZE, |
| 613 | .matches = has_mismatched_cache_line_size, |
Suzuki K Poulose | 5b4747c | 2018-03-26 15:12:32 +0100 | [diff] [blame] | 614 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
Dave Martin | c0cda3b | 2018-03-26 15:12:28 +0100 | [diff] [blame] | 615 | .cpu_enable = cpu_enable_trap_ctr_access, |
Suzuki K Poulose | 116c81f | 2016-09-09 14:07:16 +0100 | [diff] [blame] | 616 | }, |
Christopher Covington | 38fd94b | 2017-02-08 15:08:37 -0500 | [diff] [blame] | 617 | #ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003 |
| 618 | { |
| 619 | .desc = "Qualcomm Technologies Falkor erratum 1003", |
| 620 | .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 621 | ERRATA_MIDR_REV(MIDR_QCOM_FALKOR_V1, 0, 0), |
Christopher Covington | 38fd94b | 2017-02-08 15:08:37 -0500 | [diff] [blame] | 622 | }, |
Stephen Boyd | bb48711 | 2017-12-13 14:19:37 -0800 | [diff] [blame] | 623 | { |
| 624 | .desc = "Qualcomm Technologies Kryo erratum 1003", |
| 625 | .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003, |
Suzuki K Poulose | 5b4747c | 2018-03-26 15:12:32 +0100 | [diff] [blame] | 626 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
Suzuki K Poulose | 1df3105 | 2018-03-26 15:12:44 +0100 | [diff] [blame] | 627 | .midr_range.model = MIDR_QCOM_KRYO, |
Stephen Boyd | bb48711 | 2017-12-13 14:19:37 -0800 | [diff] [blame] | 628 | .matches = is_kryo_midr, |
| 629 | }, |
Christopher Covington | 38fd94b | 2017-02-08 15:08:37 -0500 | [diff] [blame] | 630 | #endif |
Christopher Covington | d9ff80f | 2017-01-31 12:50:19 -0500 | [diff] [blame] | 631 | #ifdef CONFIG_QCOM_FALKOR_ERRATUM_1009 |
| 632 | { |
| 633 | .desc = "Qualcomm Technologies Falkor erratum 1009", |
| 634 | .capability = ARM64_WORKAROUND_REPEAT_TLBI, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 635 | ERRATA_MIDR_REV(MIDR_QCOM_FALKOR_V1, 0, 0), |
Christopher Covington | d9ff80f | 2017-01-31 12:50:19 -0500 | [diff] [blame] | 636 | }, |
| 637 | #endif |
Marc Zyngier | eeb1efb | 2017-03-20 17:18:06 +0000 | [diff] [blame] | 638 | #ifdef CONFIG_ARM64_ERRATUM_858921 |
| 639 | { |
| 640 | /* Cortex-A73 all versions */ |
| 641 | .desc = "ARM erratum 858921", |
| 642 | .capability = ARM64_WORKAROUND_858921, |
Suzuki K Poulose | 5e7951c | 2018-03-26 15:12:43 +0100 | [diff] [blame] | 643 | ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), |
Marc Zyngier | eeb1efb | 2017-03-20 17:18:06 +0000 | [diff] [blame] | 644 | }, |
| 645 | #endif |
Will Deacon | aa6acde | 2018-01-03 12:46:21 +0000 | [diff] [blame] | 646 | #ifdef CONFIG_HARDEN_BRANCH_PREDICTOR |
| 647 | { |
| 648 | .capability = ARM64_HARDEN_BRANCH_PREDICTOR, |
Suzuki K Poulose | ba7d923 | 2018-03-26 15:12:46 +0100 | [diff] [blame] | 649 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
Shanker Donthineni | 4bc352f | 2018-04-10 11:36:42 +0100 | [diff] [blame] | 650 | .cpu_enable = enable_smccc_arch_workaround_1, |
| 651 | ERRATA_MIDR_RANGE_LIST(arm64_bp_harden_smccc_cpus), |
Jayachandran C | f3d795d | 2018-01-19 04:22:47 -0800 | [diff] [blame] | 652 | }, |
Will Deacon | aa6acde | 2018-01-03 12:46:21 +0000 | [diff] [blame] | 653 | #endif |
Marc Zyngier | 4b472ff | 2018-02-15 11:49:20 +0000 | [diff] [blame] | 654 | #ifdef CONFIG_HARDEN_EL2_VECTORS |
| 655 | { |
Marc Zyngier | 8892b71 | 2018-04-10 11:36:43 +0100 | [diff] [blame] | 656 | .desc = "EL2 vector hardening", |
Marc Zyngier | 4b472ff | 2018-02-15 11:49:20 +0000 | [diff] [blame] | 657 | .capability = ARM64_HARDEN_EL2_VECTORS, |
Marc Zyngier | 8892b71 | 2018-04-10 11:36:43 +0100 | [diff] [blame] | 658 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
| 659 | ERRATA_MIDR_RANGE_LIST(arm64_harden_el2_vectors), |
Marc Zyngier | 4b472ff | 2018-02-15 11:49:20 +0000 | [diff] [blame] | 660 | }, |
| 661 | #endif |
Marc Zyngier | a725e3d | 2018-05-29 13:11:08 +0100 | [diff] [blame] | 662 | #ifdef CONFIG_ARM64_SSBD |
| 663 | { |
| 664 | .desc = "Speculative Store Bypass Disable", |
| 665 | .capability = ARM64_SSBD, |
| 666 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
| 667 | .matches = has_ssbd_mitigation, |
| 668 | }, |
| 669 | #endif |
Suzuki K Poulose | 116c81f | 2016-09-09 14:07:16 +0100 | [diff] [blame] | 670 | { |
Andre Przywara | e116a37 | 2014-11-14 15:54:09 +0000 | [diff] [blame] | 671 | } |
| 672 | }; |