A multi-target system binary links more than one target.
accel_cpu_register_type() creates the abstract parent accel-$cpu_type for each
target that has an AccelCPU subclass. ARM, i386, RISC-V, and PowerPC call it.
Other targets have no such subclass, and machine init skips a missing class.

test-multi-target checks the parent only for the CPU types that register it.

This is an alternative to gating accelerator CPU types with is_available. The
RISC-V TCG and KVM gates are reverted here as redundant.

v3: 
https://lore.kernel.org/qemu-devel/[email protected]/

Changes v3 -> v4:

- Drop accel-cpu-target.c and the once-per-TARGET_BASE_ARCH build. Register the
  parent with accel_cpu_register_type() only where an AccelCPU subclass exists
- Call it from ARM, i386, RISC-V, and PowerPC. v3 registered a parent for every
  linked target
- Check those parents from test_qom_types_are_unique(). v3 expected one for
  every target in the test

Yonggang Luo (3):
  accel: register CPU parent only for AccelCPU subclasses
  Revert "target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv
    targets"
  Revert "target/riscv/tcg: restrict tcg-accel-riscv-cpu to riscv
    targets"

 accel/accel-common.c           |  6 ++----
 include/accel/accel-cpu.h      |  2 ++
 target/arm/cpu.c               |  2 ++
 target/i386/cpu.c              |  2 ++
 target/ppc/cpu_init.c          |  2 ++
 target/riscv/cpu.c             |  8 ++++++++
 target/riscv/kvm/kvm-cpu.c     |  2 --
 target/riscv/tcg/tcg-cpu.c     |  1 -
 tests/unit/test-multi-target.c | 25 +++++++++++++++++++++++++
 9 files changed, 43 insertions(+), 7 deletions(-)

-- 
2.55.0.windows.3


Reply via email to