[PATCH v5 0/3] Register accel-$cpu_type for all targets

Yonggang Luo posted 3 patches 2 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261106023936.772-1-luoyonggang@gmail.com
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>, Peter Maydell <peter.maydell@linaro.org>, Zhao Liu <zhao1.liu@intel.com>, Chinmay Rath <rathc@linux.ibm.com>, Nicholas Piggin <npiggin@gmail.com>, Glenn Miles <milesg@linux.ibm.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Chao Liu <chao.liu@processmission.com>
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 -
8 files changed, 18 insertions(+), 7 deletions(-)
[PATCH v5 0/3] Register accel-$cpu_type for all targets
Posted by Yonggang Luo 2 weeks, 3 days ago
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 already instantiates every QOM type, so this series adds no
parent check.

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

v4: https://lore.kernel.org/qemu-devel/20261105183310.1614-1-luoyonggang@gmail.com/

Changes v4 -> v5:

- Drop test_accel_cpu_parent(). test_qom_types_are_unique() already instantiates
  every QOM type

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 -
 8 files changed, 18 insertions(+), 7 deletions(-)

-- 
2.55.0.windows.3
Re: [PATCH v5 0/3] Register accel-$cpu_type for all targets
Posted by Pierrick Bouvier 2 weeks, 2 days ago
On 11/5/2026 6:39 PM, Yonggang Luo wrote:
> 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 already instantiates every QOM type, so this series adds no
> parent check.
> 
> This is an alternative to gating accelerator CPU types with is_available. The
> RISC-V TCG and KVM gates are reverted here as redundant.
> 
> v4: https://lore.kernel.org/qemu-devel/20261105183310.1614-1-luoyonggang@gmail.com/
> 
> Changes v4 -> v5:
> 
> - Drop test_accel_cpu_parent(). test_qom_types_are_unique() already instantiates
>   every QOM type
> 
> 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 -
>  8 files changed, 18 insertions(+), 7 deletions(-)
> 

Thanks Yonggang, I'll pull this as part of multi-target once the trunk
reopens.

Regards,
Pierrick