@@ -110,9 +110,7 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run);
int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run);
-#ifdef OBSOLETE_KVM_IMPL
int kvm_arch_process_async_events(CPUState *env);
-#endif
int kvm_arch_get_registers(CPUState *env);
@@ -811,3 +811,30 @@ void kvm_arch_process_irqchip_events(CPUState *env)
do_cpu_sipi(env);
}
}
+
+int kvm_arch_process_async_events(CPUState *env)
+{
+ if (env->interrupt_request & CPU_INTERRUPT_MCE) {
+ /* We must not raise CPU_INTERRUPT_MCE if it's not supported. */
+ assert(env->mcg_cap);
+
+ env->interrupt_request &= ~CPU_INTERRUPT_MCE;
+
+ kvm_cpu_synchronize_state(env);
+
+ if (env->exception_injected == EXCP08_DBLE) {
+ /* this means triple fault */
+ qemu_system_reset_request();
+ env->exit_request = 1;
+ return 0;
+ }
+ env->exception_injected = EXCP12_MCHK;
+ env->has_error_code = 0;
+
+ env->halted = 0;
+ if (kvm_irqchip_in_kernel() && env->mp_state == KVM_MP_STATE_HALTED) {
+ env->mp_state = KVM_MP_STATE_RUNNABLE;
+ }
+ }
+ return 0;
+}
@@ -1414,9 +1414,12 @@ static int kvm_main_loop_cpu(CPUState *env)
{
while (1) {
int run_cpu = !kvm_cpu_is_stopped(env);
- if (run_cpu && !kvm_irqchip_in_kernel()) {
- process_irqchip_events(env);
- run_cpu = !env->halted;
+ if (run_cpu) {
+ kvm_arch_process_async_events(env);
+ if (!kvm_irqchip_in_kernel()) {
+ process_irqchip_events(env);
+ run_cpu = !env->halted;
+ }
}
if (run_cpu) {
kvm_cpu_exec(env);
This aligns qemu-kvm with upstream commit ab443475c9. Namely, we were missing a call to an equivalent of kvm_arch_process_async_events from the main loop. This adds a stripped down version of upstream's process_async_events until we switch over. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- kvm.h | 2 -- qemu-kvm-x86.c | 27 +++++++++++++++++++++++++++ qemu-kvm.c | 9 ++++++--- 3 files changed, 33 insertions(+), 5 deletions(-)