Skip to content

Commit ef222f5

Browse files
njavalimartinkpetersen
authored andcommitted
scsi: qedf: Fix firmware halt over suspend and resume
While performing certain power-off sequences, PCI drivers are called to suspend and resume their underlying devices through PCI PM (power management) interface. However the hardware does not support PCI PM suspend/resume operations so system wide suspend/resume leads to bad MFW (management firmware) state which causes various follow-up errors in driver when communicating with the device/firmware. To fix this driver implements PCI PM suspend handler to indicate unsupported operation to the PCI subsystem explicitly, thus avoiding system to go into suspended/standby mode. Fixes: 61d8658 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.") Signed-off-by: Saurav Kashyap <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 1516ee0 commit ef222f5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/scsi/qedf/qedf_main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static void qedf_remove(struct pci_dev *pdev);
3131
static void qedf_shutdown(struct pci_dev *pdev);
3232
static void qedf_schedule_recovery_handler(void *dev);
3333
static void qedf_recovery_handler(struct work_struct *work);
34+
static int qedf_suspend(struct pci_dev *pdev, pm_message_t state);
3435

3536
/*
3637
* Driver module parameters.
@@ -3271,6 +3272,7 @@ static struct pci_driver qedf_pci_driver = {
32713272
.probe = qedf_probe,
32723273
.remove = qedf_remove,
32733274
.shutdown = qedf_shutdown,
3275+
.suspend = qedf_suspend,
32743276
};
32753277

32763278
static int __qedf_probe(struct pci_dev *pdev, int mode)
@@ -4000,6 +4002,22 @@ static void qedf_shutdown(struct pci_dev *pdev)
40004002
__qedf_remove(pdev, QEDF_MODE_NORMAL);
40014003
}
40024004

4005+
static int qedf_suspend(struct pci_dev *pdev, pm_message_t state)
4006+
{
4007+
struct qedf_ctx *qedf;
4008+
4009+
if (!pdev) {
4010+
QEDF_ERR(NULL, "pdev is NULL.\n");
4011+
return -ENODEV;
4012+
}
4013+
4014+
qedf = pci_get_drvdata(pdev);
4015+
4016+
QEDF_ERR(&qedf->dbg_ctx, "%s: Device does not support suspend operation\n", __func__);
4017+
4018+
return -EPERM;
4019+
}
4020+
40034021
/*
40044022
* Recovery handler code
40054023
*/

0 commit comments

Comments
 (0)