Re: [RFC PATCH v2 06/11] hw/arm: Filter machine types for qemu-system-arm binary

2025-04-17 Thread Pierrick Bouvier

On 4/17/25 17:50, Philippe Mathieu-Daudé wrote:

Very few machines are restricted to the qemu-system-aarch64
binary:

   $ git grep TARGET_AARCH64 hw/arm/meson.build
   hw/arm/meson.build:31:arm_common_ss.add(when: ['CONFIG_RASPI', 
'TARGET_AARCH64'], if_true: files('bcm2838.c', 'raspi4b.c'))
   hw/arm/meson.build:50:arm_common_ss.add(when: ['CONFIG_ASPEED_SOC', 
'TARGET_AARCH64'], if_true: files('aspeed_ast27x0.c'))

   $ git grep -W AARCH64 hw/arm/Kconfig
   hw/arm/Kconfig=185=config SBSA_REF
   hw/arm/Kconfig-186-bool
   hw/arm/Kconfig-187-default y
   hw/arm/Kconfig:188:depends on TCG && AARCH64
   --
   hw/arm/Kconfig=413=config XLNX_ZYNQMP_ARM
   hw/arm/Kconfig-414-bool
   hw/arm/Kconfig-415-default y if PIXMAN
   hw/arm/Kconfig:416:depends on TCG && AARCH64
   --
   hw/arm/Kconfig=435=config XLNX_VERSAL
   hw/arm/Kconfig-436-bool
   hw/arm/Kconfig-437-default y
   hw/arm/Kconfig:438:depends on TCG && AARCH64
   --
   hw/arm/Kconfig=475=config NPCM8XX
   hw/arm/Kconfig-476-bool
   hw/arm/Kconfig-477-default y
   hw/arm/Kconfig:478:depends on TCG && AARCH64
   --
   hw/arm/Kconfig=605=config FSL_IMX8MP_EVK
   hw/arm/Kconfig-606-bool
   hw/arm/Kconfig-607-default y
   hw/arm/Kconfig:608:depends on TCG && AARCH64

   $ git grep -wW TARGET_AARCH64 hw/arm | fgrep -4 MACHINE_TYPE_NAME
   ...
   hw/arm/aspeed.c:1939:#ifdef TARGET_AARCH64
   hw/arm/aspeed.c-1940-}, {
   hw/arm/aspeed.c-1941-.name  = 
MACHINE_TYPE_NAME("ast2700a0-evb"),

   hw/arm/aspeed.c-1949-.name  = 
MACHINE_TYPE_NAME("ast2700a1-evb"),

   hw/arm/raspi.c:420:#ifdef TARGET_AARCH64
   hw/arm/raspi.c-421-}, {
   hw/arm/raspi.c-422-.name   = MACHINE_TYPE_NAME("raspi3ap"),

   hw/arm/raspi.c-429-}, {
   hw/arm/raspi.c-430-.name   = MACHINE_TYPE_NAME("raspi3b"),

This can be verified as:

$ diff -u0 <(qemu-system-arm -M help) <(qemu-system-aarch64 -M help)
   @@ -5,3 +4,0 @@
   -ast2700-evb  Aspeed AST2700 A0 EVB (Cortex-A35) (alias of 
ast2700a0-evb)
   -ast2700a0-evbAspeed AST2700 A0 EVB (Cortex-A35)
   -ast2700a1-evbAspeed AST2700 A1 EVB (Cortex-A35)
   @@ -22 +18,0 @@
   -imx8mp-evk   NXP i.MX 8M Plus EVK Board
   @@ -49 +44,0 @@
   -npcm845-evb  Nuvoton NPCM845 Evaluation Board (Cortex-A35)
   @@ -63,3 +57,0 @@
   -raspi3ap Raspberry Pi 3A+ (revision 1.0)
   -raspi3b  Raspberry Pi 3B (revision 1.2)
   -raspi4b  Raspberry Pi 4B (revision 1.5)
   @@ -72 +63,0 @@
   -sbsa-ref QEMU 'SBSA Reference' ARM Virtual Machine
   @@ -116,2 +106,0 @@
   -xlnx-versal-virt Xilinx Versal Virtual development board
   -xlnx-zcu102  Xilinx ZynqMP ZCU102 board with 4xA53s and 2xR5Fs 
based on the value of smp

Register the TYPE_TARGET_ARM_MACHINE interface for all
the machines not listed previously.

Signed-off-by: Philippe Mathieu-Daudé 
---
  hw/arm/aspeed.c| 20 
  hw/arm/b-l475e-iot01a.c|  1 +
  hw/arm/bananapi_m2u.c  |  1 +
  hw/arm/collie.c|  1 +
  hw/arm/cubieboard.c|  1 +
  hw/arm/digic_boards.c  |  1 +
  hw/arm/exynos4_boards.c|  2 ++
  hw/arm/fby35.c |  1 +
  hw/arm/highbank.c  |  2 ++
  hw/arm/imx25_pdk.c |  1 +
  hw/arm/integratorcp.c  |  1 +
  hw/arm/kzm.c   |  1 +
  hw/arm/mcimx6ul-evk.c  |  1 +
  hw/arm/mcimx7d-sabre.c |  1 +
  hw/arm/microbit.c  |  1 +
  hw/arm/mps2-tz.c   |  4 
  hw/arm/mps2.c  |  4 
  hw/arm/mps3r.c |  1 +
  hw/arm/msf2-som.c  |  1 +
  hw/arm/musca.c |  2 ++
  hw/arm/musicpal.c  |  1 +
  hw/arm/netduino2.c |  1 +
  hw/arm/netduinoplus2.c |  1 +
  hw/arm/npcm7xx_boards.c|  5 +
  hw/arm/olimex-stm32-h405.c |  1 +
  hw/arm/omap_sx1.c  |  2 ++
  hw/arm/orangepi.c  |  1 +
  hw/arm/raspi.c |  3 +++
  hw/arm/realview.c  |  4 
  hw/arm/sabrelite.c |  1 +
  hw/arm/stellaris.c |  2 ++
  hw/arm/stm32vldiscovery.c  |  1 +
  hw/arm/versatilepb.c   |  2 ++
  hw/arm/vexpress.c  |  2 ++
  hw/arm/virt.c  |  1 +
  hw/arm/xilinx_zynq.c   |  1 +
  36 files changed, 77 insertions(+)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index ca7004c335a..d54ee2d4b53 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1761,6 +1761,7 @@ static const TypeInfo aspeed_machine_types[] = {
  .parent= TYPE_ASPEED_MACHINE,
  .class_init= aspeed_machine_palmetto_class_init,
  .interfaces = (InterfaceInfo[]) {
+{ TYPE_TARGET_ARM_MACHINE },
  { TYPE_TARGET_AARCH64_MACHINE },
  { },
  },
@@ -1769,6 +1770,7 @@ static const TypeInfo aspeed_machine_types[] = {
  .parent= TYPE_ASPEED_MACHINE,
  .class_init= aspeed_machine_supermic

[RFC PATCH v2 06/11] hw/arm: Filter machine types for qemu-system-arm binary

2025-04-17 Thread Philippe Mathieu-Daudé
Very few machines are restricted to the qemu-system-aarch64
binary:

  $ git grep TARGET_AARCH64 hw/arm/meson.build
  hw/arm/meson.build:31:arm_common_ss.add(when: ['CONFIG_RASPI', 
'TARGET_AARCH64'], if_true: files('bcm2838.c', 'raspi4b.c'))
  hw/arm/meson.build:50:arm_common_ss.add(when: ['CONFIG_ASPEED_SOC', 
'TARGET_AARCH64'], if_true: files('aspeed_ast27x0.c'))

  $ git grep -W AARCH64 hw/arm/Kconfig
  hw/arm/Kconfig=185=config SBSA_REF
  hw/arm/Kconfig-186-bool
  hw/arm/Kconfig-187-default y
  hw/arm/Kconfig:188:depends on TCG && AARCH64
  --
  hw/arm/Kconfig=413=config XLNX_ZYNQMP_ARM
  hw/arm/Kconfig-414-bool
  hw/arm/Kconfig-415-default y if PIXMAN
  hw/arm/Kconfig:416:depends on TCG && AARCH64
  --
  hw/arm/Kconfig=435=config XLNX_VERSAL
  hw/arm/Kconfig-436-bool
  hw/arm/Kconfig-437-default y
  hw/arm/Kconfig:438:depends on TCG && AARCH64
  --
  hw/arm/Kconfig=475=config NPCM8XX
  hw/arm/Kconfig-476-bool
  hw/arm/Kconfig-477-default y
  hw/arm/Kconfig:478:depends on TCG && AARCH64
  --
  hw/arm/Kconfig=605=config FSL_IMX8MP_EVK
  hw/arm/Kconfig-606-bool
  hw/arm/Kconfig-607-default y
  hw/arm/Kconfig:608:depends on TCG && AARCH64

  $ git grep -wW TARGET_AARCH64 hw/arm | fgrep -4 MACHINE_TYPE_NAME
  ...
  hw/arm/aspeed.c:1939:#ifdef TARGET_AARCH64
  hw/arm/aspeed.c-1940-}, {
  hw/arm/aspeed.c-1941-.name  = 
MACHINE_TYPE_NAME("ast2700a0-evb"),

  hw/arm/aspeed.c-1949-.name  = 
MACHINE_TYPE_NAME("ast2700a1-evb"),

  hw/arm/raspi.c:420:#ifdef TARGET_AARCH64
  hw/arm/raspi.c-421-}, {
  hw/arm/raspi.c-422-.name   = MACHINE_TYPE_NAME("raspi3ap"),

  hw/arm/raspi.c-429-}, {
  hw/arm/raspi.c-430-.name   = MACHINE_TYPE_NAME("raspi3b"),

This can be verified as:

$ diff -u0 <(qemu-system-arm -M help) <(qemu-system-aarch64 -M help)
  @@ -5,3 +4,0 @@
  -ast2700-evb  Aspeed AST2700 A0 EVB (Cortex-A35) (alias of 
ast2700a0-evb)
  -ast2700a0-evbAspeed AST2700 A0 EVB (Cortex-A35)
  -ast2700a1-evbAspeed AST2700 A1 EVB (Cortex-A35)
  @@ -22 +18,0 @@
  -imx8mp-evk   NXP i.MX 8M Plus EVK Board
  @@ -49 +44,0 @@
  -npcm845-evb  Nuvoton NPCM845 Evaluation Board (Cortex-A35)
  @@ -63,3 +57,0 @@
  -raspi3ap Raspberry Pi 3A+ (revision 1.0)
  -raspi3b  Raspberry Pi 3B (revision 1.2)
  -raspi4b  Raspberry Pi 4B (revision 1.5)
  @@ -72 +63,0 @@
  -sbsa-ref QEMU 'SBSA Reference' ARM Virtual Machine
  @@ -116,2 +106,0 @@
  -xlnx-versal-virt Xilinx Versal Virtual development board
  -xlnx-zcu102  Xilinx ZynqMP ZCU102 board with 4xA53s and 2xR5Fs based 
on the value of smp

Register the TYPE_TARGET_ARM_MACHINE interface for all
the machines not listed previously.

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/arm/aspeed.c| 20 
 hw/arm/b-l475e-iot01a.c|  1 +
 hw/arm/bananapi_m2u.c  |  1 +
 hw/arm/collie.c|  1 +
 hw/arm/cubieboard.c|  1 +
 hw/arm/digic_boards.c  |  1 +
 hw/arm/exynos4_boards.c|  2 ++
 hw/arm/fby35.c |  1 +
 hw/arm/highbank.c  |  2 ++
 hw/arm/imx25_pdk.c |  1 +
 hw/arm/integratorcp.c  |  1 +
 hw/arm/kzm.c   |  1 +
 hw/arm/mcimx6ul-evk.c  |  1 +
 hw/arm/mcimx7d-sabre.c |  1 +
 hw/arm/microbit.c  |  1 +
 hw/arm/mps2-tz.c   |  4 
 hw/arm/mps2.c  |  4 
 hw/arm/mps3r.c |  1 +
 hw/arm/msf2-som.c  |  1 +
 hw/arm/musca.c |  2 ++
 hw/arm/musicpal.c  |  1 +
 hw/arm/netduino2.c |  1 +
 hw/arm/netduinoplus2.c |  1 +
 hw/arm/npcm7xx_boards.c|  5 +
 hw/arm/olimex-stm32-h405.c |  1 +
 hw/arm/omap_sx1.c  |  2 ++
 hw/arm/orangepi.c  |  1 +
 hw/arm/raspi.c |  3 +++
 hw/arm/realview.c  |  4 
 hw/arm/sabrelite.c |  1 +
 hw/arm/stellaris.c |  2 ++
 hw/arm/stm32vldiscovery.c  |  1 +
 hw/arm/versatilepb.c   |  2 ++
 hw/arm/vexpress.c  |  2 ++
 hw/arm/virt.c  |  1 +
 hw/arm/xilinx_zynq.c   |  1 +
 36 files changed, 77 insertions(+)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index ca7004c335a..d54ee2d4b53 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1761,6 +1761,7 @@ static const TypeInfo aspeed_machine_types[] = {
 .parent= TYPE_ASPEED_MACHINE,
 .class_init= aspeed_machine_palmetto_class_init,
 .interfaces = (InterfaceInfo[]) {
+{ TYPE_TARGET_ARM_MACHINE },
 { TYPE_TARGET_AARCH64_MACHINE },
 { },
 },
@@ -1769,6 +1770,7 @@ static const TypeInfo aspeed_machine_types[] = {
 .parent= TYPE_ASPEED_MACHINE,
 .class_init= aspeed_machine_supermicrox11_bmc_class_init,
 .interfaces = (InterfaceInfo[]) {
+{ TYPE_TARGET_ARM_MACHINE },
 { TYPE_TARGET_AARCH64_MACHI