target/loongarch: Add post init function for kvm mode
authorBibo Mao <maobibo@loongson.cn>
Fri, 14 Feb 2025 08:30:50 +0000 (16:30 +0800)
committerBibo Mao <maobibo@loongson.cn>
Tue, 25 Feb 2025 08:05:31 +0000 (16:05 +0800)
Some features such as LBT and PMU are implemented in kvm mode,
With paravirt features in future, post init function is added
for kvm mode, so that property for these features will be created
in kvm post init function.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
target/loongarch/cpu.c
target/loongarch/cpu.h
target/loongarch/kvm/kvm.c

index f203fcc7d7e10b609eb1232aecb9b3c1608cbb89..012fcfbfdaefc2f4084a34ecd326fe57bb12ed25 100644 (file)
@@ -765,7 +765,7 @@ void loongarch_cpu_post_init(Object *obj)
                                  loongarch_set_pmu);
         object_property_set_description(obj, "pmu",
                                    "Set off to performance monitor unit.");
-
+        kvm_loongarch_cpu_post_init(cpu);
     } else {
         cpu->lbt = ON_OFF_AUTO_OFF;
         cpu->pmu = ON_OFF_AUTO_OFF;
index f2a23b7a434363b3e181ad07b942a65d7592791a..74dffcb5527e9a37db6d61431a8b42b6f4f3b8cd 100644 (file)
@@ -491,4 +491,12 @@ static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
 
 void loongarch_cpu_post_init(Object *obj);
 
+#ifdef CONFIG_KVM
+void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu);
+#else
+static inline void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu)
+{
+}
+#endif
+
 #endif /* LOONGARCH_CPU_H */
index 27df02fa3a4485686353a0c9bb8180577b665175..2d2fb1e261171602a26919365bf7965047a1f906 100644 (file)
@@ -1016,6 +1016,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
     return ret;
 }
 
+void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu)
+{
+}
+
 int kvm_arch_destroy_vcpu(CPUState *cs)
 {
     return 0;