[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1328440562-19425-4-git-send-email-pbonzini@redhat.com>
Date: Sun, 5 Feb 2012 12:16:02 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Stefan Hajnoczi <stefanha@...ux.vnet.ibm.com>,
Mike Christie <michaelc@...wisc.edu>,
Pekka Enberg <penberg@...nel.org>,
linux-scsi <linux-scsi@...r.kernel.org>,
Rusty Russell <rusty@...tcorp.com.au>,
"Michael S. Tsirkin" <mst@...hat.com>, kvm@...r.kernel.org
Subject: [PATCH v5 3/3] virtio-scsi: add power management support
This patch adds freeze/restore handlers for the HBA. Block queues
are managed independently by the disk devices.
Cc: linux-scsi <linux-scsi@...r.kernel.org>
Cc: Rusty Russell <rusty@...tcorp.com.au>
Cc: Michael S. Tsirkin <mst@...hat.com>
Cc: kvm@...r.kernel.org
Acked-by: Pekka Enberg <penberg@...nel.org>
Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
---
The feature has been merged in the virtio core for 3.3, so the patch
is new in v4.
drivers/scsi/virtio_scsi.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 68104cd..efccd72 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -406,8 +406,8 @@ static struct scsi_host_template virtscsi_host_template = {
&__val, sizeof(__val)); \
})
-static int __devinit virtscsi_init(struct virtio_device *vdev,
- struct virtio_scsi *vscsi)
+static int virtscsi_init(struct virtio_device *vdev,
+ struct virtio_scsi *vscsi)
{
int err;
struct virtqueue *vqs[3];
@@ -491,7 +491,7 @@ virtscsi_init_failed:
return err;
}
-static void __devexit virtscsi_remove_vqs(struct virtio_device *vdev)
+static void virtscsi_remove_vqs(struct virtio_device *vdev)
{
/* Stop all the virtqueues. */
vdev->config->reset(vdev);
@@ -509,6 +509,22 @@ static void __devexit virtscsi_remove(struct virtio_device *vdev)
scsi_host_put(shost);
}
+#ifdef CONFIG_PM
+static int virtscsi_freeze(struct virtio_device *vdev)
+{
+ virtscsi_remove_vqs(vdev);
+ return 0;
+}
+
+static int virtscsi_restore(struct virtio_device *vdev)
+{
+ struct Scsi_Host *sh = virtio_scsi_host(vdev);
+ struct virtio_scsi *vscsi = shost_priv(sh);
+
+ return virtscsi_init(vdev, vscsi);
+}
+#endif
+
static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_SCSI, VIRTIO_DEV_ANY_ID },
{ 0 },
@@ -519,6 +535,10 @@ static struct virtio_driver virtio_scsi_driver = {
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtscsi_probe,
+#ifdef CONFIG_PM
+ .freeze = virtscsi_freeze,
+ .restore = virtscsi_restore,
+#endif
.remove = __devexit_p(virtscsi_remove),
};
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists