[PATCH] Revert "target/arm: Build cpu32-system.o as common object"

Peter Maydell posted 1 patch 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260720100312.119894-1-peter.maydell@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>
target/arm/tcg/{cpu32-system.c => cpu32.c} | 10 +++++++++-
target/arm/tcg/meson.build                 |  5 ++++-
2 files changed, 13 insertions(+), 2 deletions(-)
rename target/arm/tcg/{cpu32-system.c => cpu32.c} (99%)
[PATCH] Revert "target/arm: Build cpu32-system.o as common object"
Posted by Peter Maydell 5 days ago
In c8bea1276c we moved cpu32.c and built it as a common object.  The
commit message says "cpu32.c only contains CPU types used in 32-bit
system emulation".  However, this is incorrect -- it contains 32-bit
CPU types used in both system and usermode emulation.  (The case
where we don't need these CPUs and which we were using ifdefs to
avoid is specifically the AArch64 usermode qemu-aarch64 binary.)

The effect is that qemu-arm lost all the named CPU types except
the M-profile ones (which are in cpu-v7m.c).

This reverts commit c8bea1276c85855b2e088b740737d043c8556d58.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3962
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
The commit reverts cleanly, and looking at the git history
I don't think we have anything that depends on it, so a simple
revert seems best to me, especially given that cpu32-system.c
doesn't reflect the fact that we do need these CPUs in
usermode too.
---
 target/arm/tcg/{cpu32-system.c => cpu32.c} | 10 +++++++++-
 target/arm/tcg/meson.build                 |  5 ++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
 rename target/arm/tcg/{cpu32-system.c => cpu32.c} (99%)

diff --git a/target/arm/tcg/cpu32-system.c b/target/arm/tcg/cpu32.c
similarity index 99%
rename from target/arm/tcg/cpu32-system.c
rename to target/arm/tcg/cpu32.c
index 6e983900899..8220d785f5b 100644
--- a/target/arm/tcg/cpu32-system.c
+++ b/target/arm/tcg/cpu32.c
@@ -1,5 +1,5 @@
 /*
- * QEMU ARM TCG-only CPUs (not needed for the AArch64 linux-user build)
+ * QEMU ARM TCG-only CPUs.
  *
  * Copyright (c) 2012 SUSE LINUX Products GmbH
  *
@@ -13,9 +13,15 @@
 #include "cpu.h"
 #include "accel/tcg/cpu-ops.h"
 #include "internals.h"
+#if !defined(CONFIG_USER_ONLY)
 #include "hw/core/boards.h"
+#endif
 #include "cpregs.h"
 
+
+/* CPU models. These are not needed for the AArch64 linux-user build. */
+#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
+
 static void arm926_initfn(Object *obj)
 {
     ARMCPU *cpu = ARM_CPU(obj);
@@ -740,3 +746,5 @@ static void arm_tcg_cpu_register_types(void)
 }
 
 type_init(arm_tcg_cpu_register_types)
+
+#endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
index 573e8b5af48..227e674ae2f 100644
--- a/target/arm/tcg/meson.build
+++ b/target/arm/tcg/meson.build
@@ -30,6 +30,10 @@ translate32_d = [
 arm_ss.add(when: 'TARGET_AARCH64', if_true: gen_a64)
 arm_stubs_ss.add(files('stubs32.c'))
 
+arm_ss.add(files(
+  'cpu32.c',
+))
+
 arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'gengvec64.c',
   'translate-a64.c',
@@ -82,7 +86,6 @@ arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files(
 
 arm_common_system_ss.add(files(
   'cpregs-at.c',
-  'cpu32-system.c',
   'gicv5-cpuif.c',
   'psci.c',
   'tlb_helper.c',
-- 
2.43.0
Re: [PATCH] Revert "target/arm: Build cpu32-system.o as common object"
Posted by Pierrick Bouvier 4 days, 17 hours ago
On 7/20/2026 3:03 AM, Peter Maydell wrote:
> In c8bea1276c we moved cpu32.c and built it as a common object.  The
> commit message says "cpu32.c only contains CPU types used in 32-bit
> system emulation".  However, this is incorrect -- it contains 32-bit
> CPU types used in both system and usermode emulation.  (The case
> where we don't need these CPUs and which we were using ifdefs to
> avoid is specifically the AArch64 usermode qemu-aarch64 binary.)
> 
> The effect is that qemu-arm lost all the named CPU types except
> the M-profile ones (which are in cpu-v7m.c).
> 
> This reverts commit c8bea1276c85855b2e088b740737d043c8556d58.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3962
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> The commit reverts cleanly, and looking at the git history
> I don't think we have anything that depends on it, so a simple
> revert seems best to me, especially given that cpu32-system.c
> doesn't reflect the fact that we do need these CPUs in
> usermode too.
> ---
>  target/arm/tcg/{cpu32-system.c => cpu32.c} | 10 +++++++++-
>  target/arm/tcg/meson.build                 |  5 ++++-
>  2 files changed, 13 insertions(+), 2 deletions(-)
>  rename target/arm/tcg/{cpu32-system.c => cpu32.c} (99%)
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Re: [PATCH] Revert "target/arm: Build cpu32-system.o as common object"
Posted by Philippe Mathieu-Daudé 4 days, 23 hours ago
On 20/7/26 12:03, Peter Maydell wrote:
> In c8bea1276c we moved cpu32.c and built it as a common object.  The
> commit message says "cpu32.c only contains CPU types used in 32-bit
> system emulation".  However, this is incorrect -- it contains 32-bit
> CPU types used in both system and usermode emulation.  (The case
> where we don't need these CPUs and which we were using ifdefs to
> avoid is specifically the AArch64 usermode qemu-aarch64 binary.)
> 
> The effect is that qemu-arm lost all the named CPU types except
> the M-profile ones (which are in cpu-v7m.c).
> 
> This reverts commit c8bea1276c85855b2e088b740737d043c8556d58.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3962
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> The commit reverts cleanly, and looking at the git history
> I don't think we have anything that depends on it, so a simple
> revert seems best to me, especially given that cpu32-system.c
> doesn't reflect the fact that we do need these CPUs in
> usermode too.
> ---
>   target/arm/tcg/{cpu32-system.c => cpu32.c} | 10 +++++++++-
>   target/arm/tcg/meson.build                 |  5 ++++-
>   2 files changed, 13 insertions(+), 2 deletions(-)
>   rename target/arm/tcg/{cpu32-system.c => cpu32.c} (99%)

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

Thanks.