[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/24] cpus: Introduce SysemuCPUOps::has_work() handler
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 03/24] cpus: Introduce SysemuCPUOps::has_work() handler |
Date: |
Sat, 25 Jan 2025 17:05:31 +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>
---
include/hw/core/sysemu-cpu-ops.h | 4 ++++
include/hw/core/tcg-cpu-ops.h | 2 +-
hw/core/cpu-system.c | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
index 0df5b058f50..dee8a62ca98 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.
*/
diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 2e3f1690f12..f60e5303f21 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/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/hw/core/cpu-system.c b/hw/core/cpu-system.c
index 16d5efee12d..7b16bda2250 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -25,6 +25,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);
}
--
2.47.1
- [PATCH v2 00/24] cpus: Restrict CPU has_work() handlers to system emulation, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 01/24] cpus: Restrict cpu_has_work() to system emulation, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 02/24] cpus: Un-inline cpu_has_work(), Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 03/24] cpus: Introduce SysemuCPUOps::has_work() handler,
Philippe Mathieu-Daudé <=
- [PATCH v2 04/24] target/alpha: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 05/24] target/arm: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 06/24] target/avr: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 07/24] target/hexagon: Remove CPUClass:has_work() handler, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 08/24] target/hppa: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 09/24] target/i386: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 10/24] target/loongarch: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 11/24] target/m68k: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 12/24] target/microblaze: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH v2 16/24] target/riscv: Move has_work() from CPUClass to SysemuCPUOps, Philippe Mathieu-Daudé, 2025/01/25