All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] accel/tcg: Make halt-to-exec transition explicit and remove cpu_exec_halt
@ 2026-08-19 14:56 Philippe Mathieu-Daudé
  2026-08-19 14:56 ` [PATCH 01/11] accel/tcg: Rename for exception codes named @ret as @excp Philippe Mathieu-Daudé
                   ` (11 more replies)
  0 siblings, 12 replies; 31+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-19 14:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel Henrique Barboza, Peter Maydell,
	Richard Henderson, Pierrick Bouvier

This series was inspired by a previous thread on the list [*].

Refactor the CPU halt-to-execution transition logic in TCG as
something more explicit and composable.

Core problem: TCGCPUOps::cpu_exec_halt callback mixed concerns,
it checked for work, processed async events, and handled state
transitions all in one place.

Solution: introduces two dedicated callbacks:

  * process_async_events(): Process target-specific async events
    before checking for work. Called early in cpu_exec().

  * transition_halt_to_exec(): Perform target-specific state updates
    when transitioning from halt to execution.

This separation allows the generic cpu_exec() code to orchestrate
the flow cleanly (process events, check for work, transition state).

Only 2 targets need to be migrated (x86 and ARM) then we can remove
the redundant cpu_exec_halt() hook.

The changes are expected to be purely refactoring with no functional
impact.

Series structure:

  Patches 1-2: Preparatory refactoring and guard additions
  Patch 3: Introduce the new hooks and orchestration logic
  Patch 4: Refactor cpu_exec() flow to use new infrastructure
  Patches 5-7: x86 extraction and conversion
  Patches 8-9: ARM extraction and conversion
  Patch 10: Remove the now-redundant cpu_exec_halt hook

Testing: CI test suite

[*] https://lore.kernel.org/qemu-devel/CABgObfaDAhrpnVqQaKgG6uxPQe1YDu77YOsUEx9nqrN=3M2cGw@mail.gmail.com/

Philippe Mathieu-Daudé (11):
  accel/tcg: Rename for exception codes named @ret as @excp
  accel/tcg: Restrict EXCP_HALTED handling to system emulation
  accel/tcg: Check %halted field in cpu_handle_halt() caller
  accel/tcg: Refactor halt-to-execution flow in cpu_exec()
  accel/tcg: Introduce .process_async_events and
    .transition_halt_to_exec
  target/arm: Extract halt-to-exec transition out of arm_cpu_exec_halt()
  target/arm: Convert cpu_exec_halt() to transition_halt_to_exec()
  target/i386: Extract async event processing out of x86_cpu_exec_halt()
  target/i386: Extract halt-to-exec transition out of
    x86_cpu_exec_halt()
  target/i386: Convert cpu_exec_halt() to transition_halt_to_exec()
  accel/tcg: Remove the now redundant cpu_exec_halt() hook

 include/accel/tcg/cpu-ops.h         | 30 +++++++-------
 target/arm/internals.h              |  3 --
 target/i386/tcg/helper-tcg.h        |  3 +-
 accel/tcg/cpu-exec.c                | 63 ++++++++++++++++-------------
 accel/tcg/tcg-accel-ops-mttcg.c     |  7 ++--
 accel/tcg/tcg-accel-ops-rr.c        |  8 ++--
 accel/tcg/tcg-accel-ops.c           |  7 ++--
 target/alpha/cpu.c                  |  1 -
 target/arm/cpu.c                    | 22 +++++-----
 target/arm/tcg/cpu-v7m.c            |  1 -
 target/avr/cpu.c                    |  1 -
 target/hexagon/cpu.c                |  1 -
 target/hppa/cpu.c                   |  1 -
 target/i386/tcg/system/seg_helper.c | 14 ++++---
 target/i386/tcg/tcg-cpu.c           |  3 +-
 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 -
 28 files changed, 84 insertions(+), 94 deletions(-)

-- 
2.53.0



^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2026-08-25 10:55 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 11/11] accel/tcg: Remove the now redundant cpu_exec_halt() hook Philippe Mathieu-Daudé
2026-08-19 15:05   ` 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é
2026-08-25 10:54       ` Mark Cave-Ayland

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.