Message ID | 20250208074808.5615-1-lixianglai@loongson.cn (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [V2] target/loongarch: fix vcpu reset command word issue | expand |
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c index a3f55155b0..3f499e60ab 100644 --- a/target/loongarch/kvm/kvm.c +++ b/target/loongarch/kvm/kvm.c @@ -581,9 +581,14 @@ static int kvm_loongarch_get_lbt(CPUState *cs) void kvm_arch_reset_vcpu(CPUState *cs) { CPULoongArchState *env = cpu_env(cs); + int ret = 0; + uint64_t unused = 0; env->mp_state = KVM_MP_STATE_RUNNABLE; - kvm_set_one_reg(cs, KVM_REG_LOONGARCH_VCPU_RESET, 0); + ret = kvm_set_one_reg(cs, KVM_REG_LOONGARCH_VCPU_RESET, &unused); + if (ret) { + error_report("Failed to set KVM_REG_LOONGARCH_VCPU_RESET"); + } } static int kvm_loongarch_get_mpstate(CPUState *cs)
When the KVM_REG_LOONGARCH_VCPU_RESET command word is sent to the kernel through the kvm_set_one_reg interface, the parameter source needs to be a legal address, otherwise the kernel will return an error and the command word will fail to be sent. Signed-off-by: Xianglai Li <lixianglai@loongson.cn> --- Cc: Bibo Mao <Maobibo@loongson.cn> Cc: Song Gao <gaosong@loongson.cn> Cc: Xianglai Li <lixianglai@loongson.cn> CHANGE: V2<-V1: 1.Sets the initial value of the variable and adds a function return value judgment and prints a log target/loongarch/kvm/kvm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)