mbox series

[v1,0/1] riscv: Introduce system suspend support

Message ID 20231012072148.7010-3-ajones@ventanamicro.com (mailing list archive)
Headers show
Series riscv: Introduce system suspend support | expand

Message

Andrew Jones Oct. 12, 2023, 7:21 a.m. UTC
OpenSBI v1.3 and later supports the SUSP SBI extension which has recently
been frozen with the freezing of SBI 2.0. This one patch series adds
system suspend support to Linux, which implements "suspend-to-RAM". To
use it, build the kernel with CONFIG_SUSPEND, boot on a platform which
supports system suspend, and then issue 'echo mem > /sys/power/state'.
It's also possible to test this Linux support on a platform without
system suspend by using OpenSBI's system suspend test support. To enable
test support add

      opensbi-domains {
          compatible = "opensbi,domain,config";
          system-suspend-test;
      };

to the chosen node of the device tree. With the test node present,
OpenSBI will wait 5 seconds on a suspend and then kick a resume.

Note: Resume may fail without the fix for probing misaligned access
speed[1]. It's best to apply that fix before attempting system suspend.

[1] https://lore.kernel.org/all/20230920193801.3035093-1-evan@rivosinc.com/

Changes for v1:
  - Rebase on v6.6-rc1 -- only minor Kconfig change needed

Changes for RFC-v2:
  - RISCV_SBI dependency [Conor]
  - Rename SBI_EXT_SUSP_SUSPEND to SBI_EXT_SUSP_SYSTEM_SUSPEND and
    SBI_SUSP_SLEEP_TYPE_SUSPEND to SBI_SUSP_SLEEP_TYPE_SUSPEND_TO_RAM [Ley Foon]

Andrew Jones (1):
  riscv: sbi: Introduce system suspend support

 arch/riscv/Kconfig           |  5 ++++-
 arch/riscv/include/asm/sbi.h |  9 ++++++++
 arch/riscv/kernel/suspend.c  | 43 ++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletion(-)

Comments

Conor Dooley Nov. 27, 2023, 10:52 a.m. UTC | #1
On Thu, Oct 12, 2023 at 09:21:49AM +0200, Andrew Jones wrote:
> OpenSBI v1.3 and later supports the SUSP SBI extension which has recently
> been frozen with the freezing of SBI 2.0. This one patch series adds
> system suspend support to Linux, which implements "suspend-to-RAM". To
> use it, build the kernel with CONFIG_SUSPEND, boot on a platform which
> supports system suspend, and then issue 'echo mem > /sys/power/state'.
> It's also possible to test this Linux support on a platform without
> system suspend by using OpenSBI's system suspend test support. To enable
> test support add
> 
>       opensbi-domains {
>           compatible = "opensbi,domain,config";
>           system-suspend-test;
>       };
> 
> to the chosen node of the device tree. With the test node present,
> OpenSBI will wait 5 seconds on a suspend and then kick a resume.
> 
> Note: Resume may fail without the fix for probing misaligned access
> speed[1]. It's best to apply that fix before attempting system suspend.
> 
> [1] https://lore.kernel.org/all/20230920193801.3035093-1-evan@rivosinc.com/
> 
> Changes for v1:
>   - Rebase on v6.6-rc1 -- only minor Kconfig change needed

Would you mind resending this rebased on -rc1 again? It looks as if the
patchwork CI threw a fit do to differing expectations about function
signatures for the misaligned access probing.

Cheers,
Conor.
Andrew Jones Nov. 27, 2023, 12:07 p.m. UTC | #2
On Mon, Nov 27, 2023 at 10:52:52AM +0000, Conor Dooley wrote:
> On Thu, Oct 12, 2023 at 09:21:49AM +0200, Andrew Jones wrote:
> > OpenSBI v1.3 and later supports the SUSP SBI extension which has recently
> > been frozen with the freezing of SBI 2.0. This one patch series adds
> > system suspend support to Linux, which implements "suspend-to-RAM". To
> > use it, build the kernel with CONFIG_SUSPEND, boot on a platform which
> > supports system suspend, and then issue 'echo mem > /sys/power/state'.
> > It's also possible to test this Linux support on a platform without
> > system suspend by using OpenSBI's system suspend test support. To enable
> > test support add
> > 
> >       opensbi-domains {
> >           compatible = "opensbi,domain,config";
> >           system-suspend-test;
> >       };
> > 
> > to the chosen node of the device tree. With the test node present,
> > OpenSBI will wait 5 seconds on a suspend and then kick a resume.
> > 
> > Note: Resume may fail without the fix for probing misaligned access
> > speed[1]. It's best to apply that fix before attempting system suspend.
> > 
> > [1] https://lore.kernel.org/all/20230920193801.3035093-1-evan@rivosinc.com/
> > 
> > Changes for v1:
> >   - Rebase on v6.6-rc1 -- only minor Kconfig change needed
> 
> Would you mind resending this rebased on -rc1 again? It looks as if the
> patchwork CI threw a fit do to differing expectations about function
> signatures for the misaligned access probing.

Thanks for the poke. I need to repost anyway with the improved condition,
checking the SBI version. I'll try to get to this today.

Thanks,
drew