[RFC PATCH v2 10/14] target/arm: remove extraneous cpu_reset from realizefn

Alex Bennée posted 14 patches 1 month, 3 weeks ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Thomas Huth <huth@tuxfamily.org>, Laurent Vivier <laurent@vivier.eu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Peter Maydell <peter.maydell@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <arikalo@gmail.com>, Bastian Koppelmann <kbastian@rumtueddeln.de>
[RFC PATCH v2 10/14] target/arm: remove extraneous cpu_reset from realizefn
Posted by Alex Bennée 1 month, 3 weeks ago
We already have do_cpu_reset called when the system is reset so there
is no need to do it here.

By removing this we now only do (smp*2)-1 calls to cpu_reset. Once per
core as part of qemu_system_reset and then once per secondary core as
PSCI calls are made to reset them.

Message-ID: <20260108143423.1378674-12-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 target/arm/cpu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 10f8280eef2..dadc48e06e5 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2198,7 +2198,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
     }
 
     qemu_init_vcpu(cs);
-    cpu_reset(cs);
 
     acc->parent_realize(dev, errp);
 }
-- 
2.47.3


Re: [RFC PATCH v2 10/14] target/arm: remove extraneous cpu_reset from realizefn
Posted by Peter Maydell 1 month, 2 weeks ago
On Thu, 19 Feb 2026 at 17:18, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> We already have do_cpu_reset called when the system is reset so there
> is no need to do it here.
>
> By removing this we now only do (smp*2)-1 calls to cpu_reset. Once per
> core as part of qemu_system_reset and then once per secondary core as
> PSCI calls are made to reset them.
>
> Message-ID: <20260108143423.1378674-12-alex.bennee@linaro.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  target/arm/cpu.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 10f8280eef2..dadc48e06e5 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -2198,7 +2198,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
>      }
>
>      qemu_init_vcpu(cs);
> -    cpu_reset(cs);
>
>      acc->parent_realize(dev, errp);
>  }

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

though it would not surprise me if there was some obscure ordering
requirement that we run into by removing this. I guess we'll have
to wait for the bug reports :-)

thanks
-- PMM
Re: [RFC PATCH v2 10/14] target/arm: remove extraneous cpu_reset from realizefn
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2/19/26 9:18 AM, Alex Bennée wrote:
> We already have do_cpu_reset called when the system is reset so there
> is no need to do it here.
> 
> By removing this we now only do (smp*2)-1 calls to cpu_reset. Once per
> core as part of qemu_system_reset and then once per secondary core as
> PSCI calls are made to reset them.
> 
> Message-ID: <20260108143423.1378674-12-alex.bennee@linaro.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   target/arm/cpu.c | 1 -
>   1 file changed, 1 deletion(-)
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>