From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>,
Peter Maydell <peter.maydell@linaro.org>,
Richard Henderson <richard.henderson@linaro.org>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Subject: [PATCH 11/11] accel/tcg: Remove the now redundant cpu_exec_halt() hook
Date: Wed, 19 Aug 2026 16:56:49 +0200 [thread overview]
Message-ID: <20260819145649.23439-12-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260819145649.23439-1-philmd@oss.qualcomm.com>
Every target setting the cpu_exec_halt callback alias it to
their cpu_has_work() function, making the callback redundant.
Call cpu_has_work() directly in accel/tcg/cpu-exec.c
cpu_has_work_after_processing_async_events() and remove the
boilerplate cpu_exec_halt hook registration. No functional
impact expected.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/accel/tcg/cpu-ops.h | 17 -----------------
accel/tcg/cpu-exec.c | 23 ++++++++---------------
target/alpha/cpu.c | 1 -
target/avr/cpu.c | 1 -
target/hexagon/cpu.c | 1 -
target/hppa/cpu.c | 1 -
target/loongarch/tcg/tcg_cpu.c | 1 -
target/m68k/cpu.c | 1 -
target/microblaze/cpu.c | 1 -
target/mips/cpu.c | 1 -
target/or1k/cpu.c | 1 -
target/ppc/cpu_init.c | 1 -
target/riscv/tcg/tcg-cpu.c | 1 -
target/rx/cpu.c | 1 -
target/s390x/cpu.c | 1 -
target/sh4/cpu.c | 1 -
target/sparc/cpu.c | 1 -
target/tricore/cpu.c | 1 -
target/xtensa/cpu.c | 1 -
19 files changed, 8 insertions(+), 49 deletions(-)
diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
index 16c19da997d..a88cc4dc572 100644
--- a/include/accel/tcg/cpu-ops.h
+++ b/include/accel/tcg/cpu-ops.h
@@ -189,23 +189,6 @@ struct TCGCPUOps {
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
/** @cpu_exec_reset: Callback for reset in cpu_exec. */
void (*cpu_exec_reset)(CPUState *cpu);
- /**
- * @cpu_exec_halt: Callback for handling halt in cpu_exec.
- *
- * The target CPU should do any special processing here that it needs
- * to do when the CPU is in the halted state.
- *
- * Return true to indicate that the CPU should now leave halt, false
- * if it should remain in the halted state. (This should generally
- * be the same value that cpu_has_work() would return.)
- *
- * Either %transition_halt_to_exec() or this method must be provided.
- * If the target does not need to
- * do anything special for halt, the same function used for its
- * SysemuCPUOps::has_work method can be used here, as they have the
- * same function signature.
- */
- bool (*cpu_exec_halt)(CPUState *cpu);
/**
* @tlb_fill_align: Handle a softmmu tlb miss
* @cpu: cpu context
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 54561ed31c1..bfdc42ab6a0 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -48,7 +48,6 @@
#include "internal-common.h"
#if !defined(CONFIG_USER_ONLY)
#include "accel/tcg/iommu.h"
-#include "hw/core/sysemu-cpu-ops.h"
#endif
/* -icount align implementation. */
@@ -659,21 +658,16 @@ static bool cpu_has_work_after_processing_async_events(CPUState *cpu)
{
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
+ if (tcg_ops->process_async_events) {
+ tcg_ops->process_async_events(cpu);
+ }
+
+ if (!cpu_has_work(cpu)) {
+ return false;
+ }
+
if (tcg_ops->transition_halt_to_exec) {
- assert(!tcg_ops->cpu_exec_halt);
- if (tcg_ops->process_async_events) {
- tcg_ops->process_async_events(cpu);
- }
- if (!cpu_has_work(cpu)) {
- return false;
- }
tcg_ops->transition_halt_to_exec(cpu);
- } else {
- assert(!tcg_ops->process_async_events);
- assert(cpu->cc->sysemu_ops->has_work == tcg_ops->cpu_exec_halt);
- if (!tcg_ops->cpu_exec_halt(cpu)) {
- return false;
- }
}
cpu->halted = 0; /* allow execution */
@@ -1072,7 +1066,6 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
/* Check mandatory TCGCPUOps handlers */
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
#ifndef CONFIG_USER_ONLY
- assert(tcg_ops->cpu_exec_halt || tcg_ops->transition_halt_to_exec);
assert(tcg_ops->cpu_exec_interrupt);
assert(tcg_ops->cpu_exec_reset);
assert(tcg_ops->pointer_wrap);
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index 12e86021663..7d1d036e1d3 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -265,7 +265,6 @@ static const TCGCPUOps alpha_tcg_ops = {
.tlb_fill = alpha_cpu_tlb_fill,
.pointer_wrap = cpu_pointer_wrap_notreached,
.cpu_exec_interrupt = alpha_cpu_exec_interrupt,
- .cpu_exec_halt = alpha_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = alpha_cpu_do_interrupt,
.do_transaction_failed = alpha_cpu_do_transaction_failed,
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
index f8409f32ab9..a01e6fa4751 100644
--- a/target/avr/cpu.c
+++ b/target/avr/cpu.c
@@ -246,7 +246,6 @@ static const TCGCPUOps avr_tcg_ops = {
.restore_state_to_opc = avr_restore_state_to_opc,
.mmu_index = avr_cpu_mmu_index,
.cpu_exec_interrupt = avr_cpu_exec_interrupt,
- .cpu_exec_halt = avr_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.tlb_fill = avr_cpu_tlb_fill,
.do_interrupt = avr_cpu_do_interrupt,
diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
index 7067e5b70f7..9765716b516 100644
--- a/target/hexagon/cpu.c
+++ b/target/hexagon/cpu.c
@@ -768,7 +768,6 @@ static const TCGCPUOps hexagon_tcg_ops = {
.cpu_exec_reset = cpu_reset,
.tlb_fill = hexagon_tlb_fill,
.do_unaligned_access = hexagon_cpu_do_unaligned_access,
- .cpu_exec_halt = hexagon_cpu_has_work,
.do_interrupt = hexagon_cpu_do_interrupt,
#endif /* !CONFIG_USER_ONLY */
};
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 07b49e51326..7b1309a7c38 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -270,7 +270,6 @@ static const TCGCPUOps hppa_tcg_ops = {
.tlb_fill_align = hppa_cpu_tlb_fill_align,
.pointer_wrap = cpu_pointer_wrap_notreached,
.cpu_exec_interrupt = hppa_cpu_exec_interrupt,
- .cpu_exec_halt = hppa_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = hppa_cpu_do_interrupt,
.do_unaligned_access = hppa_cpu_do_unaligned_access,
diff --git a/target/loongarch/tcg/tcg_cpu.c b/target/loongarch/tcg/tcg_cpu.c
index 4b1d44a1644..7ea2a1eb933 100644
--- a/target/loongarch/tcg/tcg_cpu.c
+++ b/target/loongarch/tcg/tcg_cpu.c
@@ -327,7 +327,6 @@ const TCGCPUOps loongarch_tcg_ops = {
.tlb_fill = loongarch_cpu_tlb_fill,
.pointer_wrap = loongarch_pointer_wrap,
.cpu_exec_interrupt = loongarch_cpu_exec_interrupt,
- .cpu_exec_halt = loongarch_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = loongarch_cpu_do_interrupt,
.do_transaction_failed = loongarch_cpu_do_transaction_failed,
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index ce2707dee5a..f349013ad41 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -643,7 +643,6 @@ static const TCGCPUOps m68k_tcg_ops = {
.tlb_fill = m68k_cpu_tlb_fill,
.pointer_wrap = cpu_pointer_wrap_uint32,
.cpu_exec_interrupt = m68k_cpu_exec_interrupt,
- .cpu_exec_halt = m68k_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = m68k_cpu_do_interrupt,
.do_transaction_failed = m68k_cpu_transaction_failed,
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index 389a5124b12..6013a8def8e 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -448,7 +448,6 @@ static const TCGCPUOps mb_tcg_ops = {
.tlb_fill = mb_cpu_tlb_fill,
.pointer_wrap = cpu_pointer_wrap_uint32,
.cpu_exec_interrupt = mb_cpu_exec_interrupt,
- .cpu_exec_halt = mb_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = mb_cpu_do_interrupt,
.do_transaction_failed = mb_cpu_transaction_failed,
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 669c7d99bb7..cebc2283599 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -664,7 +664,6 @@ static const TCGCPUOps mips_tcg_ops = {
.tlb_fill = mips_cpu_tlb_fill,
.pointer_wrap = mips_pointer_wrap,
.cpu_exec_interrupt = mips_cpu_exec_interrupt,
- .cpu_exec_halt = mips_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = mips_cpu_do_interrupt,
.do_transaction_failed = mips_cpu_do_transaction_failed,
diff --git a/target/or1k/cpu.c b/target/or1k/cpu.c
index 66c00c0930c..42d9351b6d7 100644
--- a/target/or1k/cpu.c
+++ b/target/or1k/cpu.c
@@ -266,7 +266,6 @@ static const TCGCPUOps openrisc_tcg_ops = {
.tlb_fill = openrisc_cpu_tlb_fill,
.pointer_wrap = cpu_pointer_wrap_uint32,
.cpu_exec_interrupt = openrisc_cpu_exec_interrupt,
- .cpu_exec_halt = openrisc_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = openrisc_cpu_do_interrupt,
#endif /* !CONFIG_USER_ONLY */
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index e3a1075aad3..85a91ff4bb6 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -7498,7 +7498,6 @@ static const TCGCPUOps ppc_tcg_ops = {
.tlb_fill = ppc_cpu_tlb_fill,
.pointer_wrap = ppc_pointer_wrap,
.cpu_exec_interrupt = ppc_cpu_exec_interrupt,
- .cpu_exec_halt = ppc_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = ppc_cpu_do_interrupt,
.cpu_exec_enter = ppc_cpu_exec_enter,
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
index 9e3cc87f8a3..cd303660f1f 100644
--- a/target/riscv/tcg/tcg-cpu.c
+++ b/target/riscv/tcg/tcg-cpu.c
@@ -287,7 +287,6 @@ const TCGCPUOps riscv_tcg_ops = {
.tlb_fill = riscv_cpu_tlb_fill,
.pointer_wrap = riscv_pointer_wrap,
.cpu_exec_interrupt = riscv_cpu_exec_interrupt,
- .cpu_exec_halt = riscv_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = riscv_cpu_do_interrupt,
.do_transaction_failed = riscv_cpu_do_transaction_failed,
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index 9b8473d71cf..69946928995 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -227,7 +227,6 @@ static const TCGCPUOps rx_tcg_ops = {
.pointer_wrap = cpu_pointer_wrap_uint32,
.cpu_exec_interrupt = rx_cpu_exec_interrupt,
- .cpu_exec_halt = rx_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = rx_cpu_do_interrupt,
};
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 641ea96c8ea..efbfb072bbf 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -382,7 +382,6 @@ static const TCGCPUOps s390_tcg_ops = {
.tlb_fill = s390_cpu_tlb_fill,
.pointer_wrap = s390_pointer_wrap,
.cpu_exec_interrupt = s390_cpu_exec_interrupt,
- .cpu_exec_halt = s390_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = s390_cpu_do_interrupt,
.debug_excp_handler = s390x_cpu_debug_excp_handler,
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index ad2ec28c1b7..8d53e11006d 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -298,7 +298,6 @@ static const TCGCPUOps superh_tcg_ops = {
.tlb_fill = superh_cpu_tlb_fill,
.pointer_wrap = cpu_pointer_wrap_notreached,
.cpu_exec_interrupt = superh_cpu_exec_interrupt,
- .cpu_exec_halt = superh_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = superh_cpu_do_interrupt,
.do_unaligned_access = superh_cpu_do_unaligned_access,
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 1bc14b586bb..2baa5036871 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -1073,7 +1073,6 @@ static const TCGCPUOps sparc_tcg_ops = {
.tlb_fill = sparc_cpu_tlb_fill,
.pointer_wrap = sparc_pointer_wrap,
.cpu_exec_interrupt = sparc_cpu_exec_interrupt,
- .cpu_exec_halt = sparc_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = sparc_cpu_do_interrupt,
.do_transaction_failed = sparc_cpu_do_transaction_failed,
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index 96e2817dee7..f79d6fe5d5d 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -192,7 +192,6 @@ static const TCGCPUOps tricore_tcg_ops = {
.tlb_fill = tricore_cpu_tlb_fill,
.pointer_wrap = cpu_pointer_wrap_uint32,
.cpu_exec_interrupt = tricore_cpu_exec_interrupt,
- .cpu_exec_halt = tricore_cpu_has_work,
.cpu_exec_reset = cpu_reset,
};
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index 7c25b9ab707..99c8bd4b5fb 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -325,7 +325,6 @@ static const TCGCPUOps xtensa_tcg_ops = {
.tlb_fill = xtensa_cpu_tlb_fill,
.pointer_wrap = cpu_pointer_wrap_uint32,
.cpu_exec_interrupt = xtensa_cpu_exec_interrupt,
- .cpu_exec_halt = xtensa_cpu_has_work,
.cpu_exec_reset = cpu_reset,
.do_interrupt = xtensa_cpu_do_interrupt,
.do_transaction_failed = xtensa_cpu_do_transaction_failed,
--
2.53.0
next prev parent reply other threads:[~2026-08-19 14:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 14:56 [PATCH 00/11] accel/tcg: Make halt-to-exec transition explicit and remove cpu_exec_halt Philippe Mathieu-Daudé
2026-08-19 14:56 ` [PATCH 01/11] accel/tcg: Rename for exception codes named @ret as @excp Philippe Mathieu-Daudé
2026-08-19 19:55 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 02/11] accel/tcg: Restrict EXCP_HALTED handling to system emulation Philippe Mathieu-Daudé
2026-08-19 20:01 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 03/11] accel/tcg: Check %halted field in cpu_handle_halt() caller Philippe Mathieu-Daudé
2026-08-19 20:02 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 04/11] accel/tcg: Refactor halt-to-execution flow in cpu_exec() Philippe Mathieu-Daudé
2026-08-19 20:03 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 05/11] accel/tcg: Introduce .process_async_events and .transition_halt_to_exec Philippe Mathieu-Daudé
2026-08-19 20:06 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 06/11] target/arm: Extract halt-to-exec transition out of arm_cpu_exec_halt() Philippe Mathieu-Daudé
2026-08-19 20:13 ` Richard Henderson
2026-08-19 21:40 ` Peter Maydell
2026-08-20 7:29 ` Philippe Mathieu-Daudé
2026-08-19 14:56 ` [PATCH 07/11] target/arm: Convert cpu_exec_halt() to transition_halt_to_exec() Philippe Mathieu-Daudé
2026-08-19 20:15 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 08/11] target/i386: Extract async event processing out of x86_cpu_exec_halt() Philippe Mathieu-Daudé
2026-08-19 20:16 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 09/11] target/i386: Extract halt-to-exec transition " Philippe Mathieu-Daudé
2026-08-19 20:17 ` Richard Henderson
2026-08-19 14:56 ` [PATCH 10/11] target/i386: Convert cpu_exec_halt() to transition_halt_to_exec() Philippe Mathieu-Daudé
2026-08-19 20:18 ` Richard Henderson
2026-08-19 20:19 ` Richard Henderson
2026-08-19 14:56 ` Philippe Mathieu-Daudé [this message]
2026-08-19 15:05 ` [PATCH 11/11] accel/tcg: Remove the now redundant cpu_exec_halt() hook Philippe Mathieu-Daudé
2026-08-19 20:20 ` Richard Henderson
2026-08-20 9:26 ` [PATCH 00/11] accel/tcg: Make halt-to-exec transition explicit and remove cpu_exec_halt Mark Cave-Ayland
2026-08-20 9:56 ` Philippe Mathieu-Daudé
2026-08-24 21:31 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260819145649.23439-12-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.