KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2
authorMarc Zyngier <maz@kernel.org>
Fri, 19 Apr 2024 10:29:25 +0000 (11:29 +0100)
committerMarc Zyngier <maz@kernel.org>
Sat, 20 Apr 2024 11:42:50 +0000 (12:42 +0100)
commit04ab519bb86df10bb8b72054fce9af1d72c36805
tree53d8991176d058eb9a2db99a5812eefa32829c91
parent6f57c6be2a0889cc0fd32b0cd2eb25dfee20dde3
KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2

Add the HCR_EL2 configuration for FEAT_NV2, adding the required
bits for running a guest hypervisor, and overall merging the
allowed bits provided by the guest.

This heavily replies on unavaliable features being sanitised
when the HCR_EL2 shadow register is accessed, and only a couple
of bits must be explicitly disabled.

Non-NV guests are completely unaffected by any of this.

Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240419102935.1935571-6-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/nvhe/switch.c
arch/arm64/kvm/hyp/vhe/switch.c