From patchwork Tue May 31 11:19:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9144393 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 9CF2A60757 for ; Tue, 31 May 2016 11:22:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F78E27D17 for ; Tue, 31 May 2016 11:22:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8432E281B4; Tue, 31 May 2016 11:22:37 +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 71C0B27D17 for ; Tue, 31 May 2016 11:22:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b7hjh-0001Dj-4A; Tue, 31 May 2016 11:21:25 +0000 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b7his-0000dM-DL for linux-arm-kernel@lists.infradead.org; Tue, 31 May 2016 11:20:35 +0000 Received: by mail-lf0-x22a.google.com with SMTP id s64so64065351lfe.0 for ; Tue, 31 May 2016 04:20:14 -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=xoUH7CFRtdpFI7vXV1+AvTOyQeQrb7sfxf13N3NzRLs=; b=QQOeVi5xZQWPyaA0V4tMqQbcXBNN5aRzW1fXwF4+qvjtAL2MM/5jt/WzCP2cUaSCNV jAt65i3MoswMn35JArFmph1Nd0Him8ZVmjy/bpUJW9PDbtiOZab1ljDDyrAeb9irQdD2 K1d1cSwqCqklrByvcpkZ8lc5OwJUg48rQr9PqpsDA/LcDOjVDweeJSdGLaL0gIEKcYLd cSNORZHVq6KC/lpglmQi7a7qzXtYd9hqk+lQPEXwdJZPQ4HkGGJZqr2Miyx39D05VpXT O587oMFCGWq3/V/rGeQrXuYND3U1JlTaQuiGFzKT3dkRov5LQr0FJrtHAgLN5NC/JrM8 ziOQ== 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=xoUH7CFRtdpFI7vXV1+AvTOyQeQrb7sfxf13N3NzRLs=; b=FGhOXFmDGpe90s3iEb5ts1/DVOMwhp3al5f61yuaSI0Vw1MwmvkWbDDOVolDmai2vS CNsQvYt8Vn/Dd9gq7MTyOaT2DVhhmbJ0Iq9ZVq1fHYdSt2nvDgpbErds+xH2GpY3e1+5 DJVbXg5wOQcnpLa9g2vzaLaPEPRM1j2ivvftuZF4gaNq0X5Ldbs7wu/+HURUFezr3OFx u3qfqbYN8K3VrsGS7Q+/b2wZoPXBw+1DR4wDBafXhU6nxN1tNcxIkUABJIMfvW+Ko1K6 Twd4KUlcG9OPzjY+CYTUTYkRmkTyqNEsq6a7FrL9lL2mKI3BwxrmSinZsaCIoPn8tkN9 3v6Q== X-Gm-Message-State: ALyK8tLL8397tP9Ic2GEohAlzSPLhrsb1DNq2+xhhLgO1DfCMab1zpM6fog06Xt7rINJWQ== X-Received: by 10.25.20.97 with SMTP id k94mr10584899lfi.207.1464693613297; Tue, 31 May 2016 04:20:13 -0700 (PDT) Received: from tn-HP-4.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id 66sm5280056lfz.14.2016.05.31.04.20.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 May 2016 04:20:12 -0700 (PDT) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, lorenzo.pieralisi@arm.com, robert.richter@caviumnetworks.com, shijie.huang@arm.com, Suravee.Suthikulpanit@amd.com, hanjun.guo@linaro.org Subject: [PATCH V5 7/7] acpi, gicv3, its: Use MADT ITS subtable to do PCI/MSI domain initialization. Date: Tue, 31 May 2016 13:19:44 +0200 Message-Id: <1464693584-22343-8-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464693584-22343-1-git-send-email-tn@semihalf.com> References: <1464693584-22343-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160531_042034_755196_D9CEBDE8 X-CRM114-Status: GOOD ( 14.67 ) 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: al.stone@linaro.org, graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, okaya@codeaurora.org, linux-acpi@vger.kernel.org, ddaney.cavm@gmail.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 is responsible for retrieving inner domain token and passing it on to its_pci_msi_init_one generic init call. We have now full PCI MSI domain stack, thus we can enable ITS initialization from GICv3 core driver for ACPI scenario. Signed-off-by: Tomasz Nowicki --- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 42 +++++++++++++++++++++++++++++++- drivers/irqchip/irq-gic-v3.c | 3 +-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c index 23679ae..985f5d9 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,10 +145,49 @@ 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; + char node_name[6 + 16 + 1]; // ITS identification name + + its_entry = (struct acpi_madt_generic_translator *)header; + snprintf(node_name, 23, "ITS@0x%lx", (long)its_entry->base_address); + dom_handle = iort_its_find_domain_token(its_entry->translation_id); + if (!dom_handle) { + pr_err("%s: Unable to locate ITS domain handle\n", node_name); + return 0; + } + + if (its_pci_msi_init_one(dom_handle, node_name)) + return 0; + + pr_info("PCI/MSI: %s domain created\n", node_name); + return 0; +} + +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 +inline 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; } - early_initcall(its_pci_msi_init); diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index cee8296..41c1cda 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -951,8 +951,7 @@ static int __init gic_init_bases(void __iomem *dist_base, set_handle_irq(gic_handle_irq); - if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis() && - to_of_node(handle)) /* Temp hack to prevent ITS init for ACPI */ + if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis()) its_init(handle, &gic_data.rdists, gic_data.domain); gic_smp_init();