在 2024/4/28 上午11:16, Bibo Mao 写道:
On Loongarch, cpucfg is register for cpu feature, some other registers
depend on cpucfg feature such as perf CSR registers. Here put cpucfg
read/write operations before CSR register, so that KVM knows how many
perf CSR registers are valid from pre-set cpucfg feature information.
Signed-off-by: Bibo Mao <maob...@loongson.cn>
---
target/loongarch/kvm/kvm.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Reviewed-by: Song Gao <gaos...@loongson.cn>
Thanks.
Song Gao
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index 8224d94333..bc75552d0f 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -587,22 +587,22 @@ int kvm_arch_get_registers(CPUState *cs)
return ret;
}
- ret = kvm_loongarch_get_csr(cs);
+ ret = kvm_loongarch_get_cpucfg(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_get_regs_fp(cs);
+ ret = kvm_loongarch_get_csr(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_get_mpstate(cs);
+ ret = kvm_loongarch_get_regs_fp(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_get_cpucfg(cs);
+ ret = kvm_loongarch_get_mpstate(cs);
return ret;
}
@@ -615,22 +615,22 @@ int kvm_arch_put_registers(CPUState *cs, int level)
return ret;
}
- ret = kvm_loongarch_put_csr(cs, level);
+ ret = kvm_loongarch_put_cpucfg(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_put_regs_fp(cs);
+ ret = kvm_loongarch_put_csr(cs, level);
if (ret) {
return ret;
}
- ret = kvm_loongarch_put_mpstate(cs);
+ ret = kvm_loongarch_put_regs_fp(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_put_cpucfg(cs);
+ ret = kvm_loongarch_put_mpstate(cs);
return ret;
}
base-commit: a118c4aff4087eafb68f7132b233ad548cf16376