]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: capabilities: Speed up capability lookup
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Fri, 30 Nov 2018 17:18:03 +0000 (17:18 +0000)
committerWill Deacon <will.deacon@arm.com>
Thu, 6 Dec 2018 15:12:25 +0000 (15:12 +0000)
commit329091811c28900e3716873b60b268c332f2fab9
tree35f729c560af8a2220d09262aa9932195381015d
parentbd490385355f7b3853d5cea101d6aa6e7dab363a
arm64: capabilities: Speed up capability lookup

We maintain two separate tables of capabilities, errata and features,
which decide the system capabilities. We iterate over each of these
tables for various operations (e.g, detection, verification etc.).
We do not have a way to map a system "capability" to its entry,
(i.e, cap -> struct arm64_cpu_capabilities) which is needed for
this_cpu_has_cap(). So we iterate over the table one by one to
find the entry and then do the operation. Also, this prevents
us from optimizing the way we "enable" the capabilities on the
CPUs, where we now issue a stop_machine() for each available
capability.

One solution is to merge the two tables into a single table,
sorted by the capability. But this is has the following
disadvantages:
  - We loose the "classification" of an errata vs. feature
  - It is quite easy to make a mistake when adding an entry,
    unless we sort the table at runtime.

So we maintain a list of pointers to the capability entry, sorted
by the "cap number" in a separate array, initialized at boot time.
The only restriction is that we can have one "entry" per capability.
While at it, remove the duplicate declaration of arm64_errata table.

Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/cpufeature.c