On 17/2/26 10:21, Peter Maydell wrote:
On Tue, 17 Feb 2026 at 06:35, Akihiko Odaki
<[email protected]> wrote:
alpha_cpu_realizefn() did not properly call cpu_reset(), which
corrupted icount. Add the missing function call to fix icount.
Signed-off-by: Akihiko Odaki <[email protected]>
---
target/alpha/cpu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index 1780db7d1e29..74281ebdb367 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -124,6 +124,7 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error
**errp)
}
qemu_init_vcpu(cs);
+ cpu_reset(cs);
acc->parent_realize(dev, errp);
}
Realize functions shouldn't call reset on themselves.
Agreed, but we are not consistent at all:
target/arm/cpu.c=1621=static void arm_cpu_realizefn(DeviceState *dev,
Error **errp)
target/arm/cpu.c-1622-{
...
target/arm/cpu.c:2211: cpu_reset(cs);
(this function is SO big!)
target/avr/cpu.c=126=static void avr_cpu_realizefn(DeviceState *dev,
Error **errp)
target/avr/cpu.c-127-{
...
target/avr/cpu.c:140: cpu_reset(cs);
target/hexagon/cpu.c=311=static void hexagon_cpu_realize(DeviceState
*dev, Error **errp)
target/hexagon/cpu.c-312-{
...
target/hexagon/cpu.c:328: cpu_reset(cs);
target/i386/cpu.c=9772=static void x86_cpu_realizefn(DeviceState *dev,
Error **errp)
target/i386/cpu.c-9773-{
...
target/i386/cpu.c-10024-
qemu_register_reset(x86_cpu_machine_reset_cb, cpu);
...
target/i386/cpu.c:10045: cpu_reset(cs);
target/loongarch/cpu.c=525=static void
loongarch_cpu_realizefn(DeviceState *dev, Error **errp)
target/loongarch/cpu.c-526-{
...
target/loongarch/cpu.c:540: cpu_reset(cs);
target/m68k/cpu.c=379=static void m68k_cpu_realizefn(DeviceState *dev,
Error **errp)
target/m68k/cpu.c-380-{
...
target/m68k/cpu.c:396: cpu_reset(cs);
target/mips/cpu.c=455=static void mips_cpu_realizefn(DeviceState *dev,
Error **errp)
target/mips/cpu.c-456-{
...
target/mips/cpu.c:491: cpu_reset(cs);
target/or1k/cpu.c=167=static void openrisc_cpu_realizefn(DeviceState
*dev, Error **errp)
target/or1k/cpu.c-168-{
...
target/or1k/cpu.c:180: cpu_reset(cs);
target/riscv/cpu.c=925=static void riscv_cpu_realize(DeviceState *dev,
Error **errp)
target/riscv/cpu.c-926-{
...
target/riscv/cpu.c:953: cpu_reset(cs);
target/rx/cpu.c=144=static void rx_cpu_realize(DeviceState *dev, Error
**errp)
target/rx/cpu.c-145-{
...
target/rx/cpu.c:157: cpu_reset(cs);
target/s390x/cpu.c=234=static void s390_cpu_realizefn(DeviceState *dev,
Error **errp)
target/s390x/cpu.c-235-{
...
target/s390x/cpu.c:272: cpu_reset(cs);
target/tricore/cpu.c=94=static void tricore_cpu_realizefn(DeviceState
*dev, Error **errp)
target/tricore/cpu.c-95-{
...
target/tricore/cpu.c:123: cpu_reset(cs);
FTR other references are in this thread:
https://lore.kernel.org/qemu-devel/CAFEAcA-PEY8utD0OiUmhOBJb24_znFpQwOtzS_BPgbYGJ=8...@mail.gmail.com/
If you don't beat me to it, this is a topic I'm interested in,
but not on the top of my priority list :/
For CPU objects it is currently the responsibility of the
board code to arrange that the CPU objects get reset.
thanks
-- PMM