[PATCH v4 2/5] arm64: Allow a capability to be checked on a single CPU
catalin.marinas at arm.com
Fri Apr 22 06:32:09 PDT 2016
On Fri, Apr 22, 2016 at 12:25:32PM +0100, Suzuki K. Poulose wrote:
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -1005,6 +1005,24 @@ 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)
> + const struct arm64_cpu_capabilities *caps = arm64_features;
> + if (WARN_ON(preemptible()))
> + return false;
> + for (caps = arm64_features; caps->desc; caps++)
> + if (caps->capability == cap && caps->matches)
> + return caps->matches(caps, SCOPE_LOCAL_CPU);
Nitpick: you don't need to initialise "caps" twice.
Reviewed-by: Catalin Marinas <catalin.marinas at arm.com>
More information about the linux-arm-kernel