]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
virtio: console: tell host of open ports after resume from s3/s4
authorAmit Shah <amit.shah@redhat.com>
Wed, 25 Apr 2012 09:10:39 +0000 (14:40 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 May 2012 17:46:21 +0000 (10:46 -0700)
commit fa8b66ccd2d200b64496cfedcce90bf54fe7d6e9 upstream.

If a port was open before going into one of the sleep states, the port
can continue normal operation after restore.  However, the host has to
be told that the guest side of the connection is open to restore
pre-suspend state.

This wasn't noticed so far due to a bug in qemu that was fixed recently
(which marked the guest-side connection as always open).

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/virtio_console.c

index b58b5618706588936ebcf7a028bde7dba8f616c1..41fc148d2e2ce81590fa66859fee37bda2f3fe33 100644 (file)
@@ -1901,6 +1901,13 @@ static int virtcons_restore(struct virtio_device *vdev)
 
                /* Get port open/close status on the host */
                send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
+
+               /*
+                * If a port was open at the time of suspending, we
+                * have to let the host know that it's still open.
+                */
+               if (port->guest_connected)
+                       send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
        }
        return 0;
 }