dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0117-virtio-serial-bus-replay-guest_open-on-migration.patch

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