From: Philippe Mathieu-Daudé Date: Tue, 21 Jan 2025 11:57:16 +0000 (+0100) Subject: cpus: Introduce SysemuCPUOps::has_work() handler X-Git-Tag: v10.0.0-rc0~17^2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72eacd623170dd680557ece6957575c30774cdef;p=thirdparty%2Fqemu.git cpus: Introduce SysemuCPUOps::has_work() handler SysemuCPUOps::has_work() is similar to CPUClass::has_work(), but only exposed on system emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20250125170125.32855-4-philmd@linaro.org> --- diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index c10e3c9ba6..601335fd76 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -33,6 +33,10 @@ 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); } diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 2e3f1690f1..f60e5303f2 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -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); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 0df5b058f5..dee8a62ca9 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,10 @@ * 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. */