[PATCH v2 2/2] target/arm: Deprecate '-cpu any' (remplaced by '-cpu max')

Philippe Mathieu-Daudé posted 2 patches 4 days, 13 hours ago
There is a newer version of this series
[PATCH v2 2/2] target/arm: Deprecate '-cpu any' (remplaced by '-cpu max')
Posted by Philippe Mathieu-Daudé 4 days, 13 hours ago
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


Re: [PATCH v2 2/2] target/arm: Deprecate '-cpu any' (remplaced by '-cpu max')
Posted by Peter Maydell 13 hours ago
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
Re: [PATCH v2 2/2] target/arm: Deprecate '-cpu any' (remplaced by '-cpu max')
Posted by Pierrick Bouvier 4 days, 10 hours ago
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>