Commit ee02a159 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Catalin Marinas

arm64: Introduce cpu_die_early

Or in other words, make fail_incapable_cpu() reusable.

We use fail_incapable_cpu() to kill a secondary CPU early during the
bringup, which doesn't have the system advertised capabilities.
This patch makes the routine more generic, to kill a secondary
booting CPU, getting rid of the dependency on capability struct.
This can be used by checks which are not necessarily attached to
a capability struct (e.g, cpu ASIDBits).

In that process, renames the function to cpu_die_early() to better
match its functionality. This will be moved to arch/arm64/kernel/smp.c
later.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent c4bc34d2
...@@ -875,15 +875,15 @@ static u64 __raw_read_system_reg(u32 sys_id) ...@@ -875,15 +875,15 @@ static u64 __raw_read_system_reg(u32 sys_id)
} }
/* /*
* Park the CPU which doesn't have the capability as advertised * Kill the calling secondary CPU, early in bringup before it is turned
* by the system. * online.
*/ */
static void fail_incapable_cpu(char *cap_type, void cpu_die_early(void)
const struct arm64_cpu_capabilities *cap)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
pr_crit("CPU%d: missing %s : %s\n", cpu, cap_type, cap->desc); pr_crit("CPU%d: will not boot\n", cpu);
/* Mark this CPU absent */ /* Mark this CPU absent */
set_cpu_present(cpu, 0); set_cpu_present(cpu, 0);
...@@ -921,8 +921,11 @@ void verify_local_cpu_capabilities(void) ...@@ -921,8 +921,11 @@ void verify_local_cpu_capabilities(void)
* If the new CPU misses an advertised feature, we cannot proceed * If the new CPU misses an advertised feature, we cannot proceed
* further, park the cpu. * further, park the cpu.
*/ */
if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) {
fail_incapable_cpu("arm64_features", &caps[i]); pr_crit("CPU%d: missing feature: %s\n",
smp_processor_id(), caps[i].desc);
cpu_die_early();
}
if (caps[i].enable) if (caps[i].enable)
caps[i].enable(NULL); caps[i].enable(NULL);
} }
...@@ -930,8 +933,11 @@ void verify_local_cpu_capabilities(void) ...@@ -930,8 +933,11 @@ void verify_local_cpu_capabilities(void)
for (i = 0, caps = arm64_hwcaps; caps[i].matches; i++) { for (i = 0, caps = arm64_hwcaps; caps[i].matches; i++) {
if (!cpus_have_hwcap(&caps[i])) if (!cpus_have_hwcap(&caps[i]))
continue; continue;
if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) {
fail_incapable_cpu("arm64_hwcaps", &caps[i]); pr_crit("CPU%d: missing HWCAP: %s\n",
smp_processor_id(), caps[i].desc);
cpu_die_early();
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment