summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-25 15:20:58 +0300
committerAvi Kivity <avi@redhat.com>2009-06-28 12:25:07 +0300
commit12f1dd56de3267bc5fead8ba6f351dd97ce23323 (patch)
tree571ed5924883d941fb0ef88b1b9ec146fe0657ca /qemu-kvm-x86.c
parentUse upstream guard for kvm support in ppcemb-softmmu (diff)
downloadqemu-kvm-12f1dd56de3267bc5fead8ba6f351dd97ce23323.tar.gz
qemu-kvm-12f1dd56de3267bc5fead8ba6f351dd97ce23323.tar.bz2
qemu-kvm-12f1dd56de3267bc5fead8ba6f351dd97ce23323.zip
Move x86 specific code from qemu-kvm.c to qemu-kvm-x86.c
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'qemu-kvm-x86.c')
-rw-r--r--qemu-kvm-x86.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 66b2b199b..568df5383 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);
+}