diff mbox series

[7/7] accels: Constify AccelOpsClass::cpu_thread_is_idle() argument

Message ID 20250120061310.81368-8-philmd@linaro.org (mailing list archive)
State New
Headers show
Series cpus: Constify some CPUState arguments | expand

Commit Message

Philippe Mathieu-Daudé Jan. 20, 2025, 6:13 a.m. UTC
If a cpu_thread_is_idle() implementation accesses
@cpu fields, it shouldn't modify them. Make the
argument const in preparation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/system/accel-ops.h        | 2 +-
 accel/kvm/kvm-accel-ops.c         | 2 +-
 target/i386/whpx/whpx-accel-ops.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/system/accel-ops.h b/include/system/accel-ops.h
index 137fb96d444..8cf353105e2 100644
--- a/include/system/accel-ops.h
+++ b/include/system/accel-ops.h
@@ -39,7 +39,7 @@  struct AccelOpsClass {
 
     void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */
     void (*kick_vcpu_thread)(CPUState *cpu);
-    bool (*cpu_thread_is_idle)(CPUState *cpu);
+    bool (*cpu_thread_is_idle)(const CPUState *cpu);
 
     void (*synchronize_post_reset)(CPUState *cpu);
     void (*synchronize_post_init)(CPUState *cpu);
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index a81e8f3b03b..3fe26f54d30 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -72,7 +72,7 @@  static void kvm_start_vcpu_thread(CPUState *cpu)
                        cpu, QEMU_THREAD_JOINABLE);
 }
 
-static bool kvm_vcpu_thread_is_idle(CPUState *cpu)
+static bool kvm_vcpu_thread_is_idle(const CPUState *cpu)
 {
     return !kvm_halt_in_kernel();
 }
diff --git a/target/i386/whpx/whpx-accel-ops.c b/target/i386/whpx/whpx-accel-ops.c
index ab2e014c9ea..ae4f1282801 100644
--- a/target/i386/whpx/whpx-accel-ops.c
+++ b/target/i386/whpx/whpx-accel-ops.c
@@ -77,7 +77,7 @@  static void whpx_kick_vcpu_thread(CPUState *cpu)
     }
 }
 
-static bool whpx_vcpu_thread_is_idle(CPUState *cpu)
+static bool whpx_vcpu_thread_is_idle(const CPUState *cpu)
 {
     return !whpx_apic_in_platform();
 }