From patchwork Tue Sep 6 09:08:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9316235 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 29123607D3 for ; Tue, 6 Sep 2016 09:13:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E96828B89 for ; Tue, 6 Sep 2016 09:13:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22A5328BFF; Tue, 6 Sep 2016 09:13:20 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 2B27628B89 for ; Tue, 6 Sep 2016 09:13:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhCPq-0000ZZ-Tr; Tue, 06 Sep 2016 09:11:38 +0000 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhCNk-00065E-3M for linux-arm-kernel@lists.infradead.org; Tue, 06 Sep 2016 09:09:32 +0000 Received: by mail-lf0-x229.google.com with SMTP id g62so141433864lfe.3 for ; Tue, 06 Sep 2016 02:09:07 -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=H+xsLiyVMPxfpT8mmgZ8X4iMYYrrjpfu78qJGjE9qmI=; b=1D8/h8kCqHB4TfOjyHAVx9Nt+FP/S9Dyb/8QIFLec/1nmG6/9j3I5spLtRgwyDu2iG 6AesX15RsAerN9pDon8xWcUJkEcBapoe6kkLyVJ4IYhvw1WIfaJpXYiIqZjtcqGh9Xzu a4DLExPaezpx0I8O09TTY0Gc+OzmtjV49V80fduAEdOppUNW/NYz01tPFLfUtc6r4zJH 8vZ/M7UdxnPl0nLM5hHf6LiO9Lxx8zfRMAtdkSFeTOBvJJKv9nNjpMfC20upRLk4lsIC BjlssHMn29By8uoj1ivxJcti2owk/0TmzJ3KczohSLAKZ7VB6m0OwX/zN02G7OYmIWl4 VSfQ== 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=H+xsLiyVMPxfpT8mmgZ8X4iMYYrrjpfu78qJGjE9qmI=; b=JCbYWWstoj0IZvg9wJX8+QO/Uqp6BkkOwst0xDL8RAVqsWbgdAS5Ht7YgDtaA5gP5o Xk3TZ80vF1H/G8TD+wt435zE/KLx0TpphXRnZVAbdY17HJhLQM/4iB4X6+JTPqNiA4Hw XpIB057Qr7jMnUqnjxzc8WmaOkBu/PmXoeJV2gJeTV4h5UqAxAmi/UXnVCo7P/rCliZd 7NTTIA0E8mMq+2auRluozKb42Tw5D/MlhPGOHI0A3Co5JTYOo6dhYzl9MSWhAZrskfSD Q9lLTbTduxJJ7lyK9koQYRQXz8hbpQx4bvgdGbhulhsA9i05ELKMTm08PSLw5A6bnb1z X1vw== X-Gm-Message-State: AE9vXwP+8KuT3duO5jzEvUulC0y/pLBUUex1L9Z4AWBS/NNLr0IOepj2QOWEJajdoIeI6g== X-Received: by 10.46.32.5 with SMTP id g5mr3436740ljg.51.1473152945897; Tue, 06 Sep 2016 02:09:05 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Sep 2016 02:09:05 -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 Subject: [PATCH V10 7/8] irqchip/gicv3-its: Factor out PCI-MSI part that might be reused for ACPI Date: Tue, 6 Sep 2016 11:08:57 +0200 Message-Id: <1473152938-17388-8-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160906_020928_472986_FAE91224 X-CRM114-Status: GOOD ( 12.73 ) 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: graeme.gregory@linaro.org, al.stone@linaro.org, linaro-acpi@lists.linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, okaya@codeaurora.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, hanjun.guo@linaro.org, ddaney.cavm@gmail.com, linux-pci@vger.kernel.org, shijie.huang@arm.com, Tomasz Nowicki , mw@semihalf.com, andrea.gallo@linaro.org, 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-Virus-Scanned: ClamAV using ClamSMTP Firmware agnostic code lands in common functions which do necessary domain initialization based on unique domain handler. DT specific code goes to DT specific init call. Signed-off-by: Tomasz Nowicki Acked-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 44 +++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c index aee60ed..d2c2496 100644 --- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c @@ -106,34 +106,48 @@ static struct of_device_id its_device_id[] = { {}, }; -static int __init its_pci_msi_init(void) +static int __init its_pci_msi_init_one(struct fwnode_handle *handle, + const char *name) { - struct device_node *np; struct irq_domain *parent; + parent = irq_find_matching_fwnode(handle, DOMAIN_BUS_NEXUS); + if (!parent || !msi_get_domain_info(parent)) { + pr_err("%s: Unable to locate ITS domain\n", name); + return -ENXIO; + } + + if (!pci_msi_create_irq_domain(handle, &its_pci_msi_domain_info, + parent)) { + pr_err("%s: Unable to create PCI domain\n", name); + return -ENOMEM; + } + + return 0; +} + +static int __init its_pci_of_msi_init(void) +{ + struct device_node *np; + for (np = of_find_matching_node(NULL, its_device_id); np; np = of_find_matching_node(np, its_device_id)) { if (!of_property_read_bool(np, "msi-controller")) continue; - parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS); - if (!parent || !msi_get_domain_info(parent)) { - pr_err("%s: unable to locate ITS domain\n", - np->full_name); + if (its_pci_msi_init_one(of_node_to_fwnode(np), np->full_name)) continue; - } - - if (!pci_msi_create_irq_domain(of_node_to_fwnode(np), - &its_pci_msi_domain_info, - parent)) { - pr_err("%s: unable to create PCI domain\n", - np->full_name); - continue; - } pr_info("PCI/MSI: %s domain created\n", np->full_name); } return 0; } + +static int __init its_pci_msi_init(void) +{ + its_pci_of_msi_init(); + + return 0; +} early_initcall(its_pci_msi_init);