All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes
@ 2021-04-06 18:05 Igor Pylypiv
  2021-04-06 18:05 ` [PATCH v2 1/2] scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check() Igor Pylypiv
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Igor Pylypiv @ 2021-04-06 18:05 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Akshat Jain, Jolly Shah, Yu Zheng,
	linux-scsi, Viswas G, Deepak Ukey, Igor Pylypiv

Changes from v1:
 - Added missing semicolons
 - Removed redundant parentheses

This patch series changes the wait time handling in mpi_uninit_check() to
make it similar to mpi_init_check().

In commit e90e236250e9 ("scsi: pm80xx: Increase timeout for pm80xx
mpi_uninit_check") the wait time for the inbound doorbell was increased
in the mpi_init_check() instead of the mpi_uninit_check().

Note:
SPC[/V]_DOORBELL_CLEAR_TIMEOUT defines could not be used in the first
commit in this series because the values were decreased in
commit d71023af4bec0 ("scsi: pm80xx: Do not busy wait in MPI init check").

Igor Pylypiv (2):
  scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check()
  scsi: pm80xx: Remove busy wait from mpi_uninit_check()

 drivers/scsi/pm8001/pm80xx_hwi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.31.1.295.g9ea45b61b8-goog


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

* [PATCH v2 1/2] scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check()
  2021-04-06 18:05 [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes Igor Pylypiv
@ 2021-04-06 18:05 ` Igor Pylypiv
  2021-04-06 18:05 ` [PATCH v2 2/2] scsi: pm80xx: Remove busy wait from mpi_uninit_check() Igor Pylypiv
  2021-04-16  2:51 ` [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Pylypiv @ 2021-04-06 18:05 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Akshat Jain, Jolly Shah, Yu Zheng,
	linux-scsi, Viswas G, Deepak Ukey, Igor Pylypiv

The mpi_uninit_check() takes longer for inbound doorbell register to be
cleared. Increased the timeout substantially so that the driver does not
fail to load.

Previously, the inbound doorbell wait time was mistakenly increased in
the mpi_init_check() instead of the mpi_uninit_check(). It is okay to
leave the mpi_init_check() wait time as is as these are timeout values
and if there is a failure, waiting longer is not an issue.

Fixes: e90e236250e9 ("scsi: pm80xx: Increase timeout for pm80xx
mpi_uninit_check")
Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 84315560e8e1..c6b0834e3806 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -1502,9 +1502,9 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha)
 
 	/* wait until Inbound DoorBell Clear Register toggled */
 	if (IS_SPCV_12G(pm8001_ha->pdev)) {
-		max_wait_count = 4 * 1000 * 1000;/* 4 sec */
+		max_wait_count = 30 * 1000 * 1000; /* 30 sec */
 	} else {
-		max_wait_count = 2 * 1000 * 1000;/* 2 sec */
+		max_wait_count = 15 * 1000 * 1000; /* 15 sec */
 	}
 	do {
 		udelay(1);
-- 
2.31.1.295.g9ea45b61b8-goog


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

* [PATCH v2 2/2] scsi: pm80xx: Remove busy wait from mpi_uninit_check()
  2021-04-06 18:05 [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes Igor Pylypiv
  2021-04-06 18:05 ` [PATCH v2 1/2] scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check() Igor Pylypiv
@ 2021-04-06 18:05 ` Igor Pylypiv
  2021-04-16  2:51 ` [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Pylypiv @ 2021-04-06 18:05 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Akshat Jain, Jolly Shah, Yu Zheng,
	linux-scsi, Viswas G, Deepak Ukey, Igor Pylypiv

mpi_uninit_check() is not being called in an ATOMIC context.
The only caller of mpi_uninit_check() is pm80xx_chip_soft_rst().

Callers of pm80xx_chip_soft_rst():
 - pm8001_ioctl_soft_reset()
 - pm8001_pci_probe()
 - pm8001_pci_remove()
 - pm8001_pci_suspend()
 - pm8001_pci_resume()

There was a similar fix for mpi_init_check() in commit d71023af4bec0
("scsi: pm80xx: Do not busy wait in MPI init check").

Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index c6b0834e3806..9fade2ed9396 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -1502,12 +1502,12 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha)
 
 	/* wait until Inbound DoorBell Clear Register toggled */
 	if (IS_SPCV_12G(pm8001_ha->pdev)) {
-		max_wait_count = 30 * 1000 * 1000; /* 30 sec */
+		max_wait_count = SPCV_DOORBELL_CLEAR_TIMEOUT;
 	} else {
-		max_wait_count = 15 * 1000 * 1000; /* 15 sec */
+		max_wait_count = SPC_DOORBELL_CLEAR_TIMEOUT;
 	}
 	do {
-		udelay(1);
+		msleep(FW_READY_INTERVAL);
 		value = pm8001_cr32(pm8001_ha, 0, MSGU_IBDB_SET);
 		value &= SPCv_MSGU_CFG_TABLE_RESET;
 	} while ((value != 0) && (--max_wait_count));
@@ -1519,9 +1519,9 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha)
 
 	/* check the MPI-State for termination in progress */
 	/* wait until Inbound DoorBell Clear Register toggled */
-	max_wait_count = 2 * 1000 * 1000;	/* 2 sec for spcv/ve */
+	max_wait_count = 100; /* 2 sec for spcv/ve */
 	do {
-		udelay(1);
+		msleep(FW_READY_INTERVAL);
 		gst_len_mpistate =
 			pm8001_mr32(pm8001_ha->general_stat_tbl_addr,
 			GST_GSTLEN_MPIS_OFFSET);
-- 
2.31.1.295.g9ea45b61b8-goog


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

* Re: [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes
  2021-04-06 18:05 [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes Igor Pylypiv
  2021-04-06 18:05 ` [PATCH v2 1/2] scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check() Igor Pylypiv
  2021-04-06 18:05 ` [PATCH v2 2/2] scsi: pm80xx: Remove busy wait from mpi_uninit_check() Igor Pylypiv
@ 2021-04-16  2:51 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-04-16  2:51 UTC (permalink / raw)
  To: Igor Pylypiv, James E.J. Bottomley, Jack Wang
  Cc: Martin K . Petersen, Akshat Jain, Deepak Ukey, Yu Zheng,
	linux-scsi, Vishakha Channapattan, Jolly Shah, Viswas G

On Tue, 6 Apr 2021 11:05:32 -0700, Igor Pylypiv wrote:

> Changes from v1:
>  - Added missing semicolons
>  - Removed redundant parentheses
> 
> This patch series changes the wait time handling in mpi_uninit_check() to
> make it similar to mpi_init_check().
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[1/2] scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check()
      https://git.kernel.org/mkp/scsi/c/3f744a14f331
[2/2] scsi: pm80xx: Remove busy wait from mpi_uninit_check()
      https://git.kernel.org/mkp/scsi/c/6f305bf699fe

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-04-16  2:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 18:05 [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes Igor Pylypiv
2021-04-06 18:05 ` [PATCH v2 1/2] scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check() Igor Pylypiv
2021-04-06 18:05 ` [PATCH v2 2/2] scsi: pm80xx: Remove busy wait from mpi_uninit_check() Igor Pylypiv
2021-04-16  2:51 ` [PATCH v2 0/2] pm80xx mpi_uninit_check() fixes Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.