From patchwork Mon Jun 13 14:41:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9173233 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 66BCA6086B for ; Mon, 13 Jun 2016 14:42:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 594C726861 for ; Mon, 13 Jun 2016 14:42:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C46727E78; Mon, 13 Jun 2016 14:42:26 +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 1C3E826861 for ; Mon, 13 Jun 2016 14:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423875AbcFMOlz (ORCPT ); Mon, 13 Jun 2016 10:41:55 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:35873 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424257AbcFMOlv (ORCPT ); Mon, 13 Jun 2016 10:41:51 -0400 Received: by mail-lf0-f47.google.com with SMTP id q132so48137235lfe.3 for ; Mon, 13 Jun 2016 07:41:50 -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=TnfIDC1r4iXpGsmDWHBv3bJ+8B7WM+b7z5GF+9tLNqg=; b=rJbkYhxyp6xQZ4NxNRSfV3Iwa0KrE2GriSiNr2e+gwT4oSdeR65BJGEx6/LW1Wfoxc 5nLDf919tPGcn+mEjRUegjLwAEQhN5N/sgg+Boj58i8pHa6db/4HkKiO+eALIzsLzoBd tlilMtIpUufdWh3MuRqKQL4Ewkq6F7XxeewFaMwZ3QgS5Ai3DHkK+sfjlAKiAre0JW1b /5qbMQmfIuUMtjvydiZwoKqUDM7Vy+zdberFTQg7ggkpsAumLNY6Ip8n10r3mwH8Bu/+ WEzFe9hMo6elKRI4wcctgFSPTNaY0F+YUXzWx+SUv0Qjh6Xscbu2MiP04mAI+kDxOzr0 AJzw== 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=TnfIDC1r4iXpGsmDWHBv3bJ+8B7WM+b7z5GF+9tLNqg=; b=k28rkoKXf0lpjm5sbfiwbL3q0HhHRETwwcgPHs40dmgsQksgKHBV3t6CnPg64FqDFM +Ec5OJWC+H3vj3OMNOsnUCNLpCAIfWCj3fSywUyU8QalZHLt4ZRvlgmZgdy2O4ZGHgkq NhMHYLZ19CUAqr3K4P5tIhwGxws//9gOKCebqg7lbkYxnnEw47kOKpNK6Ot7Oegn23lG IQZ6eQKiByBTSfM7Hkgt1u5RuJCMrbyFHuCyt6rIdbDxWRDa0z5PQybSts/0EznEgHPf OaKr1EMoE1uYBAv0TICRUGdWZrUctj1/Y39XyoykQS8RDSVYOiR51ltuO2E2R0i4Xynz xKVQ== X-Gm-Message-State: ALyK8tIB7/K1pPezCzqbkHg7FluoSiP6u1hfBmuYUfGCsoe6ZNEsPpDjAQi6e6tFMDMcIg== X-Received: by 10.25.165.70 with SMTP id o67mr445745lfe.105.1465828909269; Mon, 13 Jun 2016 07:41:49 -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 l79sm394242lfi.40.2016.06.13.07.41.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 07:41:48 -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 V6 3/7] irqchip/gicv3-its: Cleanup for ITS domain initialization Date: Mon, 13 Jun 2016 16:41:09 +0200 Message-Id: <1465828873-23498-4-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465828873-23498-1-git-send-email-tn@semihalf.com> References: <1465828873-23498-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 There is no point to initialize ITS without having msi-controller property in corresponding DT node. However, its_probe is checking msi-controller presence at the end, so we can save our time and do that check prior to its_probe call. Also, for the code clarity purpose, we put domain initialization to separate function. Signed-off-by: Tomasz Nowicki Acked-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its.c | 57 ++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 5eb1f9e..43d32fc 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1507,13 +1507,37 @@ static void its_enable_quirks(struct its_node *its) gic_enable_quirks(iidr, its_quirks, its); } +static int its_init_domain(struct device_node *node, struct its_node *its, + struct irq_domain *parent) +{ + struct irq_domain *inner_domain; + struct msi_domain_info *info; + + info = kzalloc(sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + inner_domain = irq_domain_add_tree(node, &its_domain_ops, its); + if (!inner_domain) { + kfree(info); + return -ENOMEM; + } + + inner_domain->parent = parent; + inner_domain->bus_token = DOMAIN_BUS_NEXUS; + info->ops = &its_msi_domain_ops; + info->data = its; + inner_domain->host_data = info; + + return 0; +} + static int __init its_probe(struct device_node *node, struct irq_domain *parent) { struct resource res; struct its_node *its; void __iomem *its_base; - struct irq_domain *inner_domain; u32 val; u64 baser, tmp; int err; @@ -1605,28 +1629,9 @@ static int __init its_probe(struct device_node *node, writeq_relaxed(0, its->base + GITS_CWRITER); writel_relaxed(GITS_CTLR_ENABLE, its->base + GITS_CTLR); - if (of_property_read_bool(node, "msi-controller")) { - struct msi_domain_info *info; - - info = kzalloc(sizeof(*info), GFP_KERNEL); - if (!info) { - err = -ENOMEM; - goto out_free_tables; - } - - inner_domain = irq_domain_add_tree(node, &its_domain_ops, its); - if (!inner_domain) { - err = -ENOMEM; - kfree(info); - goto out_free_tables; - } - - inner_domain->parent = parent; - inner_domain->bus_token = DOMAIN_BUS_NEXUS; - info->ops = &its_msi_domain_ops; - info->data = its; - inner_domain->host_data = info; - } + err = its_init_domain(node, its, parent); + if (err) + goto out_free_tables; spin_lock(&its_lock); list_add(&its->entry, &its_nodes); @@ -1677,6 +1682,12 @@ int __init its_init(struct device_node *node, struct rdists *rdists, for (np = of_find_matching_node(node, its_device_id); np; np = of_find_matching_node(np, its_device_id)) { + if (!of_property_read_bool(np, "msi-controller")) { + pr_warn("%s: no msi-controller property, ITS ignored\n", + np->full_name); + continue; + } + its_probe(np, parent_domain); }