From patchwork Mon Jun 20 11:02:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9187203 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 8586D6075E for ; Mon, 20 Jun 2016 11:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FEC4265B9 for ; Mon, 20 Jun 2016 11:05:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63E8226992; Mon, 20 Jun 2016 11:05:30 +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 B14C3265B9 for ; Mon, 20 Jun 2016 11:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754604AbcFTLF2 (ORCPT ); Mon, 20 Jun 2016 07:05:28 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:36468 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932450AbcFTLED (ORCPT ); Mon, 20 Jun 2016 07:04:03 -0400 Received: by mail-lf0-f50.google.com with SMTP id q132so35167965lfe.3 for ; Mon, 20 Jun 2016 04:04: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=Iqt2z0KCDi49as4mcvy2edQ6G8G2zi91tYmcx6AVl7M=; b=zZzHiMOn+e08+ez0fGzz9xh1oO+RyXAP28g1K5qaWr8DA8oYRadQJtz+Q4imR8/RXO 5I0xpSRPUQ5DQ/PLtNWRFd3QLV6pimrfYzKVLRIWsSvog6dx88o/+rf7LTOaMZpLzBdQ V1xkCWC7zRwe4RtX0M8ZMWkodDmseNfrLJMN92mJY2I3aaOeqhfKzi9pLEtIWE2FYa9n ipCveS/L2u6JmZ4sdPhFbLFwktNsyQDl2n8XsTuxYJpvgy8Imp4rD2NlVoCk0fo8VZz9 n0Xdei626cN/6K8WNljr9z1IxTG8UkylBdZjA70qOehUk8qaugMDkEuMJqEMGejnyLDE FEzA== 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=Iqt2z0KCDi49as4mcvy2edQ6G8G2zi91tYmcx6AVl7M=; b=PFk9mh1iSwmKCQeBJ63lSB5zHXCt5mTlHYRhLlryJKZuuxy+DA0o+h9tLKqTD1Gfj1 FNH22p7w3psvWEo08VnPqME6rPZP2xAMMWkoT8d5r6GD4N9gA6ogI1iAdXVVmrq5vrN/ Xzd1yf33fndvvNOUxPKYi8rMrIe/DIfyEusd1SVLx2FazmwTHfgegZHNpbCl4NvBkQaO PBiCtZ+oY/FkS0mLJtsqbL6Nb9tObF/f35X+oSqRUj5GeWBFU+nmCtJNVcq3NseXecRs kxCiKLA5U+UTNDmktWK0ve/ULk0IFQh93QAItOofiPtKWiuzUOpdUqng4eBoHCTTFy/5 o2XA== X-Gm-Message-State: ALyK8tJTWD3AN4IzpIZ8l79mKOHXZiEUHylFSKcSsXQakWN8aC2bVlVmPaCIKJrMEypuaQ== X-Received: by 10.25.20.213 with SMTP id 82mr4106382lfu.90.1466420642013; Mon, 20 Jun 2016 04:04:02 -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 e10sm44291lbr.36.2016.06.20.04.03.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jun 2016 04:04:01 -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 V7 8/8] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Date: Mon, 20 Jun 2016 13:02:21 +0200 Message-Id: <1466420541-20101-9-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466420541-20101-1-git-send-email-tn@semihalf.com> References: <1466420541-20101-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 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..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,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; }