From patchwork Tue Aug 9 07:06:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 73522 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp341801qga; Tue, 9 Aug 2016 00:12:09 -0700 (PDT) X-Received: by 10.66.160.41 with SMTP id xh9mr171838488pab.85.1470726726907; Tue, 09 Aug 2016 00:12:06 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ga5si41281284pac.245.2016.08.09.00.12.06; Tue, 09 Aug 2016 00:12:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752455AbcHIHLt (ORCPT + 6 others); Tue, 9 Aug 2016 03:11:49 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:13301 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751324AbcHIHLp (ORCPT ); Tue, 9 Aug 2016 03:11:45 -0400 Received: from 172.24.1.60 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.60]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CGB53235; Tue, 09 Aug 2016 15:07:54 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.235.1; Tue, 9 Aug 2016 15:07:43 +0800 From: Hanjun Guo To: , , CC: "Rafael J. Wysocki" , Marc Zyngier , Thomas Gleixner , Bjorn Helgaas , Greg KH , "Lorenzo Pieralisi" , Tomasz Nowicki , "Ma Jun" , Kefeng Wang , , , , "G Gregory" , Charles Garcia-Tobin , , Hanjun Guo Subject: [RFC PATCH 04/10] irqchip: gicv3-its: platform-msi: scan MADT to create platform msi domain Date: Tue, 9 Aug 2016 15:06:00 +0800 Message-ID: <1470726366-40809-5-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1470726366-40809-1-git-send-email-guohanjun@huawei.com> References: <1470726366-40809-1-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.57A9814A.0081, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 235ac9127b8fe47b2af8b0ad21a31590 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Hanjun Guo With the introduction of its_pmsi_init_one(), we can add some code on top for ACPI support of platform MSI. We are scanning the MADT table to get the ITS entry(ies), then use the information to create the platform msi domain for devices connect to it, just like the PCI MSI for ITS did. Signed-off-by: Hanjun Guo --- drivers/irqchip/irq-gic-v3-its-platform-msi.c | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) -- 1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c index 247010a..b7add84 100644 --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c @@ -15,7 +15,9 @@ * along with this program. If not, see . */ +#include #include +#include #include #include #include @@ -104,6 +106,41 @@ static int __init its_pmsi_init_one(struct fwnode_handle *fwnode, return 0; } +#ifdef CONFIG_ACPI +static int __init +its_pmsi_parse_madt(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_madt_generic_translator *its_entry; + struct fwnode_handle *domain_handle; + const char *node_name; + int err = -ENXIO; + + its_entry = (struct acpi_madt_generic_translator *)header; + node_name = kasprintf(GFP_KERNEL, "ITS@0x%lx", + (long)its_entry->base_address); + domain_handle = iort_find_domain_token(its_entry->translation_id); + if (!domain_handle) { + pr_err("%s: Unable to locate ITS domain handle\n", node_name); + goto out; + } + + err = its_pmsi_init_one(domain_handle, node_name); + +out: + kfree(node_name); + return err; +} + +static void __init its_acpi_pmsi_init(void) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + its_pmsi_parse_madt, 0); +} +#else +static inline void its_acpi_pmsi_init(void) { } +#endif + static void __init its_pmsi_of_init(void) { struct device_node *np; @@ -120,6 +157,7 @@ static void __init its_pmsi_of_init(void) static int __init its_pmsi_init(void) { its_pmsi_of_init(); + its_acpi_pmsi_init(); return 0; } early_initcall(its_pmsi_init);