virtio: console: Add freeze and restore handlers to support S4
authorAmit Shah <amit.shah@redhat.com>
Thu, 22 Dec 2011 11:28:28 +0000 (16:28 +0530)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 12 Jan 2012 05:14:45 +0000 (15:14 +1030)
commit2b8f41d846990c3c1c8addbaed2cf53c3ef91d25
treea3dbf456eb359650db0487d66d3594f1fa7be6c0
parenta0e2dbfc223028b72a1c193f94fcd3f67253ba4a
virtio: console: Add freeze and restore handlers to support S4

Remove all vqs and associated buffers in the freeze callback which
prepares us to go into hibernation state.  On restore, re-create all the
vqs and populate the input vqs with buffers to get to the pre-hibernate
state.

Note: Any outstanding unconsumed buffers are discarded; which means
there's a possibility of data loss in case the host or the guest didn't
consume any data already present in the vqs.  This can be addressed in a
later patch series, perhaps in virtio common code.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/char/virtio_console.c