[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V8 34/39] chardev: cpr for simple devices
|
From: |
Steve Sistare |
|
Subject: |
[PATCH V8 34/39] chardev: cpr for simple devices |
|
Date: |
Wed, 15 Jun 2022 07:52:21 -0700 |
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 | 10 ++++++++++
gdbstub.c | 1 +
5 files changed, 14 insertions(+)
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index ee2d47b..d47fa31 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -337,6 +337,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,
diff --git a/chardev/char-null.c b/chardev/char-null.c
index 1c6a290..02acaff 100644
--- a/chardev/char-null.c
+++ b/chardev/char-null.c
@@ -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)
diff --git a/chardev/char-serial.c b/chardev/char-serial.c
index 4b0b83d..7aa2042 100644
--- a/chardev/char-serial.c
+++ b/chardev/char-serial.c
@@ -277,6 +277,7 @@ static void qmp_chardev_open_serial(Chardev *chr,
}
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__ */
diff --git a/chardev/char-stdio.c b/chardev/char-stdio.c
index 3c64867..520f1db 100644
--- a/chardev/char-stdio.c
+++ b/chardev/char-stdio.c
@@ -27,6 +27,7 @@
#include "qemu/option.h"
#include "qemu/sockets.h"
#include "qapi/error.h"
+#include "migration/cpr.h"
#include "chardev/char.h"
#ifdef _WIN32
@@ -44,6 +45,7 @@ static int old_fd0_flags;
static bool stdio_in_use;
static bool stdio_allow_signal;
static bool stdio_echo_state;
+static Notifier cpr_notifier;
static void term_exit(void)
{
@@ -53,6 +55,11 @@ static void term_exit(void)
}
}
+static void term_cpr_exec_notifier(Notifier *notifier, void *data)
+{
+ term_exit();
+}
+
static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
{
struct termios tty;
@@ -117,6 +124,8 @@ 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);
+ cpr_add_notifier(&cpr_notifier, term_cpr_exec_notifier, CPR_NOTIFY_EXEC);
}
#endif
@@ -147,6 +156,7 @@ static void char_stdio_finalize(Object *obj)
{
#ifndef _WIN32
term_exit();
+ cpr_remove_notifier(&cpr_notifier);
#endif
}
diff --git a/gdbstub.c b/gdbstub.c
index 88a34c8..7865c3d 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -3584,6 +3584,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);
--
1.8.3.1
- [PATCH V8 26/39] vfio-pci: refactor for cpr, (continued)
- [PATCH V8 26/39] vfio-pci: refactor for cpr, Steve Sistare, 2022/06/15
- [PATCH V8 36/39] chardev: cpr for sockets, Steve Sistare, 2022/06/15
- [PATCH V8 28/39] vfio-pci: cpr part 2 (msi), Steve Sistare, 2022/06/15
- [PATCH V8 33/39] chardev: cpr framework, Steve Sistare, 2022/06/15
- [PATCH V8 35/39] chardev: cpr for pty, Steve Sistare, 2022/06/15
- [PATCH V8 32/39] loader: suppress rom_reset during cpr, Steve Sistare, 2022/06/15
- [PATCH V8 37/39] cpr: only-cpr-capable option, Steve Sistare, 2022/06/15
- [PATCH V8 27/39] vfio-pci: cpr part 1 (fd and dma), Steve Sistare, 2022/06/15
- [PATCH V8 34/39] chardev: cpr for simple devices,
Steve Sistare <=
- [PATCH V8 39/39] tests/avocado: add cpr regression test, Steve Sistare, 2022/06/15
- [PATCH V8 30/39] vfio-pci: recover from unmap-all-vaddr failure, Steve Sistare, 2022/06/15
- [PATCH V8 38/39] python/machine: add QEMUMachine accessors, Steve Sistare, 2022/06/15
- [PATCH V8 01/39] migration: fix populate_vfio_info, Steve Sistare, 2022/06/15
- [PATCH V8 05/39] vl: start on wakeup request, Steve Sistare, 2022/06/15
- [PATCH V8 07/39] cpr: reboot HMP interfaces, Steve Sistare, 2022/06/15