]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
arm64: kpti: Add ->enable callback to remap swapper using nG mappings
authorWill Deacon <will.deacon@arm.com>
Tue, 6 Feb 2018 22:22:50 +0000 (22:22 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 22 Feb 2018 14:15:47 +0000 (08:15 -0600)
commit5c10f9cae715fb03722e5200c11eac7bae7ff2b8
tree1ec4cd369b04e8e26e5afb21724caa572f3f02e2
parentf13942626bf17c8d36663b3bb0620c65084cebac
arm64: kpti: Add ->enable callback to remap swapper using nG mappings

BugLink: http://bugs.launchpad.net/bugs/1751064
Commit f992b4dfd58b upstream.

Defaulting to global mappings for kernel space is generally good for
performance and appears to be necessary for Cavium ThunderX. If we
subsequently decide that we need to enable kpti, then we need to rewrite
our existing page table entries to be non-global. This is fiddly, and
made worse by the possible use of contiguous mappings, which require
a strict break-before-make sequence.

Since the enable callback runs on each online CPU from stop_machine
context, we can have all CPUs enter the idmap, where secondaries can
wait for the primary CPU to rewrite swapper with its MMU off. It's all
fairly horrible, but at least it only runs once.

Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Conflicts:
arch/arm64/mm/proc.S
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/arm64/include/asm/assembler.h
arch/arm64/kernel/cpufeature.c
arch/arm64/mm/proc.S