]> git.proxmox.com Git - qemu.git/commitdiff
Introduce VCPU self-signaling service
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 1 Feb 2011 21:15:59 +0000 (22:15 +0100)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 14 Feb 2011 14:39:45 +0000 (12:39 -0200)
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>
cpus.c
qemu-common.h

diff --git a/cpus.c b/cpus.c
index 9a3fc312d328b6a82927eb7d1260fd3b44e8ca19..6a85dc866492b052593706df644fac2800c90f24 100644 (file)
--- 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;
index c7ff280b952f41f06c033ba1085f789406a3cc98..a4d9c21a39d94c6a7362e9bd677d7a604a86f979 100644 (file)
@@ -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 */