@@ -921,13 +921,21 @@ EXPORT_SYMBOL_GPL(kvm_hv_assist_page_enabled);
int kvm_hv_get_assist_page(struct kvm_vcpu *vcpu)
{
+ int ret = -EFAULT;
struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu);
if (!hv_vcpu || !kvm_hv_assist_page_enabled(vcpu))
- return -EFAULT;
+ goto out;
+
+ ret = kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.pv_eoi.data,
+ &hv_vcpu->vp_assist_page,
+ sizeof(struct hv_vp_assist_page));
- return kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.pv_eoi.data,
- &hv_vcpu->vp_assist_page, sizeof(struct hv_vp_assist_page));
+out:
+ if (ret == -EFAULT)
+ kvm_populate_efault_info(vcpu, vcpu->arch.pv_eoi.data.gpa,
+ vcpu->arch.pv_eoi.data.len);
+ return ret;
}
EXPORT_SYMBOL_GPL(kvm_hv_get_assist_page);
Implement KVM_CAP_MEMORY_FAULT_INFO for efaults generated by kvm_hv_get_assist_page(). Signed-off-by: Anish Moorthy <amoorthy@google.com> --- arch/x86/kvm/hyperv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)