target/arm: Deprecate '-cpu any'
v2 cover 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(-)
Signature · 1 line
2.52.0
PATCH v2 1/2 target/arm: Remove dead code
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.
--- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-)
target/arm/tcg/cpu32.c +0 -3
@@ -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 = {
Signature · 1 line
2.52.0
Re: [PATCH v2 1/2] target/arm: Remove dead code
Quoted 10 lines · Philippe Mathieu-Daudé
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é <[email protected]>Reviewed-by Richard Henderson <[email protected]>--- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-)
Peter Maydell
AppliedRe: [PATCH v2 1/2] target/arm: Remove dead code
In reply to Philippe Mathieu-DaudéQuoted 16 lines · Philippe Mathieu-Daudé
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é <[email protected]>Reviewed-by Richard Henderson <[email protected]>--- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-)target/arm/tcg/cpu32.c +0
-0
target/arm/tcg/cpu32.c static const ARMCPUInfo arm_tcg_cpus[] = { · line 900
Quoted 7 lines
target/arm/tcg/cpu32.c +0
-3@@ -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
Re: [PATCH v2 1/2] target/arm: Remove dead code
Quoted 45 lines · Peter Maydell
Quoted 16 lines · Philippe Mathieu-Daudé
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é <[email protected]>Reviewed-by Richard Henderson <[email protected]>--- target/arm/tcg/cpu32.c | 3 --- 1 file changed, 3 deletions(-)target/arm/tcg/cpu32.c +0
-0target/arm/tcg/cpu32.c static const ARMCPUInfo arm_tcg_cpus[] = { · line 900
Quoted 7 lines
target/arm/tcg/cpu32.c +0
-3@@ -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[] listSince 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.)
Quoted 4 lines
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!
PATCH v2 2/2 target/arm: Deprecate '-cpu any' (remplaced by '-cpu max')
In reply to Philippe Mathieu-Daudé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.
--- docs/about/deprecated.rst | 8 ++++++++ target/arm/cpu.h | 2 +- target/arm/cpu.c | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)
docs/about/deprecated.rst +8 -0
@@ -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 --------------------
target/arm/cpu.h +1 -1
@@ -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) &&
target/arm/cpu.c +1 -0
@@ -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
Signature · 1 line
2.52.0
Re: [PATCH v2 2/2] target/arm: Deprecate '-cpu any' (remplaced by '-cpu max')
Quoted 5 lines · Philippe Mathieu-Daudé
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.
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Richard Henderson <[email protected]>--- docs/about/deprecated.rst | 8 ++++++++ target/arm/cpu.h | 2 +- target/arm/cpu.c | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)
Re: [PATCH v2 2/2] target/arm: Deprecate '-cpu any' (remplaced by '-cpu max')
In reply to Philippe Mathieu-DaudéQuoted 14 lines · Philippe Mathieu-Daudé
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é <[email protected]>Reviewed-by Richard Henderson <[email protected]>target/arm/cpu.c +0
-0
target/arm/cpu.c static ObjectClass *arm_cpu_class_by_name(const char *cpu_model) · line 2223
Quoted 6 lines
target/arm/cpu.c +1
-0@@ -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