diff options
author | Christoffer Dall <c.dall@virtualopensystems.com> | 2012-07-24 08:51:20 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-07-26 05:23:25 -0400 |
commit | 23d43cf998275bc97437931c0cdee1df2c1aa3ca (patch) | |
tree | cc1a76fefb98f66e7807d54049ddaf008db055ac /arch/ia64/kvm | |
parent | 99245b507dc3b1b2815d6a6cb4e94a6b7018a24b (diff) |
KVM: Move KVM_IRQ_LINE to arch-generic code
Handle KVM_IRQ_LINE and KVM_IRQ_LINE_STATUS in the generic
kvm_vm_ioctl() function and call into kvm_vm_ioctl_irq_line().
This is even more relevant when KVM/ARM also uses this ioctl.
Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/ia64/kvm')
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index bd77cb507c1c..eac65380bd20 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -924,6 +924,16 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) | |||
924 | return 0; | 924 | return 0; |
925 | } | 925 | } |
926 | 926 | ||
927 | int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event) | ||
928 | { | ||
929 | if (!irqchip_in_kernel(kvm)) | ||
930 | return -ENXIO; | ||
931 | |||
932 | irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, | ||
933 | irq_event->irq, irq_event->level); | ||
934 | return 0; | ||
935 | } | ||
936 | |||
927 | long kvm_arch_vm_ioctl(struct file *filp, | 937 | long kvm_arch_vm_ioctl(struct file *filp, |
928 | unsigned int ioctl, unsigned long arg) | 938 | unsigned int ioctl, unsigned long arg) |
929 | { | 939 | { |
@@ -963,29 +973,6 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
963 | goto out; | 973 | goto out; |
964 | } | 974 | } |
965 | break; | 975 | break; |
966 | case KVM_IRQ_LINE_STATUS: | ||
967 | case KVM_IRQ_LINE: { | ||
968 | struct kvm_irq_level irq_event; | ||
969 | |||
970 | r = -EFAULT; | ||
971 | if (copy_from_user(&irq_event, argp, sizeof irq_event)) | ||
972 | goto out; | ||
973 | r = -ENXIO; | ||
974 | if (irqchip_in_kernel(kvm)) { | ||
975 | __s32 status; | ||
976 | status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, | ||
977 | irq_event.irq, irq_event.level); | ||
978 | if (ioctl == KVM_IRQ_LINE_STATUS) { | ||
979 | r = -EFAULT; | ||
980 | irq_event.status = status; | ||
981 | if (copy_to_user(argp, &irq_event, | ||
982 | sizeof irq_event)) | ||
983 | goto out; | ||
984 | } | ||
985 | r = 0; | ||
986 | } | ||
987 | break; | ||
988 | } | ||
989 | case KVM_GET_IRQCHIP: { | 976 | case KVM_GET_IRQCHIP: { |
990 | /* 0: PIC master, 1: PIC slave, 2: IOAPIC */ | 977 | /* 0: PIC master, 1: PIC slave, 2: IOAPIC */ |
991 | struct kvm_irqchip chip; | 978 | struct kvm_irqchip chip; |