diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-11-12 09:38:36 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-12-15 12:51:52 -0500 |
commit | 2f181fbd5a9d456d1da291bea61d7e3ad10ec7d1 (patch) | |
tree | f6be4e559a9b9a95a2870caf0fc323e7ca6778e7 /include | |
parent | 5a1ee6077b89ee9a803aaf8d1c98004701f63684 (diff) |
machine: introduce MachineInitPhase
Generalize the qdev_hotplug variable to the different phases of
machine initialization. We would like to allow different
monitor commands depending on the phase.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/qdev-core.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 3dab50cd87..bafc311bfa 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -786,7 +786,6 @@ Object *qdev_get_machine(void); /* FIXME: make this a link<> */ bool qdev_set_parent_bus(DeviceState *dev, BusState *bus, Error **errp); -extern bool qdev_hotplug; extern bool qdev_hot_removed; char *qdev_get_dev_path(DeviceState *dev); @@ -812,4 +811,35 @@ void device_listener_unregister(DeviceListener *listener); */ bool qdev_should_hide_device(QemuOpts *opts); +typedef enum MachineInitPhase { + /* current_machine is NULL. */ + PHASE_NO_MACHINE, + + /* current_machine is not NULL, but current_machine->accel is NULL. */ + PHASE_MACHINE_CREATED, + + /* + * current_machine->accel is not NULL, but the machine properties have + * not been validated and machine_class->init has not yet been called. + */ + PHASE_ACCEL_CREATED, + + /* + * machine_class->init has been called, thus creating any embedded + * devices and validating machine properties. Devices created at + * this time are considered to be cold-plugged. + */ + PHASE_MACHINE_INITIALIZED, + + /* + * QEMU is ready to start CPUs and devices created at this time + * are considered to be hot-plugged. The monitor is not restricted + * to "preconfig" commands. + */ + PHASE_MACHINE_READY, +} MachineInitPhase; + +extern bool phase_check(MachineInitPhase phase); +extern void phase_advance(MachineInitPhase phase); + #endif |