From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Bastian Koppelmann <kbastian@rumtueddeln.de>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Zhao Liu <zhao1.liu@intel.com>,
Peter Maydell <peter.maydell@linaro.org>,
Laurent Vivier <laurent@vivier.eu>,
qemu-arm@nongnu.org, Yoshinori Sato <yoshinori.sato@nifty.com>,
Yanan Wang <wangyanan55@huawei.com>,
Aleksandar Rikalo <arikalo@gmail.com>,
Thomas Huth <huth@tuxfamily.org>,
Eduardo Habkost <eduardo@habkost.net>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [RFC PATCH 00/12] cpu_reset clean-ups for arm, sh4, mips, m68k and tricore
Date: Thu, 08 Jan 2026 16:34:11 +0000 [thread overview]
Message-ID: <87wm1s83ng.fsf@draig.linaro.org> (raw)
In-Reply-To: <79bd03ad-3fc5-4d83-ab4f-55f8f840cc6c@linaro.org> ("Philippe Mathieu-Daudé"'s message of "Thu, 8 Jan 2026 16:35:56 +0100")
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> On 8/1/26 15:34, Alex Bennée wrote:
>> We tend to apply cpu_reset inconsistently throughout our various
>> models which leads to unintended ordering dependencies. This got in
>> the way in my last plugins series:
>> https://patchew.org/QEMU/20251219190849.238323-1-alex.bennee@linaro.org/
>> where I needed to shuffle things around to ensure that gdb register
>> creation was done after dependant peripherals had created their cpu
>> interfaces.
>> Regardless of that we do have a proper reset interface now and most
>> architectures have moved to it. This series attempts to clean-up the
>> remaining cases with proper qemu_register_reset() calls so reset is
>> called when we intend to.
>
> Last time I was blocked at this comment:
> https://lore.kernel.org/qemu-devel/20231128170008.57ddb03e@imammedo.users.ipa.redhat.com/
From that:
--cpu_reset() <- brings cpu to known (after reset|poweron) state
cpu_common_realizefn()
if (dev->hotplugged) {
cpu_synchronize_post_init(cpu);
cpu_resume(cpu);
}
++cpu_reset() <-- looks to be too late, we already told hypervisor to run undefined CPU, didn't we?
I would posit that the hotplug path is different as we online the CPU as
soon as its ready. Maybe that is just special cased as:
if (dev->hotplugged) {
cpu_reset(cpu);
cpu_synchronize_post_init(cpu);
cpu_resume(cpu);
}
Unless hotplug should also honour the reset tree in which case that
logic could be moved:
void cpu_reset(CPUState *cpu)
{
DeviceState *dev = DEVICE(cpu);
if (!dev->hotplugged) {
device_cold_reset(DEVICE(cpu));
} else {
/* hotplugging implies we should know how to setup */
cpu_synchronize_post_init(cpu);
}
trace_cpu_reset(cpu->cpu_index);
#ifdef CONFIG_TCG
/*
* Because vCPUs get "started" before the machine is ready we often
* can't provide all the information plugins need during
* cpu_common_initfn. However the vCPU will be reset a few times
* before we eventually set things going giving plugins an
* opportunity to update things.
*/
qemu_plugin_vcpu_reset_hook(cpu);
#endif
}
Do we have test cases for hotplugging CPUs?
>
>> Alex Bennée (12):
>> target/sh4: drop cpu_reset from realizefn
>> target/m68k: introduce env->reset_pc
>> hw/m68k: register a nextcube_cpu_reset handler
>> hw/m68k: register a mcf5208evb_cpu_reset handler
>> hw/m68k: register a an5206_cpu_reset handler
>> hw/m68k: just use reset_pc for virt platform
>> target/m68k: drop cpu_reset on realizefn
>> hw/mips: defer finalising gcr_base until reset time
>> hw/mips: drop cpu_reset in mips_cpu_realizefn
>> target/tricore: move cpu_reset from tricore_cpu_realizefn
>> target/arm: remove extraneous cpu_reset from realizefn
>> include/hw: expand cpu_reset function docs
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2026-01-08 16:34 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 14:34 [RFC PATCH 00/12] cpu_reset clean-ups for arm, sh4, mips, m68k and tricore Alex Bennée
2026-01-08 14:34 ` [RFC PATCH 01/12] target/sh4: drop cpu_reset from realizefn Alex Bennée
2026-01-11 7:51 ` Richard Henderson
2026-01-12 13:58 ` Philippe Mathieu-Daudé
2026-01-08 14:34 ` [RFC PATCH 02/12] target/m68k: introduce env->reset_pc Alex Bennée
2026-01-08 17:14 ` BALATON Zoltan
2026-01-08 17:23 ` BALATON Zoltan
2026-01-08 17:44 ` Alex Bennée
2026-01-10 5:33 ` Thomas Huth
2026-01-11 7:52 ` Richard Henderson
2026-01-13 1:17 ` Richard Henderson
2026-01-08 14:34 ` [RFC PATCH 03/12] hw/m68k: register a nextcube_cpu_reset handler Alex Bennée
2026-01-10 5:42 ` Thomas Huth
2026-01-13 1:20 ` Richard Henderson
2026-01-08 14:34 ` [RFC PATCH 04/12] hw/m68k: register a mcf5208evb_cpu_reset handler Alex Bennée
2026-01-13 1:21 ` Richard Henderson
2026-01-13 16:38 ` Peter Maydell
2026-01-13 18:08 ` BALATON Zoltan
2026-01-13 18:30 ` Peter Maydell
2026-01-13 22:12 ` BALATON Zoltan
2026-01-08 14:34 ` [RFC PATCH 05/12] hw/m68k: register a an5206_cpu_reset handler Alex Bennée
2026-01-10 5:50 ` Thomas Huth
2026-01-13 1:22 ` Richard Henderson
2026-01-08 14:34 ` [RFC PATCH 06/12] hw/m68k: just use reset_pc for virt platform Alex Bennée
2026-01-10 5:52 ` Thomas Huth
2026-01-13 1:19 ` Richard Henderson
2026-01-08 14:34 ` [RFC PATCH 07/12] target/m68k: drop cpu_reset on realizefn Alex Bennée
2026-01-10 5:53 ` Thomas Huth
2026-01-11 7:55 ` Richard Henderson
2026-01-08 14:34 ` [RFC PATCH 08/12] hw/mips: defer finalising gcr_base until reset time Alex Bennée
2026-01-13 16:29 ` Peter Maydell
2026-01-08 14:34 ` [RFC PATCH 09/12] hw/mips: drop cpu_reset in mips_cpu_realizefn Alex Bennée
2026-01-08 14:34 ` [RFC PATCH 10/12] target/tricore: move cpu_reset from tricore_cpu_realizefn Alex Bennée
2026-01-13 16:46 ` Peter Maydell
2026-01-08 14:34 ` [RFC PATCH 11/12] target/arm: remove extraneous cpu_reset from realizefn Alex Bennée
2026-01-08 14:34 ` [RFC PATCH 12/12] include/hw: expand cpu_reset function docs Alex Bennée
2026-01-13 1:24 ` Richard Henderson
2026-01-08 15:35 ` [RFC PATCH 00/12] cpu_reset clean-ups for arm, sh4, mips, m68k and tricore Philippe Mathieu-Daudé
2026-01-08 16:34 ` Alex Bennée [this message]
2026-01-13 16:51 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wm1s83ng.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=arikalo@gmail.com \
--cc=aurelien@aurel32.net \
--cc=eduardo@habkost.net \
--cc=huth@tuxfamily.org \
--cc=imammedo@redhat.com \
--cc=jiaxun.yang@flygoat.com \
--cc=kbastian@rumtueddeln.de \
--cc=laurent@vivier.eu \
--cc=marcel.apfelbaum@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wangyanan55@huawei.com \
--cc=yoshinori.sato@nifty.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.