Skip to contentSkip to conversation

MCE: Fix bug of IA32_MCG_STATUS after system reset

Qemu-devel Applied Huang Ying 2 participants 2 messages Jan 5, 2010 – Jan 11, 2010

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

Now, if we inject a fatal MCE into guest OS, for example Linux, Linux will go panic and then reboot. But if we inject another MCE now, system will reset directly instead of go panic firstly, because MCG_STATUS.MCIP is set to 1 and not cleared after reboot. This is does not follow the behavior in real hardware.

This patch fixes this via set env->mcg_status to 0 during system reset.

---
 target-i386/helper.c |    2 ++
 1 file changed, 2 insertions(+)
target-i386/helper.c +2 -0
@@ -617,6 +617,8 @@ void cpu_reset(CPUX86State *env)
     env->dr[7] = DR7_FIXED_1;
     cpu_breakpoint_remove_all(env, BP_CPU);
     cpu_watchpoint_remove_all(env, BP_CPU);
+
+    env->mcg_status = 0;
 }
 
 void cpu_x86_close(CPUX86State *env)
#1 lore raw
Quoted 10 lines · Huang Ying

Now, if we inject a fatal MCE into guest OS, for example Linux, Linux will go panic and then reboot. But if we inject another MCE now, system will reset directly instead of go panic firstly, because MCG_STATUS.MCIP is set to 1 and not cleared after reboot. This is does not follow the behavior in real hardware.

This patch fixes this via set env->mcg_status to 0 during system reset.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 21 lines
---
  target-i386/helper.c |    2 ++
  1 file changed, 2 insertions(+)
target-i386/helper.c +2 -0
@@ -617,6 +617,8 @@ void cpu_reset(CPUX86State *env)
      env->dr[7] = DR7_FIXED_1;
      cpu_breakpoint_remove_all(env, BP_CPU);
      cpu_watchpoint_remove_all(env, BP_CPU);
+
+    env->mcg_status = 0;
  }
 
  void cpu_x86_close(CPUX86State *env)