riscv: Add SBI system suspend support
Provide a handler for SBI system suspend requests forwarded to the
VMM by KVM and enable system suspend by default. This is just for
testing purposes, so the handler only sleeps 5 seconds before
resuming the guest. Resuming a system suspend only requires running
the system suspend invoking hart again, everything else is handled by
KVM.
Note, resuming after a suspend doesn't work with 9p used for the
guest's rootfs. Testing with a disk works though, e.g.
lkvm-static run --nodefaults -m 256 -c 2 -d rootfs.ext2 -k Image \
-p 'console=ttyS0 rootwait root=/dev/vda ro no_console_suspend'
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Link: https://lore.kernel.org/r/20250426110348.338114-6-apatel@ventanamicro.com
Signed-off-by: Will Deacon <will@kernel.org>
3 files changed