From patchwork Thu Dec 23 13:00:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 12698288 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 7BB0CC433EF for ; Thu, 23 Dec 2021 13:02:26 +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-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R4KXE7GOpGrqEK9CCh2c4CrDqgteoBhAEISrTIxC0LQ=; b=3c9UwkFdqk60SE CC6+aYM9/Z6Z/gRnn8Oi6EsG2R+GJB8FlkZByrLM9ANZzo485+X3sb4uIBbiTc330m5sESOYBM2Ur XRaMKkghmYO2/15VrTYDveAeTzks34yuybiWN/fYSDcxe271U4gQjtOpeudadMsylSt74spdxiEN4 sQn8ZhDv0vfDlgmjxQy4Wga9Ssaitst86tna8aM+/f2jwGh4VbCHonpNT4b2t6P/Jgk9lyrPQZ3ev ArJo6Tz2BD0SG/IsJIQbZaEV3F1LYLM6RZ27I0vB1B1C66HWxT3rA+TVRZ046yFAJ41gsHtXOwzKa oDNIkdptpvlKu0+zFPpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0Nie-00CkQj-Tj; Thu, 23 Dec 2021 13:01:17 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie6.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0NiQ-00CkN7-7R for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 13:01:06 +0000 X-IronPort-AV: E=Sophos;i="5.88,229,1635174000"; d="scan'208";a="104966906" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 23 Dec 2021 22:01:01 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C3D2E4366C26; Thu, 23 Dec 2021 22:00:58 +0900 (JST) From: Lad Prabhakar To: Will Deacon , Robin Murphy , 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 , Lad Prabhakar Subject: [PATCH 1/2] iommu/arm-smmu: Use platform_irq_count() to get the interrupt count Date: Thu, 23 Dec 2021 13:00:45 +0000 Message-Id: <20211223130046.9365-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211223130046.9365-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20211223130046.9365-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211223_050105_249992_B0D13BC1 X-CRM114-Status: GOOD ( 11.71 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(). 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); if (!smmu->num_context_irqs) { dev_err(dev, "found %d interrupts but expected at least %d\n",