linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: no sw reset after last linkstartup fail
       [not found] <CGME20220630041602epcas1p3f3427b4ceac68f8325d3f89bc8635603@epcas1p3.samsung.com>
@ 2022-06-30  4:48 ` Seunghui Lee
  2022-07-04 11:11   ` Seunghui Lee
  0 siblings, 1 reply; 4+ messages in thread
From: Seunghui Lee @ 2022-06-30  4:48 UTC (permalink / raw)
  To: alim.akhtar, avri.altman, bvanassche, jejb, martin.petersen,
	linux-scsi, linux-kernel
  Cc: grant.jung, jt77.jang, dh0421.hwang, junwoo80.lee, jangsub.yi,
	cw9316.lee, sh8267.baek, wkon.kim, Seunghui Lee

Host driver resets the host(ufshcd_hba_enable) after last linkstartup
command failed. All of the member or host dump after linkstartup fail are
reset value because of sw reset.

Signed-off-by: Junwoo Lee <junwoo80.lee@samsung.com>
Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
---
 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] scsi: ufs: no sw reset after last linkstartup fail
  2022-06-30  4:48 ` [PATCH] scsi: ufs: no sw reset after last linkstartup fail Seunghui Lee
@ 2022-07-04 11:11   ` Seunghui Lee
  2022-07-05  6:51     ` Avri Altman
  0 siblings, 1 reply; 4+ messages in thread
From: Seunghui Lee @ 2022-07-04 11:11 UTC (permalink / raw)
  To: alim.akhtar, avri.altman, bvanassche, jejb, martin.petersen,
	linux-scsi, linux-kernel
  Cc: grant.jung, jt77.jang, dh0421.hwang, junwoo80.lee, jangsub.yi,
	cw9316.lee, sh8267.baek, wkon.kim, seunghwan.hyun

As we know, the ufs host controller is disabled and enabled in the ufshcd_hba_enable(). So, host controller registers are clear after sw reset.

Once the host fails to link startup 3 times, all host's controller can be clear due to executing last ufshcd_hba_enable()(s/w reset).
That's why we need to skip last sw reset to get valid host register values.

Before
(ufshcd_dme_link_startup() -> ufshcd_hba_enable() -> retries--) * 3 times.

After
(ufshcd_dme_link_startup() -> if retries is 0, break. ->  ufshcd_hba_enable() -> retries--) * 3 times.
In this case, ufshcd_print_host_state(), ufshcd_print_pwr_info(), ufshcd_print_evt_hist() are valid.

> -----Original Message-----
> From: Seunghui Lee <sh043.lee@samsung.com>
> Sent: Thursday, June 30, 2022 1:48 PM
> To: alim.akhtar@samsung.com; avri.altman@wdc.com; bvanassche@acm.org;
> jejb@linux.ibm.com; martin.petersen@oracle.com; linux-scsi@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: grant.jung@samsung.com; jt77.jang@samsung.com;
> dh0421.hwang@samsung.com; junwoo80.lee@samsung.com; jangsub.yi@samsung.com;
> cw9316.lee@samsung.com; sh8267.baek@samsung.com; wkon.kim@samsung.com;
> Seunghui Lee <sh043.lee@samsung.com>
> Subject: [PATCH] scsi: ufs: no sw reset after last linkstartup fail
> 
> Host driver resets the host(ufshcd_hba_enable) after last linkstartup
> command failed. All of the member or host dump after linkstartup fail are
> reset value because of sw reset.
> 
> Signed-off-by: Junwoo Lee <junwoo80.lee@samsung.com>
> Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
> ---
>  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] scsi: ufs: no sw reset after last linkstartup fail
  2022-07-04 11:11   ` Seunghui Lee
@ 2022-07-05  6:51     ` Avri Altman
  2022-07-05  7:49       ` Seunghui Lee
  0 siblings, 1 reply; 4+ messages in thread
From: Avri Altman @ 2022-07-05  6:51 UTC (permalink / raw)
  To: Seunghui Lee, alim.akhtar, bvanassche, jejb, martin.petersen,
	linux-scsi, linux-kernel
  Cc: grant.jung, jt77.jang, dh0421.hwang, junwoo80.lee, jangsub.yi,
	cw9316.lee, sh8267.baek, wkon.kim, seunghwan.hyun

 
> As we know, the ufs host controller is disabled and enabled in the
> ufshcd_hba_enable(). So, host controller registers are clear after sw reset.
> 
> Once the host fails to link startup 3 times, all host's controller can be clear due
> to executing last ufshcd_hba_enable()(s/w reset).
> That's why we need to skip last sw reset to get valid host register values.
> 
> Before
> (ufshcd_dme_link_startup() -> ufshcd_hba_enable() -> retries--) * 3 times.
> 
> After
> (ufshcd_dme_link_startup() -> if retries is 0, break. ->  ufshcd_hba_enable()
> -> retries--) * 3 times.
> In this case, ufshcd_print_host_state(), ufshcd_print_pwr_info(),
> ufshcd_print_evt_hist() are valid.
If you find it necessary to elaborate the commit log, why not do just that?
Also maybe make the title more indicative of what you want to achieve:
"skip last hci reset to get valid register values" or something.

Thanks,
Avri


> 
> > -----Original Message-----
> > From: Seunghui Lee <sh043.lee@samsung.com>
> > Sent: Thursday, June 30, 2022 1:48 PM
> > To: alim.akhtar@samsung.com; avri.altman@wdc.com;
> bvanassche@acm.org;
> > jejb@linux.ibm.com; martin.petersen@oracle.com; linux-
> scsi@vger.kernel.org;
> > linux-kernel@vger.kernel.org
> > Cc: grant.jung@samsung.com; jt77.jang@samsung.com;
> > dh0421.hwang@samsung.com; junwoo80.lee@samsung.com;
> jangsub.yi@samsung.com;
> > cw9316.lee@samsung.com; sh8267.baek@samsung.com;
> wkon.kim@samsung.com;
> > Seunghui Lee <sh043.lee@samsung.com>
> > Subject: [PATCH] scsi: ufs: no sw reset after last linkstartup fail
> >
> > Host driver resets the host(ufshcd_hba_enable) after last linkstartup
> > command failed. All of the member or host dump after linkstartup fail are
> > reset value because of sw reset.
> >
> > Signed-off-by: Junwoo Lee <junwoo80.lee@samsung.com>
> > Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
> > ---
> >  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] scsi: ufs: no sw reset after last linkstartup fail
  2022-07-05  6:51     ` Avri Altman
@ 2022-07-05  7:49       ` Seunghui Lee
  0 siblings, 0 replies; 4+ messages in thread
From: Seunghui Lee @ 2022-07-05  7:49 UTC (permalink / raw)
  To: 'Avri Altman',
	alim.akhtar, bvanassche, jejb, martin.petersen, linux-scsi,
	linux-kernel
  Cc: grant.jung, jt77.jang, dh0421.hwang, junwoo80.lee, jangsub.yi,
	cw9316.lee, sh8267.baek, wkon.kim, seunghwan.hyun

> -----Original Message-----
> From: Avri Altman <Avri.Altman@wdc.com>
> Sent: Tuesday, July 5, 2022 3:51 PM
> To: Seunghui Lee <sh043.lee@samsung.com>; alim.akhtar@samsung.com;
> bvanassche@acm.org; jejb@linux.ibm.com; martin.petersen@oracle.com; linux-
> scsi@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: grant.jung@samsung.com; jt77.jang@samsung.com;
> dh0421.hwang@samsung.com; junwoo80.lee@samsung.com; jangsub.yi@samsung.com;
> cw9316.lee@samsung.com; sh8267.baek@samsung.com; wkon.kim@samsung.com;
> seunghwan.hyun@samsung.com
> Subject: RE: [PATCH] scsi: ufs: no sw reset after last linkstartup fail
> 
> 
> > As we know, the ufs host controller is disabled and enabled in the
> > ufshcd_hba_enable(). So, host controller registers are clear after sw
> reset.
> >
> > Once the host fails to link startup 3 times, all host's controller can
> > be clear due to executing last ufshcd_hba_enable()(s/w reset).
> > That's why we need to skip last sw reset to get valid host register
> values.
> >
> > Before
> > (ufshcd_dme_link_startup() -> ufshcd_hba_enable() -> retries--) * 3
> times.
> >
> > After
> > (ufshcd_dme_link_startup() -> if retries is 0, break. ->
> > ufshcd_hba_enable()
> > -> retries--) * 3 times.
> > In this case, ufshcd_print_host_state(), ufshcd_print_pwr_info(),
> > ufshcd_print_evt_hist() are valid.
> If you find it necessary to elaborate the commit log, why not do just that?
> Also maybe make the title more indicative of what you want to achieve:
> "skip last hci reset to get valid register values" or something.
> 
> Thanks,
> Avri

Thank you for your comment.
I'll modify the commit log and update it again.

> 
> 
> >
> > > -----Original Message-----
> > > From: Seunghui Lee <sh043.lee@samsung.com>
> > > Sent: Thursday, June 30, 2022 1:48 PM
> > > To: alim.akhtar@samsung.com; avri.altman@wdc.com;
> > bvanassche@acm.org;
> > > jejb@linux.ibm.com; martin.petersen@oracle.com; linux-
> > scsi@vger.kernel.org;
> > > linux-kernel@vger.kernel.org
> > > Cc: grant.jung@samsung.com; jt77.jang@samsung.com;
> > > dh0421.hwang@samsung.com; junwoo80.lee@samsung.com;
> > jangsub.yi@samsung.com;
> > > cw9316.lee@samsung.com; sh8267.baek@samsung.com;
> > wkon.kim@samsung.com;
> > > Seunghui Lee <sh043.lee@samsung.com>
> > > Subject: [PATCH] scsi: ufs: no sw reset after last linkstartup fail
> > >
> > > Host driver resets the host(ufshcd_hba_enable) after last
> > > linkstartup command failed. All of the member or host dump after
> > > linkstartup fail are reset value because of sw reset.
> > >
> > > Signed-off-by: Junwoo Lee <junwoo80.lee@samsung.com>
> > > Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
> > > ---
> > >  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

end of thread, other threads:[~2022-07-05  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220630041602epcas1p3f3427b4ceac68f8325d3f89bc8635603@epcas1p3.samsung.com>
2022-06-30  4:48 ` [PATCH] scsi: ufs: no sw reset after last linkstartup fail Seunghui Lee
2022-07-04 11:11   ` Seunghui Lee
2022-07-05  6:51     ` Avri Altman
2022-07-05  7:49       ` Seunghui Lee

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).