All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Yonggang Luo" <luoyonggang@gmail.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 36/48] hw/arm: declare arm machine targets
Date: Thu, 12 Nov 2026 13:30:42 +0000	[thread overview]
Message-ID: <20261112133054.1977618-37-berrange@redhat.com> (raw)
In-Reply-To: <20261112133054.1977618-1-berrange@redhat.com>

This prevents creation of arm machines unless the current selected
target is arm and enables removal of the 'is_available' callback.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 hw/arm/aspeed_ast27x0-fc.c  | 5 ++++-
 hw/arm/aspeed_ast27x0_evb.c | 7 +++++--
 hw/arm/raspi.c              | 9 ++++++---
 hw/arm/raspi4b.c            | 6 ++++--
 hw/arm/virt.c               | 6 ++++--
 5 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/hw/arm/aspeed_ast27x0-fc.c b/hw/arm/aspeed_ast27x0-fc.c
index 73362b60d2a..b0d2fc091d0 100644
--- a/hw/arm/aspeed_ast27x0-fc.c
+++ b/hw/arm/aspeed_ast27x0-fc.c
@@ -22,6 +22,8 @@
 #include "hw/arm/boot.h"
 #include "hw/block/flash.h"
 #include "hw/arm/aspeed_coprocessor.h"
+#include "qom/object_interfaces.h"
+#include "qemu/base-arch-defs.h"
 
 #define TYPE_AST2700FC MACHINE_TYPE_NAME("ast2700fc")
 OBJECT_DECLARE_SIMPLE_TYPE(Ast2700FCState, AST2700FC);
@@ -220,12 +222,14 @@ static void ast2700fc_init(MachineState *machine)
 static void ast2700fc_class_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
+    TargetSpecificClass *tsc = TARGET_SPECIFIC_CLASS(oc);
 
     mc->desc = "ast2700 full core support";
     mc->init = ast2700fc_init;
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->min_cpus = mc->max_cpus = mc->default_cpus = 6;
+    tsc->targets = QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64);
 }
 
 static const TypeInfo ast2700fc_types[] = {
@@ -234,7 +238,6 @@ static const TypeInfo ast2700fc_types[] = {
         .parent         = TYPE_MACHINE,
         .class_init     = ast2700fc_class_init,
         .instance_size  = sizeof(Ast2700FCState),
-        .is_available   = target_aarch64,
     },
 };
 
diff --git a/hw/arm/aspeed_ast27x0_evb.c b/hw/arm/aspeed_ast27x0_evb.c
index 9f7d4395114..d698bb25833 100644
--- a/hw/arm/aspeed_ast27x0_evb.c
+++ b/hw/arm/aspeed_ast27x0_evb.c
@@ -12,6 +12,7 @@
 #include "hw/arm/aspeed_soc.h"
 #include "hw/sensor/tmp105.h"
 #include "qom/object_interfaces.h"
+#include "qemu/base-arch-defs.h"
 
 /* AST2700 evb hardware value */
 /* SCU HW Strap1 */
@@ -33,7 +34,9 @@ static void aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc,
 {
     MachineClass *mc = MACHINE_CLASS(oc);
     AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+    TargetSpecificClass *tsc = TARGET_SPECIFIC_CLASS(oc);
 
+    tsc->targets = QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64);
     mc->desc = "Aspeed AST2700 A1 EVB (Cortex-A35)";
     amc->soc_name  = "ast2700-a1";
     amc->hw_strap1 = AST2700_EVB_HW_STRAP1;
@@ -55,11 +58,13 @@ static void aspeed_machine_ast2700a2_evb_class_init(ObjectClass *oc,
     MachineClass *mc = MACHINE_CLASS(oc);
     AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
     AliasedClass *alc = ALIASED_CLASS(oc);
+    TargetSpecificClass *tsc = TARGET_SPECIFIC_CLASS(oc);
     static const char *const aliases[] = {
         MACHINE_TYPE_NAME("ast2700-evb"), NULL,
     };
 
     alc->aliases = aliases;
+    tsc->targets = QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64);
     mc->desc = "Aspeed AST2700 A2 EVB (Cortex-A35)";
     amc->soc_name  = "ast2700-a2";
     amc->hw_strap1 = AST2700_EVB_HW_STRAP1;
@@ -80,13 +85,11 @@ static const TypeInfo aspeed_ast27x0_evb_types[] = {
         .name          = MACHINE_TYPE_NAME("ast2700a1-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_ast2700a1_evb_class_init,
-        .is_available  = target_aarch64,
     },
     {
         .name          = MACHINE_TYPE_NAME("ast2700a2-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_ast2700a2_evb_class_init,
-        .is_available  = target_aarch64,
     }
 };
 
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index fadbacb2534..b9b79942d29 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -24,7 +24,8 @@
 #include "qemu/error-report.h"
 #include "hw/core/boards.h"
 #include "hw/core/loader.h"
-#include "qom/object.h"
+#include "qom/object_interfaces.h"
+#include "qemu/base-arch-defs.h"
 
 #define TYPE_RASPI_MACHINE  MACHINE_TYPE_NAME("raspi-common")
 OBJECT_DECLARE_SIMPLE_TYPE(RaspiMachineState, RASPI_MACHINE)
@@ -370,9 +371,11 @@ static void raspi3ap_machine_class_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
     RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc);
+    TargetSpecificClass *tsc = TARGET_SPECIFIC_CLASS(oc);
 
     mc->auto_create_sdcard = true;
     rmc->board_rev = 0x9020e0; /* Revision 1.0 */
+    tsc->targets = QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64);
     raspi_machine_class_init(mc, rmc->board_rev);
 };
 
@@ -380,9 +383,11 @@ static void raspi3b_machine_class_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
     RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc);
+    TargetSpecificClass *tsc = TARGET_SPECIFIC_CLASS(oc);
 
     mc->auto_create_sdcard = true;
     rmc->board_rev = 0xa02082;
+    tsc->targets = QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64);
     raspi_machine_class_init(mc, rmc->board_rev);
 };
 
@@ -403,12 +408,10 @@ static const TypeInfo raspi_machine_types[] = {
         .name           = MACHINE_TYPE_NAME("raspi3ap"),
         .parent         = TYPE_RASPI_MACHINE,
         .class_init     = raspi3ap_machine_class_init,
-        .is_available   = target_aarch64,
     }, {
         .name           = MACHINE_TYPE_NAME("raspi3b"),
         .parent         = TYPE_RASPI_MACHINE,
         .class_init     = raspi3b_machine_class_init,
-        .is_available   = target_aarch64,
     }, {
         .name           = TYPE_RASPI_MACHINE,
         .parent         = TYPE_RASPI_BASE_MACHINE,
diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c
index 600dfe686f2..69048f8b4a3 100644
--- a/hw/arm/raspi4b.c
+++ b/hw/arm/raspi4b.c
@@ -19,8 +19,9 @@
 #include "hw/core/boards.h"
 #include "hw/core/loader.h"
 #include "hw/arm/boot.h"
-#include "qom/object.h"
+#include "qom/object_interfaces.h"
 #include "hw/arm/bcm2838.h"
+#include "qemu/base-arch-defs.h"
 #include <libfdt.h>
 
 #define TYPE_RASPI4B_MACHINE MACHINE_TYPE_NAME("raspi4b")
@@ -88,11 +89,13 @@ static void raspi4b_machine_class_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
     RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc);
+    TargetSpecificClass *tsc = TARGET_SPECIFIC_CLASS(oc);
 
     rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */
     raspi_machine_class_common_init(mc, rmc->board_rev);
     mc->auto_create_sdcard = true;
     mc->init = raspi4b_machine_init;
+    tsc->targets = QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64);
 }
 
 static const TypeInfo raspi4b_machine_type = {
@@ -100,7 +103,6 @@ static const TypeInfo raspi4b_machine_type = {
     .parent         = TYPE_RASPI_BASE_MACHINE,
     .instance_size  = sizeof(Raspi4bMachineState),
     .class_init     = raspi4b_machine_class_init,
-    .is_available   = target_aarch64,
 };
 
 static void raspi4b_machine_register_type(void)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 6217771032e..ca5cd3c16b8 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -95,6 +95,7 @@
 #include "qemu/guest-random.h"
 #include "hw/watchdog/sbsa_gwdt.h"
 #include "qom/object_interfaces.h"
+#include "qemu/base-arch-defs.h"
 
 static GlobalProperty arm_virt_compat_defaults[] = {
     { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" },
@@ -119,10 +120,13 @@ static void arm_virt_compat_default_set(MachineClass *mc)
         const void *data) \
     { \
         MachineClass *mc = MACHINE_CLASS(oc); \
+        TargetSpecificClass *tsc = TARGET_SPECIFIC_CLASS(oc); \
         arm_virt_compat_default_set(mc); \
         MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \
         mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \
         MACHINE_VER_DEPRECATION(__VA_ARGS__); \
+        tsc->targets = QEMU_ARCH_BIT(SYS_EMU_TARGET_ARM) | \
+            QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64); \
         classinitextra \
     } \
     static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \
@@ -130,7 +134,6 @@ static void arm_virt_compat_default_set(MachineClass *mc)
         .name = MACHINE_VER_TYPE_NAME("arm-virt", __VA_ARGS__), \
         .parent = TYPE_VIRT_MACHINE, \
         .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \
-        .is_available = target_base_arm, \
         .secure = true, \
     }; \
     static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \
@@ -4467,7 +4470,6 @@ static const TypeInfo virt_machine_info = {
          { TYPE_HOTPLUG_HANDLER },
          { }
     },
-    .is_available = target_base_arm,
 };
 
 static void machvirt_machine_init(void)
-- 
2.56.1



  parent reply	other threads:[~2026-11-12 13:36 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 13:30 [PATCH 00/48] hw: resolve QOM type conflicts in multi-target builds Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 01/48] iotests: better heuristics to find I/O tests build/source dirs Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 02/48] target-info: add target_mask_selected() Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 03/48] qom: define a TargetSpecific interface Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 04/48] qom: define an Aliased interface Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 05/48] hw: tweak approach to setting alias in machine macros Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 06/48] hw/core: implement TYPE_ALIASED interface in machines Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 07/48] qapi: report multiple aliases in MachineInfo Daniel P. Berrangé
2026-11-13  7:41   ` Markus Armbruster
2026-11-12 13:30 ` [PATCH 08/48] system: report multiple machine aliases in help output Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 09/48] system: increase space for machine name in '-machine help' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 10/48] system: resolve multiple aliases when creating machines Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 11/48] qapi: deprecate 'alias' field in MachineInfo Daniel P. Berrangé
2026-11-13  7:51   ` Markus Armbruster
2026-11-12 13:30 ` [PATCH 12/48] hw/arm: convert machines to use AliasedClass interface Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 13/48] hw/avr: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 14/48] hw/hexagon: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 15/48] hw/i386: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 16/48] hw/loongarch: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 17/48] hw/m68k: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 18/48] hw/ppc: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 19/48] hw/s390x: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 20/48] include/hw: convert machine docs " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 21/48] hw: drop 'alias' field from MachineClass Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 22/48] hw/arm: rename the 'virt' machines to 'arm-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 23/48] hw/riscv: rename the 'virt' machines to 'riscv-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 24/48] hw/hexagon: rename the 'virt' machine to 'hexagon-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 25/48] hw/loongarch: rename the 'virt' machine to 'loongarch-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 26/48] hw/m68k: rename the 'virt' machine to 'm68k-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 27/48] hw/or1k: rename the 'virt' machine to 'or1k-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 28/48] hw/xtensa: rename the 'virt' machine to 'xtensa-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 29/48] system: stop sorting machine names based on 'family' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 30/48] system: put machine aliases in alphbetical order Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 31/48] system: filter machine type list if a target is selected Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 32/48] hw/core: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 33/48] system: filter machines based on target during creation Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 34/48] hw/core: implement TYPE_TARGET_SPECIFIC for machine Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 35/48] qapi: report target compatibility for machine types Daniel P. Berrangé
2026-11-13  7:53   ` Markus Armbruster
2026-11-12 13:30 ` Daniel P. Berrangé [this message]
2026-11-12 13:30 ` [PATCH 37/48] hw/hexagon: declare hexagon machine target Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 38/48] hw/m68k: declare m68k " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 39/48] hw/or1k: declare or1k " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 40/48] hw/riscv: declare riscv " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 41/48] accel: make TYPE_ACCEL_CPU name target independent Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 42/48] Revert "multi-target: restrict whpx-accel-*-cpu to matching target" Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 43/48] Revert "target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv targets" Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 44/48] Revert "target/riscv/tcg: restrict tcg-accel-riscv-cpu " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 45/48] qom: drop the 'is_available' callback from TypeInfo Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 46/48] hw/pci: unconditionally expose the 'loadparm' property Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 47/48] hw/scsi: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 48/48] hw/virtio/virtio-mem: unconditionally expose 'unplugged-inaccessible' Daniel P. Berrangé
2026-11-12 15:08 ` [PATCH 00/48] hw: resolve QOM type conflicts in multi-target builds Yonggang Luo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112133054.1977618-37-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=luoyonggang@gmail.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.