linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mpt3sas: Move IOC state to Ready state during shutdown
@ 2021-07-05 14:59 Sreekanth Reddy
  2021-07-05 14:59 ` [PATCH] mpt3sas: Bump driver version to 38.100.00.00 Sreekanth Reddy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sreekanth Reddy @ 2021-07-05 14:59 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: thenzl, Sreekanth Reddy

[-- Attachment #1: Type: text/plain, Size: 4834 bytes --]

During shutdown just move the IOC state to Ready state
by issuing MUR. No need to free any IOC memory pools.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  | 32 ++++++++++++++--------------
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  4 ++++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  7 +++++-
 3 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index c39955239d1c..19b1c0cf5f2a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2983,13 +2983,13 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
 }
 
 /**
- * _base_free_irq - free irq
+ * mpt3sas_base_free_irq - free irq
  * @ioc: per adapter object
  *
  * Freeing respective reply_queue from the list.
  */
-static void
-_base_free_irq(struct MPT3SAS_ADAPTER *ioc)
+void
+mpt3sas_base_free_irq(struct MPT3SAS_ADAPTER *ioc)
 {
 	struct adapter_reply_queue *reply_q, *next;
 
@@ -3191,12 +3191,12 @@ _base_check_and_enable_high_iops_queues(struct MPT3SAS_ADAPTER *ioc,
 }
 
 /**
- * _base_disable_msix - disables msix
+ * mpt3sas_base_disable_msix - disables msix
  * @ioc: per adapter object
  *
  */
-static void
-_base_disable_msix(struct MPT3SAS_ADAPTER *ioc)
+void
+mpt3sas_base_disable_msix(struct MPT3SAS_ADAPTER *ioc)
 {
 	if (!ioc->msix_enable)
 		return;
@@ -3304,8 +3304,8 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
 	for (i = 0; i < ioc->reply_queue_count; i++) {
 		r = _base_request_irq(ioc, i);
 		if (r) {
-			_base_free_irq(ioc);
-			_base_disable_msix(ioc);
+			mpt3sas_base_free_irq(ioc);
+			mpt3sas_base_disable_msix(ioc);
 			goto try_ioapic;
 		}
 	}
@@ -3342,8 +3342,8 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc)
 
 	dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
 
-	_base_free_irq(ioc);
-	_base_disable_msix(ioc);
+	mpt3sas_base_free_irq(ioc);
+	mpt3sas_base_disable_msix(ioc);
 
 	kfree(ioc->replyPostRegisterIndex);
 	ioc->replyPostRegisterIndex = NULL;
@@ -7613,14 +7613,14 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
 }
 
 /**
- * _base_make_ioc_ready - put controller in READY state
+ * mpt3sas_base_make_ioc_ready - put controller in READY state
  * @ioc: per adapter object
  * @type: FORCE_BIG_HAMMER or SOFT_RESET
  *
  * Return: 0 for success, non-zero for failure.
  */
-static int
-_base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type)
+int
+mpt3sas_base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type)
 {
 	u32 ioc_state;
 	int rc;
@@ -7897,7 +7897,7 @@ mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
 	if (ioc->chip_phys && ioc->chip) {
 		mpt3sas_base_mask_interrupts(ioc);
 		ioc->shost_recovery = 1;
-		_base_make_ioc_ready(ioc, SOFT_RESET);
+		mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET);
 		ioc->shost_recovery = 0;
 	}
 
@@ -8017,7 +8017,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
 	ioc->build_sg_mpi = &_base_build_sg;
 	ioc->build_zero_len_sge_mpi = &_base_build_zero_len_sge;
 
-	r = _base_make_ioc_ready(ioc, SOFT_RESET);
+	r = mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET);
 	if (r)
 		goto out_free_resources;
 
@@ -8471,7 +8471,7 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
 	_base_pre_reset_handler(ioc);
 	mpt3sas_wait_for_commands_to_complete(ioc);
 	mpt3sas_base_mask_interrupts(ioc);
-	r = _base_make_ioc_ready(ioc, type);
+	r = mpt3sas_base_make_ioc_ready(ioc, type);
 	if (r)
 		goto out;
 	_base_clear_outstanding_commands(ioc);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index d4834c8ee9c0..0c6c3df0038d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1730,6 +1730,10 @@ do {	ioc_err(ioc, "In func: %s\n", __func__); \
 	status, mpi_request, sz); } while (0)
 
 int mpt3sas_wait_for_ioc(struct MPT3SAS_ADAPTER *ioc, int wait_count);
+int
+mpt3sas_base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type);
+void mpt3sas_base_free_irq(struct MPT3SAS_ADAPTER *ioc);
+void mpt3sas_base_disable_msix(struct MPT3SAS_ADAPTER *ioc);
 
 /* scsih shared API */
 struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc,
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 866d118f7931..8e64a6f14542 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -11295,7 +11295,12 @@ scsih_shutdown(struct pci_dev *pdev)
 
 	_scsih_ir_shutdown(ioc);
 	_scsih_nvme_shutdown(ioc);
-	mpt3sas_base_detach(ioc);
+	mpt3sas_base_mask_interrupts(ioc);
+	ioc->shost_recovery = 1;
+	mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET);
+	ioc->shost_recovery = 0;
+	mpt3sas_base_free_irq(ioc);
+	mpt3sas_base_disable_msix(ioc);
 }
 
 
-- 
2.27.0


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] mpt3sas: Bump driver version to 38.100.00.00
  2021-07-05 14:59 [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Sreekanth Reddy
@ 2021-07-05 14:59 ` Sreekanth Reddy
  2021-07-13  1:59 ` [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Martin K. Petersen
  2021-07-21  3:22 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Sreekanth Reddy @ 2021-07-05 14:59 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: thenzl, Sreekanth Reddy

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

Bump driver version to 38.100.00.00

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 0c6c3df0038d..ec0be3e80561 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -77,9 +77,9 @@
 #define MPT3SAS_DRIVER_NAME		"mpt3sas"
 #define MPT3SAS_AUTHOR "Avago Technologies <MPT-FusionLinux.pdl@avagotech.com>"
 #define MPT3SAS_DESCRIPTION	"LSI MPT Fusion SAS 3.0 Device Driver"
-#define MPT3SAS_DRIVER_VERSION		"37.101.00.00"
-#define MPT3SAS_MAJOR_VERSION		37
-#define MPT3SAS_MINOR_VERSION		101
+#define MPT3SAS_DRIVER_VERSION		"38.100.00.00"
+#define MPT3SAS_MAJOR_VERSION		38
+#define MPT3SAS_MINOR_VERSION		100
 #define MPT3SAS_BUILD_VERSION		0
 #define MPT3SAS_RELEASE_VERSION	00
 
-- 
2.27.0


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mpt3sas: Move IOC state to Ready state during shutdown
  2021-07-05 14:59 [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Sreekanth Reddy
  2021-07-05 14:59 ` [PATCH] mpt3sas: Bump driver version to 38.100.00.00 Sreekanth Reddy
@ 2021-07-13  1:59 ` Martin K. Petersen
  2021-07-13  8:46   ` Sreekanth Reddy
  2021-07-21  3:22 ` Martin K. Petersen
  2 siblings, 1 reply; 5+ messages in thread
From: Martin K. Petersen @ 2021-07-13  1:59 UTC (permalink / raw)
  To: Sreekanth Reddy; +Cc: linux-scsi, martin.petersen, thenzl


Hi Sreekanth!

> During shutdown just move the IOC state to Ready state by issuing MUR.

This patch needs a justification. Why is it preferable to move to Ready
state at shutdown?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mpt3sas: Move IOC state to Ready state during shutdown
  2021-07-13  1:59 ` [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Martin K. Petersen
@ 2021-07-13  8:46   ` Sreekanth Reddy
  0 siblings, 0 replies; 5+ messages in thread
From: Sreekanth Reddy @ 2021-07-13  8:46 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: linux-scsi, Tomas Henzl

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

On Tue, Jul 13, 2021 at 7:29 AM Martin K. Petersen
<martin.petersen@oracle.com> wrote:
>
>
> Hi Sreekanth!
>
> > During shutdown just move the IOC state to Ready state by issuing MUR.
>
> This patch needs a justification. Why is it preferable to move to Ready
> state at shutdown?

If the driver won't move the IOC state to Ready state then the IOC
firmware assumes that the host driver is alive and hence tries to post
the events (due to faulty expander phy links, etc) to the host memory
during system reboot time and it leads to 0x2666 (A bus fault occurred
on the host-to-IOC memory move) firmware fault. Hence the driver has
to make sure that it has to move IOC state to 'Ready state' from the
'operational state' by issuing the MUR.

Thanks,
Sreekanth

>
> --
> Martin K. Petersen      Oracle Linux Engineering

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mpt3sas: Move IOC state to Ready state during shutdown
  2021-07-05 14:59 [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Sreekanth Reddy
  2021-07-05 14:59 ` [PATCH] mpt3sas: Bump driver version to 38.100.00.00 Sreekanth Reddy
  2021-07-13  1:59 ` [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Martin K. Petersen
@ 2021-07-21  3:22 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-07-21  3:22 UTC (permalink / raw)
  To: linux-scsi, Sreekanth Reddy; +Cc: Martin K . Petersen, thenzl

On Mon, 5 Jul 2021 20:29:50 +0530, Sreekanth Reddy wrote:

> During shutdown just move the IOC state to Ready state
> by issuing MUR. No need to free any IOC memory pools.

Applied to 5.14/scsi-fixes, thanks!

[1/1] mpt3sas: Move IOC state to Ready state during shutdown
      https://git.kernel.org/mkp/scsi/c/fae21608c31c

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-21  3:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 14:59 [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Sreekanth Reddy
2021-07-05 14:59 ` [PATCH] mpt3sas: Bump driver version to 38.100.00.00 Sreekanth Reddy
2021-07-13  1:59 ` [PATCH] mpt3sas: Move IOC state to Ready state during shutdown Martin K. Petersen
2021-07-13  8:46   ` Sreekanth Reddy
2021-07-21  3:22 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).