Skip to content

Commit 8083cfe

Browse files
Suzuki K PouloseAKASHI Takahiro
authored andcommitted
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: Will Deacon <will.deacon@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 45a8334 commit 8083cfe

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

arch/arm64/kernel/cpufeature.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -894,15 +894,15 @@ static u64 __raw_read_system_reg(u32 sys_id)
894894
}
895895

896896
/*
897-
* Park the CPU which doesn't have the capability as advertised
898-
* by the system.
897+
* Kill the calling secondary CPU, early in bringup before it is turned
898+
* online.
899899
*/
900-
static void fail_incapable_cpu(char *cap_type,
901-
const struct arm64_cpu_capabilities *cap)
900+
void cpu_die_early(void)
902901
{
903902
int cpu = smp_processor_id();
904903

905-
pr_crit("CPU%d: missing %s : %s\n", cpu, cap_type, cap->desc);
904+
pr_crit("CPU%d: will not boot\n", cpu);
905+
906906
/* Mark this CPU absent */
907907
set_cpu_present(cpu, 0);
908908

@@ -940,17 +940,23 @@ void verify_local_cpu_capabilities(void)
940940
* If the new CPU misses an advertised feature, we cannot proceed
941941
* further, park the cpu.
942942
*/
943-
if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i]))
944-
fail_incapable_cpu("arm64_features", &caps[i]);
943+
if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) {
944+
pr_crit("CPU%d: missing feature: %s\n",
945+
smp_processor_id(), caps[i].desc);
946+
cpu_die_early();
947+
}
945948
if (caps[i].enable)
946949
caps[i].enable(NULL);
947950
}
948951

949952
for (i = 0, caps = arm64_hwcaps; caps[i].matches; i++) {
950953
if (!cpus_have_hwcap(&caps[i]))
951954
continue;
952-
if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i]))
953-
fail_incapable_cpu("arm64_hwcaps", &caps[i]);
955+
if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) {
956+
pr_crit("CPU%d: missing HWCAP: %s\n",
957+
smp_processor_id(), caps[i].desc);
958+
cpu_die_early();
959+
}
954960
}
955961
}
956962

0 commit comments

Comments
 (0)