@samitouri / QOSamiQemu / commits / ee693c9a1d

target/arm: Build cpu-max.c once

Call TargetInfo::target_aarch64() at runtime, allowing to remove the target-specific TARGET_AARCH64 definition and build cpu-max.c once as common object. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Acked-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20260526203722.79463-18-philmd@linaro.org>

Philippe Mathieu-Daudé committed May 15, 2026 at 12:06 UTC ee693c9a1dc809ad13dfdfa3d583c67869816a54
2 files changed +3 -7
target/arm/cpu-max.c
+2 -6
@@ -8,6 +8,7 @@
8
9 #include "qemu/osdep.h"
10 #include "qemu/units.h"
11 +#include "qemu/target-info.h"
12 #include "system/hw_accel.h"
13 #include "system/kvm.h"
14 #include "system/qtest.h"
@@ -190,12 +191,7 @@ void aa32_max_features(ARMCPU *cpu)
191 static void cpu_max_initfn(Object *obj)
192 {
193 ARMCPU *cpu = ARM_CPU(obj);
193 -
194 -#ifdef TARGET_AARCH64
195 - const bool aarch64_enabled = true;
196 -#else
197 - const bool aarch64_enabled = false;
198 -#endif /* !TARGET_AARCH64 */
194 + const bool aarch64_enabled = target_aarch64();
195
196 if (hwaccel_enabled()) {
197 assert(aarch64_enabled);
target/arm/meson.build
+1 -1
@@ -9,7 +9,6 @@ arm_user_ss = ss.source_set()
9 arm_common_system_ss.add(files('gdbstub.c'))
10 arm_user_ss.add(files('gdbstub.c'))
11
12 -arm_ss.add(files('cpu-max.c'))
12 arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
13 'cpu64.c',
14 ))
@@ -20,6 +19,7 @@ arm_common_ss.add(files(
19 arm_common_user_system_ss.add(files(
20 'cpregs-gcs.c',
21 'cpregs-pmu.c',
22 + 'cpu-max.c',
23 'debug_helper.c',
24 'helper.c',
25 'vfp_fpscr.c',