The previous commit demonstrated how you can interleave QMP-over-CLI with startup. We want the same for real QMP.
QMP-over-CLI starts in phase @no-machine, and may advance the phase. We then advance to phase @machine-ready, and enter the main loop, and real QMP becomes available. If we skip the phase advance, real QMP becomes exactly as expressive as QMP-over-CLI. Except the main loop crashes. If we skip to phase @machine-created, it doesn't crash, but it doesn't give me a QMP monitor either. Same for phase @accel-created. Skipping to @machine-initialized works, and suffices to let me demonstrate cold plug via QMP: $ qemu-system-x86_64 {"QMP": {"version": {"qemu": {"micro": 92, "minor": 1, "major": 6}, "package": "v6.2.0-rc2-39-g8c7f07732b"}, "capabilities": ["oob"]}} {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}} {"return": {}} {"execute": "device_add", "arguments": {"driver": "isa-serial"}} {"return": {}} Signed-off-by: Markus Armbruster <arm...@redhat.com> --- softmmu/vl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 9406368338..01f87aec07 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1038,7 +1038,12 @@ void qemu_init(int argc, char **argv, char **envp) } } - qemu_until_phase(PHASE_MACHINE_READY); + /* + * FIXME need to force phase, because staying in PHASE_NO_MACHINE + * crashes, and going only to PHASE_MACHINE_CREATED or + * PHASE_ACCEL_CREATED gives no monitor. + */ + qemu_until_phase(PHASE_MACHINE_INITIALIZED); } void qemu_until_phase(MachineInitPhase phase) -- 2.31.1