]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: arm64: Add templates for BHB mitigation sequences
authorJames Morse <james.morse@arm.com>
Fri, 18 Mar 2022 17:48:38 +0000 (17:48 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Mar 2022 08:10:43 +0000 (09:10 +0100)
commita68912a3ae3413be5febcaa40e7e0ec1fd62adee
treef6406ba696f9dfa100bc85cf288a3eebef95a048
parent7b012f6597e55a2ea4c7efe94b5d9a792b6e5757
KVM: arm64: Add templates for BHB mitigation sequences

KVM writes the Spectre-v2 mitigation template at the beginning of each
vector when a CPU requires a specific sequence to run.

Because the template is copied, it can not be modified by the alternatives
at runtime. As the KVM template code is intertwined with the bp-hardening
callbacks, all templates must have a bp-hardening callback.

Add templates for calling ARCH_WORKAROUND_3 and one for each value of K
in the brancy-loop. Identify these sequences by a new parameter
template_start, and add a copy of install_bp_hardening_cb() that is able to
install them.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/cpucaps.h
arch/arm64/include/asm/kvm_mmu.h
arch/arm64/include/asm/mmu.h
arch/arm64/kernel/cpu_errata.c
arch/arm64/kvm/hyp/hyp-entry.S