riscv: sbi: Introduce system suspend support
authorAndrew Jones <ajones@ventanamicro.com>
Wed, 6 Dec 2023 11:08:09 +0000 (12:08 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 11 Jan 2024 15:36:26 +0000 (07:36 -0800)
commit4dc4af9ce32681fbd16aa0e757ccba341cc9d4ca
tree6f0c909636e563aeb5f5e1d94c752677e992199c
parent3a58275099b9cbfb9d86b85824fb3a5de796c815
riscv: sbi: Introduce system suspend support

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@ventanamicro.com>
Tested-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20231206110807.35882-4-ajones@ventanamicro.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/Kconfig
arch/riscv/include/asm/sbi.h
arch/riscv/kernel/suspend.c