Skip to content

accel: Remove need for AccelCPUClass

Philippe Mathieu-Daudé kvm qemu-arm qemu-devel qemu-riscv 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest17 patches 5 repliesIn review
  2. v117 patches 24 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17target/loongarch: Remove unused 'accel/accel-cpu-target.h' headertarget/loongarch/tcg/tcg_cpu.c+0 -10 replies
2/17accel: Remove AccelCPUClass::cpu_class_init()accel/accel-common.c include/accel/accel-cpu.h+0 -340 replies
3/17accel: Rename AccelOpsClass::cpu_target_realize() -> cpu_realize()accel/accel-common.c accel/hvf/hvf-accel-ops.c include/accel/accel-cpu-ops.h+5 -40 replies
4/17accel/hvf: Remove need for AccelCPUClass::cpu_realizetarget/i386/hvf/hvf-cpu.c target/i386/hvf/hvf.c+5 -60 replies
5/17accel/kvm: Remove need for AccelCPUClass::cpu_realizeaccel/kvm/kvm-accel-ops.c include/system/kvm.h target/arm/kvm.c +5 more+21 -331 reply
6/17accel: Introduce AccelOpsClass::cpu_instance_init handleraccel/accel-common.c include/accel/accel-cpu-ops.h+10 -10 replies
7/17accel/whpx: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_initaccel/whpx/whpx-accel-ops.c accel/whpx/whpx-common.c target/arm/whpx/whpx-all.c +1 more+2 -190 replies
8/17accel/nvmm: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_inittarget/i386/nvmm/nvmm-accel-ops.c target/i386/nvmm/nvmm-accel-ops.h target/i386/nvmm/nvmm-all.c+5 -180 replies
9/17accel/hvf: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_initaccel/hvf/hvf-accel-ops.c include/system/hvf_int.h target/arm/hvf/hvf.c +1 more+7 -240 replies
10/17accel/kvm: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_initaccel/kvm/kvm-accel-ops.c include/system/kvm.h target/arm/kvm.c +5 more+20 -431 reply
11/17accel/tcg: Convert AccelCPUClass -> new TCGCPUOps::cpu_instance_initaccel/tcg/cpu-exec.c accel/tcg/tcg-accel-ops.c accel/tcg/tcg-accel-ops.h +3 more+18 -30 replies
12/17accel: Remove AccelCPUClass::cpu_instance_init()accel/accel-common.c include/accel/accel-cpu.h+0 -60 replies
13/17accel/tcg: Convert AccelCPUClass -> new TCGCPUOps::cpu_realizeaccel/tcg/cpu-exec.c include/accel/tcg/cpu-ops.h+6 -10 replies
14/17accel/tcg: Convert X86 AccelCPUClass -> TCGCPUOps::cpu_realizetarget/i386/tcg/tcg-cpu.c+1 -220 replies
15/17accel/tcg: Convert RISCV AccelCPUClass -> TCGCPUOps::cpu_realizetarget/riscv/tcg/tcg-cpu.c+2 -220 replies
16/17accel: Remove AccelCPUClass::cpu_target_realize()accel/accel-common.c include/accel/accel-cpu.h+0 -90 replies
17/17accel: Remove AccelCPUClass and 'accel/accel-cpu-target.h'accel/accel-common.c include/accel/accel-cpu-target.h include/accel/accel-cpu.h+0 -660 replies

Reviews trailers per patch

All 17 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchRichard HendersonPierrick BouvierAnushree MathurAmit MachhiwalMatthew Rosato
SeriesT-b R-b
1/17R-b R-b
2/17R-b R-b
3/17R-b R-b
4/17R-b
5/17R-b R-b R-b
6/17R-b R-b
7/17R-b R-b
8/17R-b R-b
9/17R-b R-b
10/17R-b R-b R-b
11/17R-b R-b
12/17R-b R-b
13/17R-b R-b
14/17R-b R-b
15/17R-b R-b
16/17R-b R-b
17/17R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/17] accel: Remove need for AccelCPUClass

Could get re-review: 4 & 5

Move cpu_init/realize hooks from AccelCPUClass to AccelOpsClass. Specialize them for TCG in TCGCPUOps.

This drastically simplifies the need of per-binary QOM types per accelerator per target (see also the nice diff-stat).

Based-on: tag single-binary-20260528

Ignoring checkpatch.pl:

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
accel/accel-target.c
include/accel/accel-cpu-target.h
include/accel/accel-cpu.h

$ git backport-diff since v1:

[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

  001/      17:[----] [--] 'target/loongarch: Remove unused 'accel/accel-cpu-target.h' header'
  002/      17:[----] [--] 'accel: Remove AccelCPUClass::cpu_class_init()'
  003/      17:[----] [--] 'accel: Rename AccelOpsClass::cpu_target_realize() -> cpu_realize()'
  004/      17:[----] [--] 'accel/hvf: Remove need for AccelCPUClass::cpu_realize'
  005/      17:[----] [--] 'accel/kvm: Remove need for AccelCPUClass::cpu_realize'
  006/      17:[----] [--] 'accel: Introduce AccelOpsClass::cpu_instance_init handler'
  007/      17:[----] [--] 'accel/whpx: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init'
  008/      17:[0002] [FC] 'accel/nvmm: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init'
  009/      17:[0002] [FC] 'accel/hvf: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init'
  010/      17:[0016] [FC] 'accel/kvm: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init'
  011/      17:[----] [--] 'accel/tcg: Convert AccelCPUClass -> new TCGCPUOps::cpu_instance_init'
  012/      17:[----] [--] 'accel: Remove AccelCPUClass::cpu_instance_init()'
  013/      17:[----] [--] 'accel/tcg: Convert AccelCPUClass -> new TCGCPUOps::cpu_realize'
  014/      17:[----] [--] 'accel/tcg: Convert X86 AccelCPUClass -> TCGCPUOps::cpu_realize'
  015/      17:[----] [--] 'accel/tcg: Convert RISCV AccelCPUClass -> TCGCPUOps::cpu_realize'
  016/      17:[----] [--] 'accel: Remove AccelCPUClass::cpu_target_realize()'
  017/      17:[----] [--] 'accel: Remove AccelCPUClass and 'accel/accel-cpu-target.h''
  diff --git a/include/system/kvm.h b/include/system/kvm.h
  index 2c31fa6019e..a249f076763 100644
  --- a/include/system/kvm.h
  +++ b/include/system/kvm.h
  @@ -225,0 +226,3 @@ void kvm_irqchip_change_notify(void);
  +void kvm_arch_cpu_instance_init(CPUState *cpu);
  +bool kvm_arch_cpu_realize(CPUState *cpu, Error **errp);
  +
  @@ -367,3 +369,0 @@ int kvm_arch_destroy_vcpu(CPUState *cpu);
  -void kvm_arch_cpu_instance_init(CPUState *cpu);
  -bool kvm_arch_cpu_realize(CPUState *cpu, Error **errp);
  -
  diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
  index 113a23f2384..edad3c1acea 100644
  --- a/accel/kvm/kvm-accel-ops.c
  +++ b/accel/kvm/kvm-accel-ops.c
  @@ -101 +101 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
  -    ops->cpu_target_realize = kvm_arch_cpu_realize;
  +    ops->cpu_realize = kvm_arch_cpu_realize;
  diff --git a/target/arm/kvm.c b/target/arm/kvm.c
  index 7d194ea112b..0f1a98b430f 100644
  --- a/target/arm/kvm.c
  +++ b/target/arm/kvm.c
  @@ -1785,0 +1786,9 @@ void kvm_arch_accel_class_init(ObjectClass *oc)
  +void kvm_arch_cpu_instance_init(CPUState *cpu)
  +{
  +}
  +
  +bool kvm_arch_cpu_realize(CPUState *cpu, Error **errp)
  +{
  +    return true;
  +}
  +
  diff --git a/target/i386/hvf/hvf-cpu.c b/target/i386/hvf/hvf-cpu.c
  index 5d74ca6fd56..536bcecd7d2 100644
  --- a/target/i386/hvf/hvf-cpu.c
  +++ b/target/i386/hvf/hvf-cpu.c
  @@ -58 +58 @@ static void hvf_cpu_xsave_init(void)
  -void hvf_arch_cpu_instance_init(CPUState *cpu)
  +void hvf_arch_cpu_instance_init(CPUState *cs)
  diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
  index 10ab7b2a4dc..2973e28122a 100644
  --- a/target/i386/nvmm/nvmm-all.c
  +++ b/target/i386/nvmm/nvmm-all.c
  @@ -1214 +1214 @@ static const TypeInfo nvmm_accel_type = {
  -void nvmm_arch_cpu_instance_init(CPUState *cpu)
  +void nvmm_arch_cpu_instance_init(CPUState *cs)
  diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
  index 9d844c4905a..167fdd515be 100644
  --- a/target/loongarch/kvm/kvm.c
  +++ b/target/loongarch/kvm/kvm.c
  @@ -1497,0 +1498,9 @@ void kvm_arch_accel_class_init(ObjectClass *oc)
  +
  +void kvm_arch_cpu_instance_init(CPUState *cpu)
  +{
  +}
  +
  +bool kvm_arch_cpu_realize(CPUState *cpu, Error **errp)
  +{
  +    return true;
  +}
  diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
  index 013f5e852e1..894962d509f 100644
  --- a/target/ppc/kvm.c
  +++ b/target/ppc/kvm.c
  @@ -2354,0 +2355,4 @@ static void alter_insns(uint64_t *word, uint64_t flags, bool on)
  +void kvm_arch_cpu_instance_init(CPUState *cpu)
  +{
  +}
  +
  diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
  index 2e4f435c537..46730e72a92 100644
  --- a/target/s390x/kvm/kvm.c
  +++ b/target/s390x/kvm/kvm.c
  @@ -2613,0 +2614,9 @@ void kvm_arch_accel_class_init(ObjectClass *oc)
  +
  +void kvm_arch_cpu_instance_init(CPUState *cpu)
  +{
  +}
  +
  +bool kvm_arch_cpu_realize(CPUState *cpu, Error **errp)
  +{
  +    return true;
  +}

Philippe Mathieu-Daudé (17):
target/loongarch: Remove unused 'accel/accel-cpu-target.h' header
accel: Remove AccelCPUClass::cpu_class_init()
accel: Rename AccelOpsClass::cpu_target_realize() -> cpu_realize() accel/hvf: Remove need for AccelCPUClass::cpu_realize accel/kvm: Remove need for AccelCPUClass::cpu_realize
accel: Introduce AccelOpsClass::cpu_instance_init handler accel/whpx: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init accel/nvmm: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init accel/hvf: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init accel/kvm: Convert AccelCPUClass -> AccelOpsClass::cpu_instance_init accel/tcg: Convert AccelCPUClass -> new TCGCPUOps::cpu_instance_init
accel: Remove AccelCPUClass::cpu_instance_init() accel/tcg: Convert AccelCPUClass -> new TCGCPUOps::cpu_realize accel/tcg: Convert X86 AccelCPUClass -> TCGCPUOps::cpu_realize accel/tcg: Convert RISCV AccelCPUClass -> TCGCPUOps::cpu_realize
accel: Remove AccelCPUClass::cpu_target_realize()
accel: Remove AccelCPUClass and 'accel/accel-cpu-target.h'

 accel/tcg/tcg-accel-ops.h         |  1 +
 include/accel/accel-cpu-ops.h     |  3 +-
 include/accel/accel-cpu-target.h  | 31 --------------
 include/accel/accel-cpu.h         | 23 -----------
 include/accel/tcg/cpu-ops.h       |  2 +
 include/system/hvf_int.h          |  1 +
 include/system/kvm.h              |  3 ++
 target/i386/nvmm/nvmm-accel-ops.h |  2 +
 accel/accel-common.c              | 68 ++++---------------------------
 accel/hvf/hvf-accel-ops.c         |  3 +-
 accel/kvm/kvm-accel-ops.c         |  2 +
 accel/tcg/cpu-exec.c              | 15 ++++++-
 accel/tcg/tcg-accel-ops.c         |  1 +
 accel/whpx/whpx-accel-ops.c       |  2 +
 accel/whpx/whpx-common.c          | 17 --------
 target/arm/hvf/hvf.c              |  4 ++
 target/arm/kvm.c                  |  9 ++++
 target/arm/whpx/whpx-all.c        |  1 -
 target/i386/hvf/hvf-cpu.c         | 25 ++----------
 target/i386/hvf/hvf.c             |  5 ---
 target/i386/kvm/kvm-cpu.c         | 25 +-----------
 target/i386/nvmm/nvmm-accel-ops.c |  2 +
 target/i386/nvmm/nvmm-all.c       | 19 +--------
 target/i386/tcg/tcg-cpu.c         | 28 ++-----------
 target/i386/whpx/whpx-all.c       |  1 -
 target/loongarch/kvm/kvm.c        |  9 ++++
 target/loongarch/tcg/tcg_cpu.c    |  1 -
 target/ppc/kvm.c                  | 27 +++---------
 target/riscv/kvm/kvm-cpu.c        | 33 +--------------
 target/riscv/tcg/tcg-cpu.c        | 28 +++----------
 target/s390x/kvm/kvm.c            |  9 ++++
 31 files changed, 95 insertions(+), 305 deletions(-)
 delete mode 100644 include/accel/accel-cpu-target.h
 delete mode 100644 include/accel/accel-cpu.h
Signature · 1 line
2.53.0