Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1671597pxb; Wed, 9 Feb 2022 01:47:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/0+UJ1YbHIKqG62SttlBzp6YFfgSg+jej85LECz581wJIe93K+ip58RRfZT+vr28MDyiT X-Received: by 2002:a17:90a:c7cf:: with SMTP id gf15mr2472989pjb.83.1644400066177; Wed, 09 Feb 2022 01:47:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644400066; cv=none; d=google.com; s=arc-20160816; b=oTn2foLSfPxBkhn44DaeK/SCfUJRfVtQ9Xu2H1lMXTbCOsLofdINuwxeZhNu/1mPTG icN85WCpIlIpULwu+0xtEITexFYjKFsr6j9JSPPhks5go7OUp82MCj5Vb2KlYO+XHDGM nlUFjpplWHvY7pF1fPPJNafIo5yFlUe+L2Pr5A7dapmCfUPglIMsMGqb1P3vvsD6mLdQ V4nPfNw7E1TlOB/QWwjY4XQrzp01CuYaq5pjnZaYhyqc68UejwTlK6WwxRIvbrsKJz4V bd6W7gD7vS2BO07BuVmSlKH43ryAPwOtjYIYThl5MoHVwH5S2Iey2zPVAlx+4ZiRq/9R teTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=dScU1dpuY/m5KKGajIgwK7kUzjlZn2xWDcbLHZQf9Zo=; b=F1yhya0dtEQhKXw54+SDZP+X/cI17iRiZl4iO4h3YLRBW8yyswCBdEQedCgTu0QTUw VEfJqVuaqzMp2OU5Nm+s+F4YU7TpYr932n7QZXI8B122IwopaDBY5VUje81Vun7TfSfg H3OTV6c2Ivf1l/4eCKGbo/Va6aSvRD+1cd/RNgpqs786AZMt0SbiDIS//rxJ16ZI3lZ5 R+WceCZg67TCCKZxdi7Cr2llWqRKohLOjDVkDIIxNxvqyF0l0CDaA0+5pchzBH1fQOKZ lXd1EqotJ9Z+J9LRGTeeA3qPblGMlFTb20DcHKvPktjwqPjpWfWW2L2lzMidWUZRoYZn icnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A691zmXw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y4si15129879plg.427.2022.02.09.01.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:47:46 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A691zmXw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0029EDF28A36; Wed, 9 Feb 2022 01:07:35 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379813AbiBHPTl (ORCPT + 99 others); Tue, 8 Feb 2022 10:19:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379804AbiBHPTk (ORCPT ); Tue, 8 Feb 2022 10:19:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 927A9C0613CA for ; Tue, 8 Feb 2022 07:19:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 28D9861476 for ; Tue, 8 Feb 2022 15:19:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62CEBC004E1; Tue, 8 Feb 2022 15:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644333578; bh=fIjxqOup6OwNvRXLtgfT5VcCzdLMcW360tWbTxHYLyo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A691zmXwYzGeuKQXa/N6uWG/wsfSLBJIJOtIyoGzTkIcBq2+cKkBle4kAQZ3gf+LW 6sbg9V+g9m17lomD+4XR/Fq0Nz1KWjzZJ2z9bvoABFRKK4CWEsDwTS+j9diztxWY5U 5UXR0x7A7qrV8mSM9G9B1Thn/AKdWiSATfqkKb9Oq0w8I+1x5yQItdfX9CJ3aHyB0u c+ouxKI86H33fVqpGBCrVmopDZImiC4X5ciw2dWYaI6AzSGK48MqDIEisJYMwKA0h3 FqxURq4I9v4S9ZRK+D6/wRH6yQ9iL48Qy1h7Yr29kRktyncaj9v2KXS2q3qHR2ftsQ 7290lS/6N5klA== Date: Tue, 8 Feb 2022 15:19:32 +0000 From: Will Deacon To: Robin Murphy Cc: Lad Prabhakar , Joerg Roedel , Rob Clark , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, Xin Tan , Sai Prakash Ranjan , "Isaac J. Manjarres" , Rob Herring , linux-kernel@vger.kernel.org, Prabhakar Subject: Re: [PATCH 1/2] iommu/arm-smmu: Use platform_irq_count() to get the interrupt count Message-ID: <20220208151932.GB1802@willie-the-truck> References: <20211223130046.9365-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20211223130046.9365-2-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 23, 2021 at 02:14:35PM +0000, Robin Murphy wrote: > 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. Did you get anywhere with this? December 23rd is long forgotten by now ;) Will