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: 9144367 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 AEE5A60757 for ; Tue, 31 May 2016 11:20:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A24BD27D17 for ; Tue, 31 May 2016 11:20:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9671C281B4; Tue, 31 May 2016 11:20:43 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 45C8327D17 for ; Tue, 31 May 2016 11:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753513AbcEaLUW (ORCPT ); Tue, 31 May 2016 07:20:22 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:33531 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753490AbcEaLUP (ORCPT ); Tue, 31 May 2016 07:20:15 -0400 Received: by mail-lf0-f51.google.com with SMTP id s64so64065353lfe.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=FN70qz6uwu+2bqVeuGALdGXZLkFbNHisM+WsOPnFXNkUFxwgFc04cVXdM37N9hVEIo fucHhDsNQAFLiNen3W+ve1a/aS6CQ37c3TZQ0tLHm+RbL1mawmXeiM3jz3HD/tC/lORs Yyc31s/xiJOeSpMlc/gO2Cz9sgulp4QhgVp/5+D9WS32mzZavZqW+EVU0fHK2efQgKQC jqvlOmMFQwWkvV6YVGaJ4k84YexJ9Bo3OA4FMUpgj4PZm+e2MNoOwAPzVr163V8HleHk 85UmsEAFUvaaLWbyI1vUWS8R1TPRWT4pfcxQpzWRKvNkckk9Sg/X5Y40oSe0d3eXlh3E AFaQ== X-Gm-Message-State: ALyK8tLDuOewYjFUG8ZciSdeKkfjLqONF0leJAnrh2o0GRk/6B9zsBjz6qj07YospbAdcw== 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 Cc: al.stone@linaro.org, mw@semihalf.com, graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ddaney.cavm@gmail.com, okaya@codeaurora.org, andrea.gallo@linaro.org, Tomasz Nowicki 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> 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 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();