public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scsi: ufs: skip last hci reset to get valid register values
       [not found] <CGME20220705080318epcas1p18896b13b2f7ad16509d7047584f1fe86@epcas1p1.samsung.com>
@ 2022-07-05  8:35 ` Seunghui Lee
  2022-07-05  9:34   ` Avri Altman
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Seunghui Lee @ 2022-07-05  8:35 UTC (permalink / raw)
  To: linux-scsi, avri.altman; +Cc: Seunghui Lee, Junwoo Lee

Once the host fails to link startup 3 times, all host registers are reset value
except ufshcd_hba_enable after linkstartup failure.

The ufs host controller is disabled and enabled in the ufshcd_hba_enable().
That's why we need to skip last hci reset to get valid host register values.

e.g.
[    1.898026] [2:  kworker/u16:2:  211] ufs: link startup failed 1
[    1.898133] [2:  kworker/u16:2:  211] host_regs: 00000000: 1383ff1f 00000000 00000300 00000000
[    1.898141] [2:  kworker/u16:2:  211] host_regs: 00000010: 00000106 000001ce 00000000 00000000
[    1.898148] [2:  kworker/u16:2:  211] host_regs: 00000020: 00000000 00000470 00000000 00000000
[    1.898155] [2:  kworker/u16:2:  211] host_regs: 00000030: 00000008 00000003 00000000 00000000
[    1.898163] [2:  kworker/u16:2:  211] host_regs: 00000040: 00000000 00000000 00000000 00000000
[    1.898171] [2:  kworker/u16:2:  211] host_regs: 00000050: 00000000 00000000 00000000 00000000
[    1.898177] [2:  kworker/u16:2:  211] host_regs: 00000060: 00000000 00000000 00000000 00000000
[    1.898186] [2:  kworker/u16:2:  211] host_regs: 00000070: 00000000 00000000 00000000 00000000
[    1.898194] [2:  kworker/u16:2:  211] host_regs: 00000080: 00000000 00000000 00000000 00000000
[    1.898201] [2:  kworker/u16:2:  211] host_regs: 00000090: 00000000 00000000 00000000 00000000
All host registers(standard special function register) are reset value except
ufshcd_hba_enable after linkstartup failure.

Signed-off-by: Junwoo Lee <junwoo80.lee@samsung.com>
Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>

---
v1->v2:
* modify the commit log and add problematic log
---
---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7c1d7bb9c579..2cdc14675443 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4753,7 +4753,7 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
 		 * but we can't be sure if the link is up until link startup
 		 * succeeds. So reset the local Uni-Pro and try again.
 		 */
-		if (ret && ufshcd_hba_enable(hba)) {
+		if (ret && retries && ufshcd_hba_enable(hba)) {
 			ufshcd_update_evt_hist(hba,
 					       UFS_EVT_LINK_STARTUP_FAIL,
 					       (u32)ret);
-- 
2.29.0


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

* RE: [PATCH v2] scsi: ufs: skip last hci reset to get valid register values
  2022-07-05  8:35 ` [PATCH v2] scsi: ufs: skip last hci reset to get valid register values Seunghui Lee
@ 2022-07-05  9:34   ` Avri Altman
  2022-07-07 21:28   ` Martin K. Petersen
  2022-07-14  4:22   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Avri Altman @ 2022-07-05  9:34 UTC (permalink / raw)
  To: Seunghui Lee, linux-scsi@vger.kernel.org; +Cc: Junwoo Lee

> Once the host fails to link startup 3 times, all host registers are reset value
> except ufshcd_hba_enable after linkstartup failure.
> 
> The ufs host controller is disabled and enabled in the ufshcd_hba_enable().
> That's why we need to skip last hci reset to get valid host register values.
> 
> e.g.
> [    1.898026] [2:  kworker/u16:2:  211] ufs: link startup failed 1
> [    1.898133] [2:  kworker/u16:2:  211] host_regs: 00000000: 1383ff1f 00000000
> 00000300 00000000
> [    1.898141] [2:  kworker/u16:2:  211] host_regs: 00000010: 00000106
> 000001ce 00000000 00000000
> [    1.898148] [2:  kworker/u16:2:  211] host_regs: 00000020: 00000000
> 00000470 00000000 00000000
> [    1.898155] [2:  kworker/u16:2:  211] host_regs: 00000030: 00000008
> 00000003 00000000 00000000
> [    1.898163] [2:  kworker/u16:2:  211] host_regs: 00000040: 00000000
> 00000000 00000000 00000000
> [    1.898171] [2:  kworker/u16:2:  211] host_regs: 00000050: 00000000
> 00000000 00000000 00000000
> [    1.898177] [2:  kworker/u16:2:  211] host_regs: 00000060: 00000000
> 00000000 00000000 00000000
> [    1.898186] [2:  kworker/u16:2:  211] host_regs: 00000070: 00000000
> 00000000 00000000 00000000
> [    1.898194] [2:  kworker/u16:2:  211] host_regs: 00000080: 00000000
> 00000000 00000000 00000000
> [    1.898201] [2:  kworker/u16:2:  211] host_regs: 00000090: 00000000
> 00000000 00000000 00000000
> All host registers(standard special function register) are reset value except
> ufshcd_hba_enable after linkstartup failure.
> 
> Signed-off-by: Junwoo Lee <junwoo80.lee@samsung.com>
> Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

> 
> ---
> v1->v2:
> * modify the commit log and add problematic log
> ---
> ---
>  drivers/ufs/core/ufshcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> 7c1d7bb9c579..2cdc14675443 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4753,7 +4753,7 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
>                  * but we can't be sure if the link is up until link startup
>                  * succeeds. So reset the local Uni-Pro and try again.
>                  */
> -               if (ret && ufshcd_hba_enable(hba)) {
> +               if (ret && retries && ufshcd_hba_enable(hba)) {
>                         ufshcd_update_evt_hist(hba,
>                                                UFS_EVT_LINK_STARTUP_FAIL,
>                                                (u32)ret);
> --
> 2.29.0


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

* Re: [PATCH v2] scsi: ufs: skip last hci reset to get valid register values
  2022-07-05  8:35 ` [PATCH v2] scsi: ufs: skip last hci reset to get valid register values Seunghui Lee
  2022-07-05  9:34   ` Avri Altman
@ 2022-07-07 21:28   ` Martin K. Petersen
  2022-07-14  4:22   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-07-07 21:28 UTC (permalink / raw)
  To: Seunghui Lee; +Cc: linux-scsi, avri.altman, Junwoo Lee


Seunghui,

> Once the host fails to link startup 3 times, all host registers are
> reset value except ufshcd_hba_enable after linkstartup failure.

Applied to 5.20/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH v2] scsi: ufs: skip last hci reset to get valid register values
  2022-07-05  8:35 ` [PATCH v2] scsi: ufs: skip last hci reset to get valid register values Seunghui Lee
  2022-07-05  9:34   ` Avri Altman
  2022-07-07 21:28   ` Martin K. Petersen
@ 2022-07-14  4:22   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-07-14  4:22 UTC (permalink / raw)
  To: avri.altman, Seunghui Lee, linux-scsi; +Cc: Martin K . Petersen, Junwoo Lee

On Tue, 5 Jul 2022 17:35:38 +0900, Seunghui Lee wrote:

> Once the host fails to link startup 3 times, all host registers are reset value
> except ufshcd_hba_enable after linkstartup failure.
> 
> The ufs host controller is disabled and enabled in the ufshcd_hba_enable().
> That's why we need to skip last hci reset to get valid host register values.
> 
> e.g.
> [    1.898026] [2:  kworker/u16:2:  211] ufs: link startup failed 1
> [    1.898133] [2:  kworker/u16:2:  211] host_regs: 00000000: 1383ff1f 00000000 00000300 00000000
> [    1.898141] [2:  kworker/u16:2:  211] host_regs: 00000010: 00000106 000001ce 00000000 00000000
> [    1.898148] [2:  kworker/u16:2:  211] host_regs: 00000020: 00000000 00000470 00000000 00000000
> [    1.898155] [2:  kworker/u16:2:  211] host_regs: 00000030: 00000008 00000003 00000000 00000000
> [    1.898163] [2:  kworker/u16:2:  211] host_regs: 00000040: 00000000 00000000 00000000 00000000
> [    1.898171] [2:  kworker/u16:2:  211] host_regs: 00000050: 00000000 00000000 00000000 00000000
> [    1.898177] [2:  kworker/u16:2:  211] host_regs: 00000060: 00000000 00000000 00000000 00000000
> [    1.898186] [2:  kworker/u16:2:  211] host_regs: 00000070: 00000000 00000000 00000000 00000000
> [    1.898194] [2:  kworker/u16:2:  211] host_regs: 00000080: 00000000 00000000 00000000 00000000
> [    1.898201] [2:  kworker/u16:2:  211] host_regs: 00000090: 00000000 00000000 00000000 00000000
> All host registers(standard special function register) are reset value except
> ufshcd_hba_enable after linkstartup failure.
> 
> [...]

Applied to 5.20/scsi-queue, thanks!

[1/1] scsi: ufs: skip last hci reset to get valid register values
      https://git.kernel.org/mkp/scsi/c/174e909b5435

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2022-07-14  4:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20220705080318epcas1p18896b13b2f7ad16509d7047584f1fe86@epcas1p1.samsung.com>
2022-07-05  8:35 ` [PATCH v2] scsi: ufs: skip last hci reset to get valid register values Seunghui Lee
2022-07-05  9:34   ` Avri Altman
2022-07-07 21:28   ` Martin K. Petersen
2022-07-14  4: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