Implement KVM_CAP_MEMORY_FAULT_INFO for efaults generated by kvm_hv_get_assist_page(). Signed-off-by: Anish Moorthy <amoorthy@xxxxxxxxxx> --- arch/x86/kvm/hyperv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index b28fd020066f6..467fff271bc88 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -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); -- 2.40.0.577.gac1e443424-goog