From patchwork Mon Sep 5 20:05:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9315169 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 C44A6607D3 for ; Mon, 5 Sep 2016 20:12:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B49BF200F5 for ; Mon, 5 Sep 2016 20:12:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A71B5288E9; Mon, 5 Sep 2016 20:12:01 +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=ham 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 41A92200F5 for ; Mon, 5 Sep 2016 20:12:01 +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 1bh0Dr-0002IX-IS; Mon, 05 Sep 2016 20:10:27 +0000 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bh0Bu-00087t-AK for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2016 20:08:32 +0000 Received: by mail-lf0-x232.google.com with SMTP id u14so9948905lfd.1 for ; Mon, 05 Sep 2016 13:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xs7RHpgGgBnMQCwBbDyEQhijo4X1YVzQJ3V8L9WiT/8=; b=xEbnndUCnMwIYJxPp1dYZO2Mw+Br+d3oB0Z+g6CVKRYDdFaJl/3DmjvKb0LFK4ttR8 ioXpahs/oNPlGACkJGxJ59y9NGqz95tN3T3bHoHYA48lzr046U7tpRLb0GjbM1hycbig WyOhQw3P1E9v0VWjcX6h2qs9vlB+WK2UX1qpRfo3G+KAFkQsrDFDkdbA3+GSx5zPrD26 hNjl9p8y2UmOwkKK+tg5f3PEg8/JQzyUTzMMYDf2LGvPpMawi/mn0XxxLKF9JmsRmScA JKV4KVDBH8LX4yxmM11jK58wX8N2M+QipKpDmMSxDBmmlU1mwev0taMKqvBxZGwlFk6g LJ4A== 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=xs7RHpgGgBnMQCwBbDyEQhijo4X1YVzQJ3V8L9WiT/8=; b=LqOQA58CJToIGlozcz7qDGOWnEHTKW71P+vLlgIDu7OOqDBGwGqTEi97qvfaW23Ahf enAKxGDT0/edHPP6nHzv/Im/acOxKGGr14beLvGdx+Ydq0/q2ipRWBKhR64TuKNfH+HX +qRngdNbbxe+Cg4jCXlVidMkag9qK3aQ3P7zKxg/KgQXb5qM8RvRXWpIsMge+3PuqlE9 wfZy6aJnMoeEbv5zwvo71+hi1xdppOJ96R3fGiatldZPNNtU9Dos+lJV7HxY2Rqzu4Ud pCwA+lEBhT6GyxJztuo+gAnI1IXVrUOhG5stLl2VbyarnoKuI1hDLu1evXfGprVLSait 3CpA== X-Gm-Message-State: AE9vXwM9+Owrvh//ERwtURKAvDXy/EFbUVa4ARJ+8n+e1vnNdYsmcH1lOb9MVDQ+rTvc1g== X-Received: by 10.25.169.213 with SMTP id s204mr11775528lfe.57.1473106084192; Mon, 05 Sep 2016 13:08:04 -0700 (PDT) Received: from localhost.localdomain (50-233-148-156-static.hfc.comcastbusiness.net. [50.233.148.156]) by smtp.gmail.com with ESMTPSA id p82sm5068405lfd.15.2016.09.05.13.07.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Sep 2016 13:08:03 -0700 (PDT) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, helgaas@kernel.org, rafael@kernel.org, Lorenzo.Pieralisi@arm.com Subject: [PATCH V9 8/8] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Date: Mon, 5 Sep 2016 22:05:40 +0200 Message-Id: <1473105940-9761-9-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473105940-9761-1-git-send-email-tn@semihalf.com> References: <1473105940-9761-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160905_130826_917453_C838A90B X-CRM114-Status: GOOD ( 12.81 ) 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: graeme.gregory@linaro.org, al.stone@linaro.org, linaro-acpi@lists.linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, okaya@codeaurora.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, hanjun.guo@linaro.org, ddaney.cavm@gmail.com, linux-pci@vger.kernel.org, shijie.huang@arm.com, Tomasz Nowicki , mw@semihalf.com, andrea.gallo@linaro.org, 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-Virus-Scanned: ClamAV using ClamSMTP Let ACPI build ITS PCI MSI domain. ACPI code is responsible for retrieving inner domain token and passing it on to its_pci_msi_init_one generic init call. IORT maintains list of registered domain tokens and allows to find corresponding domain based on MADT ITS subtable ID info. Signed-off-by: Tomasz Nowicki Acked-by: Marc Zyngier Reviewed-by: Hanjun Guo --- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c index d2c2496..ae7221c 100644 --- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -144,9 +145,52 @@ static int __init its_pci_of_msi_init(void) return 0; } +#ifdef CONFIG_ACPI + +static int __init +its_pci_msi_parse_madt(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_madt_generic_translator *its_entry; + struct fwnode_handle *dom_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); + dom_handle = iort_find_domain_token(its_entry->translation_id); + if (!dom_handle) { + pr_err("%s: Unable to locate ITS domain handle\n", node_name); + goto out; + } + + err = its_pci_msi_init_one(dom_handle, node_name); + if (!err) + pr_info("PCI/MSI: %s domain created\n", node_name); + +out: + kfree(node_name); + return err; +} + +static int __init its_pci_acpi_msi_init(void) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + its_pci_msi_parse_madt, 0); + return 0; +} +#else +static int __init its_pci_acpi_msi_init(void) +{ + return 0; +} +#endif + static int __init its_pci_msi_init(void) { its_pci_of_msi_init(); + its_pci_acpi_msi_init(); return 0; }