arm64: Verify CPU errata work arounds on hotplugged CPU
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Fri, 22 Apr 2016 11:25:34 +0000 (12:25 +0100)
committerWill Deacon <will.deacon@arm.com>
Mon, 25 Apr 2016 14:14:03 +0000 (15:14 +0100)
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>
arch/arm64/include/asm/cpufeature.h
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/cpufeature.c

index d39db638774673a2b2efe1bff2365118f0594ea5..224efe730e4614b4ffd6ab105bacf3de6d6890db 100644 (file)
@@ -193,6 +193,7 @@ void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
                            const char *info);
 void check_local_cpu_errata(void);
 
+void verify_local_cpu_errata(void);
 void verify_local_cpu_capabilities(void);
 
 u64 read_system_reg(u32 id);
index 2fdecd72ce583ff1efd0b47db13d6ac834649547..d42789499f17eb322a47da83046ca0119e643c75 100644 (file)
@@ -103,6 +103,26 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
        }
 };
 
+/*
+ * The CPU Errata work arounds are detected and applied at boot time
+ * and the related information is freed soon after. If the new CPU requires
+ * an errata not detected at boot, fail this CPU.
+ */
+void verify_local_cpu_errata(void)
+{
+       const struct arm64_cpu_capabilities *caps = arm64_errata;
+
+       for (; caps->matches; caps++)
+               if (!cpus_have_cap(caps->capability) &&
+                       caps->matches(caps, SCOPE_LOCAL_CPU)) {
+                       pr_crit("CPU%d: Requires work around for %s, not detected"
+                                       " at boot time\n",
+                               smp_processor_id(),
+                               caps->desc ? : "an erratum");
+                       cpu_die_early();
+               }
+}
+
 void check_local_cpu_errata(void)
 {
        update_cpu_capabilities(arm64_errata, "enabling workaround for");
index 2b09dc47717895c255d4a6e541254d57cd39f232..811773d1c1d015ca8e47239f5375d3ced3c04b48 100644 (file)
@@ -998,6 +998,7 @@ void verify_local_cpu_capabilities(void)
        if (!sys_caps_initialised)
                return;
 
+       verify_local_cpu_errata();
        verify_local_cpu_features(arm64_features);
        verify_local_elf_hwcaps(arm64_elf_hwcaps);
        if (system_supports_32bit_el0())