Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1678785pxb; Wed, 9 Feb 2022 02:00:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQXp3KxN9pPKqY2kkmXZKcKb5+zFRPc7HOJ6Myf0aP2d8O0vJe2bGqigWkNqtyfSkP9+sJ X-Received: by 2002:a63:f52:: with SMTP id 18mr1276086pgp.187.1644400812126; Wed, 09 Feb 2022 02:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644400812; cv=none; d=google.com; s=arc-20160816; b=PbF01nwc32gUOBPkLZCNIjviXIfX/NbK9J8HXZIWK+gS4sOMYPfNTTDIncWoXXO0CI 0X2OjuI9y15bimNsCRWUQ2/MHKU4UL51np7ZQq6o/3BGO6QCIj/QV8xVlnF8Ig9DN+Aw 0H2/nsxBiOD2ujRAcoVhPdZLNIaWJhQJeol9PB59wOp/nEIiStHNY3rT4xcioG3WIYXq 2op+tSJCi72ZnJgEPaz2NGs3JOBAjXlbeYtCE3hnPQ/YjALJCQS72bX5FWP3e3UqnchY /GoWQ6eTwsZ7F+1+eI/bDGXzBmYPGOHck0G/6ctf75+HWyJG6Fiq/PwSiHz5TKuhQ6/+ eG8w== 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=KqLBtJRXt91YFBn/C0KverEKpHVqBKGpU7sxJkitZxA=; b=CdEjc7YKJRTdXKD5M0o/2+wfeAKMPmZ3Qbq/KAwwSUKIIx1h0RcJc5f4xImsOOAs9o 6t/15LveICu/eXrtRGuuv9UNx/vGI2LUC05AedI0RR+eaNDMuj+Eg7B008EmE2rUfKW4 J/FDiwJgLWWHBkVLlQGg6uZu6p8aBS35MgbzB9tyvPkR+XId9Qgs2VuPlshW++M0LZNt DHhh7gos+/sCyvUpC560RKvumDQOtkqzviMz1bliWHJ+l3LD2YPTrLw8/ZbwkrWmD2Ju phY37lYTB9VEflPbN10lpO+PJ9rnReIiwT2caX1JOzZzSYFKO0lj7rDqQ6fYQzmjX3Pb ChPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ouw1+av2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s1si15885353pgo.597.2022.02.09.02.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:00:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ouw1+av2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 D3C64E07BF47; Wed, 9 Feb 2022 01:12:06 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380441AbiBHPcB (ORCPT + 99 others); Tue, 8 Feb 2022 10:32:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235109AbiBHPcA (ORCPT ); Tue, 8 Feb 2022 10:32:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5584C061576 for ; Tue, 8 Feb 2022 07:31:59 -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 4C1E2615C7 for ; Tue, 8 Feb 2022 15:31:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F8F2C340E9; Tue, 8 Feb 2022 15:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644334318; bh=L0p/sE9csIRwSUuble/l//7GDvjyfHoLqprBqHetPSc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ouw1+av2qOU9Y88Pio/kOxI/2jxsqngUdvYjkPsq0DGvW0wvZjBPSv7J43exny63Z 2Jq+TXc8J1EkXvbcfVnIPVggcz7rWd5ZmWfpfroAQfch+SXB/HnBePi5diiAYy+9ek 7Gi0QplCwPQIJA0pDJ/3psDaRXngU3NfjL7Y5I72ZBGiQd/i2NBFluOMvphmC4GJM8 svFHDDl/lx9IXUlgnp1hYa2IhId0BlUdVN2URhNtxlM1rSqPpQp62ngDxc/9RxRK29 HZ/ZgxNO42Hc8oXVE30B8DzAdv+ZtLzZJO+sbsWdWz8y4yHID7z3kS0HG0P4+oh8UA mThwvlwoh0fEA== Date: Tue, 8 Feb 2022 15:31:52 +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: <20220208153152.GC1802@willie-the-truck> References: <20211223130046.9365-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20211223130046.9365-2-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220208151932.GB1802@willie-the-truck> 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 Tue, Feb 08, 2022 at 03:28:50PM +0000, Robin Murphy wrote: > On 2022-02-08 15:19, Will Deacon wrote: > > 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 ;) > > Yup: https://gitlab.arm.com/linux-arm/linux-rm/-/commit/b2a40caaf1622eb35c555074a0d72f4f0513cff9 > > I'm still cleaning up the PMU driver that justifies the whole thing, but I > can send that patch now if you reckon it's not complete nonsense out of > context. Otherwise, I'll aim to get the whole lot out next week. Next week is fine, no rush. I was just trying to work out what to do with Lad's patches in this thread and it sounds like I should ignore them and wait for your series instead. Will