[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 07/40] accel/kvm: Implement AccelOpsClass::has_work()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v6 07/40] accel/kvm: Implement AccelOpsClass::has_work() |
Date: |
Fri, 24 Sep 2021 11:38:14 +0200 |
Implement KVM has_work() handler in AccelOpsClass and
remove it from cpu_thread_is_idle() since cpu_has_work()
is already called.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
accel/kvm/kvm-accel-ops.c | 6 ++++++
softmmu/cpus.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index 7516c67a3f5..6f4d5df3a0d 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -74,6 +74,11 @@ static void kvm_start_vcpu_thread(CPUState *cpu)
cpu, QEMU_THREAD_JOINABLE);
}
+static bool kvm_cpu_has_work(CPUState *cpu)
+{
+ return kvm_halt_in_kernel();
+}
+
static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
{
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
@@ -83,6 +88,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void
*data)
ops->synchronize_post_init = kvm_cpu_synchronize_post_init;
ops->synchronize_state = kvm_cpu_synchronize_state;
ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
+ ops->has_work = kvm_cpu_has_work;
}
static const TypeInfo kvm_accel_ops_type = {
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 85b06d3e685..c9f54a09989 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -90,7 +90,7 @@ bool cpu_thread_is_idle(CPUState *cpu)
return true;
}
if (!cpu->halted || cpu_has_work(cpu) ||
- kvm_halt_in_kernel() || whpx_apic_in_platform()) {
+ whpx_apic_in_platform()) {
return false;
}
return true;
--
2.31.1
- [PATCH v6 00/40] accel: Move has_work() from CPUClass to AccelOpsClass, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 01/40] accel: Simplify qemu_init_vcpu(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 02/40] accel/tcg: Restrict cpu_handle_halt() to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 03/40] hw/core: Restrict cpu_has_work() to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 04/40] hw/core: Un-inline cpu_has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 05/40] hw/core: Move cpu_common_has_work() to cpu_has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 06/40] accel: Introduce AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 07/40] accel/kvm: Implement AccelOpsClass::has_work(),
Philippe Mathieu-Daudé <=
- [PATCH v6 08/40] accel/whpx: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 09/40] accel/hvf: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 10/40] accel/xen: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 11/40] accel/hax: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 12/40] accel/nvmm: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 13/40] accel/qtest: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 14/40] accel/tcg: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 15/40] accel: Simplify cpu_has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 16/40] accel/tcg: Introduce TCGCPUOps::has_work(), Philippe Mathieu-Daudé, 2021/09/24