From patchwork Mon Apr 4 08:52:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8738961 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 21F6EC0554 for ; Mon, 4 Apr 2016 08:56:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3379B2024F for ; Mon, 4 Apr 2016 08:56:13 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 491B52021F for ; Mon, 4 Apr 2016 08:56:12 +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 1an0HW-0000xt-Rj; Mon, 04 Apr 2016 08:54:46 +0000 Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1an0GJ-0008VU-RO for linux-arm-kernel@lists.infradead.org; Mon, 04 Apr 2016 08:53:35 +0000 Received: by mail-lb0-x234.google.com with SMTP id qe11so150005459lbc.3 for ; Mon, 04 Apr 2016 01:53: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=lCnEzKn1pivRhGiE0/rApyt/jPtrCLeH4is9rOESa7Q=; b=jyXrIEquEGQt/4V5IZu/R+LTIj1zP41LpVxoUUId2Nu8fbhSRXI3FP2sW4LGEFA/v7 HbnDXnJEQvapju6erw0ba0C+6KKJXR+qVoMI4wbt4cAKmHhFxrd3KF1doo2ED5qsiKrk RGXYZAjo2LiVq1fVyvOKJJRir4e66G2V3tSkJGFLTtEzSXYITdJkvTTZwfsdgZcDEB7u ftXMW77zxcUlYWvjjp1h6Za2FCG7xYaMvVc/woQU7Sii0/W4osXQHCP0Nayg+gWr013O eU2GMWIR4+2qe0geGZqwFy2ZejxCm8aqV8ar7jhMFLWYzW8HtGSm/LrAbXLqHwbQbmtu 9ZIw== 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=lCnEzKn1pivRhGiE0/rApyt/jPtrCLeH4is9rOESa7Q=; b=CJm/Oo0Q54SSmDpU12ITHwx2b1N1ZDZDta0sSD7y+qWRcxApIoxEXbwuwhq4HRLtPL vGoLYlLc/DJ3S93LG3QmcprNxafvvYkBmS3w22EydGhYgaDXf/OtHSD0II6y/XsSXG7G mCtnCYHFkXCCwqsGugCZ/T6vq690NMBF2q7fGd8QxSKyw0ehklm2bpAPVbvzOp7LVsDA SE62TptK6oogAMKN/jrL45sdAicrreTDU64Ljzub+XlQ1hePtiTeJl5ZbqcTEBSgfbjl FbWBy7+V2UHVTb2flqpjLCEvg1IRH0jlgxTt0B6CZtyahTQ4F1CFkl6NAY8sxF2kEsyI wlnA== X-Gm-Message-State: AD7BkJK/oQ5sMwhtSlbYTD7jwmwgAdwCs9RsKEC2iK07vqgJXs3Zb5CMH52ASfp1HoHbng== X-Received: by 10.28.146.202 with SMTP id u193mr10840045wmd.82.1459759992985; Mon, 04 Apr 2016 01:53:12 -0700 (PDT) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id js8sm27765096wjc.37.2016.04.04.01.53.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 01:53: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 Subject: [PATCH V4 7/7] acpi, gicv3, its: Use MADT ITS subtable to do PCI/MSI domain initialization. Date: Mon, 4 Apr 2016 10:52:55 +0200 Message-Id: <1459759975-24097-8-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459759975-24097-1-git-send-email-tn@semihalf.com> References: <1459759975-24097-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160404_015332_387003_6B896A3F X-CRM114-Status: GOOD ( 14.33 ) X-Spam-Score: -2.6 (--) 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, Tomasz Nowicki , mw@semihalf.com, 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-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Let ACPI to build ITS PCI MSI domain. If it succeed, we register IORT domain provider and RID mapper. 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 | 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 06165cb..df269a4 100644 --- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +#include +#include #include #include #include @@ -143,10 +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 *domain_handle; + + its_entry = (struct acpi_madt_generic_translator *)header; + domain_handle = iort_its_find_domain_token(its_entry->translation_id); + if (!domain_handle) { + pr_err("ITS@0x%lx: Unable to locate ITS domain handle\n", + (long)its_entry->base_address); + return 0; + } + + if (its_pci_msi_init_one(domain_handle)) + return 0; + + pr_info("PCI/MSI: ITS@0x%lx domain created\n", + (long)its_entry->base_address); + return 0; +} + +static int __init its_pci_acpi_msi_init(void) +{ + if (acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + its_pci_msi_parse_madt, 0) > 0) { + pci_acpi_register_msi_rid_mapper(iort_pci_get_msi_rid); + pci_acpi_register_dev_msi_fwnode_provider(iort_pci_get_domain); + } + 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 995b7251..fee635e 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -871,8 +871,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();