From patchwork Tue Sep 6 09:08:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9316175 X-Patchwork-Delegate: bhelgaas@google.com 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 02081607D3 for ; Tue, 6 Sep 2016 09:09:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D1FC28BF8 for ; Tue, 6 Sep 2016 09:09:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0173A28C25; Tue, 6 Sep 2016 09:09:42 +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 2F0E828C2C for ; Tue, 6 Sep 2016 09:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933471AbcIFJJQ (ORCPT ); Tue, 6 Sep 2016 05:09:16 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:33383 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933854AbcIFJJK (ORCPT ); Tue, 6 Sep 2016 05:09:10 -0400 Received: by mail-lf0-f51.google.com with SMTP id h127so38171715lfh.0 for ; Tue, 06 Sep 2016 02:09:09 -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=8bFQuuOo8Xq7hbsLi+ltC7hIcNuVyPnJdqovw7OXVt8=; b=fb2vxWHmHkdu0f4hC+stAu4SiiMZhMzTRzPWiy7GZjxAjCyOOlVk+i09ZLmGgLV90/ MXIQemWIsnu+VAofVmorXRJMYq4CuBfDUl6NSndRp3HsNZTVVdFMcPJdn04jasadYN+G R24zByDDgDlZHWsGUKaOoZmH1WuY08QVgPU1WLITnYqE12K5+y5KxHioyU8GKPlg9Rat 3bSduulJRxt/L9C5DEkksGQ2jT5AI4a3q2umO+hXtJg/MAomS1FuAPzqxd14ICqPE1rp TWhGqr9xn0BLj7KLH4en6sdCoHerRD82eLy/XEZW3cq+3W+N0beOu45vX9LLCSsRU7tN 7rLw== 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=8bFQuuOo8Xq7hbsLi+ltC7hIcNuVyPnJdqovw7OXVt8=; b=kd6/n95r3fb4J63Wx//gO/t77NNGhtnj7YcsaEPFh3eMhhq1TpGcYC6Yy4U4EMmeyi eEXdBrb3LmuljgAtxptt2cPabfPzQxnrtZ+XEggzByIFoG3TPYy77ahrY8ryuHYcYeMU elyipnrWRZKA4jROPes7AI0DtR4tCSBQHDwAFtDTgUy3NhQOLwagErIcQJ1A1bqw3lQd y2daO1UKQe2x7sLyrpzkEdcFpInOYXG2Uuy2YZXVgAYqcyIa7BQ+NkbIgaUtNg6CtEUo 1hEIp0Bbfa+UBa5yBmDqE68GPqky2L1j1dc9jUPBuGi0ihB9TmyrfeGRL/qRGU9pVA2Q aVjQ== X-Gm-Message-State: AE9vXwO3bnceCT6G795qE+ZjCGuq7Vq4S/42t3MI2bDZzQKs5FfVZrGmitdZwf6g7poEGg== X-Received: by 10.46.5.129 with SMTP id 123mr7283627ljf.64.1473152948426; Tue, 06 Sep 2016 02:09:08 -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 184sm5443301lfz.22.2016.09.06.02.09.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Sep 2016 02:09:07 -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 Cc: will.deacon@arm.com, catalin.marinas@arm.com, hanjun.guo@linaro.org, shijie.huang@arm.com, robert.richter@caviumnetworks.com, mw@semihalf.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-acpi@lists.linaro.org, andrea.gallo@linaro.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, al.stone@linaro.org, graeme.gregory@linaro.org, ddaney.cavm@gmail.com, okaya@codeaurora.org, Tomasz Nowicki Subject: [PATCH V10 8/8] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Date: Tue, 6 Sep 2016 11:08:58 +0200 Message-Id: <1473152938-17388-9-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473152938-17388-1-git-send-email-tn@semihalf.com> References: <1473152938-17388-1-git-send-email-tn@semihalf.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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..aee1c60 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; }