Skip to content

Commit a9518f4

Browse files
njavaligregkh
authored andcommitted
scsi: qedi: Fix firmware halt over suspend and resume
commit 1516ee0 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: 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fb00449 commit a9518f4

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
{
@@ -2510,6 +2511,22 @@ static void qedi_shutdown(struct pci_dev *pdev)
25102511
__qedi_remove(pdev, QEDI_MODE_SHUTDOWN);
25112512
}
25122513

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

28732891
static int __init qedi_init(void)

0 commit comments

Comments
 (0)