FROMLIST: arm64: entry: Add fake CPU feature for unmapping the kernel at EL0
authorWill Deacon <will.deacon@arm.com>
Tue, 14 Nov 2017 14:38:19 +0000 (14:38 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 6 Jan 2018 10:14:01 +0000 (11:14 +0100)
commit472e95061e6a9cf05b0b908762f14be548bb1392
tree164c60817389ec2bd976df26c7e7afc973003dcf
parent59eae0dbcf6c0cfb428f2bfb167af8a281026a05
FROMLIST: arm64: entry: Add fake CPU feature for unmapping the kernel at EL0

Allow explicit disabling of the entry trampoline on the kernel command
line (kpti=off) by adding a fake CPU feature (ARM64_UNMAP_KERNEL_AT_EL0)
that can be used to toggle the alternative sequences in our entry code and
avoid use of the trampoline altogether if desired. This also allows us to
make use of a static key in arm64_kernel_unmapped_at_el0().

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Laura Abbott <labbott@redhat.com>
Tested-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
 commit ea1e3de85e94d711f63437c04624aa0e8de5c8b3)

Change-Id: I11cb874d12a7d0921f452c62b0752e0028a8e0a7
[ghackmann@google.com:
 - adjust context
 - apply cpucaps.h changes to cpufeature.h
 - replace cpus_have_const_cap() with cpus_have_cap()
 - tweak unmap_kernel_at_el0() declaration to match 4.4 APIs]
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
arch/arm64/include/asm/cpufeature.h
arch/arm64/include/asm/mmu.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/entry.S