[PATCH v2 0/2] target/arm: Deprecate '-cpu any'
Arm '-cpu any' is aliased to '-cpu max' since more than 5 years. Deprecate the former in preparation of removal. v2: s/any/max/ in target/arm/cpu.c comment Philippe Mathieu-Daudé (2): target/arm: Remove dead code target/arm: Deprecate '-cpu any' (remplaced by '-cpu max') docs/about/deprecated.rst | 8 ++++++++ target/arm/cpu.h | 2 +- target/arm/cpu.c | 1 + target/arm/tcg/cpu32.c | 3 --- 4 files changed, 10 insertions(+), 4 deletions(-) -- 2.52.0
Since commit a0032cc5427 ("target/arm: Make 'any' CPU just an alias for 'max'") the 'any' entry is never used (we use 'max' instead): remove it. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> --- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c index 0b0bc96bac2..2127d456ad6 100644 --- a/target/arm/tcg/cpu32.c +++ b/target/arm/tcg/cpu32.c @@ -897,9 +897,6 @@ static const ARMCPUInfo arm_tcg_cpus[] = { #ifndef TARGET_AARCH64 { .name = "max", .initfn = arm_max_initfn }, #endif -#ifdef CONFIG_USER_ONLY - { .name = "any", .initfn = arm_max_initfn }, -#endif }; static const TypeInfo idau_interface_type_info = { -- 2.52.0
On 2/2/26 7:36 AM, Philippe Mathieu-Daudé wrote:
Since commit a0032cc5427 ("target/arm: Make 'any' CPU just an alias for 'max'") the 'any' entry is never used (we use 'max' instead): remove it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> --- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
On Mon, 2 Feb 2026 at 15:36, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
Since commit a0032cc5427 ("target/arm: Make 'any' CPU just an alias for 'max'") the 'any' entry is never used (we use 'max' instead): remove it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> --- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c index 0b0bc96bac2..2127d456ad6 100644 --- a/target/arm/tcg/cpu32.c +++ b/target/arm/tcg/cpu32.c @@ -897,9 +897,6 @@ static const ARMCPUInfo arm_tcg_cpus[] = { #ifndef TARGET_AARCH64 { .name = "max", .initfn = arm_max_initfn }, #endif -#ifdef CONFIG_USER_ONLY - { .name = "any", .initfn = arm_max_initfn }, -#endif };
This is not entirely dead, because it's what causes "qemu-arm -cpu help" to include "any" in its list. But we already don't list "any" for the qemu-aarch64 help output, so it's not really a problem to drop it from the qemu-arm equivalent list. I've applied this patch to target-arm.next with the commit message adjusted accordingly: ===begin=== target/arm: Remove entry for "any" from cpu32 arm_tcg_cpus[] list Since commit a0032cc5427 ("target/arm: Make 'any' CPU just an alias for 'max'") the 'any' CPU QOM type is never used, because we change "any" to "max" before creating the object. The array entry means we have an unnecessary type in the system, and the only user-visible effect is that "any" is listed in the "-cpu help" output for qemu-arm. (System emulation already doesn't include this array entry.) Since qemu-aarch64 already doesn't include "any" in its "-cpu help" output, we can reasonably drop it for qemu-arm also; remove the not-very-useful array entry. ===endit=== -- PMM
On 6/2/26 16:28, Peter Maydell wrote:
On Mon, 2 Feb 2026 at 15:36, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
Since commit a0032cc5427 ("target/arm: Make 'any' CPU just an alias for 'max'") the 'any' entry is never used (we use 'max' instead): remove it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> --- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c index 0b0bc96bac2..2127d456ad6 100644 --- a/target/arm/tcg/cpu32.c +++ b/target/arm/tcg/cpu32.c @@ -897,9 +897,6 @@ static const ARMCPUInfo arm_tcg_cpus[] = { #ifndef TARGET_AARCH64 { .name = "max", .initfn = arm_max_initfn }, #endif -#ifdef CONFIG_USER_ONLY - { .name = "any", .initfn = arm_max_initfn }, -#endif };
This is not entirely dead, because it's what causes "qemu-arm -cpu help" to include "any" in its list. But we already don't list "any" for the qemu-aarch64 help output, so it's not really a problem to drop it from the qemu-arm equivalent list.
I've applied this patch to target-arm.next with the commit message adjusted accordingly:
===begin=== target/arm: Remove entry for "any" from cpu32 arm_tcg_cpus[] list
Since commit a0032cc5427 ("target/arm: Make 'any' CPU just an alias for 'max'") the 'any' CPU QOM type is never used, because we change "any" to "max" before creating the object. The array entry means we have an unnecessary type in the system, and the only user-visible effect is that "any" is listed in the "-cpu help" output for qemu-arm. (System emulation already doesn't include this array entry.)
Since qemu-aarch64 already doesn't include "any" in its "-cpu help" output, we can reasonably drop it for qemu-arm also; remove the not-very-useful array entry. ===endit===
Thank you!
Since more then 5 years the '-cpu any' is aliased to '-cpu max' (see commit a0032cc5427 "target/arm: Make 'any' CPU just an alias for 'max'"). Time to deprecate the alias so we can eventually remove the alias code. Emit a warnig meanwhile. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> --- docs/about/deprecated.rst | 8 ++++++++ target/arm/cpu.h | 2 +- target/arm/cpu.c | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 1d5c4f3707c..c544f23cab5 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -181,6 +181,14 @@ is going to be so much slower it wouldn't make sense for any serious instrumentation. Due to implementation differences there will also be anomalies in things like memory instrumentation. +User emulation CPUs +------------------- + +Arm 'any' CPU (since 11.0) +'''''''''''''''''''''''''' + +The Arm 'any' CPU is an alias for the 'max' CPU. Use the latter instead. + System emulator CPUs -------------------- diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 21fee5e840b..3a888eb3fb6 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2390,7 +2390,7 @@ static inline bool arm_sctlr_b(CPUARMState *env) return /* We need not implement SCTLR.ITD in user-mode emulation, so * let linux-user ignore the fact that it conflicts with SCTLR_B. - * This lets people run BE32 binaries with "-cpu any". + * This lets people run BE32 binaries with "-cpu max". */ #ifndef CONFIG_USER_ONLY !arm_feature(env, ARM_FEATURE_V7) && diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 586202071d0..da664c4e30a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2218,6 +2218,7 @@ static ObjectClass *arm_cpu_class_by_name(const char *cpu_model) * which has the same semantics as "-cpu max". */ if (!strcmp(cpunamestr, "any")) { + warn_report("CPU type 'any' is deprecated, use 'max' instead."); cpunamestr = "max"; } #endif -- 2.52.0
On 2/2/26 7:36 AM, Philippe Mathieu-Daudé wrote:
Since more then 5 years the '-cpu any' is aliased to '-cpu max' (see commit a0032cc5427 "target/arm: Make 'any' CPU just an alias for 'max'"). Time to deprecate the alias so we can eventually remove the alias code. Emit a warnig meanwhile.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> --- docs/about/deprecated.rst | 8 ++++++++ target/arm/cpu.h | 2 +- target/arm/cpu.c | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
On Mon, 2 Feb 2026 at 15:36, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
Since more then 5 years the '-cpu any' is aliased to '-cpu max' (see commit a0032cc5427 "target/arm: Make 'any' CPU just an alias for 'max'"). Time to deprecate the alias so we can eventually remove the alias code. Emit a warnig meanwhile.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 586202071d0..da664c4e30a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2218,6 +2218,7 @@ static ObjectClass *arm_cpu_class_by_name(const char *cpu_model) * which has the same semantics as "-cpu max". */ if (!strcmp(cpunamestr, "any")) { + warn_report("CPU type 'any' is deprecated, use 'max' instead."); cpunamestr = "max"; }
This doesn't compile: ../../target/arm/cpu.c: In function ‘arm_cpu_class_by_name’: ../../target/arm/cpu.c:2224:9: error: implicit declaration of function ‘warn_report’ [-Werror=implicit-function-declaration] 2224 | warn_report("CPU type 'any' is deprecated, use 'max' instead."); | ^~~~~~~~~~~ ../../target/arm/cpu.c:2224:9: error: nested extern declaration of ‘warn_report’ [-Werror=nested-externs] Also linux-user still asks for "any" by default in the arm and aarch64 get_elf_cpu_model() functions, as does bsd-user in its TARGET_DEFAULT_CPU_MODEL macros. This seems to me like the kind of deprecation that is more effort than keeping the compat handling around, if it's only three lines of code in arm_cpu_class_by_name(). Or is this going to get in the way of some cleanup we'd like to do ? thanks -- PMM
participants (3)
-
Peter Maydell -
Philippe Mathieu-Daudé -
Pierrick Bouvier