arm64: cpufeature: Fix meta-capability cpufeature check
authorAmit Daniel Kachhap <amit.kachhap@arm.com>
Fri, 13 Mar 2020 09:04:48 +0000 (14:34 +0530)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 18 Mar 2020 09:50:18 +0000 (09:50 +0000)
commit3ff047f6971d3c3aefd1b8972ac94a4301a70902
tree549edf110e837dfb6e7224ebb2c719c45e15942f
parentf8788d86ab28f61f7b46eb6be375f8a726783636
arm64: cpufeature: Fix meta-capability cpufeature check

Some existing/future meta cpucaps match need the presence of individual
cpucaps. Currently the individual cpucaps checks it via an array based
flag and this introduces dependency on the array entry order.
This limitation exists only for system scope cpufeature.

This patch introduces an internal helper function (__system_matches_cap)
to invoke the matching handler for system scope. This helper has to be
used during a narrow window when,
- The system wide safe registers are set with all the SMP CPUs and,
- The SYSTEM_FEATURE cpu_hwcaps may not have been set.

Normal users should use the existing cpus_have_{const_}cap() global
function.

Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Reviewed-by: Vincenzo Frascino <Vincenzo.Frascino@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/cpufeature.c