diff mbox series

[PULL,3/3] target/loongarch: Put cpucfg operation before CSR register

Message ID 20240509080645.457303-4-gaosong@loongson.cn
State New
Headers show
Series [PULL,1/3] hw/loongarch: Refine default numa id calculation | expand

Commit Message

Song Gao May 9, 2024, 8:06 a.m. UTC
From: Bibo Mao <maobibo@loongson.cn>

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 <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20240428031651.1354587-1-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
 target/loongarch/kvm/kvm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

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;
 }