|
@@ -6671,12 +6671,13 @@ void kvm_vcpu_deactivate_apicv(struct kvm_vcpu *vcpu)
|
|
|
int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
|
|
|
{
|
|
|
unsigned long nr, a0, a1, a2, a3, ret;
|
|
|
- int op_64_bit, r;
|
|
|
+ int op_64_bit;
|
|
|
|
|
|
- r = kvm_skip_emulated_instruction(vcpu);
|
|
|
-
|
|
|
- if (kvm_hv_hypercall_enabled(vcpu->kvm))
|
|
|
- return kvm_hv_hypercall(vcpu);
|
|
|
+ if (kvm_hv_hypercall_enabled(vcpu->kvm)) {
|
|
|
+ if (!kvm_hv_hypercall(vcpu))
|
|
|
+ return 0;
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
|
|
|
nr = kvm_register_read(vcpu, VCPU_REGS_RAX);
|
|
|
a0 = kvm_register_read(vcpu, VCPU_REGS_RBX);
|
|
@@ -6697,7 +6698,7 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
|
|
|
|
|
|
if (kvm_x86_ops->get_cpl(vcpu) != 0) {
|
|
|
ret = -KVM_EPERM;
|
|
|
- goto out;
|
|
|
+ goto out_error;
|
|
|
}
|
|
|
|
|
|
switch (nr) {
|
|
@@ -6717,12 +6718,14 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
|
|
|
ret = -KVM_ENOSYS;
|
|
|
break;
|
|
|
}
|
|
|
-out:
|
|
|
+out_error:
|
|
|
if (!op_64_bit)
|
|
|
ret = (u32)ret;
|
|
|
kvm_register_write(vcpu, VCPU_REGS_RAX, ret);
|
|
|
+
|
|
|
+out:
|
|
|
++vcpu->stat.hypercalls;
|
|
|
- return r;
|
|
|
+ return kvm_skip_emulated_instruction(vcpu);
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(kvm_emulate_hypercall);
|
|
|
|