aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-17 23:26:59 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-22 10:15:28 -0500
commitb09ea7d55cfab5a75912bb56ed1fcd757604a759 (patch)
tree0824d788e214876bdc2b9816fcdb6bfb91b64b20 /target-i386
parent6eaa68474671a6c69f30b185ce3c87ff18f85e01 (diff)
downloadqemu-b09ea7d55cfab5a75912bb56ed1fcd757604a759.zip
qemu-b09ea7d55cfab5a75912bb56ed1fcd757604a759.tar.gz
qemu-b09ea7d55cfab5a75912bb56ed1fcd757604a759.tar.bz2
Handle init/sipi in a main cpu exec loop. (v2)
This should fix compilation problem in case of CONFIG_USER_ONLY. Currently INIT/SIPI is handled in the context of CPU that sends IPI. This patch changes this to handle them like all other events in a main cpu exec loop. When KVM will gain thread per vcpu capability it will be much more clear to handle those event by cpu thread itself and not modify one cpu's state from the context of the other. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.h4
-rw-r--r--target-i386/exec.h2
-rw-r--r--target-i386/helper.c22
3 files changed, 28 insertions, 0 deletions
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 3cd391a..a50f059 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -888,4 +888,8 @@ static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
(env->eflags & (IOPL_MASK | TF_MASK | RF_MASK | VM_MASK));
}
+void apic_init_reset(CPUState *env);
+void apic_sipi(CPUState *env);
+void do_cpu_init(CPUState *env);
+void do_cpu_sipi(CPUState *env);
#endif /* CPU_I386_H */
diff --git a/target-i386/exec.h b/target-i386/exec.h
index fbaf5bc..42b471a 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -345,6 +345,8 @@ static inline int cpu_has_work(CPUState *env)
work = (env->interrupt_request & CPU_INTERRUPT_HARD) &&
(env->eflags & IF_MASK);
work |= env->interrupt_request & CPU_INTERRUPT_NMI;
+ work |= env->interrupt_request & CPU_INTERRUPT_INIT;
+ work |= env->interrupt_request & CPU_INTERRUPT_SIPI;
return work;
}
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 75e7ccd..8a76abd 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1738,3 +1738,25 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
return env;
}
+
+#if !defined(CONFIG_USER_ONLY)
+void do_cpu_init(CPUState *env)
+{
+ int sipi = env->interrupt_request & CPU_INTERRUPT_SIPI;
+ cpu_reset(env);
+ env->interrupt_request = sipi;
+ apic_init_reset(env);
+}
+
+void do_cpu_sipi(CPUState *env)
+{
+ apic_sipi(env);
+}
+#else
+void do_cpu_init(CPUState *env)
+{
+}
+void do_cpu_sipi(CPUState *env)
+{
+}
+#endif