KVM: Portability: Move KVM_INTERRUPT vcpu ioctl to x86.c
authorZhang Xiantao <xiantao.zhang@intel.com>
Tue, 20 Nov 2007 20:36:41 +0000 (04:36 +0800)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:53:16 +0000 (17:53 +0200)
Other archs doesn't need it.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm_main.c
drivers/kvm/x86.c

index 721e660023f638011bc02b12f9bf9a8c99ce2ecd..c74fb44dd87b4060e592b3243e92ff59a0740e49 100644 (file)
@@ -665,23 +665,6 @@ void kvm_resched(struct kvm_vcpu *vcpu)
 }
 EXPORT_SYMBOL_GPL(kvm_resched);
 
-static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
-                                   struct kvm_interrupt *irq)
-{
-       if (irq->irq < 0 || irq->irq >= 256)
-               return -EINVAL;
-       if (irqchip_in_kernel(vcpu->kvm))
-               return -ENXIO;
-       vcpu_load(vcpu);
-
-       set_bit(irq->irq, vcpu->irq_pending);
-       set_bit(irq->irq / BITS_PER_LONG, &vcpu->irq_summary);
-
-       vcpu_put(vcpu);
-
-       return 0;
-}
-
 static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma,
                                    unsigned long address,
                                    int *type)
@@ -883,18 +866,6 @@ static long kvm_vcpu_ioctl(struct file *filp,
                r = 0;
                break;
        }
-       case KVM_INTERRUPT: {
-               struct kvm_interrupt irq;
-
-               r = -EFAULT;
-               if (copy_from_user(&irq, argp, sizeof irq))
-                       goto out;
-               r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
-               if (r)
-                       goto out;
-               r = 0;
-               break;
-       }
        case KVM_DEBUG_GUEST: {
                struct kvm_debug_guest dbg;
 
index 12f1d6fc92bbcbe95047a3dcebf4a7782a36304c..c9e4b67bfb1b9bdb062b6c59014d782b1a8317e7 100644 (file)
@@ -1001,6 +1001,23 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
        return 0;
 }
 
+static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
+                                   struct kvm_interrupt *irq)
+{
+       if (irq->irq < 0 || irq->irq >= 256)
+               return -EINVAL;
+       if (irqchip_in_kernel(vcpu->kvm))
+               return -ENXIO;
+       vcpu_load(vcpu);
+
+       set_bit(irq->irq, vcpu->irq_pending);
+       set_bit(irq->irq / BITS_PER_LONG, &vcpu->irq_summary);
+
+       vcpu_put(vcpu);
+
+       return 0;
+}
+
 long kvm_arch_vcpu_ioctl(struct file *filp,
                         unsigned int ioctl, unsigned long arg)
 {
@@ -1034,6 +1051,18 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
                r = 0;
                break;
        }
+       case KVM_INTERRUPT: {
+               struct kvm_interrupt irq;
+
+               r = -EFAULT;
+               if (copy_from_user(&irq, argp, sizeof irq))
+                       goto out;
+               r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
+               if (r)
+                       goto out;
+               r = 0;
+               break;
+       }
        case KVM_SET_CPUID: {
                struct kvm_cpuid __user *cpuid_arg = argp;
                struct kvm_cpuid cpuid;