[PATCH v7 06/19] config/target: Implement per-binary TargetInfo structure (ARM, AARCH64)

Philippe Mathieu-Daudé posted 19 patches 3 weeks, 2 days ago
Maintainers: Pierrick Bouvier <pierrick.bouvier@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "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>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Samuel Tardieu <sam@rfc1149.net>, Beniamino Galvani <b.galvani@gmail.com>, Strahinja Jankovic <strahinja.p.jankovic@gmail.com>, Antony Pavlov <antonynpavlov@gmail.com>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Rob Herring <robh@kernel.org>, Jean-Christophe Dubois <jcd@tribudubois.net>, Bernhard Beschow <shentey@gmail.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Jan Kiszka <jan.kiszka@web.de>, Alistair Francis <alistair@alistair23.me>, Tyrone Ting <kfting@nuvoton.com>, Hao Wu <wuhaotsh@google.com>, Felipe Balbi <balbi@kernel.org>, Niek Linnenbank <nieklinnenbank@gmail.com>, Radoslaw Biernacki <rad@semihalf.com>, Leif Lindholm <leif.lindholm@oss.qualcomm.com>, Alexandre Iooss <erdnaxe@crans.org>, Shannon Zhao <shannon.zhaosl@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>
[PATCH v7 06/19] config/target: Implement per-binary TargetInfo structure (ARM, AARCH64)
Posted by Philippe Mathieu-Daudé 3 weeks, 2 days ago
Implement the TargetInfo structure for qemu-system-arm
and qemu-system-aarch64 binaries.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 configs/targets/aarch64-softmmu.c | 26 ++++++++++++++++++++++++++
 configs/targets/arm-softmmu.c     | 26 ++++++++++++++++++++++++++
 configs/targets/meson.build       |  1 +
 3 files changed, 53 insertions(+)
 create mode 100644 configs/targets/aarch64-softmmu.c
 create mode 100644 configs/targets/arm-softmmu.c

diff --git a/configs/targets/aarch64-softmmu.c b/configs/targets/aarch64-softmmu.c
new file mode 100644
index 00000000000..4e1e2f64da1
--- /dev/null
+++ b/configs/targets/aarch64-softmmu.c
@@ -0,0 +1,26 @@
+/*
+ * QEMU binary/target API (qemu-system-aarch64)
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/target-info-impl.h"
+#include "hw/arm/machines-qom.h"
+#include "target/arm/cpu-qom.h"
+
+static const TargetInfo target_info_aarch64_system = {
+    .target_name = "aarch64",
+    .target_arch = SYS_EMU_TARGET_AARCH64,
+    .long_bits = 64,
+    .cpu_type = TYPE_ARM_CPU,
+    .machine_typename = TYPE_TARGET_AARCH64_MACHINE,
+    .endianness = ENDIAN_MODE_LITTLE,
+};
+
+const TargetInfo *target_info(void)
+{
+    return &target_info_aarch64_system;
+}
diff --git a/configs/targets/arm-softmmu.c b/configs/targets/arm-softmmu.c
new file mode 100644
index 00000000000..9b3fdd2854a
--- /dev/null
+++ b/configs/targets/arm-softmmu.c
@@ -0,0 +1,26 @@
+/*
+ * QEMU binary/target API (qemu-system-arm)
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/target-info-impl.h"
+#include "hw/arm/machines-qom.h"
+#include "target/arm/cpu-qom.h"
+
+static const TargetInfo target_info_arm_system = {
+    .target_name = "arm",
+    .target_arch = SYS_EMU_TARGET_ARM,
+    .long_bits = 32,
+    .cpu_type = TYPE_ARM_CPU,
+    .machine_typename = TYPE_TARGET_ARM_MACHINE,
+    .endianness = ENDIAN_MODE_LITTLE,
+};
+
+const TargetInfo *target_info(void)
+{
+    return &target_info_arm_system;
+}
diff --git a/configs/targets/meson.build b/configs/targets/meson.build
index a9f6b24ec01..cca2514eb51 100644
--- a/configs/targets/meson.build
+++ b/configs/targets/meson.build
@@ -1,4 +1,5 @@
 foreach target : [
+      'arm-softmmu', 'aarch64-softmmu',
   ]
   config_target_info += {target : files(target + '.c')}
 endforeach
-- 
2.51.0


Re: [PATCH v7 06/19] config/target: Implement per-binary TargetInfo structure (ARM, AARCH64)
Posted by Edgar E. Iglesias 2 days, 19 hours ago
On Tue, Oct 21, 2025 at 2:59 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> Implement the TargetInfo structure for qemu-system-arm
> and qemu-system-aarch64 binaries.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>


Hi Phil!

Trying to run xenpvh guests with latest QEMU but running into trouble, the
xenpvh does get built into qemu-system-aarch64 any more.
Bisecting pointed me to this patch.

To reproduce --enable-xen, and see if xenpvh shows up in -M \? or not.

Any ideas?


>
Re: [PATCH v7 06/19] config/target: Implement per-binary TargetInfo structure (ARM, AARCH64)
Posted by Philippe Mathieu-Daudé 2 days, 8 hours ago
Hi Edgar,

On 11/11/25 22:28, Edgar E. Iglesias wrote:
> On Tue, Oct 21, 2025 at 2:59 PM Philippe Mathieu-Daudé 
> <philmd@linaro.org <mailto:philmd@linaro.org>> wrote:
> 
>     Implement the TargetInfo structure for qemu-system-arm
>     and qemu-system-aarch64 binaries.
> 
>     Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org
>     <mailto:philmd@linaro.org>>
>     Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org
>     <mailto:pierrick.bouvier@linaro.org>>
>     Reviewed-by: Richard Henderson <richard.henderson@linaro.org
>     <mailto:richard.henderson@linaro.org>>
> 
> 
> 
> Hi Phil!
> 
> Trying to run xenpvh guests with latest QEMU but running into trouble, 
> the xenpvh does get built into qemu-system-aarch64 any more.
> Bisecting pointed me to this patch.
> 
> To reproduce --enable-xen, and see if xenpvh shows up in -M \? or not.
> 
> Any ideas?

Oops, sorry for that :/

I suppose I missed the following in commit 38c5ab40031 ("hw/arm: Filter
machine types for qemu-system-arm/aarch64 binaries"):

-- >8 --
diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c
index 1a9eeb01c8e..86a02966161 100644
--- a/hw/arm/xen-pvh.c
+++ b/hw/arm/xen-pvh.c
@@ -12,2 +12,3 @@
  #include "hw/xen/xen-pvh-common.h"
+#include "hw/arm/machines-qom.h"

@@ -97,2 +98,3 @@ static const TypeInfo xen_arm_machine_type = {
      .instance_init = xen_arm_instance_init,
+    .interfaces = arm_aarch64_machine_interfaces,
  };
---

I don't have a handy Aarch64 machine with Xen anymore, I'll see
tomorrow if I can get access to one. Do you mind testing this hunk
meanwhile?

Thanks,

Phil.

Re: [PATCH v7 06/19] config/target: Implement per-binary TargetInfo structure (ARM, AARCH64)
Posted by Edgar E. Iglesias 2 days, 3 hours ago
On Wed, Nov 12, 2025 at 2:21 AM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> Hi Edgar,
>
> On 11/11/25 22:28, Edgar E. Iglesias wrote:
> > On Tue, Oct 21, 2025 at 2:59 PM Philippe Mathieu-Daudé
> > <philmd@linaro.org <mailto:philmd@linaro.org>> wrote:
> >
> >     Implement the TargetInfo structure for qemu-system-arm
> >     and qemu-system-aarch64 binaries.
> >
> >     Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org
> >     <mailto:philmd@linaro.org>>
> >     Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org
> >     <mailto:pierrick.bouvier@linaro.org>>
> >     Reviewed-by: Richard Henderson <richard.henderson@linaro.org
> >     <mailto:richard.henderson@linaro.org>>
> >
> >
> >
> > Hi Phil!
> >
> > Trying to run xenpvh guests with latest QEMU but running into trouble,
> > the xenpvh does get built into qemu-system-aarch64 any more.
> > Bisecting pointed me to this patch.
> >
> > To reproduce --enable-xen, and see if xenpvh shows up in -M \? or not.
> >
> > Any ideas?
>
> Oops, sorry for that :/
>
> I suppose I missed the following in commit 38c5ab40031 ("hw/arm: Filter
> machine types for qemu-system-arm/aarch64 binaries"):
>
> -- >8 --
> diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c
> index 1a9eeb01c8e..86a02966161 100644
> --- a/hw/arm/xen-pvh.c
> +++ b/hw/arm/xen-pvh.c
> @@ -12,2 +12,3 @@
>   #include "hw/xen/xen-pvh-common.h"
> +#include "hw/arm/machines-qom.h"
>
> @@ -97,2 +98,3 @@ static const TypeInfo xen_arm_machine_type = {
>       .instance_init = xen_arm_instance_init,
> +    .interfaces = arm_aarch64_machine_interfaces,
>   };
> ---
>
> I don't have a handy Aarch64 machine with Xen anymore, I'll see
> tomorrow if I can get access to one. Do you mind testing this hunk
> meanwhile?
>

Thanks Phil!

Yes, that fixes it!

Cheers,
Edgar



>
> Thanks,
>
> Phil.
>