[PATCH 08/10] qemu-kvm: Use upstream kvm_arch_process_async_events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Upstream's kvm_arch_process_async_events is now identical to qemu-kvm's
combination of kvm_arch_process_async_events and process_irqchip_events.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 qemu-kvm-x86.c    |   49 -------------------------------------------------
 qemu-kvm.c        |   13 +------------
 qemu-kvm.h        |    2 --
 target-i386/kvm.c |    2 --
 4 files changed, 1 insertions(+), 65 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index b009251..18f7c3a 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -225,16 +225,6 @@ void kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
     }
 }
 
-int kvm_arch_has_work(CPUState *env)
-{
-    if (((env->interrupt_request & CPU_INTERRUPT_HARD) &&
-         (env->eflags & IF_MASK)) ||
-        (env->interrupt_request & CPU_INTERRUPT_NMI)) {
-        return 1;
-    }
-    return 0;
-}
-
 int kvm_arch_try_push_interrupts(void *opaque)
 {
     CPUState *env = cpu_single_env;
@@ -331,42 +321,3 @@ int kvm_arch_init_irq_routing(void)
 
     return 0;
 }
-
-void kvm_arch_process_irqchip_events(CPUState *env)
-{
-    if (env->interrupt_request & CPU_INTERRUPT_INIT) {
-        kvm_cpu_synchronize_state(env);
-        do_cpu_init(env);
-    }
-    if (env->interrupt_request & CPU_INTERRUPT_SIPI) {
-        kvm_cpu_synchronize_state(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;
-}
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 24c667c..41c4219 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1032,23 +1032,12 @@ static void qemu_kvm_system_reset(void)
     resume_all_threads();
 }
 
-static void process_irqchip_events(CPUState *env)
-{
-    kvm_arch_process_irqchip_events(env);
-    if (kvm_arch_has_work(env))
-        env->halted = 0;
-}
-
 static int kvm_main_loop_cpu(CPUState *env)
 {
     while (1) {
         int run_cpu = !kvm_cpu_is_stopped(env);
         if (run_cpu) {
-            kvm_arch_process_async_events(env);
-            if (!kvm_irqchip_in_kernel()) {
-                process_irqchip_events(env);
-                run_cpu = !env->halted;
-            }
+            run_cpu = !kvm_arch_process_async_events(env);
         }
         if (run_cpu) {
             kvm_cpu_exec(env);
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 8ff773a..5621cfa 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -314,8 +314,6 @@ void kvm_hpet_disable_kpit(void);
 void on_vcpu(CPUState *env, void (*func)(void *data), void *data);
 void kvm_update_interrupt_request(CPUState *env);
 
-int kvm_arch_has_work(CPUState *env);
-void kvm_arch_process_irqchip_events(CPUState *env);
 int kvm_arch_try_push_interrupts(void *opaque);
 void kvm_arch_push_nmi(void);
 int kvm_set_boot_cpu_id(KVMState *s, uint32_t id);
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index a4365bf..e98eccf 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1636,7 +1636,6 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run)
     cpu_set_apic_base(env->apic_state, run->apic_base);
 }
 
-#ifdef OBSOLETE_KVM_IMPL
 int kvm_arch_process_async_events(CPUState *env)
 {
     if (env->interrupt_request & CPU_INTERRUPT_MCE) {
@@ -1682,7 +1681,6 @@ int kvm_arch_process_async_events(CPUState *env)
 
     return env->halted;
 }
-#endif
 
 static int kvm_handle_halt(CPUState *env)
 {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux