render / rpms / qemu

Forked from rpms/qemu 5 months ago
Clone

Blame 0414-hw-virtio-serial-bus-replay-guest-open-on-destinatio.patch

Alon Levy cc85c4
From 5b6831175b21aa5a3405a21dd79e1ef0a81bbdb3 Mon Sep 17 00:00:00 2001
Alon Levy cc85c4
From: Alon Levy <alevy@redhat.com>
Alon Levy cc85c4
Date: Fri, 16 Nov 2012 16:24:47 +0200
Alon Levy cc85c4
Subject: [PATCH 2/2] hw/virtio-serial-bus: replay guest open on destination
Alon Levy cc85c4
Alon Levy cc85c4
This is rewrite of a patch carried in Fedora previously based
Alon Levy cc85c4
on new code upstream, here is the original message, it still applies:
Alon Levy cc85c4
(the original fedora patch was commit id
Alon Levy cc85c4
a9bc20afc1f0604ee81c23b7c67d627e51d2e8d4, this is useful for grepping in
Alon Levy cc85c4
logs, it isn't in upstream)
Alon Levy cc85c4
Alon Levy cc85c4
When migrating a host with with a spice agent running the mouse becomes
Alon Levy cc85c4
non operational after the migration. This is rhbz #725965.
Alon Levy cc85c4
Alon Levy cc85c4
The problem is that after migration spice doesn't know the guest agent
Alon Levy cc85c4
is open.  Spice is just a char dev here. And a chardev cannot query it's
Alon Levy cc85c4
device, the device has to let the chardev know when it is open. Right
Alon Levy cc85c4
now after migration the chardev which is recreated is in it's default
Alon Levy cc85c4
state, which assumes the guest is disconnected.
Alon Levy cc85c4
Alon Levy cc85c4
Char devices carry no information across migration, but the
Alon Levy cc85c4
virtio-serial does already carry the guest_connected state. This patch
Alon Levy cc85c4
passes that bit to the chardev.
Alon Levy cc85c4
---
Alon Levy cc85c4
 hw/virtio-serial-bus.c | 6 ++++++
Alon Levy cc85c4
 1 file changed, 6 insertions(+)
Alon Levy cc85c4
Alon Levy cc85c4
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
Alon Levy cc85c4
index a028877..a6ec2df 100644
Alon Levy cc85c4
--- a/hw/virtio-serial-bus.c
Alon Levy cc85c4
+++ b/hw/virtio-serial-bus.c
Alon Levy cc85c4
@@ -641,6 +641,7 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
Alon Levy cc85c4
     VirtIOSerial *s = opaque;
Alon Levy cc85c4
     VirtIOSerialPort *port;
Alon Levy cc85c4
     uint8_t host_connected;
Alon Levy cc85c4
+    VirtIOSerialPortClass *vsc;
Alon Levy cc85c4
 
Alon Levy cc85c4
     for (i = 0 ; i < s->post_load.nr_active_ports; ++i) {
Alon Levy cc85c4
         port = s->post_load.connected[i].port;
Alon Levy cc85c4
@@ -653,6 +654,11 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
Alon Levy cc85c4
             send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN,
Alon Levy cc85c4
                                port->host_connected);
Alon Levy cc85c4
         }
Alon Levy cc85c4
+        vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
Alon Levy cc85c4
+        if (port->guest_connected && vsc->guest_open) {
Alon Levy cc85c4
+            /* replay guest open */
Alon Levy cc85c4
+            vsc->guest_open(port);
Alon Levy cc85c4
+        }
Alon Levy cc85c4
     }
Alon Levy cc85c4
     g_free(s->post_load.connected);
Alon Levy cc85c4
     s->post_load.connected = NULL;
Alon Levy cc85c4
-- 
Alon Levy cc85c4
1.8.0
Alon Levy cc85c4