From patchwork Mon Jul 15 10:51:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13733319 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 3B8EDC3DA5D for ; Mon, 15 Jul 2024 10:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version: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=52Jkl2G2ah6gRyKV2ASHd7/mqOleOHsmqeJvWmsq9dg=; b=MTawzLFh/eHiWGFOVKCUSdqflN cSjCqZGyS71304wOCrVNGTL6PDd4OoU7gv5p2XrThZe+GlbvlInI7wLibMu1XcCR2/z8Rf4PiDKIp wNi6XDsS7gp+IveRLf+9JH9ZrBJs4qA531J3j4zwphFkIhgJPzf0jiIQTrA4DDyqqOMEN7W5ChlAh XYWHk2CMtZbQUzRojWi8sU0F+NAKdqte7xONeLTcuQT7PHCIBSIlIr4gHe6begv1worbeOC4fBQN6 FKatf/LZws0GzxWP4N3QXGN6H/lCCr05s+zi2sdU8umF7OE1b6esOgu4vw83fAPuwEnfWsOb18NKO HJB72Y7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTJMN-00000006mGI-3KtT; Mon, 15 Jul 2024 10:55:11 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTJJo-00000006lT7-2Ai3 for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 10:52:33 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C88F6CE0ECE; Mon, 15 Jul 2024 10:52:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7FFAC4AF0B; Mon, 15 Jul 2024 10:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721040750; bh=ospChZBh29PvY9nOnz0jXXLFXiWBOOs16kUH2ioQPuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/zLUO0+RAM1+cCBK4jLHy1/42heldS4BzheYqFNx9olC2OVmRUyPRcePnm2OUq92 b+zRTu1vSOCGvByuJo1gmRnQV29dMRApIsJ6Uy+kRimIpFzvfsn/6GKCVAueHK2PiG GIk+DtGpYBng4zuPvYdMfiSQMzKMJj1ltrsb7DD/k9nFPl4W0tP/9GXPxEEvz0gD7G 06A8Wpf8ItrE7SmrmvaxrIRkxVGycEI7Y3IK/s0HJIgRC0wl6rRtUZrlp8GlNvLL85 2MvfwyBika7Oy/8fRxmMLCxNEw38DtJ7T6gjC+sqbokJQNXsu9igc9xeqBsP7Hcd6S NlHdGL44Ozmgg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH 10/13] irqchip/armada-370-xp: Fix reenabling last per-CPU interrupt Date: Mon, 15 Jul 2024 12:51:53 +0200 Message-ID: <20240715105156.18388-11-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240715105156.18388-1-kabel@kernel.org> References: <20240715105156.18388-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_035232_754750_DFA0CFA3 X-CRM114-Status: GOOD ( 14.98 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The number of per-CPU interrupts is 29 (0 to 28). This is described by the constant MPIC_MAX_PER_CPU_IRQS, set to 28 (the maximum per-CPU interrupt). Commit 0fa4ce746d1d ("irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time") used the constant incorrectly in the for-loop, it used the operator < instead of <=, causing it to iterate only the first 28 interrupts (0 to 27), ignoring the last, 28th, per-CPU interrupt. To avoid this kind of confusions, fix this issue by renaming the constant to MPIC_PER_CPU_IRQS_NR and set it to 29, the number of per-CPU IRQs. Update its use in mpic_is_percpu_irq() accordingly. Fixes: 0fa4ce746d1d ("irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time") Signed-off-by: Marek BehĂșn --- drivers/irqchip/irq-armada-370-xp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index e8daa967e5fc..78d9c7699972 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -133,7 +133,7 @@ #define MPIC_INT_FABRIC_MASK 0x54 #define MPIC_INT_CAUSE_PERF(cpu) BIT(cpu) -#define MPIC_MAX_PER_CPU_IRQS 28 +#define MPIC_PER_CPU_IRQS_NR 29 /* IPI and MSI interrupt definitions for IPI platforms */ #define IPI_DOORBELL_NR 8 @@ -195,7 +195,7 @@ static inline bool mpic_is_ipi_available(struct mpic *mpic) static inline bool mpic_is_percpu_irq(irq_hw_number_t hwirq) { - return hwirq <= MPIC_MAX_PER_CPU_IRQS; + return hwirq < MPIC_PER_CPU_IRQS_NR; } /* @@ -546,7 +546,7 @@ static void mpic_smp_cpu_init(struct mpic *mpic) static void mpic_reenable_percpu(struct mpic *mpic) { /* Re-enable per-CPU interrupts that were enabled before suspend */ - for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) { + for (irq_hw_number_t i = 0; i < MPIC_PER_CPU_IRQS_NR; i++) { unsigned int virq = irq_linear_revmap(mpic->domain, i); struct irq_data *d;