arm64: Run enable method for errata work arounds on late CPUs
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 17 Jan 2018 17:42:20 +0000 (17:42 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2018 19:22:52 +0000 (20:22 +0100)
Commit 55b35d070c25 upstream.

When a CPU is brought up after we have finalised the system
wide capabilities (i.e, features and errata), we make sure the
new CPU doesn't need a new errata work around which has not been
detected already. However we don't run enable() method on the new
CPU for the errata work arounds already detected. This could
cause the new CPU running without potential work arounds.
It is upto the "enable()" method to decide if this CPU should
do something about the errata.

Fixes: commit 6a6efbb45b7d95c84 ("arm64: Verify CPU errata work arounds on hotplugged CPU")
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/cpu_errata.c

index e4c78630a730cdac00f2f6abb39025e9fbac0a05..624f8a1180291ce1f6a970dfff72013d4bd54465 100644 (file)
@@ -221,15 +221,18 @@ void verify_local_cpu_errata_workarounds(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)) {
+       for (; caps->matches; caps++) {
+               if (cpus_have_cap(caps->capability)) {
+                       if (caps->enable)
+                               caps->enable((void *)caps);
+               } else if (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 update_cpu_errata_workarounds(void)