[PATCH v2 1/1] riscv: sbi: Introduce system suspend support

Andrew Jones ajones at ventanamicro.com
Wed Dec 6 00:24:59 PST 2023


On Tue, Dec 05, 2023 at 12:23:07PM -0600, Samuel Holland wrote:
> Hi Andrew,
> 
> On 2023-11-29 5:34 AM, Andrew Jones wrote:
> > When the SUSP SBI extension is present it implies that the standard
> > "suspend to RAM" type is available. Wire it up to the generic
> > platform suspend support, also applying the already present support
> > for non-retentive CPU suspend. When the kernel is built with
> > CONFIG_SUSPEND, one can do 'echo mem > /sys/power/state' to suspend.
> > Resumption will occur when a platform-specific wake-up event arrives.
> > 
> > Signed-off-by: Andrew Jones <ajones at ventanamicro.com>
> > Tested-by: Samuel Holland <samuel.holland at sifive.com>
> > ---
> >  arch/riscv/Kconfig           |  6 ++++-
> >  arch/riscv/include/asm/sbi.h |  9 ++++++++
> >  arch/riscv/kernel/suspend.c  | 44 ++++++++++++++++++++++++++++++++++++
> >  3 files changed, 58 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 95a2a06acc6a..385fcad45c47 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -65,7 +65,7 @@ config RISCV
> >  	select CLINT_TIMER if !MMU
> >  	select CLONE_BACKWARDS
> >  	select COMMON_CLK
> > -	select CPU_PM if CPU_IDLE || HIBERNATION
> > +	select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
> >  	select EDAC_SUPPORT
> >  	select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
> >  	select GENERIC_ARCH_TOPOLOGY
> > @@ -918,9 +918,13 @@ config PORTABLE
> >  	select MMU
> >  	select OF
> >  
> > +
> >  config ARCH_PROC_KCORE_TEXT
> >  	def_bool y
> >  
> > +config ARCH_SUSPEND_POSSIBLE
> > +	def_bool RISCV_SBI
> > +
> 
> This option was already added by commit c1f048a6bd7d ("riscv: Enable
> ARCH_SUSPEND_POSSIBLE for s2idle"), so this hunk is a duplicate.

Thanks, Samuel. I'll send a v3.

drew



More information about the linux-riscv mailing list