linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
@ 2020-03-28  2:27 ` Can Guo
  2020-03-30  0:35   ` Stanley Chu
                     ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Can Guo @ 2020-03-28  2:27 UTC (permalink / raw)
  To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
	saravanak, salyzyn, cang
  Cc: Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, Stanley Chu, Bean Huo, Bart Van Assche,
	Venkat Gopalakrishnan, Tomas Winkler, open list

From: Asutosh Das <asutoshd@codeaurora.org>

During suspend, if the link is put to off, it would require
a full initialization during resume. This patch resets and
restores both the hba and the card during initialization.

Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f19a11e..21e41e5 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8007,9 +8007,13 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 		else
 			goto vendor_suspend;
 	} else if (ufshcd_is_link_off(hba)) {
-		ret = ufshcd_host_reset_and_restore(hba);
 		/*
-		 * ufshcd_host_reset_and_restore() should have already
+		 * A full initialization of the host and the device is required
+		 * since the link was put to off during suspend.
+		 */
+		ret = ufshcd_reset_and_restore(hba);
+		/*
+		 * ufshcd_reset_and_restore() should have already
 		 * set the link state as active
 		 */
 		if (ret || !ufshcd_is_link_active(hba))
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
  2020-03-28  2:27 ` [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off Can Guo
@ 2020-03-30  0:35   ` Stanley Chu
  2020-03-30  8:43   ` [EXT] " Bean Huo (beanhuo)
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Stanley Chu @ 2020-03-30  0:35 UTC (permalink / raw)
  To: Can Guo
  Cc: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
	saravanak, salyzyn, Alim Akhtar, Avri Altman,
	James E.J. Bottomley, Martin K. Petersen, Bean Huo,
	Bart Van Assche, Venkat Gopalakrishnan, Tomas Winkler, open list

Hi Can,

On Fri, 2020-03-27 at 19:27 -0700, Can Guo wrote:
> From: Asutosh Das <asutoshd@codeaurora.org>
> 
> During suspend, if the link is put to off, it would require
> a full initialization during resume. This patch resets and
> restores both the hba and the card during initialization.
> 
> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
> Signed-off-by: Can Guo <cang@codeaurora.org>

Personally I like this patch because the re-initialization performance
is improved in my test platform with my patch "scsi: ufs: set device as
active power mode after resetting device" working together. But I am not
sure if every vendor is happy about this.

Anyway,
Acked-by: Stanley Chu <stanley.chu@mediatek.com>

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

* RE: [EXT] [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
  2020-03-28  2:27 ` [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off Can Guo
  2020-03-30  0:35   ` Stanley Chu
@ 2020-03-30  8:43   ` Bean Huo (beanhuo)
  2020-04-14  0:34   ` Martin K. Petersen
  2020-04-14  2:30   ` Alim Akhtar
  3 siblings, 0 replies; 7+ messages in thread
From: Bean Huo (beanhuo) @ 2020-03-30  8:43 UTC (permalink / raw)
  To: Can Guo, asutoshd, nguyenb, hongwus, rnayak, linux-scsi,
	kernel-team, saravanak, salyzyn
  Cc: Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, Stanley Chu, Bart Van Assche,
	Venkat Gopalakrishnan, Tomas Winkler, open list

> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
> Signed-off-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>


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

* Re: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
  2020-03-28  2:27 ` [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off Can Guo
  2020-03-30  0:35   ` Stanley Chu
  2020-03-30  8:43   ` [EXT] " Bean Huo (beanhuo)
@ 2020-04-14  0:34   ` Martin K. Petersen
  2020-04-17 11:14     ` Avri Altman
  2020-04-14  2:30   ` Alim Akhtar
  3 siblings, 1 reply; 7+ messages in thread
From: Martin K. Petersen @ 2020-04-14  0:34 UTC (permalink / raw)
  To: Alim Akhtar, Avri Altman
  Cc: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
	saravanak, salyzyn, James E.J. Bottomley, Martin K. Petersen,
	Stanley Chu, Bean Huo, Bart Van Assche, Venkat Gopalakrishnan,
	Tomas Winkler, open list, Can Guo


> During suspend, if the link is put to off, it would require a full
> initialization during resume. This patch resets and restores both the
> hba and the card during initialization.

Avri, Alim: Any opinions on this change in behavior wrt. your
controllers? Would a quirk or callback be preferred to changing this for
everyone?

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* RE: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
  2020-03-28  2:27 ` [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off Can Guo
                     ` (2 preceding siblings ...)
  2020-04-14  0:34   ` Martin K. Petersen
@ 2020-04-14  2:30   ` Alim Akhtar
  2020-04-14  5:56     ` Can Guo
  3 siblings, 1 reply; 7+ messages in thread
From: Alim Akhtar @ 2020-04-14  2:30 UTC (permalink / raw)
  To: 'Can Guo',
	asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
	saravanak, salyzyn
  Cc: 'Avri Altman', 'James E.J. Bottomley',
	'Martin K. Petersen', 'Stanley Chu',
	'Bean Huo', 'Bart Van Assche',
	'Venkat Gopalakrishnan', 'Tomas Winkler',
	'open list'

Hi Can,

> -----Original Message-----
> From: Can Guo <cang@codeaurora.org>
> Sent: 28 March 2020 07:58
> To: asutoshd@codeaurora.org; nguyenb@codeaurora.org;
> hongwus@codeaurora.org; rnayak@codeaurora.org; linux-
> scsi@vger.kernel.org; kernel-team@android.com; saravanak@google.com;
> salyzyn@google.com; cang@codeaurora.org
> Cc: Alim Akhtar <alim.akhtar@samsung.com>; Avri Altman
> <avri.altman@wdc.com>; James E.J. Bottomley <jejb@linux.ibm.com>; Martin
> K. Petersen <martin.petersen@oracle.com>; Stanley Chu
> <stanley.chu@mediatek.com>; Bean Huo <beanhuo@micron.com>; Bart Van
> Assche <bvanassche@acm.org>; Venkat Gopalakrishnan
> <venkatg@codeaurora.org>; Tomas Winkler <tomas.winkler@intel.com>; open
> list <linux-kernel@vger.kernel.org>
> Subject: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
> 
> From: Asutosh Das <asutoshd@codeaurora.org>
> 
> During suspend, if the link is put to off, it would require a full
initialization during
> resume. This patch resets and restores both the hba and the card during
> initialization.
> 
In case you have faced issues by not doing what this patch does, it is worth
mentioning that in the commit mesg.

> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
> Signed-off-by: Can Guo <cang@codeaurora.org>
> ---
I don't have a way to test this path as of now, changes looks ok though.
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>

>  drivers/scsi/ufs/ufshcd.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index
> f19a11e..21e41e5 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8007,9 +8007,13 @@ static int ufshcd_resume(struct ufs_hba *hba, enum
> ufs_pm_op pm_op)
>  		else
>  			goto vendor_suspend;
>  	} else if (ufshcd_is_link_off(hba)) {
> -		ret = ufshcd_host_reset_and_restore(hba);
>  		/*
> -		 * ufshcd_host_reset_and_restore() should have already
> +		 * A full initialization of the host and the device is
required
> +		 * since the link was put to off during suspend.
> +		 */
> +		ret = ufshcd_reset_and_restore(hba);
> +		/*
> +		 * ufshcd_reset_and_restore() should have already
>  		 * set the link state as active
>  		 */
>  		if (ret || !ufshcd_is_link_active(hba))
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project.



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

* Re: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
  2020-04-14  2:30   ` Alim Akhtar
@ 2020-04-14  5:56     ` Can Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Can Guo @ 2020-04-14  5:56 UTC (permalink / raw)
  To: Alim Akhtar
  Cc: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
	saravanak, salyzyn, 'Avri Altman',
	'James E.J. Bottomley', 'Martin K. Petersen',
	'Stanley Chu', 'Bean Huo',
	'Bart Van Assche', 'Venkat Gopalakrishnan',
	'Tomas, Winkler', 'open list'

Hi Alim,

On 2020-04-14 10:30, Alim Akhtar wrote:
> Hi Can,
> 
>> -----Original Message-----
>> From: Can Guo <cang@codeaurora.org>
>> Sent: 28 March 2020 07:58
>> To: asutoshd@codeaurora.org; nguyenb@codeaurora.org;
>> hongwus@codeaurora.org; rnayak@codeaurora.org; linux-
>> scsi@vger.kernel.org; kernel-team@android.com; saravanak@google.com;
>> salyzyn@google.com; cang@codeaurora.org
>> Cc: Alim Akhtar <alim.akhtar@samsung.com>; Avri Altman
>> <avri.altman@wdc.com>; James E.J. Bottomley <jejb@linux.ibm.com>; 
>> Martin
>> K. Petersen <martin.petersen@oracle.com>; Stanley Chu
>> <stanley.chu@mediatek.com>; Bean Huo <beanhuo@micron.com>; Bart Van
>> Assche <bvanassche@acm.org>; Venkat Gopalakrishnan
>> <venkatg@codeaurora.org>; Tomas Winkler <tomas.winkler@intel.com>; 
>> open
>> list <linux-kernel@vger.kernel.org>
>> Subject: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was 
>> off
>> 
>> From: Asutosh Das <asutoshd@codeaurora.org>
>> 
>> During suspend, if the link is put to off, it would require a full
> initialization during

Good catch.

>> resume. This patch resets and restores both the hba and the card 
>> during
>> initialization.
>> 
> In case you have faced issues by not doing what this patch does, it is 
> worth
> mentioning that in the commit mesg.
> 

OK.

>> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
>> Signed-off-by: Can Guo <cang@codeaurora.org>
>> ---
> I don't have a way to test this path as of now, changes looks ok 
> though.
> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
> 
>>  drivers/scsi/ufs/ufshcd.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c 
>> index
>> f19a11e..21e41e5 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -8007,9 +8007,13 @@ static int ufshcd_resume(struct ufs_hba *hba, 
>> enum
>> ufs_pm_op pm_op)
>>  		else
>>  			goto vendor_suspend;
>>  	} else if (ufshcd_is_link_off(hba)) {
>> -		ret = ufshcd_host_reset_and_restore(hba);
>>  		/*
>> -		 * ufshcd_host_reset_and_restore() should have already
>> +		 * A full initialization of the host and the device is
> required

Shall fix.

>> +		 * since the link was put to off during suspend.
>> +		 */
>> +		ret = ufshcd_reset_and_restore(hba);
>> +		/*
>> +		 * ufshcd_reset_and_restore() should have already
>>  		 * set the link state as active
>>  		 */
>>  		if (ret || !ufshcd_is_link_active(hba))
>> --
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
>> Linux
>> Foundation Collaborative Project.

Thanks.
Can Guo.

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

* RE: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off
  2020-04-14  0:34   ` Martin K. Petersen
@ 2020-04-17 11:14     ` Avri Altman
  0 siblings, 0 replies; 7+ messages in thread
From: Avri Altman @ 2020-04-17 11:14 UTC (permalink / raw)
  To: Martin K. Petersen, Alim Akhtar
  Cc: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
	saravanak, salyzyn, James E.J. Bottomley, Stanley Chu, Bean Huo,
	Bart Van Assche, Venkat Gopalakrishnan, Tomas Winkler, open list,
	Can Guo

Hi,
> 
> 
> > During suspend, if the link is put to off, it would require a full
> > initialization during resume. This patch resets and restores both the
> > hba and the card during initialization.
> 
> Avri, Alim: Any opinions on this change in behavior wrt. your
> controllers? Would a quirk or callback be preferred to changing this for
> everyone?
You have a v2 of this patch and a Reviewed-by tag by Alim.
It looks fine to me as well.

Thanks,
Avri

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

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

end of thread, other threads:[~2020-04-17 11:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200328022740epcas5p1e97777d3e2dacfbee89fed75d6b36e99@epcas5p1.samsung.com>
2020-03-28  2:27 ` [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off Can Guo
2020-03-30  0:35   ` Stanley Chu
2020-03-30  8:43   ` [EXT] " Bean Huo (beanhuo)
2020-04-14  0:34   ` Martin K. Petersen
2020-04-17 11:14     ` Avri Altman
2020-04-14  2:30   ` Alim Akhtar
2020-04-14  5:56     ` Can Guo

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