|
@@ -65,11 +65,11 @@ has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry,
|
|
|
(arm64_ftr_reg_ctrel0.sys_val & arm64_ftr_reg_ctrel0.strict_mask);
|
|
|
}
|
|
|
|
|
|
-static int cpu_enable_trap_ctr_access(void *__unused)
|
|
|
+static void
|
|
|
+cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused)
|
|
|
{
|
|
|
/* Clear SCTLR_EL1.UCT */
|
|
|
config_sctlr_el1(SCTLR_EL1_UCT, 0);
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
|
|
@@ -173,25 +173,25 @@ static void call_hvc_arch_workaround_1(void)
|
|
|
arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL);
|
|
|
}
|
|
|
|
|
|
-static int enable_smccc_arch_workaround_1(void *data)
|
|
|
+static void
|
|
|
+enable_smccc_arch_workaround_1(const struct arm64_cpu_capabilities *entry)
|
|
|
{
|
|
|
- const struct arm64_cpu_capabilities *entry = data;
|
|
|
bp_hardening_cb_t cb;
|
|
|
void *smccc_start, *smccc_end;
|
|
|
struct arm_smccc_res res;
|
|
|
|
|
|
if (!entry->matches(entry, SCOPE_LOCAL_CPU))
|
|
|
- return 0;
|
|
|
+ return;
|
|
|
|
|
|
if (psci_ops.smccc_version == SMCCC_VERSION_1_0)
|
|
|
- return 0;
|
|
|
+ return;
|
|
|
|
|
|
switch (psci_ops.conduit) {
|
|
|
case PSCI_CONDUIT_HVC:
|
|
|
arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
|
|
|
ARM_SMCCC_ARCH_WORKAROUND_1, &res);
|
|
|
if (res.a0)
|
|
|
- return 0;
|
|
|
+ return;
|
|
|
cb = call_hvc_arch_workaround_1;
|
|
|
smccc_start = __smccc_workaround_1_hvc_start;
|
|
|
smccc_end = __smccc_workaround_1_hvc_end;
|
|
@@ -201,19 +201,19 @@ static int enable_smccc_arch_workaround_1(void *data)
|
|
|
arm_smccc_1_1_smc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
|
|
|
ARM_SMCCC_ARCH_WORKAROUND_1, &res);
|
|
|
if (res.a0)
|
|
|
- return 0;
|
|
|
+ return;
|
|
|
cb = call_smc_arch_workaround_1;
|
|
|
smccc_start = __smccc_workaround_1_smc_start;
|
|
|
smccc_end = __smccc_workaround_1_smc_end;
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
- return 0;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
install_bp_hardening_cb(entry, cb, smccc_start, smccc_end);
|
|
|
|
|
|
- return 0;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
static void qcom_link_stack_sanitization(void)
|
|
@@ -228,15 +228,12 @@ static void qcom_link_stack_sanitization(void)
|
|
|
: "=&r" (tmp));
|
|
|
}
|
|
|
|
|
|
-static int qcom_enable_link_stack_sanitization(void *data)
|
|
|
+static void
|
|
|
+qcom_enable_link_stack_sanitization(const struct arm64_cpu_capabilities *entry)
|
|
|
{
|
|
|
- const struct arm64_cpu_capabilities *entry = data;
|
|
|
-
|
|
|
install_bp_hardening_cb(entry, qcom_link_stack_sanitization,
|
|
|
__qcom_hyp_sanitize_link_stack_start,
|
|
|
__qcom_hyp_sanitize_link_stack_end);
|
|
|
-
|
|
|
- return 0;
|
|
|
}
|
|
|
#endif /* CONFIG_HARDEN_BRANCH_PREDICTOR */
|
|
|
|
|
@@ -266,7 +263,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
|
|
|
.desc = "ARM errata 826319, 827319, 824069",
|
|
|
.capability = ARM64_WORKAROUND_CLEAN_CACHE,
|
|
|
MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x02),
|
|
|
- .enable = cpu_enable_cache_maint_trap,
|
|
|
+ .cpu_enable = cpu_enable_cache_maint_trap,
|
|
|
},
|
|
|
#endif
|
|
|
#ifdef CONFIG_ARM64_ERRATUM_819472
|
|
@@ -275,7 +272,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
|
|
|
.desc = "ARM errata 819472",
|
|
|
.capability = ARM64_WORKAROUND_CLEAN_CACHE,
|
|
|
MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x01),
|
|
|
- .enable = cpu_enable_cache_maint_trap,
|
|
|
+ .cpu_enable = cpu_enable_cache_maint_trap,
|
|
|
},
|
|
|
#endif
|
|
|
#ifdef CONFIG_ARM64_ERRATUM_832075
|
|
@@ -365,7 +362,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
|
|
|
.capability = ARM64_MISMATCHED_CACHE_LINE_SIZE,
|
|
|
.matches = has_mismatched_cache_line_size,
|
|
|
.def_scope = SCOPE_LOCAL_CPU,
|
|
|
- .enable = cpu_enable_trap_ctr_access,
|
|
|
+ .cpu_enable = cpu_enable_trap_ctr_access,
|
|
|
},
|
|
|
#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
|
|
|
{
|
|
@@ -404,27 +401,27 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
|
|
|
- .enable = enable_smccc_arch_workaround_1,
|
|
|
+ .cpu_enable = enable_smccc_arch_workaround_1,
|
|
|
},
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
|
|
|
- .enable = enable_smccc_arch_workaround_1,
|
|
|
+ .cpu_enable = enable_smccc_arch_workaround_1,
|
|
|
},
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
|
|
|
- .enable = enable_smccc_arch_workaround_1,
|
|
|
+ .cpu_enable = enable_smccc_arch_workaround_1,
|
|
|
},
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_CORTEX_A75),
|
|
|
- .enable = enable_smccc_arch_workaround_1,
|
|
|
+ .cpu_enable = enable_smccc_arch_workaround_1,
|
|
|
},
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR_V1),
|
|
|
- .enable = qcom_enable_link_stack_sanitization,
|
|
|
+ .cpu_enable = qcom_enable_link_stack_sanitization,
|
|
|
},
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BP_POST_GUEST_EXIT,
|
|
@@ -433,7 +430,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR),
|
|
|
- .enable = qcom_enable_link_stack_sanitization,
|
|
|
+ .cpu_enable = qcom_enable_link_stack_sanitization,
|
|
|
},
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BP_POST_GUEST_EXIT,
|
|
@@ -442,12 +439,12 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
|
|
|
- .enable = enable_smccc_arch_workaround_1,
|
|
|
+ .cpu_enable = enable_smccc_arch_workaround_1,
|
|
|
},
|
|
|
{
|
|
|
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
|
|
|
MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
|
|
|
- .enable = enable_smccc_arch_workaround_1,
|
|
|
+ .cpu_enable = enable_smccc_arch_workaround_1,
|
|
|
},
|
|
|
#endif
|
|
|
{
|
|
@@ -465,8 +462,8 @@ void verify_local_cpu_errata_workarounds(void)
|
|
|
|
|
|
for (; caps->matches; caps++) {
|
|
|
if (cpus_have_cap(caps->capability)) {
|
|
|
- if (caps->enable)
|
|
|
- caps->enable((void *)caps);
|
|
|
+ if (caps->cpu_enable)
|
|
|
+ caps->cpu_enable(caps);
|
|
|
} else if (caps->matches(caps, SCOPE_LOCAL_CPU)) {
|
|
|
pr_crit("CPU%d: Requires work around for %s, not detected"
|
|
|
" at boot time\n",
|