Commit 64355b92 authored by Brian King's avatar Brian King Committed by James Bottomley

[SCSI] ibmvscsi: Add suspend/resume support

Adds support for resuming from suspend for IBM VSCSI devices. We may have
lost an interrupt over the suspend, so we just kick the interrupt handler
to process anything that is outstanding. We expect to find a transport event
indicating we need to reestablish our CRQ.
Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent c03af1ae
......@@ -71,6 +71,7 @@
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/pm.h>
#include <asm/firmware.h>
#include <asm/vio.h>
#include <scsi/scsi.h>
......@@ -1990,6 +1991,19 @@ static int ibmvscsi_remove(struct vio_dev *vdev)
return 0;
}
/**
* ibmvscsi_resume: Resume from suspend
* @dev: device struct
*
* We may have lost an interrupt across suspend/resume, so kick the
* interrupt handler
*/
static int ibmvscsi_resume(struct device *dev)
{
struct ibmvscsi_host_data *hostdata = dev_get_drvdata(dev);
return ibmvscsi_ops->resume(hostdata);
}
/**
* ibmvscsi_device_table: Used by vio.c to match devices in the device tree we
* support.
......@@ -2000,6 +2014,10 @@ static struct vio_device_id ibmvscsi_device_table[] __devinitdata = {
};
MODULE_DEVICE_TABLE(vio, ibmvscsi_device_table);
static struct dev_pm_ops ibmvscsi_pm_ops = {
.resume = ibmvscsi_resume
};
static struct vio_driver ibmvscsi_driver = {
.id_table = ibmvscsi_device_table,
.probe = ibmvscsi_probe,
......@@ -2008,6 +2026,7 @@ static struct vio_driver ibmvscsi_driver = {
.driver = {
.name = "ibmvscsi",
.owner = THIS_MODULE,
.pm = &ibmvscsi_pm_ops,
}
};
......
......@@ -120,6 +120,7 @@ struct ibmvscsi_ops {
struct ibmvscsi_host_data *hostdata);
int (*send_crq)(struct ibmvscsi_host_data *hostdata,
u64 word1, u64 word2);
int (*resume) (struct ibmvscsi_host_data *hostdata);
};
extern struct ibmvscsi_ops iseriesvscsi_ops;
......
......@@ -158,10 +158,16 @@ static int iseriesvscsi_send_crq(struct ibmvscsi_host_data *hostdata,
0);
}
static int iseriesvscsi_resume(struct ibmvscsi_host_data *hostdata)
{
return 0;
}
struct ibmvscsi_ops iseriesvscsi_ops = {
.init_crq_queue = iseriesvscsi_init_crq_queue,
.release_crq_queue = iseriesvscsi_release_crq_queue,
.reset_crq_queue = iseriesvscsi_reset_crq_queue,
.reenable_crq_queue = iseriesvscsi_reenable_crq_queue,
.send_crq = iseriesvscsi_send_crq,
.resume = iseriesvscsi_resume,
};
......@@ -334,10 +334,23 @@ static int rpavscsi_reenable_crq_queue(struct crq_queue *queue,
return rc;
}
/**
* rpavscsi_resume: - resume after suspend
* @hostdata: ibmvscsi_host_data of host
*
*/
static int rpavscsi_resume(struct ibmvscsi_host_data *hostdata)
{
vio_disable_interrupts(to_vio_dev(hostdata->dev));
tasklet_schedule(&hostdata->srp_task);
return 0;
}
struct ibmvscsi_ops rpavscsi_ops = {
.init_crq_queue = rpavscsi_init_crq_queue,
.release_crq_queue = rpavscsi_release_crq_queue,
.reset_crq_queue = rpavscsi_reset_crq_queue,
.reenable_crq_queue = rpavscsi_reenable_crq_queue,
.send_crq = rpavscsi_send_crq,
.resume = rpavscsi_resume,
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment