[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 30/31] accel/tcg: Introduce TCGCPUOps::cpu_exec_halt() handler
|
From: |
Richard Henderson |
|
Subject: |
[PULL 30/31] accel/tcg: Introduce TCGCPUOps::cpu_exec_halt() handler |
|
Date: |
Tue, 30 Jan 2024 09:01:20 +1000 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
In order to make accel/tcg/ target agnostic,
introduce the cpu_exec_halt() handler.
Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240124101639.30056-9-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/hw/core/tcg-cpu-ops.h | 2 ++
accel/tcg/cpu-exec.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 013867b890..bf8ff8e3ee 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -112,6 +112,8 @@ struct TCGCPUOps {
void (*do_interrupt)(CPUState *cpu);
/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
+ /** @cpu_exec_halt: Callback for handling halt in cpu_exec */
+ void (*cpu_exec_halt)(CPUState *cpu);
/**
* @tlb_fill: Handle a softmmu tlb miss
*
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 75f7ba7bed..82627b12b8 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -664,6 +664,8 @@ static inline bool cpu_handle_halt(CPUState *cpu)
{
#ifndef CONFIG_USER_ONLY
if (cpu->halted) {
+ const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
+
#if defined(TARGET_I386)
if (cpu->interrupt_request & CPU_INTERRUPT_POLL) {
X86CPU *x86_cpu = X86_CPU(cpu);
@@ -673,6 +675,9 @@ static inline bool cpu_handle_halt(CPUState *cpu)
bql_unlock();
}
#endif /* TARGET_I386 */
+ if (tcg_ops->cpu_exec_halt) {
+ tcg_ops->cpu_exec_halt(cpu);
+ }
if (!cpu_has_work(cpu)) {
return true;
}
--
2.34.1
- [PULL 21/31] accel/tcg: Rename tcg_cpus_destroy() -> tcg_cpu_destroy(), (continued)
- [PULL 21/31] accel/tcg: Rename tcg_cpus_destroy() -> tcg_cpu_destroy(), Richard Henderson, 2024/01/29
- [PULL 18/31] accel/tcg: Remove #ifdef TARGET_I386 from perf.c, Richard Henderson, 2024/01/29
- [PULL 20/31] accel/tcg: Rename tcg_ss[] -> tcg_specific_ss[] in meson, Richard Henderson, 2024/01/29
- [PULL 25/31] target/loongarch: Constify loongarch_tcg_ops, Richard Henderson, 2024/01/29
- [PULL 28/31] target/i386: Extract x86_need_replay_interrupt() from accel/tcg/, Richard Henderson, 2024/01/29
- [PULL 22/31] accel/tcg: Rename tcg_cpus_exec() -> tcg_cpu_exec(), Richard Henderson, 2024/01/29
- [PULL 29/31] accel/tcg: Inline need_replay_interrupt, Richard Henderson, 2024/01/29
- [PULL 24/31] include/qemu: Add TCGCPUOps typedef to typedefs.h, Richard Henderson, 2024/01/29
- [PULL 23/31] accel/tcg: Un-inline icount_exit_request() for clarity, Richard Henderson, 2024/01/29
- [PULL 31/31] target/i386: Extract x86_cpu_exec_halt() from accel/tcg/, Richard Henderson, 2024/01/29
- [PULL 30/31] accel/tcg: Introduce TCGCPUOps::cpu_exec_halt() handler,
Richard Henderson <=
- [PULL 26/31] accel/tcg: Use CPUState.cc instead of CPU_GET_CLASS in cpu-exec.c, Richard Henderson, 2024/01/29
- [PULL 27/31] accel/tcg: Introduce TCGCPUOps::need_replay_interrupt() handler, Richard Henderson, 2024/01/29
- Re: [PULL 00/31] tcg patch queue, Peter Maydell, 2024/01/31