From patchwork Mon Jun 13 14:41:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9173261 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 2C9F860573 for ; Mon, 13 Jun 2016 14:43:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EF142040D for ; Mon, 13 Jun 2016 14:43:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1391825EF7; Mon, 13 Jun 2016 14:43:17 +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=ham 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 E97782040D for ; Mon, 13 Jun 2016 14:43:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424476AbcFMOnM (ORCPT ); Mon, 13 Jun 2016 10:43:12 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35907 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424257AbcFMOl4 (ORCPT ); Mon, 13 Jun 2016 10:41:56 -0400 Received: by mail-lf0-f41.google.com with SMTP id q132so48138850lfe.3 for ; Mon, 13 Jun 2016 07:41:55 -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=idpfpXQTarLpW+Q/kSuaTEMqVMSeCgJm7qzFMVJHUIE=; b=j6ugbwIQTxDTYJLFZ05MMGvvVJ5/ydoKfXeWuXyjhM2cptwkyCotLGIVkRRQsGfd4m fYH6MUS23IqavzKMJWtt9ui55t3qpk/gujCBE7Fkk45ifPN3NPcYirhsIzfMjLaYIi+T u8CCKC878ndG8m20/Rhik4lnMiuYdd6lDsi5PqGB9n6L3bLV5Ta0GgXRlpzq0NB8qhKc IqUk5c2yHXXX517oAu/QLKr0OcVu8vBoSyLhRrSx0nc+WW/hlF2YSF7iFjAnqWUTACQb DofMGGCLQ7Ktbaf3qfWLlI7GaLrobe0HyiPjoNt/h2YcudG+hHj5lFx3F8OlF1XkWcBg 2Sew== 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=idpfpXQTarLpW+Q/kSuaTEMqVMSeCgJm7qzFMVJHUIE=; b=GuFziN8D4lqbj3ZYIHmB00u1HVPPi3DLLahG6Y742w0pMlwdAvdCdfclRDYtBPZVOQ RnUYJhWuuo7TgcvXKuGpK14uhMwerFkBLYobDL85fj5qe4NIs6a9vUokIKHByF+mUEQ+ vyxFZZq3WXR0HbP7UzQO7sEKM0Je3O3991xVtfcN6R0NuMx5/uVCDxW8SrXq5m2WCwHO 7qN4CUTrGyso6j6CgMQXBvC8N3HXL+IgGHbHQtFj2PaRGcqUQCvy4LYmVw5ZURJn6Vi9 PWc6wO6Xf5zTeIozLaA0jWJ0cCIfmwtLLIblZtLKMvUdyL5MmF9YRojHURRx/EHWQAB/ SpVw== X-Gm-Message-State: ALyK8tIbGZRATvEPSh4D8K4t+jcksLpzSjk5EtSZuOAeg/uEdCdfysDb4VFCIgvZ+s54JQ== X-Received: by 10.25.149.6 with SMTP id x6mr354653lfd.106.1465828914237; Mon, 13 Jun 2016 07:41:54 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 07:41:53 -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 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, linux-pci@vger.kernel.org, Tomasz Nowicki Subject: [PATCH V6 5/7] irqchip/gicv3-its: Probe ITS in the ACPI way Date: Mon, 13 Jun 2016 16:41:11 +0200 Message-Id: <1465828873-23498-6-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> 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 ITS is prepared for being initialized different than DT, therefore we can initialize it in ACPI way. We collect register base address from MADT table and pass mandatory info to firmware-agnostic ITS init call. Use here IORT lib to register ITS domain which then can be found and used on to build another PCI MSI domain in hierarchical stack domain. NOTE: Waiting for proper ITS and NUMA node relation description in IORT table, we pass around NUMA_NO_NODE to the its_probe_one init call. This means that Cavium ThunderX erratum 23144 (pass1.1 only) is not supported for ACPI boot method yet. Signed-off-by: Tomasz Nowicki Acked-by: Marc Zyngier --- drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-gic-v3-its.c | 59 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index fa33c50..c6e652f 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -32,6 +32,7 @@ config ARM_GIC_V3 config ARM_GIC_V3_ITS bool select PCI_MSI_IRQ_DOMAIN + select IORT_TABLE if ACPI config ARM_NVIC bool diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index f033fd8..7315263 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -15,10 +15,13 @@ * along with this program. If not, see . */ +#include #include #include #include #include +#include +#include #include #include #include @@ -1336,6 +1339,11 @@ static int its_irq_gic_domain_alloc(struct irq_domain *domain, fwspec.param[0] = GIC_IRQ_TYPE_LPI; fwspec.param[1] = hwirq; fwspec.param[2] = IRQ_TYPE_EDGE_RISING; + } else if (is_fwnode_irqchip(domain->parent->fwnode)) { + fwspec.fwnode = domain->parent->fwnode; + fwspec.param_count = 2; + fwspec.param[0] = hwirq; + fwspec.param[1] = IRQ_TYPE_EDGE_RISING; } else { return -EINVAL; } @@ -1690,6 +1698,55 @@ static int __init its_of_probe(struct device_node *node) return 0; } +#ifdef CONFIG_ACPI + +#define ACPI_GICV3_ITS_MEM_SIZE (SZ_128K) + +static int __init gic_acpi_parse_madt_its(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_madt_generic_translator *its_entry; + struct fwnode_handle *dom_handle; + struct resource res; + int err; + + its_entry = (struct acpi_madt_generic_translator *)header; + res.start = its_entry->base_address; + res.end = its_entry->base_address + ACPI_GICV3_ITS_MEM_SIZE - 1; + + dom_handle = irq_domain_alloc_fwnode((void *)its_entry->base_address); + if (!dom_handle) { + pr_err("ITS@%pa: Unable to allocate GICv3 ITS domain token\n", + &res.start); + return -ENOMEM; + } + + err = iort_register_domain_token(its_entry->translation_id, dom_handle); + if (err) { + pr_err("ITS@%pa: Unable to register GICv3 ITS domain token (ITS ID %d) to IORT\n", + &res.start, its_entry->translation_id); + goto dom_err; + } + + err = its_probe_one(&res, dom_handle, NUMA_NO_NODE); + if (!err) + return 0; + + iort_deregister_domain_token(its_entry->translation_id); +dom_err: + irq_domain_free_fwnode(dom_handle); + return err; +} + +static void __init its_acpi_probe(void) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + gic_acpi_parse_madt_its, 0); +} +#else +static void __init its_acpi_probe(void) { } +#endif + int __init its_init(struct fwnode_handle *handle, struct rdists *rdists, struct irq_domain *parent_domain) { @@ -1699,6 +1756,8 @@ int __init its_init(struct fwnode_handle *handle, struct rdists *rdists, of_node = to_of_node(handle); if (of_node) its_of_probe(of_node); + else + its_acpi_probe(); if (list_empty(&its_nodes)) { pr_warn("ITS: No ITS available, not enabling LPIs\n");