]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
KVM: Implement NotifyLongSpinWait HYPER-V hypercall
authorGleb Natapov <gleb@redhat.com>
Sun, 17 Jan 2010 13:51:24 +0000 (15:51 +0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 1 Mar 2010 15:36:00 +0000 (12:36 -0300)
Windows issues this hypercall after guest was spinning on a spinlock
for too many iterations.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Vadim Rozenfeld <vrozenfe@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c
include/linux/kvm.h

index 552be51e4d844d90ef787e1ae7a5e4d1d71622e2..9f72a443455b75b5fec6ec1b540e049f574c8c10 100644 (file)
@@ -1564,6 +1564,7 @@ int kvm_dev_ioctl_check_extension(long ext)
        case KVM_CAP_VCPU_EVENTS:
        case KVM_CAP_HYPERV:
        case KVM_CAP_HYPERV_VAPIC:
+       case KVM_CAP_HYPERV_SPIN:
                r = 1;
                break;
        case KVM_CAP_COALESCED_MMIO:
@@ -3827,7 +3828,14 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
 
        trace_kvm_hv_hypercall(code, fast, rep_cnt, rep_idx, ingpa, outgpa);
 
-       res = HV_STATUS_INVALID_HYPERCALL_CODE;
+       switch (code) {
+       case HV_X64_HV_NOTIFY_LONG_SPIN_WAIT:
+               kvm_vcpu_on_spin(vcpu);
+               break;
+       default:
+               res = HV_STATUS_INVALID_HYPERCALL_CODE;
+               break;
+       }
 
        ret = res | (((u64)rep_done & 0xfff) << 32);
        if (longmode) {
index 5ce61738dc3095456a89c6a046fe3554ecdea3b4..4c4937e7f65f3642fff9c1c2d376b90b670e281e 100644 (file)
@@ -499,6 +499,7 @@ struct kvm_ioeventfd {
 #define KVM_CAP_PPC_SEGSTATE 43
 #define KVM_CAP_HYPERV 44
 #define KVM_CAP_HYPERV_VAPIC 45
+#define KVM_CAP_HYPERV_SPIN 46
 
 #ifdef KVM_CAP_IRQ_ROUTING