|
|
9ae3a8 |
From 9c6b84014b3650e478494d3c19b7461b947b3b14 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gal Hammer <ghammer@redhat.com>
|
|
|
9ae3a8 |
Date: Sun, 16 Mar 2014 09:57:09 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 01/31] char: restore read callback on a reattached (hotplug) chardev
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Gal Hammer <ghammer@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1394963829-5384-1-git-send-email-ghammer@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 58105
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH] char: restore read callback on a reattached (hotplug) chardev
|
|
|
9ae3a8 |
Bugzilla: 1038914
|
|
|
9ae3a8 |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amos Kong <akong@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1027181
|
|
|
9ae3a8 |
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7207613
|
|
|
9ae3a8 |
Upstream: commit ac1b84dd1e020648db82a99260891aa982d1142c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Fix a bug that was introduced in commit 386a5a1e. A removal of a device
|
|
|
9ae3a8 |
set the chr handlers to NULL. However when the device is plugged back,
|
|
|
9ae3a8 |
its read callback is not restored so data can't be transferred from the
|
|
|
9ae3a8 |
host to the guest (e.g. via the virtio-serial port).
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1027181
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Gal Hammer <ghammer@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-char.c | 17 +++++++++++++++--
|
|
|
9ae3a8 |
1 file changed, 15 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-char.c | 17 +++++++++++++++--
|
|
|
9ae3a8 |
1 files changed, 15 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/qemu-char.c b/qemu-char.c
|
|
|
9ae3a8 |
index 983f686..930f3d4 100644
|
|
|
9ae3a8 |
--- a/qemu-char.c
|
|
|
9ae3a8 |
+++ b/qemu-char.c
|
|
|
9ae3a8 |
@@ -215,7 +215,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
|
|
|
9ae3a8 |
s->chr_read = fd_read;
|
|
|
9ae3a8 |
s->chr_event = fd_event;
|
|
|
9ae3a8 |
s->handler_opaque = opaque;
|
|
|
9ae3a8 |
- if (s->chr_update_read_handler)
|
|
|
9ae3a8 |
+ if (fe_open && s->chr_update_read_handler)
|
|
|
9ae3a8 |
s->chr_update_read_handler(s);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (!s->explicit_fe_open) {
|
|
|
9ae3a8 |
@@ -1140,13 +1140,14 @@ static void pty_chr_state(CharDriverState *chr, int connected)
|
|
|
9ae3a8 |
if (!s->connected) {
|
|
|
9ae3a8 |
s->connected = 1;
|
|
|
9ae3a8 |
qemu_chr_be_generic_open(chr);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ if (!chr->fd_in_tag) {
|
|
|
9ae3a8 |
chr->fd_in_tag = io_add_watch_poll(s->fd, pty_chr_read_poll,
|
|
|
9ae3a8 |
pty_chr_read, chr);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
static void pty_chr_close(struct CharDriverState *chr)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
PtyCharDriver *s = chr->opaque;
|
|
|
9ae3a8 |
@@ -2514,6 +2515,17 @@ static void tcp_chr_connect(void *opaque)
|
|
|
9ae3a8 |
qemu_chr_be_generic_open(chr);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static void tcp_chr_update_read_handler(CharDriverState *chr)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ TCPCharDriver *s = chr->opaque;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ remove_fd_in_watch(chr);
|
|
|
9ae3a8 |
+ if (s->chan) {
|
|
|
9ae3a8 |
+ chr->fd_in_tag = io_add_watch_poll(s->chan, tcp_chr_read_poll,
|
|
|
9ae3a8 |
+ tcp_chr_read, chr);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
#define IACSET(x,a,b,c) x[0] = a; x[1] = b; x[2] = c;
|
|
|
9ae3a8 |
static void tcp_chr_telnet_init(int fd)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -2669,6 +2681,7 @@ static CharDriverState *qemu_chr_open_socket_fd(int fd, bool do_nodelay,
|
|
|
9ae3a8 |
chr->get_msgfd = tcp_get_msgfd;
|
|
|
9ae3a8 |
chr->chr_add_client = tcp_chr_add_client;
|
|
|
9ae3a8 |
chr->chr_add_watch = tcp_chr_add_watch;
|
|
|
9ae3a8 |
+ chr->chr_update_read_handler = tcp_chr_update_read_handler;
|
|
|
9ae3a8 |
/* be isn't opened until we get a connection */
|
|
|
9ae3a8 |
chr->explicit_be_open = true;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|