From patchwork Mon Jan 2 13:31:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 9493629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F1F7762AB4 for ; Mon, 2 Jan 2017 13:35:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2D681FF35 for ; Mon, 2 Jan 2017 13:35:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D73EF266F3; Mon, 2 Jan 2017 13:35:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 797F21FF35 for ; Mon, 2 Jan 2017 13:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933102AbdABNdg (ORCPT ); Mon, 2 Jan 2017 08:33:36 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:32811 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933101AbdABNdd (ORCPT ); Mon, 2 Jan 2017 08:33:33 -0500 Received: by mail-pg0-f51.google.com with SMTP id g1so164954707pgn.0 for ; Mon, 02 Jan 2017 05:33:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9ZbzYwKZXdLZndOqZJIXbU0H4xkUPJxcJiBR16fu04k=; b=dDUsL1qQ1znmNm4364cMlicdm6NQTOMnqvDbYCYmCYuThK0xwg5gRceNDoKTyM1EV8 B4rwnFS7cVcsU79wSPF7dShvXs2OLhTVhAd+h3VsceZd1CvpbM0hl5uTHGWUr2xwuKZN Amsrv3wz2P++NDGrf6Axe59uNu7jUfWwoxKBE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9ZbzYwKZXdLZndOqZJIXbU0H4xkUPJxcJiBR16fu04k=; b=AO9TV/b1pMwCeKliLNeBP0XxWTc4XLKvrRHXq1C3ZNIuZzAtxYB2o9nZbmWS/jZIZX KfXAGhuoQBSgLmHe1P3zKvt72uG5eRifWUOMUlb75o6pcbckzRDZ68QBhNtpESXIL2il 5OKPHjKjjkp+tcQIK4MPCJ0IYAh7mFsYANPS8XyxnExj1xYXHpt+bm0SPQwlL9miLUlj eOwWA82e855duT/kdrlYRbdV2NgxREHnjylqP9DC0sdt7qlWIjgVehwslmLoaX4yEMJy Y/UAf9+a9fnryEnngS9cWeW46UarjjglPWxWBw4oJKkdmNZA3FLueYujq48ILG/rFgXk JIZg== X-Gm-Message-State: AIkVDXLHanWDStySaCQuK233fXxyBHMiZvDfHVQmFDDSqruO/nkxRdzaW6ahymtPR2XIOyfC X-Received: by 10.99.168.69 with SMTP id i5mr108905358pgp.10.1483364012815; Mon, 02 Jan 2017 05:33:32 -0800 (PST) Received: from localhost ([104.237.91.251]) by smtp.googlemail.com with ESMTPSA id d186sm90293419pfd.5.2017.01.02.05.33.31 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 02 Jan 2017 05:33:32 -0800 (PST) From: Hanjun Guo To: Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, Thomas Gleixner , Greg KH , Tomasz Nowicki , Ma Jun , Kefeng Wang , Agustin Vega-Frias , Sinan Kaya , charles.garcia-tobin@arm.com, huxinwei@huawei.com, yimin@huawei.com, Jon Masters , Hanjun Guo Subject: [PATCH v6 07/14] irqchip: gicv3-its: platform-msi: scan MADT to create platform msi domain Date: Mon, 2 Jan 2017 21:31:38 +0800 Message-Id: <1483363905-2806-8-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483363905-2806-1-git-send-email-hanjun.guo@linaro.org> References: <1483363905-2806-1-git-send-email-hanjun.guo@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Sinan Kaya Tested-by: Majun Tested-by: Xinwei Kong Cc: Marc Zyngier Cc: Tomasz Nowicki Cc: Thomas Gleixner --- drivers/irqchip/irq-gic-v3-its-platform-msi.c | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c index ff72704..0be0437 100644 --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c @@ -105,6 +105,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; @@ -121,6 +156,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);