aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-10-28 07:36:57 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-12-10 12:15:18 -0500
commit6b21670cfda76e47a827810eea5eb3b518cb6521 (patch)
treef04a2ea9e60db8497f7ea34e4613a3ec2d5610c1 /hw
parent2c65db5e58d2c74921077f6c064ba4c91ebde16a (diff)
downloadqemu-6b21670cfda76e47a827810eea5eb3b518cb6521.zip
qemu-6b21670cfda76e47a827810eea5eb3b518cb6521.tar.gz
qemu-6b21670cfda76e47a827810eea5eb3b518cb6521.tar.bz2
vl: extract machine done notifiers
Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/machine.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 71a0e37..d7f8fde 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1169,6 +1169,30 @@ void machine_run_board_init(MachineState *machine)
machine_class->init(machine);
}
+static NotifierList machine_init_done_notifiers =
+ NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers);
+
+bool machine_init_done;
+
+void qemu_add_machine_init_done_notifier(Notifier *notify)
+{
+ notifier_list_add(&machine_init_done_notifiers, notify);
+ if (machine_init_done) {
+ notify->notify(notify, NULL);
+ }
+}
+
+void qemu_remove_machine_init_done_notifier(Notifier *notify)
+{
+ notifier_remove(notify);
+}
+
+void qemu_run_machine_init_done_notifiers(void)
+{
+ machine_init_done = true;
+ notifier_list_notify(&machine_init_done_notifiers, NULL);
+}
+
static const TypeInfo machine_info = {
.name = TYPE_MACHINE,
.parent = TYPE_OBJECT,