KVM: arm64: Initialize trap registers for protected VMs
authorFuad Tabba <tabba@google.com>
Sun, 10 Oct 2021 14:56:33 +0000 (15:56 +0100)
committerMarc Zyngier <maz@kernel.org>
Mon, 11 Oct 2021 13:57:29 +0000 (14:57 +0100)
commit2a0c343386ae1a6826e1b9d751bfc14f4711c2de
tree83c441a60b73d2dab6a0bb865b28c8766d6e2aef
parent6c30bfb18d0b7d09593f204c936493cfcd153956
KVM: arm64: Initialize trap registers for protected VMs

Protected VMs have more restricted features that need to be
trapped. Moreover, the host should not be trusted to set the
appropriate trapping registers and their values.

Initialize the trapping registers, i.e., hcr_el2, mdcr_el2, and
cptr_el2 at EL2 for protected guests, based on the values of the
guest's feature id registers.

No functional change intended as trap handlers introduced in the
previous patch are still not hooked in to the guest exit
handlers.

Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211010145636.1950948-9-tabba@google.com
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/include/nvhe/trap_handler.h
arch/arm64/kvm/hyp/nvhe/Makefile
arch/arm64/kvm/hyp/nvhe/hyp-main.c
arch/arm64/kvm/hyp/nvhe/pkvm.c [new file with mode: 0644]