aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-02-01 22:15:59 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-02-14 12:39:45 -0200
commit46d62fac8a6a43453322b3305ab2fcb8ee594443 (patch)
tree498dcb0052cf6108b6fc9c94e9d088e30d27708d
parent6d9cb73c1bf80bfb0b8e7b2b3a23703e621c1405 (diff)
Introduce VCPU self-signaling service
Introduce qemu_cpu_kick_self to send SIG_IPI to the calling VCPU context. First user will be kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--cpus.c21
-rw-r--r--qemu-common.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/cpus.c b/cpus.c
index 9a3fc312d3..6a85dc8664 100644
--- a/cpus.c
+++ b/cpus.c
@@ -529,6 +529,17 @@ void qemu_cpu_kick(void *env)
return;
}
+void qemu_cpu_kick_self(void)
+{
+#ifndef _WIN32
+ assert(cpu_single_env);
+
+ raise(SIG_IPI);
+#else
+ abort();
+#endif
+}
+
void qemu_notify_event(void)
{
CPUState *env = cpu_single_env;
@@ -831,6 +842,16 @@ void qemu_cpu_kick(void *_env)
}
}
+void qemu_cpu_kick_self(void)
+{
+ assert(cpu_single_env);
+
+ if (!cpu_single_env->thread_kicked) {
+ qemu_thread_signal(cpu_single_env->thread, SIG_IPI);
+ cpu_single_env->thread_kicked = true;
+ }
+}
+
int qemu_cpu_self(void *_env)
{
CPUState *env = _env;
diff --git a/qemu-common.h b/qemu-common.h
index c7ff280b95..a4d9c21a39 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -288,6 +288,7 @@ void qemu_notify_event(void);
/* Unblock cpu */
void qemu_cpu_kick(void *env);
+void qemu_cpu_kick_self(void);
int qemu_cpu_self(void *env);
/* work queue */