diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-11-20 15:36:41 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:16 -0500 |
commit | f77bc6a420eba845605ff1d53cadf55f94c5e8b7 (patch) | |
tree | 1b393e18aeaeb5c728ec2fd2aa71e6d85139ad26 /drivers | |
parent | 018a98db74d4cc8967cfc570197b14bcbdddb579 (diff) |
KVM: Portability: Move KVM_INTERRUPT vcpu ioctl to x86.c
Other archs doesn't need it.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/kvm_main.c | 29 | ||||
-rw-r--r-- | drivers/kvm/x86.c | 29 |
2 files changed, 29 insertions, 29 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 721e660023f6..c74fb44dd87b 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -665,23 +665,6 @@ void kvm_resched(struct kvm_vcpu *vcpu) | |||
665 | } | 665 | } |
666 | EXPORT_SYMBOL_GPL(kvm_resched); | 666 | EXPORT_SYMBOL_GPL(kvm_resched); |
667 | 667 | ||
668 | static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, | ||
669 | struct kvm_interrupt *irq) | ||
670 | { | ||
671 | if (irq->irq < 0 || irq->irq >= 256) | ||
672 | return -EINVAL; | ||
673 | if (irqchip_in_kernel(vcpu->kvm)) | ||
674 | return -ENXIO; | ||
675 | vcpu_load(vcpu); | ||
676 | |||
677 | set_bit(irq->irq, vcpu->irq_pending); | ||
678 | set_bit(irq->irq / BITS_PER_LONG, &vcpu->irq_summary); | ||
679 | |||
680 | vcpu_put(vcpu); | ||
681 | |||
682 | return 0; | ||
683 | } | ||
684 | |||
685 | static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma, | 668 | static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma, |
686 | unsigned long address, | 669 | unsigned long address, |
687 | int *type) | 670 | int *type) |
@@ -883,18 +866,6 @@ static long kvm_vcpu_ioctl(struct file *filp, | |||
883 | r = 0; | 866 | r = 0; |
884 | break; | 867 | break; |
885 | } | 868 | } |
886 | case KVM_INTERRUPT: { | ||
887 | struct kvm_interrupt irq; | ||
888 | |||
889 | r = -EFAULT; | ||
890 | if (copy_from_user(&irq, argp, sizeof irq)) | ||
891 | goto out; | ||
892 | r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); | ||
893 | if (r) | ||
894 | goto out; | ||
895 | r = 0; | ||
896 | break; | ||
897 | } | ||
898 | case KVM_DEBUG_GUEST: { | 869 | case KVM_DEBUG_GUEST: { |
899 | struct kvm_debug_guest dbg; | 870 | struct kvm_debug_guest dbg; |
900 | 871 | ||
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c index 12f1d6fc92bb..c9e4b67bfb1b 100644 --- a/drivers/kvm/x86.c +++ b/drivers/kvm/x86.c | |||
@@ -1001,6 +1001,23 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, | |||
1001 | return 0; | 1001 | return 0; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, | ||
1005 | struct kvm_interrupt *irq) | ||
1006 | { | ||
1007 | if (irq->irq < 0 || irq->irq >= 256) | ||
1008 | return -EINVAL; | ||
1009 | if (irqchip_in_kernel(vcpu->kvm)) | ||
1010 | return -ENXIO; | ||
1011 | vcpu_load(vcpu); | ||
1012 | |||
1013 | set_bit(irq->irq, vcpu->irq_pending); | ||
1014 | set_bit(irq->irq / BITS_PER_LONG, &vcpu->irq_summary); | ||
1015 | |||
1016 | vcpu_put(vcpu); | ||
1017 | |||
1018 | return 0; | ||
1019 | } | ||
1020 | |||
1004 | long kvm_arch_vcpu_ioctl(struct file *filp, | 1021 | long kvm_arch_vcpu_ioctl(struct file *filp, |
1005 | unsigned int ioctl, unsigned long arg) | 1022 | unsigned int ioctl, unsigned long arg) |
1006 | { | 1023 | { |
@@ -1034,6 +1051,18 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
1034 | r = 0; | 1051 | r = 0; |
1035 | break; | 1052 | break; |
1036 | } | 1053 | } |
1054 | case KVM_INTERRUPT: { | ||
1055 | struct kvm_interrupt irq; | ||
1056 | |||
1057 | r = -EFAULT; | ||
1058 | if (copy_from_user(&irq, argp, sizeof irq)) | ||
1059 | goto out; | ||
1060 | r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); | ||
1061 | if (r) | ||
1062 | goto out; | ||
1063 | r = 0; | ||
1064 | break; | ||
1065 | } | ||
1037 | case KVM_SET_CPUID: { | 1066 | case KVM_SET_CPUID: { |
1038 | struct kvm_cpuid __user *cpuid_arg = argp; | 1067 | struct kvm_cpuid __user *cpuid_arg = argp; |
1039 | struct kvm_cpuid cpuid; | 1068 | struct kvm_cpuid cpuid; |