From patchwork Mon Jun 20 11:02:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9187207 X-Patchwork-Delegate: bhelgaas@google.com 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 B52F06075E for ; Mon, 20 Jun 2016 11:05:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0B84265B9 for ; Mon, 20 Jun 2016 11:05:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9567B26929; Mon, 20 Jun 2016 11:05:33 +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 24A4B265B9 for ; Mon, 20 Jun 2016 11:05:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754611AbcFTLFb (ORCPT ); Mon, 20 Jun 2016 07:05:31 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:35292 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932446AbcFTLEB (ORCPT ); Mon, 20 Jun 2016 07:04:01 -0400 Received: by mail-lf0-f47.google.com with SMTP id l188so35204328lfe.2 for ; Mon, 20 Jun 2016 04:04:01 -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=WL9U5inN4X4IvI5apn0JFfEy729yygKfVrMD/ZCur0taJNQIuods01U1ULaIPM3vd8 MJHC55NhUNMA1JaYg8dBE5MjkPMhpL8u3lIQTGJwkCkv+s42ZUDvwI3y7oxLvcY67yCz syr98/VpO3v6du14bR1Bq+BwK8C0hJAW0vDgKtvQkLHWYrndWBcDJl0nNZMcN7Gx9a4W lhuqrseZScYKIxZaslxe86skrRLGS5fVQEPzNwuVUDWNvdbpkOWnJJSLyR15ImEAiVJd g1ICreErezIZ0Pi07jxdzIJA4m43jEH80y48XGnmN0xD0s9kd2e6ut4jDQmyxgXuOggK TpQA== 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=agm8nRST5Nlbwy9Tl3Gr7ZEL066l10kU1YqyJs1I6W4UjSkqZ6e1ckTHGctLEvv4gU DkBIK87SIwvdYbvqOHfTxs70kGPgXeUCaaGCpEHZGFMwOgC+63E+k0wuHC2Si6/joIs/ EPv1SA2HRED6rWotxs9ZMigUSZrxOhw5dl0rfdU3V8b6xwROgCrqTg0UcR+UJ5v+9F6U Yh6VwpujQIQMoGqiecaWCd1oiJ6NNXNRGETt6ABTHEhWpWZVeTl9fMEb1Nc5qiO2TINd VSQjqKQ8eys5l5lhfPysWVlpz6s2+Iqukju9ohtsH5Q0uwZ04t/8YFGW3NQtm9TJgfqF z74g== X-Gm-Message-State: ALyK8tLM6N6jAzKxYGCbZJg00ZFUaobqwabnQQjxoa21mJEgPvXqVO4XkCK70pDwnsW0ng== X-Received: by 10.25.212.141 with SMTP id l135mr3340852lfg.69.1466420639596; Mon, 20 Jun 2016 04:03:59 -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.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jun 2016 04:03:58 -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 7/8] irqchip/gicv3-its: Factor out code that might be reused for ACPI Date: Mon, 20 Jun 2016 13:02:20 +0200 Message-Id: <1466420541-20101-8-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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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);