From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966479AbcAZPFI (ORCPT ); Tue, 26 Jan 2016 10:05:08 -0500 Received: from terminus.zytor.com ([198.137.202.10]:50142 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965184AbcAZPFD (ORCPT ); Tue, 26 Jan 2016 10:05:03 -0500 Date: Tue, 26 Jan 2016 07:04:30 -0800 From: tip-bot for Marc Zyngier Message-ID: Cc: grant.likely@linaro.org, robh+dt@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, marc.zyngier@arm.com, thomas.petazzoni@free-electrons.com, gregkh@linuxfoundation.org, frowand.list@gmail.com, hpa@zytor.com, jiang.liu@linux.intel.com, mingo@kernel.org Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, robh+dt@kernel.org, grant.likely@linaro.org, thomas.petazzoni@free-electrons.com, marc.zyngier@arm.com, frowand.list@gmail.com, gregkh@linuxfoundation.org, hpa@zytor.com, jiang.liu@linux.intel.com, mingo@kernel.org In-Reply-To: <1453816347-32720-2-git-send-email-marc.zyngier@arm.com> References: <1453816347-32720-2-git-send-email-marc.zyngier@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/urgent] irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token Git-Commit-ID: 530cbe100ef7587aa5b5ac3a4b670cda4d50e598 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: 530cbe100ef7587aa5b5ac3a4b670cda4d50e598 Gitweb: http://git.kernel.org/tip/530cbe100ef7587aa5b5ac3a4b670cda4d50e598 Author: Marc Zyngier AuthorDate: Tue, 26 Jan 2016 13:52:25 +0000 Committer: Thomas Gleixner CommitDate: Tue, 26 Jan 2016 16:00:14 +0100 irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token Let's take the (outlandish) example of an interrupt controller capable of handling both wired interrupts and PCI MSIs. With the current code, the PCI MSI domain is going to be tagged with DOMAIN_BUS_PCI_MSI, and the wired domain with DOMAIN_BUS_ANY. Things get hairy when we start looking up the domain for a wired interrupt (typically when creating it based on some firmware information - DT or ACPI). In irq_create_fwspec_mapping(), we perform the lookup using DOMAIN_BUS_ANY, which is actually used as a wildcard. This gives us one chance out of two to end up with the wrong domain, and we try to configure a wired interrupt with the MSI domain. Everything grinds to a halt pretty quickly. What we really need to do is to start looking for a domain that would uniquely identify a wired interrupt domain, and only use DOMAIN_BUS_ANY as a fallback. In order to solve this, let's introduce a new DOMAIN_BUS_WIRED token, which is going to be used exactly as described above. Of course, this depends on the irqchip to setup the domain bus_token, and nobody had to implement this so far. Only so far. Signed-off-by: Marc Zyngier Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Frank Rowand Cc: Grant Likely Cc: Thomas Petazzoni Cc: Jiang Liu Link: http://lkml.kernel.org/r/1453816347-32720-2-git-send-email-marc.zyngier@arm.com Signed-off-by: Thomas Gleixner --- include/linux/irqdomain.h | 1 + kernel/irq/irqdomain.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index f64622a..04579d9 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -70,6 +70,7 @@ struct irq_fwspec { */ enum irq_domain_bus_token { DOMAIN_BUS_ANY = 0, + DOMAIN_BUS_WIRED, DOMAIN_BUS_PCI_MSI, DOMAIN_BUS_PLATFORM_MSI, DOMAIN_BUS_NEXUS, diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 8cf95de..d751797 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -575,10 +575,15 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec) unsigned int type = IRQ_TYPE_NONE; int virq; - if (fwspec->fwnode) - domain = irq_find_matching_fwnode(fwspec->fwnode, DOMAIN_BUS_ANY); - else + if (fwspec->fwnode) { + domain = irq_find_matching_fwnode(fwspec->fwnode, + DOMAIN_BUS_WIRED); + if (!domain) + domain = irq_find_matching_fwnode(fwspec->fwnode, + DOMAIN_BUS_ANY); + } else { domain = irq_default_domain; + } if (!domain) { pr_warn("no irq domain found for %s !\n",