On 4/23/25 09:34, Philippe Mathieu-Daudé wrote:
On 22/4/25 19:40, Richard Henderson wrote:
On 4/22/25 07:54, Philippe Mathieu-Daudé wrote:
Since the qemu-system-aarch64 binary is able to run
all machines indistinctly, simply register the
TYPE_TARGET_AARCH64_MACHINE interface for all
existing machines under the hw/arm/ directory.

"indistinctly" is the wrong word.  I'm not quite sure what you're trying
to say in order to suggest a replacement.

I want to express that qemu-system-aarch64 is a superset of
qemu-system-arm machines.


diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 82f42582fa3..ce4d49a9f59 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -15,6 +15,7 @@
   #include "hw/arm/aspeed.h"
   #include "hw/arm/aspeed_soc.h"
   #include "hw/arm/aspeed_eeprom.h"
+#include "hw/arm/machines-qom.h"
   #include "hw/block/flash.h"
   #include "hw/i2c/i2c_mux_pca954x.h"
   #include "hw/i2c/smbus_eeprom.h"
@@ -1760,91 +1761,199 @@ static const TypeInfo aspeed_machine_types[] = {
           .name          = MACHINE_TYPE_NAME("palmetto-bmc"),
           .parent        = TYPE_ASPEED_MACHINE,
           .class_init    = aspeed_machine_palmetto_class_init,
+        .interfaces     = (InterfaceInfo[]) {
+            { TYPE_TARGET_ARM_MACHINE },
+            { TYPE_TARGET_AARCH64_MACHINE },
+            { },
+        },
       }, {
           .name          = MACHINE_TYPE_NAME("supermicrox11-bmc"),
           .parent        = TYPE_ASPEED_MACHINE,
           .class_init    = aspeed_machine_supermicrox11_bmc_class_init,
+        .interfaces     = (InterfaceInfo[]) {
+            { TYPE_TARGET_ARM_MACHINE },
+            { TYPE_TARGET_AARCH64_MACHINE },
+            { },
+        },

Don't replicate these anonymous arrays.
You want common

extern InterfaceInfo arm_aarch64_machine_interfaces[];
extern InterfaceInfo aarch64_machine_interfaces[];

to be shared by all.


@Richard:
Is it a concern regarding code maintenance, or potential impact on .data?

IMHO, it's worth repeating here, so it's easy to find all occurrences in the codebase.

"common" was my first approach (not via extern but macro)
https://lore.kernel.org/qemu-devel/20250403235821.9909-5-phi...@linaro.org/
but Pierrick said on offlist review we want this array to
be verbose.

Pierrick, are you OK with external symbols?


I'm not opposed to it, as long as we make it consistent through all our boards, and all architectures, whether they are defined with the full struct, or using any macro.
The last thing we want is to have to do multiple greps to find information.

The advantage of explicitly listing this is that it's unambiguous and easy to find.

If the Richard's concern is just for code writing, maybe we can add a variadic macro to reduce boilerplate to a minimum, so we can have:

.interfaces = TARGET_MACHINE(ARM, AARCH64).
or
DEFINE_MACHINE(..., TARGET_MACHINE(ARM, AARCH64))

Reply via email to