From patchwork Thu Aug 11 10:06:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9274929 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 B1FCC60CDC for ; Thu, 11 Aug 2016 10:07:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A155C285E4 for ; Thu, 11 Aug 2016 10:07:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95B17285E9; Thu, 11 Aug 2016 10:07:48 +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=unavailable 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 31BEE285E7 for ; Thu, 11 Aug 2016 10:07:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752881AbcHKKHG (ORCPT ); Thu, 11 Aug 2016 06:07:06 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35072 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752869AbcHKKHD (ORCPT ); Thu, 11 Aug 2016 06:07:03 -0400 Received: by mail-wm0-f44.google.com with SMTP id f65so19919304wmi.0 for ; Thu, 11 Aug 2016 03:07: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=H+xsLiyVMPxfpT8mmgZ8X4iMYYrrjpfu78qJGjE9qmI=; b=POmnHycdtoV/DJNHSNUrnorCi5RLcpARE1833RY6FacgBaKKYMcypSHSVExzVlgWLk 10yxJXY1iERdiIcX7uQ3OnZI9wXnVE9R/rv/nC7PLzbDyvUTJU8LTFaUZYh4cexrAsMV 3YbLwPiIYovBgags2ytaFOAw0q6QslX14wtpn+fsM0Yk6/5f1VLB89uV+l3sBaC5ZH4d N9YAG2KjXj7MTOijGTbYBVzpt8kRVQDH8H6AJTky0Nlv015l1Ao8ehmifh5Xh6BjUKjI EeQ55laqCE7rxbUoGUVb1vpfBocoZM9ShfROw3gXhAIngKIICY0R8Q7LDJ0xI7JrXZjc 5wBA== 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=XbEYkgQNoQ8Qscom6FNmHbAOJZmg0hTgSh+lGu/YLzg74A5ufPMtDj3otIKZ9l0ozg QtI/wqO3a7mUlINaYvEZC0tTVBQHD6nT8nyRtUnRZ7+B+4MarOhlTIpIL/PBR+Pbe8Ob yU/3MQ0X7VNpychoQw9aGG/LEDJ8hFiKmaOYiIHHkj3b11NmDG9WxFEJu64KUhK7brpw ecTZZ2DPU8M/D96tB+k1Un/zuJeGom5VIv7YBQyatEB8cGfy6eJqrZJhwvq7LGQFxm2F GSMdrcL9MdAgEILgwA//MkrHwYTjv650wNKToc3DtJp6gzcEoQSKDyJxxh+fQ0RzDDPV 5Wqw== X-Gm-Message-State: AEkoout6pCmBnZciXbTNT8dySJSG+1SCdM1GXMok99Ij05r/Ue1vOlbIspxLY3J9YR8XqQ== X-Received: by 10.46.1.35 with SMTP id 35mr1382450ljb.8.1470910021284; Thu, 11 Aug 2016 03:07:01 -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 p21sm448233lfp.4.2016.08.11.03.06.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 03:07:00 -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 V8 7/8] irqchip/gicv3-its: Factor out PCI-MSI part that might be reused for ACPI Date: Thu, 11 Aug 2016 12:06:37 +0200 Message-Id: <1470909998-16710-8-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470909998-16710-1-git-send-email-tn@semihalf.com> References: <1470909998-16710-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 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);