From patchwork Mon Nov 15 14:31:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 71232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B60FBB70F9 for ; Tue, 16 Nov 2010 01:54:32 +1100 (EST) Received: from localhost ([127.0.0.1]:39400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PI0Ry-0004Ol-9o for incoming@patchwork.ozlabs.org; Mon, 15 Nov 2010 09:54:30 -0500 Received: from [140.186.70.92] (port=43432 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PI05a-00082E-O2 for qemu-devel@nongnu.org; Mon, 15 Nov 2010 09:31:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PI05U-0007U4-KL for qemu-devel@nongnu.org; Mon, 15 Nov 2010 09:31:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PI05U-0007TU-At for qemu-devel@nongnu.org; Mon, 15 Nov 2010 09:31:16 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAFEVDje025901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 15 Nov 2010 09:31:13 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAFEVCGl026343; Mon, 15 Nov 2010 09:31:13 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 49A6018D491; Mon, 15 Nov 2010 16:31:10 +0200 (IST) From: Gleb Natapov To: qemu-devel@nongnu.org Date: Mon, 15 Nov 2010 16:31:08 +0200 Message-Id: <1289831469-25540-15-git-send-email-gleb@redhat.com> In-Reply-To: <1289831469-25540-1-git-send-email-gleb@redhat.com> References: <1289831469-25540-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kvm@vger.kernel.org, mst@redhat.com, armbru@redhat.com, blauwirbel@gmail.com, alex.williamson@redhat.com, kevin@koconnor.net Subject: [Qemu-devel] [PATCHv5 14/15] Add notifier that will be called when machine is fully created. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Action that depends on fully initialized device model should register with this notifier chain. Signed-off-by: Gleb Natapov --- sysemu.h | 2 ++ vl.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/sysemu.h b/sysemu.h index 48f8eee..c42f33a 100644 --- a/sysemu.h +++ b/sysemu.h @@ -60,6 +60,8 @@ void qemu_system_reset(void); void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); +void qemu_add_machine_init_done_notifier(Notifier *notify); + void do_savevm(Monitor *mon, const QDict *qdict); int load_vmstate(const char *name); void do_delvm(Monitor *mon, const QDict *qdict); diff --git a/vl.c b/vl.c index e8ada75..918d988 100644 --- a/vl.c +++ b/vl.c @@ -253,6 +253,9 @@ static void *boot_set_opaque; static NotifierList exit_notifiers = NOTIFIER_LIST_INITIALIZER(exit_notifiers); +static NotifierList machine_init_done_notifiers = + NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); + int kvm_allowed = 0; uint32_t xen_domid; enum xen_mode xen_mode = XEN_EMULATE; @@ -1778,6 +1781,16 @@ static void qemu_run_exit_notifiers(void) notifier_list_notify(&exit_notifiers); } +void qemu_add_machine_init_done_notifier(Notifier *notify) +{ + notifier_list_add(&machine_init_done_notifiers, notify); +} + +static void qemu_run_machine_init_done_notifiers(void) +{ + notifier_list_notify(&machine_init_done_notifiers); +} + static const QEMUOption *lookup_opt(int argc, char **argv, const char **poptarg, int *poptind) { @@ -3023,6 +3036,8 @@ int main(int argc, char **argv, char **envp) exit(1); } + qemu_run_machine_init_done_notifiers(); + qemu_system_reset(); if (loadvm) { if (load_vmstate(loadvm) < 0) {