From: Gleb Natapov <[email protected]> Use kvm_irqchip_in_kernel() for that. If irq chip is not handled by userspace kernel should be entered even when CPU is halted.
Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Avi Kivity <[email protected]> diff --git a/hw/apic.c b/hw/apic.c index c5d97b2..f186202 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -467,8 +467,7 @@ static void apic_init_ipi(APICState *s) cpu_reset(s->cpu_env); - if (!(s->apicbase & MSR_IA32_APICBASE_BSP) && - (!kvm_enabled() || !qemu_kvm_irqchip_in_kernel())) + if (!(s->apicbase & MSR_IA32_APICBASE_BSP)) s->cpu_env->halted = 1; if (kvm_enabled() && !qemu_kvm_irqchip_in_kernel()) diff --git a/qemu-kvm.c b/qemu-kvm.c index 9dc0a01..59de374 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1725,6 +1725,8 @@ static int has_work(CPUState *env) { if (!vm_running || (env && env->kvm_cpu_state.stopped)) return 0; + if (kvm_irqchip_in_kernel(kvm_context)) + return 1; if (!env->halted) return 1; return kvm_arch_has_work(env); @@ -1898,8 +1900,6 @@ static int kvm_main_loop_cpu(CPUState *env) setup_kernel_sigmask(env); pthread_mutex_lock(&qemu_mutex); - if (kvm_irqchip_in_kernel(kvm_context)) - env->halted = 0; kvm_qemu_init_env(env); #ifdef TARGET_I386 @@ -1920,7 +1920,7 @@ static int kvm_main_loop_cpu(CPUState *env) if (env->kvm_cpu_state.sipi_needed) update_regs_for_sipi(env); } - if (!env->halted) + if (!env->halted || kvm_irqchip_in_kernel(kvm_context)) kvm_cpu_exec(env); env->exit_request = 0; env->exception_index = EXCP_INTERRUPT; -- To unsubscribe from this list: send the line "unsubscribe kvm-commits" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
