From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
VT-x needs an explicit MC vector intercept to handle machine checks in the hyper visor.
It also has a special option to catch machine checks that happen
during VT entry.
Do these interceptions and forward them to the Linux machine check
handler. Make it always look like user space is interrupted because
the machine check handler treats kernel/user space differently.
Thanks to Jiang Yunhong for help and testing.
v4: move exit_reason to struct vcpu_vmx, add is_machine_check()
v3: Rebased on kvm.git
v2: Handle machine checks still in interrupt off context
to avoid problems on preemptible kernels.
+ vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
+
+ /* Handle machine checks before interrupts are enabled */
+ if ((vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY) ||
+ is_machine_check(exit_intr_info))
+ kvm_machine_check();
+