From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752648AbbIKK3g (ORCPT ); Fri, 11 Sep 2015 06:29:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34065 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbbIKK3e (ORCPT ); Fri, 11 Sep 2015 06:29:34 -0400 Subject: Re: [PATCH v7 10/17] KVM: x86: Update IRTE for posted-interrupts To: Feng Wu , alex.williamson@redhat.com, joro@8bytes.org, mtosatti@redhat.com References: <1440492620-15934-1-git-send-email-feng.wu@intel.com> <1440492620-15934-11-git-send-email-feng.wu@intel.com> Cc: eric.auger@linaro.org, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org From: Paolo Bonzini X-Enigmail-Draft-Status: N1110 Message-ID: <55F2AD09.1000009@redhat.com> Date: Fri, 11 Sep 2015 12:29:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1440492620-15934-11-git-send-email-feng.wu@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/08/2015 10:50, Feng Wu wrote: > +int kvm_arch_update_pi_irte(struct kvm *kvm, unsigned int host_irq, > + uint32_t guest_irq, bool set) Please move all of this code to a vmx.c callback instead of adding get_pi_desc_addr. Check if this makes the pi_set_sn and pi_clear_sn callbacks superfluous. Paolo > + if (!irq_remapping_cap(IRQ_POSTING_CAP)) > + return 0; > + idx = srcu_read_lock(&kvm->irq_srcu); > + irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu); > + BUG_ON(guest_irq >= irq_rt->nr_rt_entries); > + > + hlist_for_each_entry(e, &irq_rt->map[guest_irq], link) { > + if (e->type != KVM_IRQ_ROUTING_MSI) > + continue; > + /* > + * VT-d PI cannot support posting multicast/broadcast > + * interrupts to a VCPU, we still use interrupt remapping > + * for these kind of interrupts. > + * > + * For lowest-priority interrupts, we only support > + * those with single CPU as the destination, e.g. user > + * configures the interrupts via /proc/irq or uses > + * irqbalance to make the interrupts single-CPU. > + * > + * We will support full lowest-priority interrupt later. > + * > + */ > + > + kvm_set_msi_irq(e, &irq); > + if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu)) > + continue; > + > + vcpu_info.pi_desc_addr = kvm_x86_ops->get_pi_desc_addr(vcpu);