[PATCH 00/27] single-binary: implement dynamic filtering for machine types

Pierrick Bouvier posted 27 patches 4 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260724000948.234657-1-pierrick.bouvier@oss.qualcomm.com
Maintainers: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, "Philippe Mathieu-Daudé" <philmd@mailo.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>, "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Kane Chen <kane_chen@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Samuel Tardieu <sam@rfc1149.net>, Strahinja Jankovic <strahinja.p.jankovic@gmail.com>, Antony Pavlov <antonynpavlov@gmail.com>, Jean-Christophe Dubois <jcd@tribudubois.net>, Gaurav Sharma <gaurav.sharma_7@nxp.com>, Bernhard Beschow <shentey@gmail.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Jan Kiszka <jan.kiszka@web.de>, Tyrone Ting <kfting@nuvoton.com>, Hao Wu <wuhaotsh@google.com>, Felipe Balbi <balbi@kernel.org>, Niek Linnenbank <nieklinnenbank@gmail.com>, Leif Lindholm <leif.lindholm@oss.qualcomm.com>, Alexandre Iooss <erdnaxe@crans.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Zhao Liu <zhao1.liu@intel.com>, Alexander Graf <graf@amazon.com>, Elena Ufimtseva <elena.ufimtseva@oracle.com>, Jagannathan Raman <jag.raman@oracle.com>, Sai Pavan Boddu <sai.pavan.boddu@amd.com>, Conor Dooley <conor@kernel.org>, Sebastian Huber <sebastian.huber@embedded-brains.de>, Nicholas Piggin <npiggin@gmail.com>, Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>, Michael Ellerman <mpe@kernel.org>, Portia Stephens <portias@oss.tenstorrent.com>, Ran Wang <wangran@bosc.ac.cn>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>
configs/targets/aarch64-softmmu.c         | 27 ------------
configs/targets/arm-softmmu.c             | 27 ------------
configs/targets/meson.build               |  6 ---
configs/targets/riscv32-softmmu.c         | 26 -----------
configs/targets/riscv64-softmmu.c         | 26 -----------
hw/arm/aspeed.c                           |  1 -
hw/arm/aspeed_ast1040_evb.c               |  4 +-
hw/arm/aspeed_ast10x0_evb.c               |  7 +--
hw/arm/aspeed_ast2400_palmetto.c          |  4 +-
hw/arm/aspeed_ast2400_quanta-q71l.c       |  4 +-
hw/arm/aspeed_ast2400_supermicrox11.c     |  4 +-
hw/arm/aspeed_ast2500_evb.c               |  4 +-
hw/arm/aspeed_ast2500_g220a.c             |  4 +-
hw/arm/aspeed_ast2500_romulus.c           |  4 +-
hw/arm/aspeed_ast2500_supermicro-x11spi.c |  4 +-
hw/arm/aspeed_ast2500_tiogapass.c         |  4 +-
hw/arm/aspeed_ast2500_witherspoon.c       |  4 +-
hw/arm/aspeed_ast2500_yosemitev2.c        |  4 +-
hw/arm/aspeed_ast2600_anacapa.c           |  4 +-
hw/arm/aspeed_ast2600_bletchley.c         |  4 +-
hw/arm/aspeed_ast2600_catalina.c          |  4 +-
hw/arm/aspeed_ast2600_evb.c               |  4 +-
hw/arm/aspeed_ast2600_fby35.c             |  4 +-
hw/arm/aspeed_ast2600_fuji.c              |  4 +-
hw/arm/aspeed_ast2600_gb200nvl.c          |  4 +-
hw/arm/aspeed_ast2600_rainier.c           |  4 +-
hw/arm/aspeed_ast27x0-fc.c                |  4 +-
hw/arm/aspeed_ast27x0_evb.c               |  7 +--
hw/arm/b-l475e-iot01a.c                   |  4 +-
hw/arm/bananapi_m2u.c                     |  4 +-
hw/arm/collie.c                           |  4 +-
hw/arm/cubieboard.c                       |  4 +-
hw/arm/digic_boards.c                     |  4 +-
hw/arm/exynos4_boards.c                   |  7 +--
hw/arm/imx25_pdk.c                        |  4 +-
hw/arm/imx8mm-evk.c                       |  4 +-
hw/arm/imx8mp-evk.c                       |  4 +-
hw/arm/integratorcp.c                     |  4 +-
hw/arm/kzm.c                              |  4 +-
hw/arm/max78000fthr.c                     |  4 +-
hw/arm/mcimx6ul-evk.c                     |  4 +-
hw/arm/mcimx7d-sabre.c                    |  4 +-
hw/arm/microbit.c                         |  4 +-
hw/arm/mps2-tz.c                          | 13 +++---
hw/arm/mps2.c                             | 13 +++---
hw/arm/mps3r.c                            |  4 +-
hw/arm/msf2-som.c                         |  4 +-
hw/arm/musca.c                            |  7 +--
hw/arm/musicpal.c                         |  4 +-
hw/arm/netduino2.c                        |  4 +-
hw/arm/netduinoplus2.c                    |  4 +-
hw/arm/npcm7xx_boards.c                   | 16 ++++---
hw/arm/npcm8xx_boards.c                   |  4 +-
hw/arm/olimex-stm32-h405.c                |  4 +-
hw/arm/omap_sx1.c                         |  7 +--
hw/arm/orangepi.c                         |  4 +-
hw/arm/raspi.c                            | 16 ++++---
hw/arm/raspi4b.c                          |  4 +-
hw/arm/realview.c                         | 13 +++---
hw/arm/sabrelite.c                        |  4 +-
hw/arm/sbsa-ref.c                         |  4 +-
hw/arm/stellaris.c                        |  7 +--
hw/arm/stm32vldiscovery.c                 |  4 +-
hw/arm/versatilepb.c                      |  7 +--
hw/arm/vexpress.c                         |  7 +--
hw/arm/virt.c                             |  4 +-
hw/arm/xen-pvh.c                          |  4 +-
hw/arm/xilinx_zynq.c                      |  4 +-
hw/arm/xlnx-versal-virt.c                 |  7 +--
hw/arm/xlnx-zcu102.c                      |  4 +-
hw/core/machine-qmp-cmds.c                |  3 +-
hw/core/null-machine.c                    |  9 +---
hw/nitro/machine.c                        |  4 +-
hw/remote/machine.c                       |  5 +--
hw/riscv/boston-aia.c                     |  4 +-
hw/riscv/k230.c                           |  4 +-
hw/riscv/microblaze-v-generic.c           |  4 +-
hw/riscv/microchip_pfsoc.c                |  4 +-
hw/riscv/opentitan.c                      |  4 +-
hw/riscv/shakti_c.c                       |  4 +-
hw/riscv/sifive_e.c                       |  4 +-
hw/riscv/sifive_u.c                       |  4 +-
hw/riscv/spike.c                          |  4 +-
hw/riscv/tt_atlantis.c                    |  4 +-
hw/riscv/virt.c                           |  3 --
hw/riscv/xiangshan_kmh.c                  |  4 +-
hw/xenpv/xen_machine_pv.c                 |  3 +-
include/hw/arm/machines-qom.h             | 46 -------------------
include/hw/core/boards.h                  |  4 ++
include/hw/riscv/machines-qom.h           | 46 -------------------
include/qemu/target-info-impl.h           |  9 +++-
include/qemu/target-info-qom.h            | 24 ++++++++++
include/qemu/target-info.h                | 45 +++++++++++++++----
meson.build                               |  9 +---
monitor/qemu-config-qmp.c                 |  4 +-
system/vl.c                               |  5 +--
target-info-stub.c => target-info-def.c   | 29 ++++++++++--
target-info-qom.c                         | 54 ++++++++++++++++-------
target-info.c                             | 36 ++++++++++++---
target/arm/machine.c                      | 19 +-------
target/riscv/machine.c                    | 18 +-------
101 files changed, 385 insertions(+), 481 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
delete mode 100644 include/hw/arm/machines-qom.h
delete mode 100644 include/hw/riscv/machines-qom.h
rename target-info-stub.c => target-info-def.c (67%)
[PATCH 00/27] single-binary: implement dynamic filtering for machine types
Posted by Pierrick Bouvier 4 hours ago
Now that we can link a single-binary with at least two targets (arm, aarch64),
we want to make sure that we expose the same set of machines (later devices and
cpus) than target binaries. For that, we implemented a static filtering based on
target interfaces that each machine will implement to declare which targets have
this machine.

However, we discovered that this static filtering is not enough. Indeed, some
machines and devices do not depend only on target, and their presence can depend
on Kconfig or host/target combination. Thus, our static approach can't work, and
we need something more flexible.

This series adds a new TYPE_TARGET_SPECIFIC, that declare a single function
bool is_available(void). From there, any machine type (and later devices and
cpus) can implement it to override their presence for each target.
We first replace the existing static mechanism with this, and once done, we
cleanup all the old interface. One nice benefit is that we can get rid of
config/targets/*.c files, which saves duplication.

This series was tested by comparing list of machines for all qemu system
binaries, before and after this change, to make sure we don't introduce a
regression.

Pierrick Bouvier (27):
  include/qemu/target-info-qom.h: declare TYPE_TARGET_SPECIFIC interface
  hw/arm: implement TYPE_TARGET_SPECIFIC
  target-info: add target_riscv32 and target_base_riscv
  hw/riscv: implement TYPE_TARGET_SPECIFIC
  target-info: add target_config_multiprocess
  hw/remote/machine: remove unsupported arm target
  hw/remote/machine: implement TYPE_TARGET_SPECIFIC
  target-info: add target_config_xen
  hw/arm/xen-pvh: implement TYPE_TARGET_SPECIFIC
  hw/xenpv/xen_machine_pv: implement TYPE_TARGET_SPECIFIC
  target-info: add target_config_nitro
  hw/nitro/machine: implement TYPE_TARGET_SPECIFIC
  target-info-qom: implement new machine filtering per target
  target-info-qom: use TYPE_MACHINE instead of target_machine_typename
  target-info: remove target_machine_typename
  target-info-qom: add type_target_specific
  hw/arm: remove TYPE_TARGET_{AARCH64,ARM}_MACHINE
  hw/arm: remove {arm,arm_aarch64,aarch64}_machine_interfaces
  include/hw/core/boards.h: add DEFINE_MACHINE_TARGET_SPECIFIC
  hw/arm: remove DEFINE_MACHINE_{AARCH64,ARM}
  hw/arm: remove machines-qom.h
  hw/riscv: remove TYPE_TARGET_{RISCV32,RISCV64}_MACHINE
  hw/riscv: remove {riscv32,riscv32_64,riscv64}_machine_interfaces
  hw/riscv: remove DEFINE_MACHINE_{RISCV32,RISCV64}
  hw/riscv: remove machines-qom.h
  configs/targets: remove target info definitions
  target-info: rename target-info-stub.c in target-info-def.c

 configs/targets/aarch64-softmmu.c         | 27 ------------
 configs/targets/arm-softmmu.c             | 27 ------------
 configs/targets/meson.build               |  6 ---
 configs/targets/riscv32-softmmu.c         | 26 -----------
 configs/targets/riscv64-softmmu.c         | 26 -----------
 hw/arm/aspeed.c                           |  1 -
 hw/arm/aspeed_ast1040_evb.c               |  4 +-
 hw/arm/aspeed_ast10x0_evb.c               |  7 +--
 hw/arm/aspeed_ast2400_palmetto.c          |  4 +-
 hw/arm/aspeed_ast2400_quanta-q71l.c       |  4 +-
 hw/arm/aspeed_ast2400_supermicrox11.c     |  4 +-
 hw/arm/aspeed_ast2500_evb.c               |  4 +-
 hw/arm/aspeed_ast2500_g220a.c             |  4 +-
 hw/arm/aspeed_ast2500_romulus.c           |  4 +-
 hw/arm/aspeed_ast2500_supermicro-x11spi.c |  4 +-
 hw/arm/aspeed_ast2500_tiogapass.c         |  4 +-
 hw/arm/aspeed_ast2500_witherspoon.c       |  4 +-
 hw/arm/aspeed_ast2500_yosemitev2.c        |  4 +-
 hw/arm/aspeed_ast2600_anacapa.c           |  4 +-
 hw/arm/aspeed_ast2600_bletchley.c         |  4 +-
 hw/arm/aspeed_ast2600_catalina.c          |  4 +-
 hw/arm/aspeed_ast2600_evb.c               |  4 +-
 hw/arm/aspeed_ast2600_fby35.c             |  4 +-
 hw/arm/aspeed_ast2600_fuji.c              |  4 +-
 hw/arm/aspeed_ast2600_gb200nvl.c          |  4 +-
 hw/arm/aspeed_ast2600_rainier.c           |  4 +-
 hw/arm/aspeed_ast27x0-fc.c                |  4 +-
 hw/arm/aspeed_ast27x0_evb.c               |  7 +--
 hw/arm/b-l475e-iot01a.c                   |  4 +-
 hw/arm/bananapi_m2u.c                     |  4 +-
 hw/arm/collie.c                           |  4 +-
 hw/arm/cubieboard.c                       |  4 +-
 hw/arm/digic_boards.c                     |  4 +-
 hw/arm/exynos4_boards.c                   |  7 +--
 hw/arm/imx25_pdk.c                        |  4 +-
 hw/arm/imx8mm-evk.c                       |  4 +-
 hw/arm/imx8mp-evk.c                       |  4 +-
 hw/arm/integratorcp.c                     |  4 +-
 hw/arm/kzm.c                              |  4 +-
 hw/arm/max78000fthr.c                     |  4 +-
 hw/arm/mcimx6ul-evk.c                     |  4 +-
 hw/arm/mcimx7d-sabre.c                    |  4 +-
 hw/arm/microbit.c                         |  4 +-
 hw/arm/mps2-tz.c                          | 13 +++---
 hw/arm/mps2.c                             | 13 +++---
 hw/arm/mps3r.c                            |  4 +-
 hw/arm/msf2-som.c                         |  4 +-
 hw/arm/musca.c                            |  7 +--
 hw/arm/musicpal.c                         |  4 +-
 hw/arm/netduino2.c                        |  4 +-
 hw/arm/netduinoplus2.c                    |  4 +-
 hw/arm/npcm7xx_boards.c                   | 16 ++++---
 hw/arm/npcm8xx_boards.c                   |  4 +-
 hw/arm/olimex-stm32-h405.c                |  4 +-
 hw/arm/omap_sx1.c                         |  7 +--
 hw/arm/orangepi.c                         |  4 +-
 hw/arm/raspi.c                            | 16 ++++---
 hw/arm/raspi4b.c                          |  4 +-
 hw/arm/realview.c                         | 13 +++---
 hw/arm/sabrelite.c                        |  4 +-
 hw/arm/sbsa-ref.c                         |  4 +-
 hw/arm/stellaris.c                        |  7 +--
 hw/arm/stm32vldiscovery.c                 |  4 +-
 hw/arm/versatilepb.c                      |  7 +--
 hw/arm/vexpress.c                         |  7 +--
 hw/arm/virt.c                             |  4 +-
 hw/arm/xen-pvh.c                          |  4 +-
 hw/arm/xilinx_zynq.c                      |  4 +-
 hw/arm/xlnx-versal-virt.c                 |  7 +--
 hw/arm/xlnx-zcu102.c                      |  4 +-
 hw/core/machine-qmp-cmds.c                |  3 +-
 hw/core/null-machine.c                    |  9 +---
 hw/nitro/machine.c                        |  4 +-
 hw/remote/machine.c                       |  5 +--
 hw/riscv/boston-aia.c                     |  4 +-
 hw/riscv/k230.c                           |  4 +-
 hw/riscv/microblaze-v-generic.c           |  4 +-
 hw/riscv/microchip_pfsoc.c                |  4 +-
 hw/riscv/opentitan.c                      |  4 +-
 hw/riscv/shakti_c.c                       |  4 +-
 hw/riscv/sifive_e.c                       |  4 +-
 hw/riscv/sifive_u.c                       |  4 +-
 hw/riscv/spike.c                          |  4 +-
 hw/riscv/tt_atlantis.c                    |  4 +-
 hw/riscv/virt.c                           |  3 --
 hw/riscv/xiangshan_kmh.c                  |  4 +-
 hw/xenpv/xen_machine_pv.c                 |  3 +-
 include/hw/arm/machines-qom.h             | 46 -------------------
 include/hw/core/boards.h                  |  4 ++
 include/hw/riscv/machines-qom.h           | 46 -------------------
 include/qemu/target-info-impl.h           |  9 +++-
 include/qemu/target-info-qom.h            | 24 ++++++++++
 include/qemu/target-info.h                | 45 +++++++++++++++----
 meson.build                               |  9 +---
 monitor/qemu-config-qmp.c                 |  4 +-
 system/vl.c                               |  5 +--
 target-info-stub.c => target-info-def.c   | 29 ++++++++++--
 target-info-qom.c                         | 54 ++++++++++++++++-------
 target-info.c                             | 36 ++++++++++++---
 target/arm/machine.c                      | 19 +-------
 target/riscv/machine.c                    | 18 +-------
 101 files changed, 385 insertions(+), 481 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
 delete mode 100644 include/hw/arm/machines-qom.h
 delete mode 100644 include/hw/riscv/machines-qom.h
 rename target-info-stub.c => target-info-def.c (67%)

-- 
2.43.0