Hi,

TL;DR; this series remove TCG plugin code from generic accel code.

Since the introduction of the scoreboard in plugins, the INIT
hook use the vCPU index, which is only available somewhere
during the vCPU REALIZE() step (see below for call tree).

In order to clarify that, we split accel_cpu_common_[un]realize
as *unassigned and *assigned steps. This allow to remove the
plugin [un]registration code from common accel code.

Another approach suggested by rth is to add a PostRealize()
handler in DeviceClass. This was already experimented here:
https://lore.kernel.org/qemu-devel/20240209123226.32576-1-phi...@linaro.org/
Since it is a change harder to sell, I took this simplified
path which just make the vCPU REALIZE a bit more complex,
but not really an concern since the current call tree is
https://etherpad.opendev.org/p/QEMU_vCPU_life.

Philippe Mathieu-Daudé (6):
  system/runstate: Remove unused 'qemu/plugin.h' header
  accel/tcg: Move common declarations to 'internal-common.h'
  accel: Clarify accel_cpu_common_[un]realize() use unassigned vCPU
  accel: Introduce accel_cpu_common_[un]realize_assigned() handlers
  accel: Restrict TCG plugin (un)registration to TCG accel
  accel/tcg: Move qemu_plugin_vcpu_init__async() to plugins/

 accel/tcg/internal-common.h | 17 ++++++++++++++++
 accel/tcg/internal-target.h | 14 -------------
 include/qemu/accel.h        | 39 ++++++++++++++++++++++++++++++-------
 include/qemu/plugin.h       |  6 ------
 accel/accel-target.c        | 34 +++++++++++++++++++++++++++-----
 accel/tcg/cpu-exec-common.c | 20 +++++++++++++++++++
 accel/tcg/cpu-exec.c        |  4 ++--
 accel/tcg/tcg-all.c         |  8 +++++---
 cpu-target.c                | 10 ++++++++--
 hw/core/cpu-common.c        | 25 ------------------------
 plugins/core.c              |  8 +++++++-
 system/runstate.c           |  1 -
 12 files changed, 120 insertions(+), 66 deletions(-)

-- 
2.41.0


Reply via email to