Skip to content

Commit 1516ee0

Browse files
njavalimartinkpetersen
authored andcommitted
scsi: qedi: 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: ace7f46 ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") Signed-off-by: Nilesh Javali <njavali@marvell.com> Link: https://lore.kernel.org/r/20230807093725.46829-2-njavali@marvell.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent dd64f80 commit 1516ee0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/scsi/qedi/qedi_main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static struct nvm_iscsi_block *qedi_get_nvram_block(struct qedi_ctx *qedi);
6969
static void qedi_recovery_handler(struct work_struct *work);
7070
static void qedi_schedule_hw_err_handler(void *dev,
7171
enum qed_hw_err_type err_type);
72+
static int qedi_suspend(struct pci_dev *pdev, pm_message_t state);
7273

7374
static int qedi_iscsi_event_cb(void *context, u8 fw_event_code, void *fw_handle)
7475
{
@@ -2511,6 +2512,22 @@ static void qedi_shutdown(struct pci_dev *pdev)
25112512
__qedi_remove(pdev, QEDI_MODE_SHUTDOWN);
25122513
}
25132514

2515+
static int qedi_suspend(struct pci_dev *pdev, pm_message_t state)
2516+
{
2517+
struct qedi_ctx *qedi;
2518+
2519+
if (!pdev) {
2520+
QEDI_ERR(NULL, "pdev is NULL.\n");
2521+
return -ENODEV;
2522+
}
2523+
2524+
qedi = pci_get_drvdata(pdev);
2525+
2526+
QEDI_ERR(&qedi->dbg_ctx, "%s: Device does not support suspend operation\n", __func__);
2527+
2528+
return -EPERM;
2529+
}
2530+
25142531
static int __qedi_probe(struct pci_dev *pdev, int mode)
25152532
{
25162533
struct qedi_ctx *qedi;
@@ -2869,6 +2886,7 @@ static struct pci_driver qedi_pci_driver = {
28692886
.remove = qedi_remove,
28702887
.shutdown = qedi_shutdown,
28712888
.err_handler = &qedi_err_handler,
2889+
.suspend = qedi_suspend,
28722890
};
28732891

28742892
static int __init qedi_init(void)

0 commit comments

Comments
 (0)