From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00447C433EF for ; Thu, 23 Dec 2021 14:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X9+CltdvT+o/Xv0B33tWaQgsGkr4cKWvcvOGU17/Ngc=; b=p9NAsXCGvSK/LS nrMzu8Cafxk2/MKmnV1OGLDNoeOxls6mWwjwmlVvzt3hyg9MLVWyOZMn2V/bqEYfrEwVPR0rZHxwW 84SMMjCzvDanMMIljjKa1tvSF0B1lmWSsugOSKsN9yxAo/OjRqPNwRvF2Z/G2qnac1H+bL878KiFf xUj4rXceG2QbgtLG4jeiQXu/2ZH6/gUsm7LmYVidf/5UrwyX3UNq9WS/WEdIFO74RcpAqwxIeMbPu EfKk38etk3EGsd6dFevvGLXsdvVPa1FF+tuO7fZKTjWvysS+fpnt1N09gv4kleL1cz1Cum+F+X3jS pO2LUaQIbNVcF+LZT5SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0Orm-00CsLD-Hd; Thu, 23 Dec 2021 14:14:46 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0Ori-00CsKT-KF for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 14:14:44 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 75DE6D6E; Thu, 23 Dec 2021 06:14:41 -0800 (PST) Received: from [10.57.66.229] (unknown [10.57.66.229]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 920083F5A1; Thu, 23 Dec 2021 06:14:39 -0800 (PST) Message-ID: Date: Thu, 23 Dec 2021 14:14:35 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH 1/2] iommu/arm-smmu: Use platform_irq_count() to get the interrupt count Content-Language: en-GB To: Lad Prabhakar , Will Deacon , Joerg Roedel , Rob Clark , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org Cc: Xin Tan , Sai Prakash Ranjan , "Isaac J. Manjarres" , Rob Herring , linux-kernel@vger.kernel.org, Prabhakar References: <20211223130046.9365-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20211223130046.9365-2-prabhakar.mahadev-lad.rj@bp.renesas.com> From: Robin Murphy In-Reply-To: <20211223130046.9365-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211223_061442_750909_DD7C0610 X-CRM114-Status: GOOD ( 19.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-12-23 13:00, Lad Prabhakar wrote: > platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static > allocation of IRQ resources in DT core code, this causes an issue > when using hierarchical interrupt domains using "interrupts" property > in the node as this bypasses the hierarchical setup and messes up the > irq chaining. > > In preparation for removal of static setup of IRQ resource from DT core > code use platform_get_irq_count(). Nit: platform_irq_count() > Signed-off-by: Lad Prabhakar > --- > drivers/iommu/arm/arm-smmu/arm-smmu.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c > index 4bc75c4ce402..4844cd075644 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > @@ -2105,12 +2105,12 @@ static int arm_smmu_device_probe(struct platform_device *pdev) > if (IS_ERR(smmu)) > return PTR_ERR(smmu); > > - num_irqs = 0; > - while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, num_irqs))) { > - num_irqs++; > - if (num_irqs > smmu->num_global_irqs) > - smmu->num_context_irqs++; > - } > + num_irqs = platform_irq_count(pdev); > + if (num_irqs < 0) > + return num_irqs; > + > + if (num_irqs > smmu->num_global_irqs) > + smmu->num_context_irqs += (num_irqs - smmu->num_global_irqs); This seems a bit overcomplicated. I reckon: smmu->num_context_irqs = num_irqs - smmu->num_global_irqs; if (num_irqs <= smmu->num_global_irqs) { dev_err(... should do it. However, FYI I have some patches refactoring most of the IRQ stuff here that I plan to post next cycle (didn't quite have time to get them done for 5.17 as I'd hoped...), so unless this needs to go in right now as an urgent fix, I'm happy to take care of removing platform_get_resource() as part of that if it's easier. Thanks, Robin. > > if (!smmu->num_context_irqs) { > dev_err(dev, "found %d interrupts but expected at least %d\n", _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel