• Mark Rutland's avatar
    arm64: use const cap for system_uses_ttbr0_pan() · 14088540
    Mark Rutland authored
    Since commit 4b65a5db ("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 a4023f68 ("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: default avatarMark Rutland <mark.rutland@arm.com>
    Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    14088540
cpufeature.h 7.03 KB