Commit 1d648e44 authored by Marc Zyngier's avatar Marc Zyngier Committed by Greg Kroah-Hartman

arm64: Allow checking of a CPU-local erratum

commit 8f413758 upstream.

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.
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Alex Shi <alex.shi@linaro.org> [v4.9 backport]
Signed-off-by: Mark Rutland <mark.rutland@arm.com> [v4.9 backport]
Tested-by: default avatarWill Deacon <will.deacon@arm.com>
Tested-by: default avatarGreg Hackmann <ghackmann@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7354772a
...@@ -1103,20 +1103,29 @@ static void __init setup_feature_capabilities(void) ...@@ -1103,20 +1103,29 @@ static void __init setup_feature_capabilities(void)
* Check if the current CPU has a given feature capability. * Check if the current CPU has a given feature capability.
* Should be called from non-preemptible context. * 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; const struct arm64_cpu_capabilities *caps;
if (WARN_ON(preemptible())) if (WARN_ON(preemptible()))
return false; return false;
for (caps = arm64_features; caps->desc; caps++) for (caps = cap_array; caps->desc; caps++)
if (caps->capability == cap && caps->matches) if (caps->capability == cap && caps->matches)
return caps->matches(caps, SCOPE_LOCAL_CPU); return caps->matches(caps, SCOPE_LOCAL_CPU);
return false; 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) void __init setup_cpu_features(void)
{ {
u32 cwg; u32 cwg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment