Skip to content

Commit 6a6efbb

Browse files
Suzuki K Poulosewildea01
authored andcommitted
arm64: Verify CPU errata work arounds on hotplugged CPU
CPU Errata work arounds are detected and applied to the kernel code at boot time and the data is then freed up. If a new hotplugged CPU requires a work around which was not applied at boot time, there is nothing we can do but simply fail the booting. Cc: Will Deacon <will.deacon@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 25fc11a commit 6a6efbb

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

arch/arm64/include/asm/cpufeature.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
193193
const char *info);
194194
void check_local_cpu_errata(void);
195195

196+
void verify_local_cpu_errata(void);
196197
void verify_local_cpu_capabilities(void);
197198

198199
u64 read_system_reg(u32 id);

arch/arm64/kernel/cpu_errata.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
103103
}
104104
};
105105

106+
/*
107+
* The CPU Errata work arounds are detected and applied at boot time
108+
* and the related information is freed soon after. If the new CPU requires
109+
* an errata not detected at boot, fail this CPU.
110+
*/
111+
void verify_local_cpu_errata(void)
112+
{
113+
const struct arm64_cpu_capabilities *caps = arm64_errata;
114+
115+
for (; caps->matches; caps++)
116+
if (!cpus_have_cap(caps->capability) &&
117+
caps->matches(caps, SCOPE_LOCAL_CPU)) {
118+
pr_crit("CPU%d: Requires work around for %s, not detected"
119+
" at boot time\n",
120+
smp_processor_id(),
121+
caps->desc ? : "an erratum");
122+
cpu_die_early();
123+
}
124+
}
125+
106126
void check_local_cpu_errata(void)
107127
{
108128
update_cpu_capabilities(arm64_errata, "enabling workaround for");

arch/arm64/kernel/cpufeature.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ void verify_local_cpu_capabilities(void)
998998
if (!sys_caps_initialised)
999999
return;
10001000

1001+
verify_local_cpu_errata();
10011002
verify_local_cpu_features(arm64_features);
10021003
verify_local_elf_hwcaps(arm64_elf_hwcaps);
10031004
if (system_supports_32bit_el0())

0 commit comments

Comments
 (0)