summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/smartpqi
diff options
context:
space:
mode:
authorSagar Biradar <sagar.biradar@microchip.com>2022-02-01 15:48:33 -0600
committerMartin K. Petersen <martin.petersen@oracle.com>2022-02-07 23:38:35 -0500
commitb73357a1fd39cec82b654421110e35e8167930d5 (patch)
tree4ac36a5a5bb791e1548232a80959030a8476f7c7 /drivers/scsi/smartpqi
parent42dc0426fbbbe380c83976e7601f23de0034249d (diff)
downloadlinux-stable-b73357a1fd39cec82b654421110e35e8167930d5.tar.gz
linux-stable-b73357a1fd39cec82b654421110e35e8167930d5.tar.bz2
linux-stable-b73357a1fd39cec82b654421110e35e8167930d5.zip
scsi: smartpqi: Avoid drive spin-down during suspend
On certain systems (based on PCI IDs), when the OS transitions the system into the suspend (S3) state, the BMIC flush cache command will indicate a system RESTART instead of SUSPEND. This avoids drive spin-down. Link: https://lore.kernel.org/r/164375211330.440833.7203813692110347698.stgit@brunhilda.pdev.net Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com> Reviewed-by: Scott Benesh <scott.benesh@microchip.com> Reviewed-by: Scott Teel <scott.teel@microchip.com> Signed-off-by: Sagar Biradar <sagar.biradar@microchip.com> Signed-off-by: Don Brace <don.brace@microchip.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/smartpqi')
-rw-r--r--drivers/scsi/smartpqi/smartpqi_init.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b32a5a5a5c21..ab12507da436 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -8976,10 +8976,19 @@ static void pqi_process_module_params(void)
pqi_process_lockup_action_param();
}
+static inline enum bmic_flush_cache_shutdown_event pqi_get_flush_cache_shutdown_event(struct pci_dev *pci_dev)
+{
+ if (pci_dev->subsystem_vendor == PCI_VENDOR_ID_ADAPTEC2 && pci_dev->subsystem_device == 0x1304)
+ return RESTART;
+ return SUSPEND;
+}
+
static __maybe_unused int pqi_suspend(struct pci_dev *pci_dev, pm_message_t state)
{
struct pqi_ctrl_info *ctrl_info;
+ enum bmic_flush_cache_shutdown_event shutdown_event;
+ shutdown_event = pqi_get_flush_cache_shutdown_event(pci_dev);
ctrl_info = pci_get_drvdata(pci_dev);
pqi_wait_until_ofa_finished(ctrl_info);
@@ -8989,7 +8998,7 @@ static __maybe_unused int pqi_suspend(struct pci_dev *pci_dev, pm_message_t stat
pqi_ctrl_block_device_reset(ctrl_info);
pqi_ctrl_block_requests(ctrl_info);
pqi_ctrl_wait_until_quiesced(ctrl_info);
- pqi_flush_cache(ctrl_info, SUSPEND);
+ pqi_flush_cache(ctrl_info, shutdown_event);
pqi_stop_heartbeat_timer(ctrl_info);
pqi_crash_if_pending_command(ctrl_info);