Message ID | 1442393409-2623-10-git-send-email-feng.wu@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 16/09/2015 10:50, Feng Wu wrote: > +int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq, > + uint32_t guest_irq, bool set) > +{ > + return !kvm_x86_ops->update_pi_irte ? -EINVAL : > + kvm_x86_ops->update_pi_irte(kvm, host_irq, guest_irq, set); > +} > + Just use "if" here. No need to resend if this is the only comment. > > } > +int __attribute__((weak)) kvm_arch_update_irqfd_routing( > + struct kvm *kvm, unsigned Empty line after "}". Paolo -- 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
> -----Original Message----- > From: Paolo Bonzini [mailto:pbonzini@redhat.com] > Sent: Wednesday, September 16, 2015 5:27 PM > To: Wu, Feng; alex.williamson@redhat.com; joro@8bytes.org; > mtosatti@redhat.com > Cc: eric.auger@linaro.org; kvm@vger.kernel.org; > iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH v8 09/13] KVM: Add an arch specific hooks in 'struct > kvm_kernel_irqfd' > > > > On 16/09/2015 10:50, Feng Wu wrote: > > +int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq, > > + uint32_t guest_irq, bool set) > > +{ > > + return !kvm_x86_ops->update_pi_irte ? -EINVAL : > > + kvm_x86_ops->update_pi_irte(kvm, host_irq, guest_irq, set); > > +} > > + > > Just use "if" here. No need to resend if this is the only comment. I am sorry, I don't quite understand. Do you mean I don't need to include this patch in v9? If so, what about other patches with your Reviewed-by? Thanks, Feng > > > > > } > > +int __attribute__((weak)) kvm_arch_update_irqfd_routing( > > + struct kvm *kvm, unsigned > > Empty line after "}". > > Paolo -- 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
On 17/09/2015 03:51, Wu, Feng wrote: > > >> -----Original Message----- >> From: Paolo Bonzini [mailto:pbonzini@redhat.com] >> Sent: Wednesday, September 16, 2015 5:27 PM >> To: Wu, Feng; alex.williamson@redhat.com; joro@8bytes.org; >> mtosatti@redhat.com >> Cc: eric.auger@linaro.org; kvm@vger.kernel.org; >> iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org >> Subject: Re: [PATCH v8 09/13] KVM: Add an arch specific hooks in 'struct >> kvm_kernel_irqfd' >> >> >> >> On 16/09/2015 10:50, Feng Wu wrote: >>> +int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq, >>> + uint32_t guest_irq, bool set) >>> +{ >>> + return !kvm_x86_ops->update_pi_irte ? -EINVAL : >>> + kvm_x86_ops->update_pi_irte(kvm, host_irq, guest_irq, set); >>> +} >>> + >> >> Just use "if" here. No need to resend if this is the only comment. > > I am sorry, I don't quite understand. Do you mean I don't need to include > this patch in v9? If so, what about other patches with your Reviewed-by? No, I just wrote this email first. If this was the only comment, I could have fixed it up myself. But since there were a few other comments, please send v9 with all the required changes. Thanks, Paolo -- 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
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 79dac02..e189a94 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8293,6 +8293,13 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons, " fails: %d\n", irqfd->consumer.token, ret); } +int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq, + uint32_t guest_irq, bool set) +{ + return !kvm_x86_ops->update_pi_irte ? -EINVAL : + kvm_x86_ops->update_pi_irte(kvm, host_irq, guest_irq, set); +} + EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_inj_virq); EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_page_fault); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 5f183fb..feba1fb 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1174,6 +1174,8 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *, struct irq_bypass_producer *); void kvm_arch_irq_bypass_stop(struct irq_bypass_consumer *); void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *); +int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq, + uint32_t guest_irq, bool set); #endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */ #endif diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index c0a56a1..89c9635 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -266,6 +266,12 @@ void __attribute__((weak)) kvm_arch_irq_bypass_start( struct irq_bypass_consumer *cons) { } +int __attribute__((weak)) kvm_arch_update_irqfd_routing( + struct kvm *kvm, unsigned int host_irq, + uint32_t guest_irq, bool set) +{ + return 0; +} #endif static int @@ -582,13 +588,24 @@ kvm_irqfd_release(struct kvm *kvm) */ void kvm_irq_routing_update(struct kvm *kvm) { + int ret; struct kvm_kernel_irqfd *irqfd; spin_lock_irq(&kvm->irqfds.lock); - list_for_each_entry(irqfd, &kvm->irqfds.items, list) + list_for_each_entry(irqfd, &kvm->irqfds.items, list) { irqfd_update(kvm, irqfd); +#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS + if (irqfd->producer) { + ret = kvm_arch_update_irqfd_routing( + irqfd->kvm, irqfd->producer->irq, + irqfd->gsi, 1); + WARN_ON(ret); + } +#endif + } + spin_unlock_irq(&kvm->irqfds.lock); }
This patch adds an arch specific hooks 'arch_update' in 'struct kvm_kernel_irqfd'. On Intel side, it is used to update the IRTE when VT-d posted-interrupts is used. Signed-off-by: Feng Wu <feng.wu@intel.com> --- v8: - Remove callback .arch_update() - Remove kvm_arch_irqfd_init() - Call kvm_arch_update_irqfd_routing() instead. arch/x86/kvm/x86.c | 7 +++++++ include/linux/kvm_host.h | 2 ++ virt/kvm/eventfd.c | 19 ++++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-)