diff mbox

Move x86 specific code from qemu-kvm.c to qemu-kvm-x86.c

Message ID 1245932460-15616-1-git-send-email-gleb@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov June 25, 2009, 12:20 p.m. UTC
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 qemu-kvm-ia64.c |    4 ++++
 qemu-kvm-x86.c  |   43 +++++++++++++++++++++++++++++++++++++++++++
 qemu-kvm.c      |   44 +-------------------------------------------
 qemu-kvm.h      |    1 +
 4 files changed, 49 insertions(+), 43 deletions(-)

Comments

Avi Kivity June 28, 2009, 9:26 a.m. UTC | #1
On 06/25/2009 03:20 PM, Gleb Natapov wrote:
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
>    


Applied, thanks.
diff mbox

Patch

diff --git a/qemu-kvm-ia64.c b/qemu-kvm-ia64.c
index 477d24c..582113f 100644
--- a/qemu-kvm-ia64.c
+++ b/qemu-kvm-ia64.c
@@ -142,3 +142,7 @@  void kvm_arch_do_ioperm(void *_data)
     struct ioperm_data *data = _data;
     ioperm(data->start_port, data->num, data->turn_on);
 }
+
+void kvm_arch_process_irqchip_events(CPUState *env)
+{
+}
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 66b2b19..568df53 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1574,3 +1574,46 @@  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 (env->cpu_index != 0)
+	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);
+}
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 2d0015c..c5cd038 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1647,19 +1647,6 @@  void kvm_update_interrupt_request(CPUState *env)
     }
 }
 
-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 (env->cpu_index != 0)
-	env->kvm_cpu_state.init = 1;
-    kvm_update_interrupt_request(env);
-}
-
 #include <signal.h>
 
 static int kvm_try_push_interrupts(void *opaque)
@@ -1863,32 +1850,6 @@  static void kvm_vm_state_change_handler(void *context, int running, int reason)
 	pause_all_threads();
 }
 
-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)
-{
-#ifdef TARGET_I386
-    SegmentCache cs = env->segs[R_CS];
-#endif
-
-    cpu_reset(env);
-    /* cpu_reset() clears env->halted, cpu should be halted after init */
-    env->halted = 1;
-
-#ifdef TARGET_I386
-    /* restore SIPI vector */
-    if(env->kvm_cpu_state.sipi_needed)
-        env->segs[R_CS] = cs;
-#endif
-
-    env->kvm_cpu_state.init = 0;
-    kvm_arch_load_regs(env);
-}
-
 static void setup_kernel_sigmask(CPUState *env)
 {
     sigset_t set;
@@ -1923,10 +1884,7 @@  static void qemu_kvm_system_reset(void)
 
 static void 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);
+    kvm_arch_process_irqchip_events(env);
     if (kvm_arch_has_work(env))
         env->halted = 0;
 }
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 68a5b40..9c28566 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -75,6 +75,7 @@  int kvm_arch_qemu_init_env(CPUState *cenv);
 void kvm_arch_pre_kvm_run(void *opaque, CPUState *env);
 void kvm_arch_post_kvm_run(void *opaque, 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 *opaque);
 void kvm_arch_update_regs_for_sipi(CPUState *env);