From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752685AbdIFJsF (ORCPT ); Wed, 6 Sep 2017 05:48:05 -0400 Received: from terminus.zytor.com ([65.50.211.136]:40603 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752269AbdIFJsA (ORCPT ); Wed, 6 Sep 2017 05:48:00 -0400 Date: Wed, 6 Sep 2017 02:46:34 -0700 From: tip-bot for John Keeping Message-ID: Cc: mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, john@metanate.com, marc.zyngier@arm.com Reply-To: marc.zyngier@arm.com, john@metanate.com, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de In-Reply-To: <20170906103540.373864a2.john@metanate.com> References: <20170906103540.373864a2.john@metanate.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/urgent] genirq/msi: Fix populating multiple interrupts Git-Commit-ID: 596a7a1d0989c621c3ae49be73a1d1f9de22eb5a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 596a7a1d0989c621c3ae49be73a1d1f9de22eb5a Gitweb: http://git.kernel.org/tip/596a7a1d0989c621c3ae49be73a1d1f9de22eb5a Author: John Keeping AuthorDate: Wed, 6 Sep 2017 10:35:40 +0100 Committer: Thomas Gleixner CommitDate: Wed, 6 Sep 2017 11:41:20 +0200 genirq/msi: Fix populating multiple interrupts On allocating the interrupts routed via a wire-to-MSI bridge, the allocator iterates over the MSI descriptors to build the hierarchy, but fails to use the descriptor interrupt number, and instead uses the base number, generating the wrong IRQ domain mappings. The fix is to use the MSI descriptor interrupt number when setting up the interrupt instead of the base interrupt for the allocation range. The only saving grace is that although the MSI descriptors are allocated in bulk, the wired interrupts are only allocated one by one (so desc->irq == virq) and the bug went unnoticed so far. Fixes: 2145ac9310b60 ("genirq/msi: Add msi_domain_populate_irqs") Signed-off-by: John Keeping Signed-off-by: Thomas Gleixner Reviewed-by: Marc Zyngier Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20170906103540.373864a2.john@metanate.com --- kernel/irq/msi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 48eadf4..3fa4bd5 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -315,11 +315,12 @@ int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev, ops->set_desc(arg, desc); /* Assumes the domain mutex is held! */ - ret = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg); + ret = irq_domain_alloc_irqs_hierarchy(domain, desc->irq, 1, + arg); if (ret) break; - irq_set_msi_desc_off(virq, 0, desc); + irq_set_msi_desc_off(desc->irq, 0, desc); } if (ret) {