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: 9493631 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 6656562AB4 for ; Mon, 2 Jan 2017 13:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 550601FF35 for ; Mon, 2 Jan 2017 13:35:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47D41266F3; Mon, 2 Jan 2017 13:35:40 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id D15FD1FF35 for ; Mon, 2 Jan 2017 13:35:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2kd-0005wL-4h; Mon, 02 Jan 2017 13:34:11 +0000 Received: from mail-pg0-x234.google.com ([2607:f8b0:400e:c05::234]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2kO-0005aS-Ex for linux-arm-kernel@lists.infradead.org; Mon, 02 Jan 2017 13:34:02 +0000 Received: by mail-pg0-x234.google.com with SMTP id f188so203998307pgc.3 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=qBO1LJptvhA0lrPIIYw6cjbk84aHiJszgajrXYJX/KTfcSONMwQk2moEvvEQz+OXU5 9xgXvWquxuM/pBRUjf/HIv4QieJfQUpCKgayYyKdVuuA/nr08s33xP0xRYS1kNr7fcHQ 4rILewOcxiMS9q26cDjF1LFcF6Mv3fnIb3VT4/j90PTeBe6vxFC5NUtowGl/VESs95Im ftGETOT6JvO6foUzZiN9qqQlMnvz/gQqO65OzGao9pv1zDVCQCgSilhQ6HSXYtk7uHoY ZAEAV/0GHwNTO/KcRLonZypPR37EBWuMzsXe8nvYza4EmAj8RUNzDHuSkGIip6vc/vxH qYAw== X-Gm-Message-State: AIkVDXKJSCwLiTzyVW2Y8jlmRWLBHPDPl59ScmqjD1hN1Ox5IdzPUQlKM64mQMhQEgQHNAaH 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170102_053356_854069_180B1242 X-CRM114-Status: GOOD ( 13.26 ) 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: huxinwei@huawei.com, Kefeng Wang , charles.garcia-tobin@arm.com, Jon Masters , yimin@huawei.com, Greg KH , linux-kernel@vger.kernel.org, linuxarm@huawei.com, Sinan Kaya , linux-acpi@vger.kernel.org, Hanjun Guo , Tomasz Nowicki , Thomas Gleixner , Agustin Vega-Frias , linux-arm-kernel@lists.infradead.org, Ma Jun MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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);