Skip to content

Commit 38b0020

Browse files
njavaligregkh
authored andcommitted
scsi: qedf: Fix firmware halt over suspend and resume
commit ef222f5 upstream. 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 <skashyap@marvell.com> Signed-off-by: Nilesh Javali <njavali@marvell.com> Link: https://lore.kernel.org/r/20230807093725.46829-1-njavali@marvell.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a9518f4 commit 38b0020

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.
@@ -3276,6 +3277,7 @@ static struct pci_driver qedf_pci_driver = {
32763277
.probe = qedf_probe,
32773278
.remove = qedf_remove,
32783279
.shutdown = qedf_shutdown,
3280+
.suspend = qedf_suspend,
32793281
};
32803282

32813283
static int __qedf_probe(struct pci_dev *pdev, int mode)
@@ -4005,6 +4007,22 @@ static void qedf_shutdown(struct pci_dev *pdev)
40054007
__qedf_remove(pdev, QEDF_MODE_NORMAL);
40064008
}
40074009

4010+
static int qedf_suspend(struct pci_dev *pdev, pm_message_t state)
4011+
{
4012+
struct qedf_ctx *qedf;
4013+
4014+
if (!pdev) {
4015+
QEDF_ERR(NULL, "pdev is NULL.\n");
4016+
return -ENODEV;
4017+
}
4018+
4019+
qedf = pci_get_drvdata(pdev);
4020+
4021+
QEDF_ERR(&qedf->dbg_ctx, "%s: Device does not support suspend operation\n", __func__);
4022+
4023+
return -EPERM;
4024+
}
4025+
40084026
/*
40094027
* Recovery handler code
40104028
*/

0 commit comments

Comments
 (0)