public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpuidle: riscv-sbi: Stop using non-retentive suspend
@ 2022-11-21 20:56 Palmer Dabbelt
  2022-11-21 21:10 ` Conor Dooley
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2022-11-21 20:56 UTC (permalink / raw)
  To: Conor Dooley
  Cc: anup, rafael, daniel.lezcano, Paul Walmsley, Palmer Dabbelt, aou,
	linux-pm, linux-riscv, linux-kernel, linux, Palmer Dabbelt

From: Palmer Dabbelt <palmer@rivosinc.com>

As per [1], whether or not the core can wake up from non-retentive
suspend is a platform-specific detail.  We don't have any way to encode
that, so just stop using them until we've sorted that out.

Link: https://github.com/riscv-non-isa/riscv-sbi-doc/issues/98#issuecomment-1288564687
Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

---

This should allow us to revert 232ccac1bd9b ("clocksource/drivers/riscv:
Events are stopped during CPU suspend"), which fixes suspend on the D1
but breaks timers everywhere.
---
 drivers/cpuidle/cpuidle-riscv-sbi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
index 05fe2902df9a..9d1063a54495 100644
--- a/drivers/cpuidle/cpuidle-riscv-sbi.c
+++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
@@ -214,6 +214,17 @@ static bool sbi_suspend_state_is_valid(u32 state)
 	if (state > SBI_HSM_SUSPEND_NON_RET_DEFAULT &&
 	    state < SBI_HSM_SUSPEND_NON_RET_PLATFORM)
 		return false;
+
+	/*
+	 * Whether or not RISC-V systems deliver interrupts to harts in a
+	 * non-retentive suspend state is a platform-specific detail.  This can
+	 * leave the hart unable to wake up, so just mark these states as
+	 * unsupported until we have a mechanism to expose these
+	 * platform-specific details to Linux.
+	 */
+	if (state & SBI_HSM_SUSP_NON_RET_BIT)
+		return false;
+
 	return true;
 }
 
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-11-23 10:56 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 20:56 [PATCH] cpuidle: riscv-sbi: Stop using non-retentive suspend Palmer Dabbelt
2022-11-21 21:10 ` Conor Dooley
2022-11-22  0:45 ` Samuel Holland
2022-11-22 11:06   ` Conor Dooley
2022-11-23  3:42     ` Samuel Holland
2022-11-23 10:46       ` Conor Dooley
2022-11-22  3:45 ` Anup Patel
2022-11-22  5:16   ` Palmer Dabbelt
2022-11-22  5:36     ` Anup Patel
2022-11-22 11:19       ` Conor Dooley
2022-11-22 15:28         ` Palmer Dabbelt
2022-11-23  4:38           ` Anup Patel
2022-11-23  5:11           ` Samuel Holland
2022-11-23  5:35             ` Anup Patel
2022-11-23  5:38               ` Samuel Holland
2022-11-23  6:10                 ` Anup Patel
2022-11-23  6:27                   ` Samuel Holland
2022-11-23  6:41                     ` Anup Patel
2022-11-23  6:49                       ` Samuel Holland
2022-11-23  7:13                         ` Anup Patel
2022-11-23 10:20             ` Sudeep Holla
2022-11-23  4:26         ` Anup Patel
2022-11-23 10:09           ` Conor Dooley
2022-11-23 10:36             ` Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox