All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH] Move x86 specific code from qemu-kvm.c to qemu-kvm-x86.c
Date: Thu, 25 Jun 2009 15:20:58 +0300	[thread overview]
Message-ID: <1245932460-15616-1-git-send-email-gleb@redhat.com> (raw)


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(-)

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);
-- 
1.6.2.1


             reply	other threads:[~2009-06-25 12:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-25 12:20 Gleb Natapov [this message]
2009-06-28  9:26 ` [PATCH] Move x86 specific code from qemu-kvm.c to qemu-kvm-x86.c Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1245932460-15616-1-git-send-email-gleb@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.