From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: [PATCH v5 for-xen-4.5 3/3] dpci: In hvm_dirq_assist stop using pt_pirq_iterate Date: Fri, 19 Sep 2014 14:51:37 -0400 Message-ID: <1411152697-13765-4-git-send-email-konrad.wilk@oracle.com> References: <1411152697-13765-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XV3Hb-0006EC-1e for xen-devel@lists.xenproject.org; Fri, 19 Sep 2014 18:51:51 +0000 In-Reply-To: <1411152697-13765-1-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org, ian.campbell@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, keir@xen.org, tim@xen.org Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org As we are now called from dpci_softirq with the outstanding 'struct hvm_pirq_dpci' there is no need to call pt_pirq_iterate which will iterate over all of the PIRQs and call us with every one that is mapped. And then _hvm_dirq_assist figuring out which one to execute. We know which one to execute as 'schedule_dpci_for' is called for the specific 'struct hvm_pirq_dpci' that has an outstanding interrupt. Signed-off-by: Konrad Rzeszutek Wilk --- xen/drivers/passthrough/io.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c index 13433a5..62fdca9 100644 --- a/xen/drivers/passthrough/io.c +++ b/xen/drivers/passthrough/io.c @@ -621,9 +621,13 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector) spin_unlock(&d->event_lock); } -static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci, - void *arg) +static int hvm_dirq_assist(struct hvm_pirq_dpci *pirq_dpci) { + struct domain *d = pirq_dpci->dom; + + ASSERT(d && d->arch.hvm_domain.irq.dpci); + + spin_lock(&d->event_lock); if ( test_and_clear_bool(pirq_dpci->masked) ) { struct pirq *pirq = dpci_pirq(pirq_dpci); @@ -634,13 +638,13 @@ static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci, send_guest_pirq(d, pirq); if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI ) - return 0; + goto out; } if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI ) { vmsi_deliver_pirq(d, pirq_dpci); - return 0; + goto out; } list_for_each_entry ( digl, &pirq_dpci->digl_list, list ) @@ -653,7 +657,7 @@ static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci, { /* for translated MSI to INTx interrupt, eoi as early as possible */ __msi_pirq_eoi(pirq_dpci); - return 0; + goto out; } /* @@ -666,21 +670,12 @@ static int _hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci, ASSERT(pt_irq_need_timer(pirq_dpci->flags)); set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT); } + out: + spin_unlock(&d->event_lock); return 0; } -static void hvm_dirq_assist(struct hvm_pirq_dpci *pirq_dpci) -{ - struct domain *d = pirq_dpci->dom; - - ASSERT(d && d->arch.hvm_domain.irq.dpci); - - spin_lock(&d->event_lock); - pt_pirq_iterate(d, _hvm_dirq_assist, NULL); - spin_unlock(&d->event_lock); -} - static void __hvm_dpci_eoi(struct domain *d, const struct hvm_girq_dpci_mapping *girq, const union vioapic_redir_entry *ent) -- 1.9.3