Commit b415d8d4 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Paolo Bonzini

KVM: x86: Make kvm_hv_get_assist_page() return 0/-errno

Convert kvm_hv_get_assist_page() to return 'int' and propagate possible
errors from kvm_read_guest_cached().
Suggested-by: default avatarSean Christopherson <seanjc@google.com>
Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-Id: <20221101145426.251680-28-vkuznets@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent c30e9bc8
...@@ -900,14 +900,14 @@ bool kvm_hv_assist_page_enabled(struct kvm_vcpu *vcpu) ...@@ -900,14 +900,14 @@ bool kvm_hv_assist_page_enabled(struct kvm_vcpu *vcpu)
} }
EXPORT_SYMBOL_GPL(kvm_hv_assist_page_enabled); EXPORT_SYMBOL_GPL(kvm_hv_assist_page_enabled);
bool kvm_hv_get_assist_page(struct kvm_vcpu *vcpu) int kvm_hv_get_assist_page(struct kvm_vcpu *vcpu)
{ {
struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu);
if (!hv_vcpu || !kvm_hv_assist_page_enabled(vcpu)) if (!hv_vcpu || !kvm_hv_assist_page_enabled(vcpu))
return false; return -EFAULT;
return !kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.pv_eoi.data, return kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.pv_eoi.data,
&hv_vcpu->vp_assist_page, sizeof(struct hv_vp_assist_page)); &hv_vcpu->vp_assist_page, sizeof(struct hv_vp_assist_page));
} }
EXPORT_SYMBOL_GPL(kvm_hv_get_assist_page); EXPORT_SYMBOL_GPL(kvm_hv_get_assist_page);
......
...@@ -108,7 +108,7 @@ int kvm_hv_activate_synic(struct kvm_vcpu *vcpu, bool dont_zero_synic_pages); ...@@ -108,7 +108,7 @@ int kvm_hv_activate_synic(struct kvm_vcpu *vcpu, bool dont_zero_synic_pages);
void kvm_hv_vcpu_uninit(struct kvm_vcpu *vcpu); void kvm_hv_vcpu_uninit(struct kvm_vcpu *vcpu);
bool kvm_hv_assist_page_enabled(struct kvm_vcpu *vcpu); bool kvm_hv_assist_page_enabled(struct kvm_vcpu *vcpu);
bool kvm_hv_get_assist_page(struct kvm_vcpu *vcpu); int kvm_hv_get_assist_page(struct kvm_vcpu *vcpu);
static inline struct kvm_vcpu_hv_stimer *to_hv_stimer(struct kvm_vcpu *vcpu, static inline struct kvm_vcpu_hv_stimer *to_hv_stimer(struct kvm_vcpu *vcpu,
int timer_index) int timer_index)
......
...@@ -326,7 +326,7 @@ u64 nested_get_evmptr(struct kvm_vcpu *vcpu) ...@@ -326,7 +326,7 @@ u64 nested_get_evmptr(struct kvm_vcpu *vcpu)
{ {
struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu);
if (unlikely(!kvm_hv_get_assist_page(vcpu))) if (unlikely(kvm_hv_get_assist_page(vcpu)))
return EVMPTR_INVALID; return EVMPTR_INVALID;
if (unlikely(!hv_vcpu->vp_assist_page.enlighten_vmentry)) if (unlikely(!hv_vcpu->vp_assist_page.enlighten_vmentry))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment