diff mbox

BUG: commit 50a2c6e breaks KVM/ARM (reset/init vcpu order)

Message ID 538379DA.9070404@twiddle.net
State New
Headers show

Commit Message

Richard Henderson May 26, 2014, 5:28 p.m. UTC
On 05/26/2014 03:20 AM, Andreas Färber wrote:
> Alpha is the main blocker for unifying CPU reset iirc. It does not
> implement reset at all and thus is not calling it. The struct was not
> designed for zero'ing things, so there's a mix of data fields and
> pointers without clear separation to allow memset(), and I have neither
> a working alpha test image nor the time to investigate this at the moment.
> 
> WIP here:
> https://github.com/afaerber/qemu-cpu/commits/qom-cpu-alpha
> https://github.com/afaerber/qemu-cpu/commits/qom-cpu-reset

Doesn't compile anymore.  I can fix that up with the attached, but we can't
actually test this without changes to the rom to actually support reset.  At
the moment, the rom will tell qemu to poweroff whether the kernel signals for
poweroff or reset.

If this is good enough to unblock you in other qom cleanups, please go ahead.
One of these days I'll get around to filling out more complete roms...


r~
diff mbox

Patch

diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 6ab31a1..cbad6fa 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -49,19 +49,30 @@  static bool alpha_cpu_has_work(CPUState *cs)
 /* CPUClass::reset() */
 static void alpha_cpu_reset(CPUState *s)
 {
+#ifdef CONFIG_SOFTMMU
     AlphaCPU *cpu = ALPHA_CPU(s);
     AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(cpu);
     CPUAlphaState *env = &cpu->env;
+    uint64_t palbr;
 
     if (qemu_loglevel_mask(CPU_LOG_RESET)) {
         qemu_log("CPU Reset (CPU %d)\n", s->cpu_index);
-        log_cpu_state(env, 0);
+        log_cpu_state(s, 0);
     }
 
     acc->parent_reset(s);
 
-    memset(env, 0, offsetof(CPUAlphaState, breakpoints));
-    tlb_flush(env, 1);
+    palbr = env->palbr;
+
+    memset(env, 0, offsetof(CPUAlphaState, error_code));
+    tlb_flush(s, 1);
+
+    /* Reset vector goes to palbr + 0.  */
+    env->palbr = palbr;
+    env->pc = palbr;
+#else
+    abort();
+#endif
 }
 
 static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)