From: Amit Shah <amit.shah@redhat.com>
To: Virtualization List <virtualization@lists.linux-foundation.org>
Cc: Amit Shah <amit.shah@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [RFC PATCH 7/8] virtio: block: Add freeze, restore handlers to support S4
Date: Thu, 28 Jul 2011 20:05:12 +0530 [thread overview]
Message-ID: <0a018de7cac2a27bf28287da64850729ec62e1e5.1311863438.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1311863438.git.amit.shah@redhat.com>
In-Reply-To: <cover.1311863438.git.amit.shah@redhat.com>
Delete the vq on the freeze callback to prepare for hibernation.
Re-create the vq in the restore callback to resume normal function.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
drivers/block/virtio_blk.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 079c088..700ad76 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -540,6 +540,26 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
kfree(vblk);
}
+#ifdef CONFIG_PM
+static int virtblk_freeze(struct virtio_device *vdev)
+{
+ vdev->config->del_vqs(vdev);
+ return 0;
+}
+
+static int virtblk_restore(struct virtio_device *vdev)
+{
+ struct virtio_blk *vblk = vdev->priv;
+ int err = 0;
+
+ vblk->vq = virtio_find_single_vq(vdev, blk_done, "requests");
+ if (IS_ERR(vblk->vq))
+ err = PTR_ERR(vblk->vq);
+
+ return err;
+}
+#endif
+
static const struct virtio_device_id id_table[] = {
{ VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID },
{ 0 },
@@ -565,6 +585,10 @@ static struct virtio_driver __refdata virtio_blk = {
.probe = virtblk_probe,
.remove = __devexit_p(virtblk_remove),
.config_changed = virtblk_config_changed,
+#ifdef CONFIG_PM
+ .freeze = virtblk_freeze,
+ .restore = virtblk_restore,
+#endif
};
static int __init init(void)
--
1.7.6
next prev parent reply other threads:[~2011-07-28 14:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-28 14:35 [RFC PATCH 0/8] virtio: Support for hibernation (S4) Amit Shah
2011-07-28 14:35 ` [RFC PATCH 1/8] virtio: pci: switch to new PM API Amit Shah
2011-07-28 14:35 ` [RFC PATCH 2/8] virtio-pci: add PM notification handlers for restore, freeze, thaw, poweroff Amit Shah
2011-07-28 14:35 ` [RFC PATCH 3/8] virtio-pci: save/restore config space across S4 Amit Shah
2011-07-29 4:07 ` Michael S. Tsirkin
2011-07-29 4:20 ` Amit Shah
2011-07-28 14:35 ` [RFC PATCH 4/8] virtio: console: Ignore port name update request if name already set Amit Shah
2011-07-29 4:19 ` Michael S. Tsirkin
2011-07-29 4:26 ` Amit Shah
2011-07-29 4:27 ` Michael S. Tsirkin
2011-07-28 14:35 ` [RFC PATCH 5/8] virtio: console: Use wait_event_freezable instead of _interruptible Amit Shah
2011-07-28 14:35 ` [RFC PATCH 6/8] virtio: console: Add freeze and restore handlers to support S4 Amit Shah
2011-07-28 14:35 ` Amit Shah [this message]
2011-07-28 14:35 ` [RFC PATCH 8/8] virtio: net: Add freeze, " Amit Shah
2011-07-29 4:13 ` Michael S. Tsirkin
2011-07-29 4:28 ` Amit Shah
2011-07-29 4:31 ` Michael S. Tsirkin
2011-07-29 5:08 ` Amit Shah
2011-08-10 10:53 ` [RFC PATCH 0/8] virtio: Support for hibernation (S4) Amit Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a018de7cac2a27bf28287da64850729ec62e1e5.1311863438.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.