diff mbox

Use upstream QEMU apic init/sipi handling

Message ID 20090628154608.GP20289@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov June 28, 2009, 3:46 p.m. UTC
Remove KVM specific init/sipi handling from hw/apic.c. Now when
upstream QEMU handles init/sipi in a cpu loop KVM can do the same.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Avi Kivity June 29, 2009, 9:13 a.m. UTC | #1
On 06/28/2009 06:46 PM, Gleb Natapov wrote:
> Remove KVM specific init/sipi handling from hw/apic.c. Now when
> upstream QEMU handles init/sipi in a cpu loop KVM can do the same.
>
>    

Applied, thanks.
diff mbox

Patch

diff --git a/cpu-defs.h b/cpu-defs.h
index e17209a..7570096 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -140,8 +140,6 @@  typedef struct CPUWatchpoint {
 struct qemu_work_item;
 
 struct KVMCPUState {
-    int sipi_needed;
-    int init;
     pthread_t thread;
     int signalled;
     int stop;
diff --git a/hw/apic.c b/hw/apic.c
index 7ac926a..1a0d38b 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -492,9 +492,6 @@  void apic_init_reset(CPUState *env)
     s->wait_for_sipi = 1;
 
     env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP);
-
-    if (kvm_enabled() && !qemu_kvm_irqchip_in_kernel())
-        kvm_apic_init(s->cpu_env);
 }
 
 static void apic_startup(APICState *s, int vector_num)
@@ -517,8 +514,6 @@  void apic_sipi(CPUState *env)
                            0xffff, 0);
     env->halted = 0;
     s->wait_for_sipi = 0;
-    if (kvm_enabled() && !qemu_kvm_irqchip_in_kernel())
-	kvm_update_after_sipi(env);
 }
 
 static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index a78073e..1eb147e 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1576,45 +1576,10 @@  uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
     return kvm_get_supported_cpuid(kvm_context, function, reg);
 }
 
-void kvm_update_after_sipi(CPUState *env)
-{
-    env->kvm_cpu_state.sipi_needed = 1;
-    kvm_update_interrupt_request(env);
-}
-
-void kvm_apic_init(CPUState *env)
-{
-    if (!cpu_is_bsp(env))
-	env->kvm_cpu_state.init = 1;
-    kvm_update_interrupt_request(env);
-}
-
-static void update_regs_for_sipi(CPUState *env)
-{
-    kvm_arch_update_regs_for_sipi(env);
-    env->kvm_cpu_state.sipi_needed = 0;
-}
-
-static void update_regs_for_init(CPUState *env)
-{
-    SegmentCache cs = env->segs[R_CS];
-
-    cpu_reset(env);
-    /* cpu_reset() clears env->halted, cpu should be halted after init */
-    env->halted = 1;
-
-    /* restore SIPI vector */
-    if(env->kvm_cpu_state.sipi_needed)
-        env->segs[R_CS] = cs;
-
-    env->kvm_cpu_state.init = 0;
-    kvm_arch_load_regs(env);
-}
-
 void kvm_arch_process_irqchip_events(CPUState *env)
 {
-    if (env->kvm_cpu_state.init)
-        update_regs_for_init(env);
-    if (env->kvm_cpu_state.sipi_needed)
-        update_regs_for_sipi(env);
+    if (env->interrupt_request & CPU_INTERRUPT_INIT)
+        do_cpu_init(env);
+    if (env->interrupt_request & CPU_INTERRUPT_SIPI)
+        do_cpu_sipi(env);
 }