OSDN Git Service

KVM: x86: Export kvm_mmu_gva_to_gpa_{read,write}() for SGX (VMX)
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 12 Apr 2021 04:21:33 +0000 (16:21 +1200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 20 Apr 2021 08:18:53 +0000 (04:18 -0400)
commit54f958cdaa8c43c0e9b9ef850ae613a6e1bda44e
treeae9f812dcfcde72b867614b99d841bb7d180e644
parentb9c2bd50eca5dc6ed8eaacbbb2e17df95a56bd1c
KVM: x86: Export kvm_mmu_gva_to_gpa_{read,write}() for SGX (VMX)

Export the gva_to_gpa() helpers for use by SGX virtualization when
executing ENCLS[ECREATE] and ENCLS[EINIT] on behalf of the guest.
To execute ECREATE and EINIT, KVM must obtain the GPA of the target
Secure Enclave Control Structure (SECS) in order to get its
corresponding HVA.

Because the SECS must reside in the Enclave Page Cache (EPC), copying
the SECS's data to a host-controlled buffer via existing exported
helpers is not a viable option as the EPC is not readable or writable
by the kernel.

SGX virtualization will also use gva_to_gpa() to obtain HVAs for
non-EPC pages in order to pass user pointers directly to ECREATE and
EINIT, which avoids having to copy pages worth of data into the kernel.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Kai Huang <kai.huang@intel.com>
Message-Id: <02f37708321bcdfaa2f9d41c8478affa6e84b04d.1618196135.git.kai.huang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c