[PATCH] hw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro

Philippe Mathieu-Daudé posted 1 patch 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260225034720.41495-1-philmd@linaro.org
Maintainers: Beniamino Galvani <b.galvani@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
hw/misc/allwinner-cpucfg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] hw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
allwinner_cpucfg_cpu_reset() doesn't access ARM CPU internal
fields: no need to cast, pass a generic CPU pointer along.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/misc/allwinner-cpucfg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/misc/allwinner-cpucfg.c b/hw/misc/allwinner-cpucfg.c
index 3a1526bda0d..f8dbfdd120c 100644
--- a/hw/misc/allwinner-cpucfg.c
+++ b/hw/misc/allwinner-cpucfg.c
@@ -84,7 +84,7 @@ static void allwinner_cpucfg_cpu_reset(AwCpuCfgState *s, uint8_t cpu_id)
 
     trace_allwinner_cpucfg_cpu_reset(cpu_id, s->entry_addr);
 
-    ARMCPU *target_cpu = ARM_CPU(arm_get_cpu_by_id(cpu_id));
+    CPUState *target_cpu = arm_get_cpu_by_id(cpu_id);
     if (!target_cpu) {
         /*
          * Called with a bogus value for cpu_id. Guest error will
@@ -92,7 +92,7 @@ static void allwinner_cpucfg_cpu_reset(AwCpuCfgState *s, uint8_t cpu_id)
          */
         return;
     }
-    bool target_aa64 = arm_feature(&target_cpu->env, ARM_FEATURE_AARCH64);
+    bool target_aa64 = arm_feature(cpu_env(target_cpu), ARM_FEATURE_AARCH64);
 
     ret = arm_set_cpu_on(cpu_id, s->entry_addr, 0,
                          CPU_EXCEPTION_LEVEL_ON_RESET, target_aa64);
-- 
2.52.0


Re: [PATCH] hw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro
Posted by Peter Maydell 1 month, 2 weeks ago
On Wed, 25 Feb 2026 at 03:47, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> allwinner_cpucfg_cpu_reset() doesn't access ARM CPU internal
> fields: no need to cast, pass a generic CPU pointer along.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---



Applied to target-arm.next, thanks.

-- PMM
Re: [PATCH] hw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro
Posted by Richard Henderson 1 month, 2 weeks ago
On 2/25/26 14:47, Philippe Mathieu-Daudé wrote:
> allwinner_cpucfg_cpu_reset() doesn't access ARM CPU internal
> fields: no need to cast, pass a generic CPU pointer along.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/misc/allwinner-cpucfg.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/misc/allwinner-cpucfg.c b/hw/misc/allwinner-cpucfg.c
> index 3a1526bda0d..f8dbfdd120c 100644
> --- a/hw/misc/allwinner-cpucfg.c
> +++ b/hw/misc/allwinner-cpucfg.c
> @@ -84,7 +84,7 @@ static void allwinner_cpucfg_cpu_reset(AwCpuCfgState *s, uint8_t cpu_id)
>   
>       trace_allwinner_cpucfg_cpu_reset(cpu_id, s->entry_addr);
>   
> -    ARMCPU *target_cpu = ARM_CPU(arm_get_cpu_by_id(cpu_id));
> +    CPUState *target_cpu = arm_get_cpu_by_id(cpu_id);
>       if (!target_cpu) {
>           /*
>            * Called with a bogus value for cpu_id. Guest error will
> @@ -92,7 +92,7 @@ static void allwinner_cpucfg_cpu_reset(AwCpuCfgState *s, uint8_t cpu_id)
>            */
>           return;
>       }
> -    bool target_aa64 = arm_feature(&target_cpu->env, ARM_FEATURE_AARCH64);
> +    bool target_aa64 = arm_feature(cpu_env(target_cpu), ARM_FEATURE_AARCH64);
>   
>       ret = arm_set_cpu_on(cpu_id, s->entry_addr, 0,
>                            CPU_EXCEPTION_LEVEL_ON_RESET, target_aa64);

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~