[kvmtool PATCH 06/10] riscv: Make system suspend time configurable
Anup Patel
apatel at ventanamicro.com
Tue Mar 25 23:56:40 PDT 2025
From: Andrew Jones <ajones at ventanamicro.com>
If the default of 5 seconds for a system suspend test is too long or
too short, then feel free to change it.
Signed-off-by: Andrew Jones <ajones at ventanamicro.com>
Signed-off-by: Anup Patel <apatel at ventanamicro.com>
---
riscv/include/kvm/kvm-config-arch.h | 4 ++++
riscv/kvm-cpu.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h
index 0553004..7e54d8a 100644
--- a/riscv/include/kvm/kvm-config-arch.h
+++ b/riscv/include/kvm/kvm-config-arch.h
@@ -5,6 +5,7 @@
struct kvm_config_arch {
const char *dump_dtb_filename;
+ u64 suspend_seconds;
u64 custom_mvendorid;
u64 custom_marchid;
u64 custom_mimpid;
@@ -16,6 +17,9 @@ struct kvm_config_arch {
pfx, \
OPT_STRING('\0', "dump-dtb", &(cfg)->dump_dtb_filename, \
".dtb file", "Dump generated .dtb to specified file"),\
+ OPT_U64('\0', "suspend-seconds", \
+ &(cfg)->suspend_seconds, \
+ "Number of seconds to suspend for system suspend (default is 5)"), \
OPT_U64('\0', "custom-mvendorid", \
&(cfg)->custom_mvendorid, \
"Show custom mvendorid to Guest VCPU"), \
diff --git a/riscv/kvm-cpu.c b/riscv/kvm-cpu.c
index ad68b58..7a86d71 100644
--- a/riscv/kvm-cpu.c
+++ b/riscv/kvm-cpu.c
@@ -228,7 +228,7 @@ static bool kvm_cpu_riscv_sbi(struct kvm_cpu *vcpu)
break;
}
- sleep(5);
+ sleep(vcpu->kvm->cfg.arch.suspend_seconds ? : 5);
break;
default:
--
2.43.0
More information about the kvm-riscv
mailing list