@@ -330,6 +330,7 @@ static void qemu_chr_open_mux(Chardev *chr,
*/
*be_opened = machine_init_done;
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__ */
@@ -116,9 +116,17 @@ static void qemu_chr_open_stdio(Chardev *chr,
stdio_allow_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)
{
@@ -3417,6 +3417,7 @@ int gdbserver_start(const char *device)
mon_chr = gdbserver_state.mon_chr;
reset_gdbserver_state();
}
+ mon_chr->close_on_cpr = true;
create_processes(&gdbserver_state);
@@ -294,5 +294,6 @@ GSource *qemu_chr_timeout_add_ms(Chardev *chr, guint ms,
void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp);
bool qemu_chr_cpr_capable(Error **errp);
+void qemu_term_exit(void);
#endif
@@ -139,6 +139,7 @@ void cprsave(const char *file, CprMode mode, Error **errp)
}
walkenv(FD_PREFIX, preserve_fd, 0);
vhost_dev_reset_all();
+ qemu_term_exit();
setenv("QEMU_START_FREEZE", "", 1);
qemu_system_exec_request();
}
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(+)