mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
target/loongarch: Put cpucfg operation before CSR register
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>
This commit is contained in:
+10
-10
@@ -587,6 +587,11 @@ int kvm_arch_get_registers(CPUState *cs)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_get_cpucfg(cs);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_get_csr(cs);
|
||||
if (ret) {
|
||||
return ret;
|
||||
@@ -598,11 +603,6 @@ int kvm_arch_get_registers(CPUState *cs)
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_get_mpstate(cs);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_get_cpucfg(cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -615,6 +615,11 @@ int kvm_arch_put_registers(CPUState *cs, int level)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_put_cpucfg(cs);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_put_csr(cs, level);
|
||||
if (ret) {
|
||||
return ret;
|
||||
@@ -626,11 +631,6 @@ int kvm_arch_put_registers(CPUState *cs, int level)
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_put_mpstate(cs);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = kvm_loongarch_put_cpucfg(cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user