From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379793; b=jcQ/c8N+1Yg8vQqRESbRjwjOF+An5vQ7N3uCwUxWzISMg0sYEnB3oAJV/W+Ro/ZpGtog hwI2nPlsDH3AFo4d8tL4mUDqz51C1ol0etOlqy+7mmEQCYoDSgAgSMP6p52/dcjnM1PQv sVnW3L/dgNFHoT8dzGQzoJ2p65z4ipJ4bbH0+gMiDjNc8ybjQfvlU1drNRwV7/G6QZoZ9 m8Uf6viSiJBSb0H6GgKEJHh4Pjtia1yUsi5PibsyANwjVsPh0jovOCL+TO3pb/018U35M E+2pyiwF1cBw6UWlTY07qw8OAMA3RhBQ2kjR76WpaXz/0SyRRqbnO+QTiJoa2M/LqmQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379793; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Oy+xRnL+a06hKopL7hTNc1us5GS/TjphD1elve3C45o=; b=e99UsZq0JM5T1bHp1OCjJGISXr9rbf6stFhniWZo2msjJmJOmJCS4Vae1i5qTDqUdcGe aGsgjgc44gAtTImTmIeFRJNiYhv1+iGQRxy5YeZxAzMo/or18Vh36Kr4R2Sx2hrMxhiPU V3zTJVrShWk6YQ8CPe/CUWlFhGDST9/LNE7Le+e5kCtWg3QuT3DtQomk6VC238RTrocGT QvvGniZ2eaQ7RyxgyFRUzZyKfI+j/jplU0p5Gnv0oxGf4zQOxZWrq5+x5ZBSdVuIrGOHs 56chbgMBcytHZGBU6DmtZ3tC7sElX/iS599WUDjt50gfIJ+OgDA6iqsznSz4jlzEj6Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HFDCPhbr; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 513F1606A322; Fri, 4 Dec 2026 10:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HFDCPhbr Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD31E1F000C2; Fri, 4 Dec 2026 10:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379793; bh=Oy+xRnL+a06hKopL7hTNc1us5GS/TjphD1elve3C45o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HFDCPhbrJEs+F13prC0Yygiq1Q1fQCCbIvVFbi/9TxKBeKbJPs4ZJBPr5ZoXJw5Xu Z9AtqFqNnm8UFdEKIQElmvXgS6M2kqOvnpnrFKx97ceJvPvRfeVpSVtQ8fiKzEBPpK wKQOufJOnAIqTD6+u/kYczH6GmaKOj4Q9RyJgdBk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ada Couprie Diaz , Vladimir Murzin , Jinjie Ruan , Will Deacon , Sasha Levin Subject: [PATCH 6.12 062/555] arm64: suspend: rely on daif helpers to handle PMR Date: Fri, 4 Dec 2026 19:01:45 +0900 Message-ID: <20261204100609.231162957@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ada Couprie Diaz [ Upstream commit 630ca6c58fcfeaddd96dd46e7b11826013977955 ] Commit 77345ef70445 ("arm64: suspend: Use cpuidle context helpers in cpu_suspend()") added cpuidle helpers to handle PMR manipulation and restoration to ensure that the CPU receives interrupts when suspended and pseudo-NMIs are enabled. However, those helpers are called in between a pair of `local_daif_save()` and `local_daif_restore()`, which already configure the PMR as expected. Effectively, `arm_cpuidle_save_irq_context()` is a no-op here, even when using pseudo-NMIs, and `arm_cpuidle_restore_irq_context()` would not restore proper interrupt masking configuration early enough if there were unexpected changes during suspend or resume. (This can be observed with Trusted Firmware A (TF-A) at EL3 handling suspend through PSCI. Even though it should not be the case, TF-A can reset `ICC_PMR_EL1` during CPU_SUSPEND, thus resuming the kernel with an inconsistent priority mask value on hardware implementing more than the minimum number of priority levels, such as Morello.) Thus : remove the cpuidle context helpers as they do not do anything, but keep the comment mentioning the need for interrupts to reach the CPU if we are using pseudo-NMIs. Signed-off-by: Ada Couprie Diaz Signed-off-by: Vladimir Murzin Reviewed-by: Jinjie Ruan Signed-off-by: Will Deacon Stable-dep-of: ad3fc05c7e65 ("arm64: suspend: Only track cpuidle context for idle tasks") Signed-off-by: Sasha Levin --- arch/arm64/kernel/suspend.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c index eaaff94329cdd..c41724a40b756 100644 --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -99,7 +99,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) int ret = 0; unsigned long flags; struct sleep_stack_data state; - struct arm_cpuidle_irq_context context; /* * Some portions of CPU state (e.g. PSTATE.{PAN,DIT}) are initialized @@ -121,6 +120,9 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) * Strictly speaking the trace_hardirqs_off() here is superfluous, * hardirqs should be firmly off by now. This really ought to use * something like raw_local_daif_save(). + * + * This also unmasks interrupts in PMR in order to reliably + * resume if we're using pseudo-NMIs. */ flags = local_daif_save(); @@ -131,12 +133,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) */ pause_graph_tracing(); - /* - * Switch to using DAIF.IF instead of PMR in order to reliably - * resume if we're using pseudo-NMIs. - */ - arm_cpuidle_save_irq_context(&context); - ct_cpuidle_enter(); if (__cpu_suspend_enter(&state)) { @@ -159,8 +155,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) __cpu_suspend_exit(); } - arm_cpuidle_restore_irq_context(&context); - unpause_graph_tracing(); /* -- 2.53.0