]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu/target-info: Add %target_arch field to TargetInfo
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 8 Jul 2025 21:53:14 +0000 (23:53 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 15 Jul 2025 06:56:39 +0000 (02:56 -0400)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20250708215320.70426-4-philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
include/qemu/target-info-impl.h
target-info-stub.c
target-info.c

index 1b51cbcfe1b0eb46e0c04528e900f005fa610cea..a8b34d150ab2c94f9c1d25523936382e02f5be4f 100644 (file)
@@ -9,11 +9,13 @@
 #ifndef QEMU_TARGET_INFO_IMPL_H
 #define QEMU_TARGET_INFO_IMPL_H
 
-#include "qemu/target-info.h"
+#include "qapi/qapi-types-machine.h"
 
 typedef struct TargetInfo {
     /* runtime equivalent of TARGET_NAME definition */
     const char *target_name;
+    /* related to TARGET_ARCH definition */
+    SysEmuTarget target_arch;
     /* runtime equivalent of TARGET_LONG_BITS definition */
     unsigned long_bits;
     /* runtime equivalent of CPU_RESOLVING_TYPE definition */
index fecc0e71286b19b9187093145c4ca836a3b400ee..2e4407ff04b9a380a1215db36ae66ff785415f40 100644 (file)
@@ -14,6 +14,7 @@
 
 static const TargetInfo target_info_stub = {
     .target_name = TARGET_NAME,
+    .target_arch = SYS_EMU_TARGET__MAX,
     .long_bits = TARGET_LONG_BITS,
     .cpu_type = CPU_RESOLVING_TYPE,
     .machine_typename = TYPE_MACHINE,
index 9ebabec988ff528a508577173aa11b021dcaf91e..8e29553b4eff0bf3e07887f9bb1ee99c0a4771d5 100644 (file)
@@ -24,8 +24,13 @@ unsigned target_long_bits(void)
 
 SysEmuTarget target_arch(void)
 {
-    return qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
-                           &error_abort);
+    SysEmuTarget arch = target_info()->target_arch;
+
+    if (arch == SYS_EMU_TARGET__MAX) {
+        arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
+                               &error_abort);
+    }
+    return arch;
 }
 
 const char *target_cpu_type(void)