Property kvm-pv-ipi is added to paravirt ipi feature, it is specially
for kvm mode.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
target/loongarch/cpu.h | 1 +
target/loongarch/kvm/kvm.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index f2a23b7a43..b09ca04bc1 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -406,6 +406,7 @@ struct ArchCPU {
OnOffAuto pmu;
OnOffAuto lsx;
OnOffAuto lasx;
+ OnOffAuto kvm_pv_ipi;
/* 'compatible' string for this CPU for Linux device trees */
const char *dtb_compatible;
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index df4b21bef5..f0bcec1baf 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -1033,6 +1033,18 @@ static void loongarch_set_pmu(Object *obj, bool value, Error **errp)
cpu->pmu = value ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF;
}
+static bool kvm_pv_ipi_get(Object *obj, Error **errp)
+{
+ return LOONGARCH_CPU(obj)->kvm_pv_ipi != ON_OFF_AUTO_OFF;
+}
+
+static void kvm_pv_ipi_set(Object *obj, bool value, Error **errp)
+{
+ LoongArchCPU *cpu = LOONGARCH_CPU(obj);
+
+ cpu->kvm_pv_ipi = value ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF;
+}
+
void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu)
{
cpu->lbt = ON_OFF_AUTO_AUTO;
@@ -1046,6 +1058,12 @@ void kvm_loongarch_cpu_post_init(LoongArchCPU *cpu)
loongarch_set_pmu);
object_property_set_description(OBJECT(cpu), "pmu",
"Set off to performance monitor unit.");
+
+ cpu->kvm_pv_ipi = ON_OFF_AUTO_AUTO;
+ object_property_add_bool(OBJECT(cpu), "kvm-pv-ipi", kvm_pv_ipi_get,
+ kvm_pv_ipi_set);
+ object_property_set_description(OBJECT(cpu), "kvm-pv-ipi",
+ "Set off to disable KVM paravirt IPI.");
}
int kvm_arch_destroy_vcpu(CPUState *cs)
--
2.39.3