On 29/05/26 7:54 PM, Philippe Mathieu-Daudé wrote:
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
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_target_realize
accel/kvm: Remove need for AccelCPUClass::cpu_target_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/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/tcg/tcg_cpu.c | 1 -
target/ppc/kvm.c | 23 +----------
target/riscv/kvm/kvm-cpu.c | 33 +--------------
target/riscv/tcg/tcg-cpu.c | 28 +++----------
28 files changed, 64 insertions(+), 305 deletions(-)
delete mode 100644 include/accel/accel-cpu-target.h
delete mode 100644 include/accel/accel-cpu.h
Hi Philippe,
I am seeing a compilation issue when I am building the qemu after
applying this series of patch. I have tested this for arch PPC.
After applying the patch when I ran make command it failed with the
below error:
[2418/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/hw_intc_xics_pnv.c.o
[2419/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/hw_ppc_spapr_drc.c.o
[2420/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/libdecnumber_dpd_decimal32.c.o
[2421/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/target_ppc_mmu_helper.c.o
[2422/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/accel_kvm_kvm-accel-ops.c.o
FAILED: [code=1] libqemu-ppc64-softmmu.a.p/accel_kvm_kvm-accel-ops.c.o
cc -m64 -mlittle-endian -Ilibqemu-ppc64-softmmu.a.p -I. -I..
-Itarget/ppc -I../target/ppc -Isubprojects/dtc/libfdt
-I../subprojects/dtc/libfdt -Isubprojects/libvduse
-I../subprojects/libvduse -Iqapi -Itrace -Iui -Iui/shader
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0
-fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-init-padding-bits=all -fzero-call-used-regs=used-gpr
-fstack-protector-strong -Wempty-body -Wendif-labels
-Wexpansion-to-defined -Wformat-overflow=2 -Wformat-security
-Wformat-y2k -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self
-Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs
-Wold-style-declaration -Wold-style-definition -Wredundant-decls
-Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla
-Wwrite-strings -Wno-missing-include-dirs -Wno-psabi
-Wno-shift-negative-value -isystem /home/Anu/qemu/linux-headers -isystem
linux-headers -iquote . -iquote /home/Anu/qemu -iquote
/home/Anu/qemu/include -iquote /home/Anu/qemu/host/include/ppc64 -iquote
/home/Anu/qemu/host/include/generic -iquote /home/Anu/qemu/tcg/ppc64
-pthread -fPIE -isystem../linux-headers -isystemlinux-headers
-DCOMPILING_PER_TARGET '-DCONFIG_TARGET="ppc64-softmmu-config-target.h"'
'-DCONFIG_DEVICES="ppc64-softmmu-config-devices.h"' -MD -MQ
libqemu-ppc64-softmmu.a.p/accel_kvm_kvm-accel-ops.c.o -MF
libqemu-ppc64-softmmu.a.p/accel_kvm_kvm-accel-ops.c.o.d -o
libqemu-ppc64-softmmu.a.p/accel_kvm_kvm-accel-ops.c.o -c
../accel/kvm/kvm-accel-ops.c
../accel/kvm/kvm-accel-ops.c: In function ‘kvm_accel_ops_class_init’:
../accel/kvm/kvm-accel-ops.c:101:8: error: ‘AccelOpsClass’ has no member
named ‘cpu_target_realize’
101 | ops->cpu_target_realize = kvm_arch_cpu_realize;
| ^~
[2423/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/hw_ppc_spapr_nested.c.o
[2424/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/hw_remote_memory.c.o
[2425/2928] Compiling C object
libqemu-ppc64-softmmu.a.p/libdecnumber_decContext.c.o
[2426/2928] Compiling C object
qga/qemu-ga.p/meson-generated_.._qga-qapi-emit-events.c.o
[2427/2928] Compiling C object libqemu-ppc64-softmmu.a.p/hw_intc_ppc-uic.c.o
Thank you,
Anushree Mathur