aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2013-04-15 15:12:53 -0400
committerAlexander Graf <agraf@suse.de>2013-04-26 14:27:17 -0400
commitaa8d5944b8b2809e574581abbf41894089b7def2 (patch)
tree42c76bd981edbb5b67ce1209b083f6d96f94b8d9 /virt
parent7eee2efdc6978aa70ab4046394128c1a10bc2d80 (diff)
KVM: Move irq routing to generic code
The IRQ routing set ioctl lives in the hacky device assignment code inside of KVM today. This is definitely the wrong place for it. Move it to the much more natural kvm_main.c. Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/assigned-dev.c30
-rw-r--r--virt/kvm/kvm_main.c30
2 files changed, 30 insertions, 30 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index f4c7f591b5d8..8db43701016f 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -983,36 +983,6 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
983 goto out; 983 goto out;
984 break; 984 break;
985 } 985 }
986#ifdef KVM_CAP_IRQ_ROUTING
987 case KVM_SET_GSI_ROUTING: {
988 struct kvm_irq_routing routing;
989 struct kvm_irq_routing __user *urouting;
990 struct kvm_irq_routing_entry *entries;
991
992 r = -EFAULT;
993 if (copy_from_user(&routing, argp, sizeof(routing)))
994 goto out;
995 r = -EINVAL;
996 if (routing.nr >= KVM_MAX_IRQ_ROUTES)
997 goto out;
998 if (routing.flags)
999 goto out;
1000 r = -ENOMEM;
1001 entries = vmalloc(routing.nr * sizeof(*entries));
1002 if (!entries)
1003 goto out;
1004 r = -EFAULT;
1005 urouting = argp;
1006 if (copy_from_user(entries, urouting->entries,
1007 routing.nr * sizeof(*entries)))
1008 goto out_free_irq_routing;
1009 r = kvm_set_irq_routing(kvm, entries, routing.nr,
1010 routing.flags);
1011 out_free_irq_routing:
1012 vfree(entries);
1013 break;
1014 }
1015#endif /* KVM_CAP_IRQ_ROUTING */
1016#ifdef __KVM_HAVE_MSIX 986#ifdef __KVM_HAVE_MSIX
1017 case KVM_ASSIGN_SET_MSIX_NR: { 987 case KVM_ASSIGN_SET_MSIX_NR: {
1018 struct kvm_assigned_msix_nr entry_nr; 988 struct kvm_assigned_msix_nr entry_nr;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2c3b226bc13b..b6f33547b3db 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2274,6 +2274,36 @@ static long kvm_vm_ioctl(struct file *filp,
2274 break; 2274 break;
2275 } 2275 }
2276#endif 2276#endif
2277#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
2278 case KVM_SET_GSI_ROUTING: {
2279 struct kvm_irq_routing routing;
2280 struct kvm_irq_routing __user *urouting;
2281 struct kvm_irq_routing_entry *entries;
2282
2283 r = -EFAULT;
2284 if (copy_from_user(&routing, argp, sizeof(routing)))
2285 goto out;
2286 r = -EINVAL;
2287 if (routing.nr >= KVM_MAX_IRQ_ROUTES)
2288 goto out;
2289 if (routing.flags)
2290 goto out;
2291 r = -ENOMEM;
2292 entries = vmalloc(routing.nr * sizeof(*entries));
2293 if (!entries)
2294 goto out;
2295 r = -EFAULT;
2296 urouting = argp;
2297 if (copy_from_user(entries, urouting->entries,
2298 routing.nr * sizeof(*entries)))
2299 goto out_free_irq_routing;
2300 r = kvm_set_irq_routing(kvm, entries, routing.nr,
2301 routing.flags);
2302 out_free_irq_routing:
2303 vfree(entries);
2304 break;
2305 }
2306#endif /* CONFIG_HAVE_KVM_IRQ_ROUTING */
2277 default: 2307 default:
2278 r = kvm_arch_vm_ioctl(filp, ioctl, arg); 2308 r = kvm_arch_vm_ioctl(filp, ioctl, arg);
2279 if (r == -ENOTTY) 2309 if (r == -ENOTTY)