arm64: capabilities: Handle duplicate entries for a capability
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 9 Jan 2018 16:12:18 +0000 (16:12 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 15 Jan 2018 18:00:34 +0000 (18:00 +0000)
commit67948af41f2e6818edeeba5182811c704d484949
tree11e0c889cc1c62d3ebfef4815b007a48d5e9c7f2
parentbb48711800e6d7aedbf4dfd3367e0ab1270a6bea
arm64: capabilities: Handle duplicate entries for a capability

Sometimes a single capability could be listed multiple times with
differing matches(), e.g, CPU errata for different MIDR versions.
This breaks verify_local_cpu_feature() and this_cpu_has_cap() as
we stop checking for a capability on a CPU with the first
entry in the given table, which is not sufficient. Make sure we
run the checks for all entries of the same capability. We do
this by fixing __this_cpu_has_cap() to run through all the
entries in the given table for a match and reuse it for
verify_local_cpu_feature().

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/cpufeature.c