]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: use const cap for system_uses_ttbr0_pan()
authorMark Rutland <mark.rutland@arm.com>
Fri, 10 Mar 2017 17:44:18 +0000 (17:44 +0000)
committerWill Deacon <will.deacon@arm.com>
Fri, 10 Mar 2017 17:45:16 +0000 (17:45 +0000)
commita426397a54eebd4365d6450eeddaf8de1f20745f
tree634b7aaf1a7376f476fba53f963113d828d94673
parent218b8c42c0cce6d103f78d936b148cc226ae70dc
arm64: use const cap for system_uses_ttbr0_pan()

Since commit dea722584c80c87f ("arm64: Introduce
uaccess_{disable,enable} functionality based on TTBR0_EL1"),
system_uses_ttbr0_pan() has used cpus_have_cap() to determine whether
PAN is present.

Since commit efc4705725ecd7ef ("arm64: Add hypervisor safe helper for
checking constant capabilities"), which was introduced around the same
time, cpus_have_cap() doesn't try to use a static key, and must always
perform a load, test, and consitional branch (likely a tbnz for the
latter two).

Elsewhere, we moved to using cpus_have_const_cap(), which can use a
static key (i.e. a non-conditional branch), which is patched at runtime
when the feature is detected.

This patch makes system_uses_ttbr0_pan() use cpus_have_const_cap(). The
static key is likely a win for hot-paths like the uacccess primitives,
and this makes our usage consistent regardless.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/cpufeature.h