Skip to content

qom: pass TargetInfo to the is_available callback

Yonggang Luo qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 53 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8configs/targets: remove target info definitionsMAINTAINERS configs/targets/aarch64-softmmu.c configs/targets/arm-softmmu.c +4 more+1 -1112 replies
2/8target-info: rename target-info-stub.c in target-info-def.cinclude/hw/core/cpu.h meson.build target-info-def.c+2 -20 replies
3/8target-info: rename target-info-impl.h to target-info-def.hinclude/qemu/target-info-def.h include/qemu/target-info-qom.h page-vary-common.c +4 more+8 -81 reply
4/8target-info: replace QOM registration with a constructor listinclude/qemu/module.h include/qemu/target-info-def.h include/qemu/target-info-init.h +9 more+129 -16812 replies
5/8tests/unit: add target-info coverage for multi-target buildsMAINTAINERS meson.build tests/unit/meson.build +1 more+47 -10 replies
6/8meson: load all target .mak files into target_mak_allmeson.build+16 -41 reply
7/8target-info: Replace handwritten architecture checks with generated codeinclude/qemu/target-info.h meson.build scripts/gen-target-info.py +1 more+125 -1281 reply
8/8qom: pass TargetInfo to is_available for later usehw/arm/aspeed_ast27x0-fc.c hw/arm/aspeed_ast27x0_evb.c hw/arm/raspi.c +6 more+24 -1313 replies

Reviews trailers per patch

1 of 8 patches has a Reviewed-by or Acked-by.

PatchPierrick Bouvier
1/8
2/8
3/8R-b
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/8] qom: pass TargetInfo to the is_available callback

This allows a combined binary to register machine types from all its targets. Consequently, QMP query-machines can return machine entries from every target, even when none is selected. For example, a client can query the combined machine list with:

```json
{ "execute": "query-machines" }
```

The returned list includes the registered machine classes from all linked targets. This is separate from selecting a machine: with -target none, -M virt reports the targets that provide virt instead of choosing one arbitrarily:

```text
qemu-system -target none -M virt
unsupported machine type: "virt" for target "none"
Available for targets:
  aarch64
  arm
```

It moves target_info() to a shared location so object.c can call it when checking machine availability. The series also replaces QOM-based target-info registration with a constructor list and passes TargetInfo to the is_available callback.

Target metadata and architecture checks are generated from the configured targets, there is too much arch to write biiolperate code. doing this for easier Add TargetInfo* to is_available

The target-info API and implementation are shared, rather than compiled separately for every target.

This series removes the per-target source files "configs/targets/*.c". Their target-specific parameters are collected in a generated target-info-def.c for each softmmu target. This lays the groundwork for QEMU system builds in which target-info-def.c is the only target-specific source file compiled for each target. Using the same filename lets meson.build handle these definitions uniformly.

The series adds unit-test coverage for target info and multi-target builds.

Pierrick Bouvier (2):
configs/targets: remove target info definitions
target-info: rename target-info-stub.c in target-info-def.c

Yonggang Luo (6):
target-info: rename target-info-impl.h to target-info-def.h
target-info: replace QOM registration with a constructor list tests/unit: add target-info coverage for multi-target builds
meson: load all target .mak files into target_mak_all
target-info: Replace handwritten architecture checks with generated
code
qom: pass TargetInfo to is_available for later use

 MAINTAINERS                             |   2 +-
 configs/targets/aarch64-softmmu.c       |  25 ------
 configs/targets/arm-softmmu.c           |  25 ------
 configs/targets/meson.build             |   6 --
 configs/targets/riscv32-softmmu.c       |  24 -----
 configs/targets/riscv64-softmmu.c       |  24 -----
 hw/arm/aspeed_ast27x0-fc.c              |   2 +-
 hw/arm/aspeed_ast27x0_evb.c             |   4 +-
 hw/arm/raspi.c                          |   4 +-
 hw/arm/raspi4b.c                        |   2 +-
 hw/arm/virt.c                           |   4 +-
 hw/m68k/virt.c                          |   4 +-
 hw/or1k/virt.c                          |   2 +-
 include/hw/core/cpu.h                   |   2 +-
 include/qemu/module.h                   |   1 -
 include/qemu/target-info-def.h          |  88 ++++++++++++++++++
 include/qemu/target-info-impl.h         |  42 ---------
 include/qemu/target-info-init.h         |  53 -----------
 include/qemu/target-info-qom.h          |  31 -------
 include/qemu/target-info.h              |  87 ++++--------------
 include/qom/object.h                    |  12 ++-
 meson.build                             |  52 ++++++++---
 page-vary-common.c                      |   2 +-
 page-vary-system.c                      |   2 +-
 qom/object.c                            |   3 +-
 scripts/gen-target-info.py              |  99 ++++++++++++++++++++
 system/vl.c                             |   4 -
 target-info-stub.c => target-info-def.c |   3 +-
 target-info-qom.c                       |  60 -------------
 target-info.c                           | 115 ++++++++++++------------
 tests/qtest/fuzz/fuzz.c                 |   3 -
 tests/unit/meson.build                  |   4 +
 tests/unit/test-multi-target.c          |  12 +--
 tests/unit/test-target-info.c           |  38 ++++++++
 34 files changed, 379 insertions(+), 462 deletions(-)
 delete mode 100644 configs/targets/aarch64-softmmu.c
 delete mode 100644 configs/targets/arm-softmmu.c
 delete mode 100644 configs/targets/meson.build
 delete mode 100644 configs/targets/riscv32-softmmu.c
 delete mode 100644 configs/targets/riscv64-softmmu.c
 create mode 100644 include/qemu/target-info-def.h
 delete mode 100644 include/qemu/target-info-impl.h
 delete mode 100644 include/qemu/target-info-init.h
 delete mode 100644 include/qemu/target-info-qom.h
 create mode 100644 scripts/gen-target-info.py
 rename target-info-stub.c => target-info-def.c (94%)
 delete mode 100644 target-info-qom.c
 create mode 100644 tests/unit/test-target-info.c
Signature · 1 line
2.55.0.windows.3