@@ -336,6 +336,7 @@ static void qemu_chr_open_mux(Chardev *chr,
*/
*be_opened = muxes_opened;
qemu_chr_fe_init(&d->chr, drv, errp);
+ qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_CPR);
}
static void qemu_chr_parse_mux(QemuOpts *opts, ChardevBackend *backend,
@@ -32,6 +32,7 @@ static void null_chr_open(Chardev *chr,
Error **errp)
{
*be_opened = false;
+ qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_CPR);
}
static void char_null_class_init(ObjectClass *oc, void *data)
@@ -274,6 +274,7 @@ static void qmp_chardev_open_serial(Chardev *chr,
qemu_set_nonblock(fd);
tty_serial_init(fd, 115200, 'N', 8, 1);
+ qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_CPR);
qemu_chr_open_fd(chr, fd, fd);
}
#endif /* __linux__ || __sun__ */
@@ -114,9 +114,17 @@ static void qemu_chr_open_stdio(Chardev *chr,
stdio_allow_signal = !opts->has_signal || opts->signal;
qemu_chr_set_echo_stdio(chr, false);
+ qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_CPR);
}
#endif
+void qemu_term_exit(void)
+{
+#ifndef _WIN32
+ term_exit();
+#endif
+}
+
static void qemu_chr_parse_stdio(QemuOpts *opts, ChardevBackend *backend,
Error **errp)
{
@@ -3534,6 +3534,7 @@ int gdbserver_start(const char *device)
mon_chr = gdbserver_state.mon_chr;
reset_gdbserver_state();
}
+ mon_chr->reopen_on_cpr = true;
create_processes(&gdbserver_state);
@@ -295,5 +295,6 @@ void resume_mux_open(void);
void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp);
bool qemu_chr_is_cpr_capable(Error **errp);
+void qemu_term_exit(void);
#endif
@@ -119,6 +119,7 @@ void qmp_cpr_exec(strList *args, Error **errp)
return;
}
vhost_dev_reset_all();
+ qemu_term_exit();
qemu_system_exec_request(args);
}
Set QEMU_CHAR_FEATURE_CPR for devices that trivially support cpr. char-stdio is slightly less trivial. Allow the gdb server by closing it on exec. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> --- chardev/char-mux.c | 1 + chardev/char-null.c | 1 + chardev/char-serial.c | 1 + chardev/char-stdio.c | 8 ++++++++ gdbstub.c | 1 + include/chardev/char.h | 1 + migration/cpr.c | 1 + 7 files changed, 14 insertions(+)