diff mbox series

[1/8] target/loongarch: Add post init function for kvm mode

Message ID 20250217035718.3977137-2-maobibo@loongson.cn (mailing list archive)
State New
Headers show
Series target/loongarch: Add paravirt feature property and enabling | expand

Commit Message

bibo mao Feb. 17, 2025, 3:57 a.m. UTC
Some features such as LBT and PMU are implemented in kvm mode,
With para-virt 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>
---
 target/loongarch/cpu.c               | 2 +-
 target/loongarch/kvm/kvm.c           | 4 ++++
 target/loongarch/kvm/kvm_loongarch.h | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index e91f4a5239..40f753167f 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -759,7 +759,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;
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index a3f55155b0..516aba180f 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -1009,6 +1009,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;
diff --git a/target/loongarch/kvm/kvm_loongarch.h b/target/loongarch/kvm/kvm_loongarch.h
index 1051a341ec..23793f2198 100644
--- a/target/loongarch/kvm/kvm_loongarch.h
+++ b/target/loongarch/kvm/kvm_loongarch.h
@@ -11,6 +11,7 @@ 
 #define QEMU_KVM_LOONGARCH_H
 
 int  kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level);
+void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu);
 void kvm_arch_reset_vcpu(CPUState *cs);
 
 #endif