From patchwork Mon Jun 13 14:41:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9173287 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 B775560573 for ; Mon, 13 Jun 2016 14:44:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9D2D1FF12 for ; Mon, 13 Jun 2016 14:44:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EA2C2040D; Mon, 13 Jun 2016 14:44:36 +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 5C1461FF12 for ; Mon, 13 Jun 2016 14:44: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 1bCT5H-0005ws-5s; Mon, 13 Jun 2016 14:43:23 +0000 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bCT4J-000533-6q for linux-arm-kernel@lists.infradead.org; Mon, 13 Jun 2016 14:42:24 +0000 Received: by mail-lf0-x234.google.com with SMTP id q132so48140874lfe.3 for ; Mon, 13 Jun 2016 07:42:02 -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=h3xF5QdJJGZAZFuM/4QZBzcM9EpAfuiAPQw8ENviY5I=; b=TmG7Cy8dbhBQLQfQw0P5byTSh8MA3qZ1VLshk1KJGQtJ71EXpw3cRfvJAYxRgEwt7D xWPMwsW4cnUZV2N56KXYnWTblsDJQWepgACLyqDDy7PQzonoH9CNagFlH+A3Fd6LuoA1 yTaHZXAm+U6yKZ1ZPXWsaraBhcEIVdBTEFkv/tFK2YPIZy4JMQ73I7rSlJ5WYd/sA3mK 0gPHvS1oqpMNPCjabX454PzM+cb2YBUxLG20Ll1sU5F3kihNLTyplH/3JGLndlg5p9xz N6Xc68Seu+KRT1i1CiFkvsoo3dmUAP4isNc+vzZv8T0KQ4e1MHfQegmSYTaF5V6rPQqk vgYw== 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=h3xF5QdJJGZAZFuM/4QZBzcM9EpAfuiAPQw8ENviY5I=; b=VxGA6i3LmUZjO70zFjpA8Bf1k/YMmGLsezcVsRuLwQVrE+Mt/CztzxsaYASCnv12UX Dw9udXQCOy1YJnIEI9y167vhpKq41mD4rPoYzdiVhdC7li3dpUKRVVXVp0XJ59u8m6zQ Na8kfXtqreTDcuA7PMYW324dTIweQlaivAbvj6xdom7dMjsbe2aD+LKJzlt081JIy+dY 1X1E7aVywiRpX3zcp6xARj1KhPU52o24haU8sFAk+4T1ned2AdPO/X2FxgtDip/ioRlB Ecor9K0nvhputoSDMq3VM/tR/qz8PjirOr8XPygSfm9Eg9Ij4f9FY9/AFKENE89Lty36 7K+g== X-Gm-Message-State: ALyK8tJn5jnVn1Hypz3dTVcGOtSmTvC7bhpjdIQpDcyRw2ggfJq4ImSEA7SSlECVLzcDog== X-Received: by 10.25.149.75 with SMTP id x72mr357134lfd.156.1465828920969; Mon, 13 Jun 2016 07:42:00 -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 l79sm394242lfi.40.2016.06.13.07.41.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 07:41:59 -0700 (PDT) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, bhelgaas@google.com, lorenzo.pieralisi@arm.com, robert.richter@caviumnetworks.com, shijie.huang@arm.com, Suravee.Suthikulpanit@amd.com, hanjun.guo@linaro.org Subject: [PATCH V6 7/7] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Date: Mon, 13 Jun 2016 16:41:13 +0200 Message-Id: <1465828873-23498-8-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465828873-23498-1-git-send-email-tn@semihalf.com> References: <1465828873-23498-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160613_074223_639241_1FD08CC3 X-CRM114-Status: GOOD ( 14.28 ) 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, linux-pci@vger.kernel.org, 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 Acked-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 46 +++++++++++++++++++++++++++++++- drivers/irqchip/irq-gic-v3.c | 3 +-- 2 files changed, 46 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..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,10 +145,53 @@ 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; } - early_initcall(its_pci_msi_init); diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 019b442..2a8b2e1 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();