KVM: arm64: Use the pKVM hyp vCPU structure in handle___kvm_vcpu_run()
authorWill Deacon <will@kernel.org>
Thu, 10 Nov 2022 19:02:59 +0000 (19:02 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 11 Nov 2022 17:19:35 +0000 (17:19 +0000)
commitbe66e67f175096f283c9d5614c4991fc9e7ed975
treefa477573896bc6eb967252485754a38dc695c8fc
parent169cd0f8238f2598b85d2db2e15828e8f8da18e5
KVM: arm64: Use the pKVM hyp vCPU structure in handle___kvm_vcpu_run()

As a stepping stone towards deprivileging the host's access to the
guest's vCPU structures, introduce some naive flush/sync routines to
copy most of the host vCPU into the hyp vCPU on vCPU run and back
again on return to EL1.

This allows us to run using the pKVM hyp structures when KVM is
initialised in protected mode.

Tested-by: Vincent Donnefort <vdonnefort@google.com>
Co-developed-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221110190259.26861-27-will@kernel.org
arch/arm64/kvm/hyp/include/nvhe/pkvm.h
arch/arm64/kvm/hyp/nvhe/hyp-main.c
arch/arm64/kvm/hyp/nvhe/pkvm.c