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: 89499 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp7592728qgi; Mon, 2 Jan 2017 05:33:43 -0800 (PST) X-Received: by 10.99.235.10 with SMTP id t10mr106694356pgh.95.1483364023847; Mon, 02 Jan 2017 05:33:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d85si65764390pfb.163.2017.01.02.05.33.43; Mon, 02 Jan 2017 05:33:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933117AbdABNdi (ORCPT + 25 others); Mon, 2 Jan 2017 08:33:38 -0500 Received: from mail-pg0-f53.google.com ([74.125.83.53]:33820 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933059AbdABNdd (ORCPT ); Mon, 2 Jan 2017 08:33:33 -0500 Received: by mail-pg0-f53.google.com with SMTP id y62so152058987pgy.1 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=GHprtYNGCmXTGLdCLxWs187MpbwvlR+U/2JUWqH+YdOkY8GCjcGJVaHmo5Cx8BPunY XodjnIt/KGwkQU0nOOme5s0phmlk/FSRkcyJgz9COsstE/9CIkYo9oezLjEihHt95s1H SbGsnBRtGn0NUH6D1KwEsXOebN6tWC+ehDYPxQjMJRCK1f6KQCbNqHDvagwHsVctYXFf YvqHRX/n0zLz1656sG6Zcvf+nhsdgIuCymJ1g01yNNCxO/1fDbF4AA+bchuqZ8DFe7pe GwANdzJ+cYlBTa/c9oFlyX6KfOmkw7FnyK8idWotdkfvPVpkeKzo3znSm9BNIQOS0shG 2JRg== X-Gm-Message-State: AIkVDXLyMhpXUYl2byAK/AsXc33toY6y/1+8et7PPV8COxuyBDsdP9yduYl3h+3azYvTVE/s 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 1.9.1 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);