From patchwork Mon Sep 5 20:05:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9315199 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 7C64F607D3 for ; Mon, 5 Sep 2016 20:12:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D4E6288E4 for ; Mon, 5 Sep 2016 20:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60B5728904; Mon, 5 Sep 2016 20:12:53 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 67FD5288E4 for ; Mon, 5 Sep 2016 20:12:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936078AbcIEUIK (ORCPT ); Mon, 5 Sep 2016 16:08:10 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:34736 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934868AbcIEUHy (ORCPT ); Mon, 5 Sep 2016 16:07:54 -0400 Received: by mail-lf0-f47.google.com with SMTP id u14so9946574lfd.1 for ; Mon, 05 Sep 2016 13:07:53 -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=G5imMdIjJfuizG0gUpRJotG+tP1qy0ZBQatqKEqqQVPvyEdsGmhAF7FSISyCYkt06B iZdh41uds7xWXMqO4Q45TcG9h3h5lAVqq8Yf9FvMTgr+mW7ysY/nIPD5PItSLYfUivAA 7kvMlE/8SNLL7sdPuiGf7I5VC7diDLmV0Ss2hCtNTzmSysGT5o+1nDnvMRHJt+KChcp5 rXxrsCgXek1hi3MMHIKRAMjp7F9FLHEV4cY7aU2x2jfkKdriYbqOtPS+RbieUMIAK3gL d21cDh4/FCAKlpM9zuJbxmtreA9vMDJBXhyViERS2CPUWaJAzmCYDcoE8c4275jatp+M pl/Q== 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=i/7yP4B/5WMvwK1Nelb5XXltDXoqZeIhFY9TGcI+sjfJumifc3Qe+jW2PDWdbqskG0 xpcZuZVnf8+059Qdel/nzZY9q+HSr/IwZ16CK6hxivI4rgJxoad6Ec1jRyxxXWCloRon bq2eAgMJOBxDftXa/c08Sa8PAQ5/cwAPXx4RJz7FzhfzWv8jhQq82fBz9Ww357mK/Ymh GWwwBOyUUAk0kziXy/f81nt+oGlQLcmBUvsmFDbw239GGiU2GsVieZ7UCcQqNRh/AKmB Q24oNcmKnlLWxUsFmuZicK3YBgxKWCKGUXT+4Zqtp7EUfGuRM7/57R6pn+JyA3vmbJ+G GI0A== X-Gm-Message-State: AE9vXwN116s6RLkSvMS8Y3qMbeHsmo77GE1V+qpyvMr8q++0rqbtTASoH/puJ+dazmtD3w== X-Received: by 10.25.210.205 with SMTP id j196mr797461lfg.139.1473106072665; Mon, 05 Sep 2016 13:07:52 -0700 (PDT) Received: from localhost.localdomain (50-233-148-156-static.hfc.comcastbusiness.net. [50.233.148.156]) by smtp.gmail.com with ESMTPSA id p82sm5068405lfd.15.2016.09.05.13.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Sep 2016 13:07:52 -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 V9 7/8] irqchip/gicv3-its: Factor out PCI-MSI part that might be reused for ACPI Date: Mon, 5 Sep 2016 22:05:39 +0200 Message-Id: <1473105940-9761-8-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473105940-9761-1-git-send-email-tn@semihalf.com> References: <1473105940-9761-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);