From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1H62-000836-DP for qemu-devel@nongnu.org; Tue, 24 Nov 2015 12:09:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1H5y-0006Oz-VW for qemu-devel@nongnu.org; Tue, 24 Nov 2015 12:09:38 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:50163 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1H5y-0006Of-Ks for qemu-devel@nongnu.org; Tue, 24 Nov 2015 12:09:34 -0500 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Tue, 24 Nov 2015 18:09:25 +0100 Message-Id: <144838496556.3052.7233365214053800760.stgit@localhost> In-Reply-To: <144838492534.3052.2948919558518613064.stgit@localhost> References: <144838492534.3052.2948919558518613064.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 07/10] [trivial] Track when QEMU has finished initialization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Stefan Hajnoczi , Riku Voipio , Blue Swirl , Paolo Bonzini Later used to synchronize per-vCPU state of events enabled from command line. Signed-off-by: Llu=C3=ADs Vilanova --- Makefile.objs | 2 +- bsd-user/main.c | 1 + include/qemu-common.h | 3 +++ linux-user/main.c | 1 + qemu-common.c | 14 ++++++++++++++ stubs/Makefile.objs | 1 + stubs/qemu-common-stub.c | 21 +++++++++++++++++++++ vl.c | 2 ++ 8 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 qemu-common.c create mode 100644 stubs/qemu-common-stub.c diff --git a/Makefile.objs b/Makefile.objs index 77be052..d161060 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -2,7 +2,7 @@ # Common libraries for tools and emulators stub-obj-y =3D stubs/ util-obj-y =3D util/ qobject/ qapi/ -util-obj-y +=3D qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o +util-obj-y +=3D qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o = qemu-common.o =20 ####################################################################### # block-obj-y is code used by both qemu system emulation and qemu-img diff --git a/bsd-user/main.c b/bsd-user/main.c index adf2de0..eff37e0 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -1121,6 +1121,7 @@ int main(int argc, char **argv) gdbserver_start (gdbstub_port); gdb_handlesig(cpu, 0); } + qemu_initialized =3D true; cpu_loop(env); /* never exits */ return 0; diff --git a/include/qemu-common.h b/include/qemu-common.h index 405364f..dccc0ac 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -35,6 +35,9 @@ # error Unknown pointer size #endif =20 +/* Whether the system has finished initializing */ +extern bool qemu_initialized; + void cpu_ticks_init(void); =20 /* icount */ diff --git a/linux-user/main.c b/linux-user/main.c index 8acfe0f..f80a01e 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4663,6 +4663,7 @@ int main(int argc, char **argv, char **envp) } gdb_handlesig(cpu, 0); } + qemu_initialized =3D true; cpu_loop(env); /* never exits */ return 0; diff --git a/qemu-common.c b/qemu-common.c new file mode 100644 index 0000000..4b5ca1a --- /dev/null +++ b/qemu-common.c @@ -0,0 +1,14 @@ +/* + * Common symbol definitions for all tools and targets. + * + * Copyright (C) 2011-2015 Llu=C3=ADs Vilanova + * + * This work is licensed under the terms of the GNU GPL, version 2 or la= ter. + * See the COPYING file in the top-level directory. +*/ + +#include "qemu-common.h" + + +/* Whether QEMU has been initialized. */ +bool qemu_initialized; diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index d7898a0..670585a 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -38,3 +38,4 @@ stub-obj-y +=3D qmp_pc_dimm_device_list.o stub-obj-y +=3D target-monitor-defs.o stub-obj-y +=3D target-get-monitor-def.o stub-obj-y +=3D vhost.o +stub-obj-y +=3D qemu-common-stub.o diff --git a/stubs/qemu-common-stub.c b/stubs/qemu-common-stub.c new file mode 100644 index 0000000..f34f019 --- /dev/null +++ b/stubs/qemu-common-stub.c @@ -0,0 +1,21 @@ +/* + * Common symbol definitions for all tools and targets. + * + * Copyright (C) 2011-2015 Llu=C3=ADs Vilanova + * + * This work is licensed under the terms of the GNU GPL, version 2 or la= ter. + * See the COPYING file in the top-level directory. +*/ + +#include "qemu-common.h" +#include + + +static void do_qemu_initialized_init(void) +{ + /* Tools always consider QEMU as inited */ + qemu_initialized =3D true; +} + +/* Block is always inited on both tools (and targets) */ +block_init(do_qemu_initialized_init); diff --git a/vl.c b/vl.c index 525929b..7c56159 100644 --- a/vl.c +++ b/vl.c @@ -4681,6 +4681,8 @@ int main(int argc, char **argv, char **envp) } } =20 + qemu_initialized =3D true; + main_loop(); replay_disable_events(); =20