d4cdad5
From 8e92fe9feebc319c019feb8c28941e322524932f Mon Sep 17 00:00:00 2001
d4cdad5
From: Alon Levy <alevy@redhat.com>
d4cdad5
Date: Thu, 28 Jul 2011 15:08:48 +0300
d4cdad5
Subject: [PATCH 117/118] virtio-serial-bus: replay guest_open on migration
d4cdad5
d4cdad5
When migrating a host with with a spice agent running the mouse becomes
d4cdad5
non operational after the migration. This is rhbz #725965.
d4cdad5
d4cdad5
The problem is that after migration spice doesn't know the guest agent is open.
d4cdad5
Spice is just a char dev here. And a chardev cannot query it's device, the
d4cdad5
device has to let the chardev know when it is open. Right now after migration
d4cdad5
the chardev which is recreated is in it's default state, which assumes the
d4cdad5
guest is disconnected.
d4cdad5
d4cdad5
Char devices carry no information across migration, but the virtio-serial does
d4cdad5
already carry the guest_connected state. This patch passes that bit to the
d4cdad5
chardev.
d4cdad5
d4cdad5
Signed-off-by: Alon Levy <alevy@redhat.com>
d4cdad5
---
d4cdad5
 hw/virtio-serial-bus.c |    6 ++++++
d4cdad5
 1 files changed, 6 insertions(+), 0 deletions(-)
d4cdad5
d4cdad5
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
d4cdad5
index a4825b9..e5f343f 100644
d4cdad5
--- a/hw/virtio-serial-bus.c
d4cdad5
+++ b/hw/virtio-serial-bus.c
d4cdad5
@@ -618,6 +618,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
d4cdad5
     for (i = 0; i < nr_active_ports; i++) {
d4cdad5
         uint32_t id;
d4cdad5
         bool host_connected;
d4cdad5
+        VirtIOSerialPortInfo *info;
d4cdad5
d4cdad5
         id = qemu_get_be32(f);
d4cdad5
         port = find_port_by_id(s, id);
d4cdad5
@@ -626,6 +627,11 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
d4cdad5
         }
d4cdad5
d4cdad5
         port->guest_connected = qemu_get_byte(f);
d4cdad5
+        info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info);
d4cdad5
+        if (port->guest_connected && info->guest_open) {
d4cdad5
+            /* replay guest open */
d4cdad5
+            info->guest_open(port);
d4cdad5
+        }
d4cdad5
         host_connected = qemu_get_byte(f);
d4cdad5
         if (host_connected != port->host_connected) {
d4cdad5
             /*
d4cdad5
-- 
d4cdad5
1.7.7.5
d4cdad5