KVM: arm64: Allow indirect vectors to be used without SPECTRE_V3A
authorJames Morse <james.morse@arm.com>
Tue, 16 Nov 2021 15:06:19 +0000 (15:06 +0000)
committerJames Morse <james.morse@arm.com>
Tue, 15 Feb 2022 17:38:25 +0000 (17:38 +0000)
commit5bdf3437603d4af87f9c7f424b0c8aeed2420745
tree97ff7240c3f3033e1d0ff77c8347bd164ff7a043
parent1b33d4860deaecf1d8eec3061b7e7ed7ab0bae8d
KVM: arm64: Allow indirect vectors to be used without SPECTRE_V3A

CPUs vulnerable to Spectre-BHB either need to make an SMC-CC firmware
call from the vectors, or run a sequence of branches. This gets added
to the hyp vectors. If there is no support for arch-workaround-1 in
firmware, the indirect vector will be used.

kvm_init_vector_slots() only initialises the two indirect slots if
the platform is vulnerable to Spectre-v3a. pKVM's hyp_map_vectors()
only initialises __hyp_bp_vect_base if the platform is vulnerable to
Spectre-v3a.

As there are about to more users of the indirect vectors, ensure
their entries in hyp_spectre_vector_selector[] are always initialised,
and __hyp_bp_vect_base defaults to the regular VA mapping.

The Spectre-v3a check is moved to a helper
kvm_system_needs_idmapped_vectors(), and merged with the code
that creates the hyp mappings.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/nvhe/mm.c