]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
cpus: Introduce SysemuCPUOps::has_work() handler
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 21 Jan 2025 11:57:16 +0000 (12:57 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Sun, 9 Mar 2025 16:00:47 +0000 (17:00 +0100)
SysemuCPUOps::has_work() is similar to CPUClass::has_work(),
but only exposed on system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250125170125.32855-4-philmd@linaro.org>

hw/core/cpu-system.c
include/accel/tcg/cpu-ops.h
include/hw/core/sysemu-cpu-ops.h

index c10e3c9ba6441ff7608413dcc7e347e5d4dbe1b6..601335fd764b1069e8910d0689c0e22d01dc135b 100644 (file)
 
 bool cpu_has_work(CPUState *cpu)
 {
+    if (cpu->cc->sysemu_ops->has_work) {
+        return cpu->cc->sysemu_ops->has_work(cpu);
+    }
+
     g_assert(cpu->cc->has_work);
     return cpu->cc->has_work(cpu);
 }
index 2e3f1690f127e897e056981749657a8806531c65..f60e5303f2141c2e3b06453157dfd56b804a0372 100644 (file)
@@ -141,7 +141,7 @@ struct TCGCPUOps {
      *
      * This method must be provided. If the target does not need to
      * do anything special for halt, the same function used for its
-     * CPUClass::has_work method can be used here, as they have the
+     * SysemuCPUOps::has_work method can be used here, as they have the
      * same function signature.
      */
     bool (*cpu_exec_halt)(CPUState *cpu);
index 0df5b058f50073e47d2a6b8286be5204776520d2..dee8a62ca989f00a9648b1f9ec35db85b3250ec0 100644 (file)
  * struct SysemuCPUOps: System operations specific to a CPU class
  */
 typedef struct SysemuCPUOps {
+    /**
+     * @has_work: Callback for checking if there is work to do.
+     */
+    bool (*has_work)(CPUState *cpu);
     /**
      * @get_memory_mapping: Callback for obtaining the memory mappings.
      */