Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Suzuki K Poulose and committed by
Will Deacon
6a6efbb4 25fc11ae

+22
+1
arch/arm64/include/asm/cpufeature.h
··· 193 193 const char *info); 194 194 void check_local_cpu_errata(void); 195 195 196 + void verify_local_cpu_errata(void); 196 197 void verify_local_cpu_capabilities(void); 197 198 198 199 u64 read_system_reg(u32 id);
+20
arch/arm64/kernel/cpu_errata.c
··· 103 103 } 104 104 }; 105 105 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 + 106 126 void check_local_cpu_errata(void) 107 127 { 108 128 update_cpu_capabilities(arm64_errata, "enabling workaround for");
+1
arch/arm64/kernel/cpufeature.c
··· 998 998 if (!sys_caps_initialised) 999 999 return; 1000 1000 1001 + verify_local_cpu_errata(); 1001 1002 verify_local_cpu_features(arm64_features); 1002 1003 verify_local_elf_hwcaps(arm64_elf_hwcaps); 1003 1004 if (system_supports_32bit_el0())