]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: arm64: Add templates for BHB mitigation sequences
authorJames Morse <james.morse@arm.com>
Thu, 31 Mar 2022 18:33:56 +0000 (19:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Apr 2022 10:41:10 +0000 (12:41 +0200)
commit0b1c660d8516e8960227a92b9ee890e9e3682b31
treefef5bd6523f9038823839c8346e9b4a3c3686151
parente2ee0b0d9677bfec26bfd22187cdd479f9789f47
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/bpi.S
arch/arm64/kernel/cpu_errata.c