KVM: Get rid of get_irq() callback
authorGleb Natapov <gleb@redhat.com>
Tue, 21 Apr 2009 14:45:11 +0000 (17:45 +0300)
committerAvi Kivity <avi@redhat.com>
Wed, 10 Jun 2009 08:48:49 +0000 (11:48 +0300)
It just returns pending IRQ vector from the queue for VMX/SVM.
Get IRQ directly from the queue before migration and put it back
after.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c

index dd9ecd3..3e94d05 100644 (file)
@@ -510,7 +510,6 @@ struct kvm_x86_ops {
        void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
        void (*patch_hypercall)(struct kvm_vcpu *vcpu,
                                unsigned char *hypercall_addr);
-       int (*get_irq)(struct kvm_vcpu *vcpu);
        void (*set_irq)(struct kvm_vcpu *vcpu, int vec);
        void (*set_nmi)(struct kvm_vcpu *vcpu);
        void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr,
index 1807288..d96a6d3 100644 (file)
@@ -966,13 +966,6 @@ static int svm_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg)
        return 0;
 }
 
-static int svm_get_irq(struct kvm_vcpu *vcpu)
-{
-       if (!vcpu->arch.interrupt.pending)
-               return -1;
-       return vcpu->arch.interrupt.nr;
-}
-
 static void load_host_msrs(struct kvm_vcpu *vcpu)
 {
 #ifdef CONFIG_X86_64
@@ -2647,7 +2640,6 @@ static struct kvm_x86_ops svm_x86_ops = {
        .handle_exit = handle_exit,
        .skip_emulated_instruction = skip_emulated_instruction,
        .patch_hypercall = svm_patch_hypercall,
-       .get_irq = svm_get_irq,
        .set_irq = svm_set_irq,
        .set_nmi = svm_inject_nmi,
        .queue_exception = svm_queue_exception,
index bad2413..25be53a 100644 (file)
@@ -1045,13 +1045,6 @@ static int set_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg)
        return 0;
 }
 
-static int vmx_get_irq(struct kvm_vcpu *vcpu)
-{
-       if (!vcpu->arch.interrupt.pending)
-               return -1;
-       return vcpu->arch.interrupt.nr;
-}
-
 static __init int cpu_has_kvm_support(void)
 {
        return cpu_has_vmx();
@@ -3634,7 +3627,6 @@ static struct kvm_x86_ops vmx_x86_ops = {
        .handle_exit = vmx_handle_exit,
        .skip_emulated_instruction = skip_emulated_instruction,
        .patch_hypercall = vmx_patch_hypercall,
-       .get_irq = vmx_get_irq,
        .set_irq = vmx_inject_irq,
        .set_nmi = vmx_inject_nmi,
        .queue_exception = vmx_queue_exception,
index 6391721..0f3e04b 100644 (file)
@@ -3536,7 +3536,6 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
                                  struct kvm_sregs *sregs)
 {
        struct descriptor_table dt;
-       int pending_vec;
 
        vcpu_load(vcpu);
 
@@ -3573,9 +3572,9 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
                memcpy(sregs->interrupt_bitmap, vcpu->arch.irq_pending,
                       sizeof sregs->interrupt_bitmap);
 
-       pending_vec = kvm_x86_ops->get_irq(vcpu);
-       if (pending_vec >= 0)
-               set_bit(pending_vec, (unsigned long *)sregs->interrupt_bitmap);
+       if (vcpu->arch.interrupt.pending)
+               set_bit(vcpu->arch.interrupt.nr,
+                       (unsigned long *)sregs->interrupt_bitmap);
 
        vcpu_put(vcpu);
 
@@ -4097,9 +4096,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
                        max_bits);
                /* Only pending external irq is handled here */
                if (pending_vec < max_bits) {
-                       kvm_x86_ops->set_irq(vcpu, pending_vec);
-                       pr_debug("Set back pending irq %d\n",
-                                pending_vec);
+                       kvm_queue_interrupt(vcpu, pending_vec);
+                       pr_debug("Set back pending irq %d\n", pending_vec);
                }
                kvm_pic_clear_isr_ack(vcpu->kvm);
        }