qemu-riscv.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	qemu-riscv@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH-for-10.1 RESEND v8 3/8] qemu/target-info: Add %target_arch field to TargetInfo
Date: Tue,  8 Jul 2025 23:53:14 +0200	[thread overview]
Message-ID: <20250708215320.70426-4-philmd@linaro.org> (raw)
In-Reply-To: <20250708215320.70426-1-philmd@linaro.org>

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>
---
 include/qemu/target-info-impl.h | 4 +++-
 target-info-stub.c              | 1 +
 target-info.c                   | 9 +++++++--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-impl.h
index 1b51cbcfe1b..a8b34d150ab 100644
--- a/include/qemu/target-info-impl.h
+++ b/include/qemu/target-info-impl.h
@@ -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 */
diff --git a/target-info-stub.c b/target-info-stub.c
index fecc0e71286..2e4407ff04b 100644
--- a/target-info-stub.c
+++ b/target-info-stub.c
@@ -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,
diff --git a/target-info.c b/target-info.c
index 9ebabec988f..8e29553b4ef 100644
--- a/target-info.c
+++ b/target-info.c
@@ -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)
-- 
2.49.0



  parent reply	other threads:[~2025-07-08 22:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 21:53 [PATCH-for-10.1 RESEND v8 0/8] target-info: Add more API for VirtIO cleanups Philippe Mathieu-Daudé
2025-07-08 21:53 ` [PATCH-for-10.1 RESEND v8 1/8] target/qmp: Use target_cpu_type() Philippe Mathieu-Daudé
2025-07-08 21:53 ` [PATCH-for-10.1 RESEND v8 2/8] qemu/target-info: Factor target_arch() out Philippe Mathieu-Daudé
2025-07-08 21:53 ` Philippe Mathieu-Daudé [this message]
2025-07-08 21:53 ` [PATCH-for-10.1 RESEND v8 4/8] qemu/target-info: Add target_endian_mode() Philippe Mathieu-Daudé
2025-07-08 21:53 ` [PATCH-for-10.1 RESEND v8 5/8] qemu: Convert target_words_bigendian() to TargetInfo API Philippe Mathieu-Daudé
2025-07-08 21:53 ` [PATCH-for-10.1 RESEND v8 6/8] gdbstub/helpers: Replace TARGET_BIG_ENDIAN -> target_big_endian() Philippe Mathieu-Daudé
2025-07-09  6:33   ` Manos Pitsidianakis
2025-07-08 21:53 ` [PATCH-for-10.1 RESEND v8 7/8] qemu: Declare all load/store helper in 'qemu/bswap.h' Philippe Mathieu-Daudé
2025-07-08 21:53 ` [PATCH-for-10.1 RESEND v8 8/8] hw/virtio: Build various files once Philippe Mathieu-Daudé

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=20250708215320.70426-4-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=mst@redhat.com \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).