From patchwork Thu Oct 15 14:05:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 7406741 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 20B9DBF90C for ; Thu, 15 Oct 2015 14:10:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95E8C2082B for ; Thu, 15 Oct 2015 14:10:05 +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 0D15B2062F for ; Thu, 15 Oct 2015 14:10:02 +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 1ZmjCT-0005WM-6r; Thu, 15 Oct 2015 14:08:09 +0000 Received: from mail-lb0-f179.google.com ([209.85.217.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmjAy-0003Js-Jz for linux-arm-kernel@lists.infradead.org; Thu, 15 Oct 2015 14:06:40 +0000 Received: by lbcao8 with SMTP id ao8so69941915lbc.3 for ; Thu, 15 Oct 2015 07:06:15 -0700 (PDT) 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=4aLjnp36OrZgWvzty6VzA83+dnkP6KK+lZD6WmuBsSQ=; b=QsGiSdqt2gJTPgldkcqQD+EDQUa7V+pX7/6tfZeyiJUhVY1npYpXd7CB4m/+U4mln8 dStKlugR+9VC3NBOb47zTEm4JX7BbUG76DmlnHI54FI7UF5nG196dKQD9XYylju+eFxj e/BDYBUJTjpndx1W40EsvGTXr3EbR/tCGNMtAoyDmn37MpEyvtu6HLe+XdrEISzYzsiN aeLhff8SvPZuqPp5AAjKIQOpnT0Z9bgmEYpNVAGi+baW0RntZBMG3d9CfghtnYpfYbHx +ttslUg6Zu1BkgJXmFUTwc3AmAMOzWxTqbaSMOZuarz6902ANVIcZexOtqUZZrozeoq6 Ih7A== X-Gm-Message-State: ALoCoQkjAdUD1qnNda9yXlVYT9LpfFZqBdwjhesdCsE1ihPp2jhe7MnY7mBfuXOETTIa+E5+pZ70 X-Received: by 10.112.205.69 with SMTP id le5mr4712867lbc.89.1444917974757; Thu, 15 Oct 2015 07:06:14 -0700 (PDT) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id s126sm2105958lfe.3.2015.10.15.07.06.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Oct 2015 07:06:13 -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 Subject: [PATCH V1 10/10] acpi, gicv3, its: Use MADT ITS subtable to do PCI/MSI domain initialization. Date: Thu, 15 Oct 2015 16:05:19 +0200 Message-Id: <1444917919-21152-11-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444917919-21152-1-git-send-email-tn@semihalf.com> References: <1444917919-21152-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151015_070636_924898_7106B665 X-CRM114-Status: GOOD ( 15.81 ) 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: Suravee.Suthikulpanit@amd.com, graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, ddaney.cavm@gmail.com, Tomasz Nowicki , 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 After refactoring DT code, we let ACPI to build ITS PCI MSI domain and do requester ID to device ID translation using IORT table. 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 | 48 ++++++++++++++++++++++++++++++-- drivers/irqchip/irq-gic-v3.c | 3 +- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c index cfd35da..09ae2d8 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 @@ -59,8 +61,10 @@ static int its_pci_msi_vec_count(struct pci_dev *pdev) static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data) { struct its_pci_alias *dev_alias = data; + u32 dev_id; - dev_alias->dev_id = alias; + dev_alias->dev_id = iort_find_pci_id(pdev, alias, &dev_id) == 0 ? + dev_id : alias; if (pdev != dev_alias->pdev) dev_alias->count += its_pci_msi_vec_count(pdev); @@ -145,10 +149,50 @@ 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_find_its_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; + + pci_msi_register_fwnode_provider(&iort_find_pci_domain_token); + 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) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + its_pci_msi_parse_madt, 0); + 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 27a6b79..b498947 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -894,8 +894,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();