From patchwork Wed Jul 29 10:08:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 6891921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 77D329F358 for ; Wed, 29 Jul 2015 10:14:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8CDA5207A9 for ; Wed, 29 Jul 2015 10:14:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A96DA207A0 for ; Wed, 29 Jul 2015 10:14:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKOLu-00036U-W9; Wed, 29 Jul 2015 10:12:47 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKOKL-0001Ep-Jy for linux-arm-kernel@lists.infradead.org; Wed, 29 Jul 2015 10:11:10 +0000 Received: by pdbnt7 with SMTP id nt7so3570290pdb.0 for ; Wed, 29 Jul 2015 03:10:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=m1VUyt1tn17W3EvGHNF6lsSIbYAYAZaPMjp+Su4CCfk=; b=L+zBtwfrr0oSjvZTCrjV/O8J8qMKIJhrMB77MhBil/0LZz4hHRFxHq3Df2F1vgxaTa e/z361kYGhbdIQSqEhdjCsN2p3i8IbVa1mNbwMiGUgnyNyNcHYf8qZ4MYhUFCYHYI/x5 rN5OvKOsXMQ6Hqya0J5Y80q/dpUudOkWPWWl2XCqpsUL3PmuFAlb9kk45gsNeHrCODpw bT6ZyTQj7lAnrrLFtq9opzvKhWwiyT7QO/TydYVNvITani5WaJnMZcLGSz+iLTMgL414 WLj9WHRAuMxX6zwlWtZ/LMpa7Tgya73Re/7z2QOHC3OxFxPi7E2b6npAgfX3g4MsIRAj 3+Xw== X-Gm-Message-State: ALoCoQkU6kKooFT/xnFbnLnQZC520ZQBY4+TOXP/Qrho+ShC3ZPU+y/ex+nOCPGsHmOBdQFeV7/Y X-Received: by 10.70.103.145 with SMTP id fw17mr93037464pdb.1.1438164648694; Wed, 29 Jul 2015 03:10:48 -0700 (PDT) Received: from localhost ([180.150.157.4]) by smtp.googlemail.com with ESMTPSA id br14sm35253868pdb.47.2015.07.29.03.10.46 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 29 Jul 2015 03:10:47 -0700 (PDT) From: Hanjun Guo To: Marc Zyngier , Jason Cooper , Will Deacon , Catalin Marinas , "Rafael J. Wysocki" Subject: [PATCH v4 09/10] PCI: ACPI: Bind GIC MSI frame to PCI host bridge Date: Wed, 29 Jul 2015 18:08:58 +0800 Message-Id: <1438164539-29256-10-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438164539-29256-1-git-send-email-hanjun.guo@linaro.org> References: <1438164539-29256-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150729_031109_720792_AEECE926 X-CRM114-Status: GOOD ( 15.87 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Huang , Lorenzo Pieralisi , linux-acpi@vger.kernel.org, Timur Tabi , linaro-acpi@lists.linaro.org, linux-kernel@vger.kernel.org, Tomasz Nowicki , Grant Likely , Mark Brown , Hanjun Guo , Suravee Suthikulpanit , Bjorn Helgaas , Thomas Gleixner , Jiang Liu , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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: Suravee Suthikulpanit This patch introduces pci_host_bridge_acpi_msi_domain(), which queries a GIC MSI irq-domain token and use it to retrieve an irq_domain with DOMAIN_BUS_PCI_MSI bus type, and bind it to PCI host-bridge. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Hanjun Guo --- drivers/pci/pci-acpi.c | 18 ++++++++++++++++++ drivers/pci/probe.c | 3 +++ include/linux/pci-acpi.h | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 314a625..5f11653 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#include #include "pci.h" /* @@ -681,6 +683,22 @@ static bool pci_acpi_bus_match(struct device *dev) return dev_is_pci(dev); } +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN +struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) +{ + struct irq_domain *d = NULL; + void *token = acpi_gic_get_msi_token(&bus->dev); + + if (token) + d = irq_find_matching_host(token, DOMAIN_BUS_PCI_MSI); + + if (!d) + pr_debug("Fail to find domain for MSI\n"); + + return d; +} +#endif /*CONFIG_GENERIC_MSI_IRQ_DOMAIN*/ + static struct acpi_bus_type acpi_pci_bus = { .name = "PCI", .match = pci_acpi_bus_match, diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a7afeac..8c1204c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "pci.h" @@ -670,6 +671,8 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) * should be called from here. */ d = pci_host_bridge_of_msi_domain(bus); + if (!d) + d = pci_host_bridge_acpi_msi_domain(bus); return d; } diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index a965efa..766d045 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -77,6 +77,8 @@ static inline void acpiphp_remove_slots(struct pci_bus *bus) { } static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } #endif +struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus); + extern const u8 pci_acpi_dsm_uuid[]; #define DEVICE_LABEL_DSM 0x07 #define RESET_DELAY_DSM 0x08 @@ -85,6 +87,8 @@ extern const u8 pci_acpi_dsm_uuid[]; #else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } +static inline struct irq_domain * +pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; } #endif /* CONFIG_ACPI */ #ifdef CONFIG_ACPI_APEI