From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH 05/17] KVM: Move irq routing to generic code Date: Thu, 25 Apr 2013 13:19:32 +0300 Message-ID: <20130425101932.GE16463@redhat.com> References: <1366380388-25926-1-git-send-email-agraf@suse.de> <1366380388-25926-6-git-send-email-agraf@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm-ppc@vger.kernel.org, "kvm@vger.kernel.org mailing list" , Scott Wood , Marcelo Tosatti , Gleb Natapov To: Alexander Graf Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33042 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755629Ab3DYKTm (ORCPT ); Thu, 25 Apr 2013 06:19:42 -0400 Content-Disposition: inline In-Reply-To: <1366380388-25926-6-git-send-email-agraf@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Apr 19, 2013 at 04:06:16PM +0200, Alexander Graf wrote: > 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 Acked-by: Michael S. Tsirkin > --- > virt/kvm/assigned-dev.c | 30 ------------------------------ > virt/kvm/kvm_main.c | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 30 insertions(+), 30 deletions(-) > > diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c > index f4c7f59..8db4370 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, > goto out; > break; > } > -#ifdef KVM_CAP_IRQ_ROUTING > - case KVM_SET_GSI_ROUTING: { > - struct kvm_irq_routing routing; > - struct kvm_irq_routing __user *urouting; > - struct kvm_irq_routing_entry *entries; > - > - r = -EFAULT; > - if (copy_from_user(&routing, argp, sizeof(routing))) > - goto out; > - r = -EINVAL; > - if (routing.nr >= KVM_MAX_IRQ_ROUTES) > - goto out; > - if (routing.flags) > - goto out; > - r = -ENOMEM; > - entries = vmalloc(routing.nr * sizeof(*entries)); > - if (!entries) > - goto out; > - r = -EFAULT; > - urouting = argp; > - if (copy_from_user(entries, urouting->entries, > - routing.nr * sizeof(*entries))) > - goto out_free_irq_routing; > - r = kvm_set_irq_routing(kvm, entries, routing.nr, > - routing.flags); > - out_free_irq_routing: > - vfree(entries); > - break; > - } > -#endif /* KVM_CAP_IRQ_ROUTING */ > #ifdef __KVM_HAVE_MSIX > case KVM_ASSIGN_SET_MSIX_NR: { > struct kvm_assigned_msix_nr entry_nr; > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 2c3b226..b6f3354 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, > break; > } > #endif > +#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING > + case KVM_SET_GSI_ROUTING: { > + struct kvm_irq_routing routing; > + struct kvm_irq_routing __user *urouting; > + struct kvm_irq_routing_entry *entries; > + > + r = -EFAULT; > + if (copy_from_user(&routing, argp, sizeof(routing))) > + goto out; > + r = -EINVAL; > + if (routing.nr >= KVM_MAX_IRQ_ROUTES) > + goto out; > + if (routing.flags) > + goto out; > + r = -ENOMEM; > + entries = vmalloc(routing.nr * sizeof(*entries)); > + if (!entries) > + goto out; > + r = -EFAULT; > + urouting = argp; > + if (copy_from_user(entries, urouting->entries, > + routing.nr * sizeof(*entries))) > + goto out_free_irq_routing; > + r = kvm_set_irq_routing(kvm, entries, routing.nr, > + routing.flags); > + out_free_irq_routing: > + vfree(entries); > + break; > + } > +#endif /* CONFIG_HAVE_KVM_IRQ_ROUTING */ > default: > r = kvm_arch_vm_ioctl(filp, ioctl, arg); > if (r == -ENOTTY) > -- > 1.6.0.2 > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html