On Tue, 17 Feb 2026, Philippe Mathieu-Daudé wrote:
On 17/2/26 20:12, Yodel Eldar wrote:
+Philippe
Hi,
On 17/02/2026 03: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]>
---
So, the real culprit was hiding in plain sight in Alpha-specific code
all along? Congrats on finding it!
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.
For CPU objects it is currently the responsibility of the
board code to arrange that the CPU objects get reset.
thanks
-- PMM
I think the following addresses Peter's remarks; it passed 100
repetitions of the Alpha replay test after reapplying the reverted
commit:
diff --git hw/alpha/dp264.c hw/alpha/dp264.c
index 5e64528431..091ffc0085 100644
--- hw/alpha/dp264.c
+++ hw/alpha/dp264.c
@@ -68,5 +68,7 @@ static void clipper_init(MachineState *machine)
memset(cpus, 0, sizeof(cpus));
for (i = 0; i < smp_cpus; ++i) {
- cpus[i] = ALPHA_CPU(cpu_create(machine->cpu_type));
+ CPUState *cpu = cpu_create(machine->cpu_type);
+ cpu_reset(cpu);
+ cpus[i] = ALPHA_CPU(cpu);
Hmm this pattern is used a lot (creating CPUs in board_init without
manually calling cpu_reset). If this is the simplest fix, maybe
we could add a cpu_create_resetted() helper and use it where
appropriate (i.e. not where qemu_register_reset is then called).
I've been bitten by this before and was suggested to add a
machine_cpu_reset function that calls cpu_reset and register it with
qemu_register_reset in the machine init method. That was a while ago so
maybe things changed since but hw/ppc/ppc440_bamboo.c is a simple example
showing this (although that machnie is old and not quite maintained
machine so may not follow up to date recommendations) and most other ppc
machines do this.
Regards,
BALATON Zoltan