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/kvm/x86.c | |
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/kvm/x86.c')
-rw-r--r-- | drivers/kvm/x86.c | 29 |
1 files changed, 29 insertions, 0 deletions
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; |