render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

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

Hans de Goede 329b58
From be9fad02180478f6c9435257e6a7c29b9e4c9841 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
Hans de Goede 329b58
Subject: [PATCH 112/114] 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 ++++++
Hans de Goede 329b58
 1 file changed, 6 insertions(+)
Justin M. Forbes d4cdad
Justin M. Forbes d4cdad
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
Hans de Goede 329b58
index 72287d1..7ea5bbf 100644
Justin M. Forbes d4cdad
--- a/hw/virtio-serial-bus.c
Justin M. Forbes d4cdad
+++ b/hw/virtio-serial-bus.c
Hans de Goede 329b58
@@ -682,6 +682,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;
Hans de Goede 329b58
+        VirtIOSerialPortClass *vsc;
Hans de Goede 329b58
 
Justin M. Forbes d4cdad
         id = qemu_get_be32(f);
Justin M. Forbes d4cdad
         port = find_port_by_id(s, id);
Hans de Goede 329b58
@@ -690,6 +691,11 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
Justin M. Forbes d4cdad
         }
Hans de Goede 329b58
 
Justin M. Forbes d4cdad
         port->guest_connected = qemu_get_byte(f);
Hans de Goede 329b58
+        vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
Hans de Goede 329b58
+        if (port->guest_connected && vsc->guest_open) {
Justin M. Forbes d4cdad
+            /* replay guest open */
Hans de Goede 329b58
+            vsc->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
-- 
Hans de Goede 329b58
1.7.10.4
Justin M. Forbes d4cdad