]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: SAUCE: arm64: Allow checking of a CPU-local erratum
authorMarc Zyngier <marc.zyngier@arm.com>
Mon, 30 Jan 2017 15:39:52 +0000 (15:39 +0000)
committerTim Gardner <tim.gardner@canonical.com>
Tue, 28 Mar 2017 20:17:54 +0000 (14:17 -0600)
BugLink: https://bugs.launchpad.net/bugs/1675509
this_cpu_has_cap() only checks the feature array, and not the errata
one. In order to be able to check for a CPU-local erratum, allow it
to inspect the latter as well.

This is consistent with cpus_have_cap()'s behaviour, which includes
errata already.

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
(cherry picked from commit cd3fc121809c82f577363d112bf028b2bd3a655d
 in the timers/errata-rework branch of
 git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/arm64/kernel/cpufeature.c

index 8d4a8c51317038069a6680cdd7f648b35fa1dca8..1f786954d9ca98d64706093fd5789d6f3543dfff 100644 (file)
@@ -1070,20 +1070,29 @@ static void __init setup_feature_capabilities(void)
  * Check if the current CPU has a given feature capability.
  * Should be called from non-preemptible context.
  */
-bool this_cpu_has_cap(unsigned int cap)
+static bool __this_cpu_has_cap(const struct arm64_cpu_capabilities *cap_array,
+                              unsigned int cap)
 {
        const struct arm64_cpu_capabilities *caps;
 
        if (WARN_ON(preemptible()))
                return false;
 
-       for (caps = arm64_features; caps->desc; caps++)
+       for (caps = cap_array; caps->desc; caps++)
                if (caps->capability == cap && caps->matches)
                        return caps->matches(caps, SCOPE_LOCAL_CPU);
 
        return false;
 }
 
+extern const struct arm64_cpu_capabilities arm64_errata[];
+
+bool this_cpu_has_cap(unsigned int cap)
+{
+       return (__this_cpu_has_cap(arm64_features, cap) ||
+               __this_cpu_has_cap(arm64_errata, cap));
+}
+
 void __init setup_cpu_features(void)
 {
        u32 cwg;