diff options
authorAmit Shah <>2012-04-25 14:40:39 +0530
committerMichael S. Tsirkin <>2012-05-17 12:14:33 +0300
commitfa8b66ccd2d200b64496cfedcce90bf54fe7d6e9 (patch)
parent0e93b4b304ae052ba1bc73f6d34a68556fe93429 (diff)
virtio: console: tell host of open ports after resume from s3/s4
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). CC: # Only for 3.3 Signed-off-by: Amit Shah <> Signed-off-by: Michael S. Tsirkin <>
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index ddf86b6500b7..cdf2f5451c76 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1895,6 +1895,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;