From patchwork Fri Sep 11 00:01:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jake Oshins X-Patchwork-Id: 7156541 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8D19BBEEC1 for ; Fri, 11 Sep 2015 00:11:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B689D20816 for ; Fri, 11 Sep 2015 00:11:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D67B92080E for ; Fri, 11 Sep 2015 00:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752073AbbIKALJ (ORCPT ); Thu, 10 Sep 2015 20:11:09 -0400 Received: from o1.f.az.sendgrid.net ([208.117.55.132]:6180 "EHLO o1.f.az.sendgrid.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751726AbbIKAJk (ORCPT ); Thu, 10 Sep 2015 20:09:40 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:cc:subject:in-reply-to:references; s=smtpapi; bh=H+l+cZc/UxCTiaC15ftpl/xh6A4=; b=sDR4RhVNqjLsv1w2DlS8EQSo/V26Z kIjY21LjdK1fxnvLjmBawmplMKdUwMGEZ4nBiUxcwPY1ZICkFU2ny7nWmil3Fo69 e5XbV8MFvYYk8XN/Y+bhPpNUZTz5Rqb6pylqBz6N1ChruKRZzHv4eU8QTmKEt5GB 9EgUdeY9WjeUJo= Received: by filter-487.sjc1.sendgrid.net with SMTP id filter-487.7895.55F21A8A2 2015-09-11 00:04:26.268581199 +0000 UTC Received: from jakeoshinsu2.jakeoshinsu2.d1.internal.cloudapp.net (unknown [104.210.40.47]) by ismtpd-046 (SG) with ESMTP id 14fb9b7aa5f.502f.1adba19 Fri, 11 Sep 2015 00:04:25 +0000 (UTC) From: jakeo@microsoft.com To: gregkh@linuxfoundation.org, kys@microsoft.com, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, linux-pci@vger.kernel.org, bhelgaas@google.com, tglx@linutronix.de Cc: Jake Oshins Subject: [PATCH v2 04/12] drivers:pci: Add IRQ domain lookup by PCI domain Date: Fri, 11 Sep 2015 00:01:03 +0000 Message-Id: <1441929670-10058-5-git-send-email-jakeo@microsoft.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441929670-10058-1-git-send-email-jakeo@microsoft.com> References: <1441929670-10058-1-git-send-email-jakeo@microsoft.com> X-SG-EID: lfnueJVzSjg1mfuVqqukVH7tZvRy9mfCIcBnfbfzaMMWVgeXPdEksBJQKTtitQJWBjd+oeRa6oW71Y S2zMq5Zch+tH38eK+eZKomPOhiOaezFpZFLWXeq+seFLhUiPai7lIKeN5lMXkjaVZ2e+WLNBU/GZN0 Luik5SRtSzn0Veg= Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_GREY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jake Oshins The PCI driver currently looks up IRQ domains for root PCI buses by walking up the Open Firmware tree looking for any that cover this particular PCI root. Since x86 PCs don't implement Open Firmware, this patch offers an alternative lookup by the PCI domain ID (known as "segment" in the PCI and ACPI specs.) I could have tried to build a (fake) Open Firmware tree and leverage the old code, but I rejected that possibility both because it would have required changes in lots of other places and because most distributions don't even compile in the OF infrastructure when targeting PCs. Signed-off-by: Jake Oshins --- drivers/pci/probe.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 0b2be17..e7e5ff3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "pci.h" @@ -663,12 +664,22 @@ static void pci_set_bus_speed(struct pci_bus *bus) static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) { struct irq_domain *d; + int pci_domain; /* * Any firmware interface that can resolve the msi_domain * should be called from here. */ d = pci_host_bridge_of_msi_domain(bus); + if (d) + return d; + + /* + * If firmware couldn't help find, it try looking it up by PCI + * domain/segment. + */ + pci_domain = pci_domain_nr(bus); + d = irq_find_matching_host(NULL, DOMAIN_BUS_PCI_MSI, &pci_domain); return d; }