diff mbox

scsi: smartpqi: put controller in SIS mode at shutdown

Message ID 20171120182505.12947-1-v.minet@criteo.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Vincent Minet Nov. 20, 2017, 6:25 p.m. UTC
Since commit 162d7753fce9 ("scsi: smartpqi: ensure controller is in SIS
mode at init"), the driver is able to work even if the controller is in
PQI mode at startup. This made it possible to keep using the controller
across a kexec.

But kernels built before that patch still expect the controller to be in
SIS mode at startup. They will fail when kexec'd. To handle that case,
this patch reverts the controller to SIS mode during the ->shutdown()
callback.

Signed-off-by: Vincent Minet <v.minet@criteo.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index b2880c7709e6..5e898dd9ae2b 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -6699,7 +6699,12 @@  static void pqi_shutdown(struct pci_dev *pci_dev)
 	 * storage.
 	 */
 	rc = pqi_flush_cache(ctrl_info, SHUTDOWN);
-	pqi_reset(ctrl_info);
+
+	if (ctrl_info->pqi_mode_enabled)
+		pqi_revert_to_sis_mode(ctrl_info);
+	else
+		pqi_reset(ctrl_info);
+
 	if (rc == 0)
 		return;