On 2/4/22 06:18, Philippe Mathieu-Daudé wrote:
Add cpus_are_resettable() to AccelOps, and implement it for the
KVM accelerator.

Suggested-by: Richard Henderson <richard.hender...@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
---
  accel/kvm/kvm-accel-ops.c  | 6 ++++++
  include/sysemu/accel-ops.h | 2 ++
  include/sysemu/hw_accel.h  | 5 -----
  softmmu/cpus.c             | 5 ++++-
  4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index 95b7b08020..cd4d4a06a7 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -79,12 +79,18 @@ static bool kvm_vcpu_thread_is_idle(CPUState *cpu)
      return !kvm_halt_in_kernel();
  }
+static bool kvm_cpus_are_resettable(void)
+{
+    return kvm_enabled() ? kvm_cpu_check_are_resettable() : true;
+}

Hrm. This is code movement, but this calls out to be rewritten with proper logical operations:

    !kvm_enabled() || kvm_cpu_check_are_resettable();

Anyway,
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>


r~

Reply via email to