target/loongarch: Add post init function for kvm mode

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>
This commit is contained in:
Bibo Mao 2025-02-14 16:30:50 +08:00
parent 0262c8075e
commit 3406b001e6
3 changed files with 13 additions and 1 deletions

View File

@ -765,7 +765,7 @@ void loongarch_cpu_post_init(Object *obj)
loongarch_set_pmu); loongarch_set_pmu);
object_property_set_description(obj, "pmu", object_property_set_description(obj, "pmu",
"Set off to performance monitor unit."); "Set off to performance monitor unit.");
kvm_loongarch_cpu_post_init(cpu);
} else { } else {
cpu->lbt = ON_OFF_AUTO_OFF; cpu->lbt = ON_OFF_AUTO_OFF;
cpu->pmu = ON_OFF_AUTO_OFF; cpu->pmu = ON_OFF_AUTO_OFF;

View File

@ -491,4 +491,12 @@ static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
void loongarch_cpu_post_init(Object *obj); 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 */ #endif /* LOONGARCH_CPU_H */

View File

@ -1016,6 +1016,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
return ret; return ret;
} }
void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu)
{
}
int kvm_arch_destroy_vcpu(CPUState *cs) int kvm_arch_destroy_vcpu(CPUState *cs)
{ {
return 0; return 0;