qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH-for-9.0 02/11] target/arm: Add target_aarch64_available()


From: Philippe Mathieu-Daudé
Subject: Re: [RFC PATCH-for-9.0 02/11] target/arm: Add target_aarch64_available() helper
Date: Thu, 23 Nov 2023 11:00:46 +0100
User-agent: Mozilla Thunderbird

On 22/11/23 19:30, Philippe Mathieu-Daudé wrote:
We want to build HW models once, but don't want to
register types when all prerequisites are satisfied. Add
the target_aarch64_available() to know at runtime whether
TARGET_AARCH64 is built-in.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  target/arm/cpu-qom.h | 2 ++
  target/arm/cpu.c     | 9 +++++++++
  2 files changed, 11 insertions(+)

diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
index 02b914c876..bf6b3604ed 100644
--- a/target/arm/cpu-qom.h
+++ b/target/arm/cpu-qom.h
@@ -33,4 +33,6 @@ typedef struct AArch64CPUClass AArch64CPUClass;
  DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
                         TYPE_AARCH64_CPU)
+bool target_aarch64_available(void);
+
  #endif
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 25e9d2ae7b..1990c04089 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2548,3 +2548,12 @@ static void arm_cpu_register_types(void)
  }
type_init(arm_cpu_register_types)
+
+bool target_aarch64_available(void)
+{
+#ifdef TARGET_AARCH64
+    return true;
+#else
+    return false;
+#endif
+}

I forgot to precise here, what was discussed during the previous 2
years. Eventually qemu-system-arm is absorbed by qemu-system-aarch64,
but to keep backward compatibility we add a new qemu-system-arm wrapper
which simply calls 'qemu-system-aarch64 --32bit-only' (or better named
option) forwarding the same command line. target_aarch64_available()
then becomes:

  bool target_aarch64_available(void)
  {
    return option_32bit_only == false;
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]