Skip to contentSkip to conversation

scsi: ufs: full reinit upon resume if link was off

PATCH Superseded Can Guo 6 participants 7 messages Mar 30, 2020 – Apr 17, 2020 SCSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
Acked-by on v1 1/1
#1 lore raw
In reply to Can Guo

Hi Can,

Quoted 8 lines · Can Guo

From: Asutosh Das <[email protected]>

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.

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,

Can Guo

author
#0 lore raw

PATCH 1/1 scsi: ufs: full reinit upon resume if link was off

From: Asutosh Das <[email protected]>

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.

---
 drivers/scsi/ufs/ufshcd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +6 -2
index f19a11e..21e41e5 100644
@@ -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))
Signature · 1 line
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#3 lore raw
Quoted 4 lines

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?

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
Reviewed-by on v1 1/1
#5 lore raw
In reply to Can Guo

Hi Can,

Quoted 16 lines

-----Original Message-----
From: Can Guo <[email protected]>
Sent: 28 March 2020 07:58
To: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Alim Akhtar <[email protected]>; Avri Altman <[email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; Stanley Chu <[email protected]>; Bean Huo <[email protected]>; Bart Van Assche <[email protected]>; Venkat Gopalakrishnan <[email protected]>; Tomas Winkler <[email protected]>; open list <[email protected]>
Subject: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off

Quoted 3 lines

From: Asutosh Das <[email protected]>

During suspend, if the link is put to off, it would require a full

initialization during

Quoted 3 lines

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.

Quoted 3 lines

---

I don't have a way to test this path as of now, changes looks ok though.

Quoted 8 lines
 drivers/scsi/ufs/ufshcd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c index renamed from drivers/scsi/ufs/ufshcd.c +0 -0

f19a11e..21e41e5 100644

drivers/scsi/ufs/ufshcd.c static int ufshcd_resume(struct ufs_hba *hba, enum · line 8012

Quoted 8 lines
drivers/scsi/ufs/ufshcd.c +1 -2
@@ -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

Quoted 11 lines
drivers/scsi/ufs/ufshcd.c +5 -0
+		 * 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.

author
#6 lore raw

Hi Alim,

Quoted 18 lines · Alim Akhtar

Hi Can,

Quoted 16 lines

-----Original Message-----
From: Can Guo <[email protected]>
Sent: 28 March 2020 07:58
To: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Alim Akhtar <[email protected]>; Avri Altman <[email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; Stanley Chu <[email protected]>; Bean Huo <[email protected]>; Bart Van Assche <[email protected]>; Venkat Gopalakrishnan <[email protected]>; Tomas Winkler <[email protected]>; open list <[email protected]>
Subject: [PATCH v1 1/1] scsi: ufs: full reinit upon resume if link was off

Quoted 4 lines
Quoted 3 lines

From: Asutosh Das <[email protected]>

During suspend, if the link is put to off, it would require a full

initialization during

Good catch.

Quoted 6 lines
Quoted 3 lines

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.

Quoted 9 lines
Quoted 3 lines

---

I don't have a way to test this path as of now, changes looks ok though.

Quoted 3 lines
 drivers/scsi/ufs/ufshcd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 15 lines
Quoted 7 lines
drivers/scsi/ufs/ufshcd.c index renamed from drivers/scsi/ufs/ufshcd.c +0 -0

f19a11e..21e41e5 100644

drivers/scsi/ufs/ufshcd.c +0 -0
@@ -8007,9 +8007,13 @@ static int ufshcd_resume(struct ufs_hba *hba, 

enum
ufs_pm_op pm_op)

drivers/scsi/ufs/ufshcd.c static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)

Quoted 7 lines
drivers/scsi/ufs/ufshcd.c +1 -2
 		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.

Quoted 11 lines
Quoted 11 lines
drivers/scsi/ufs/ufshcd.c +5 -1
+		 * 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.

#4 lore raw
In reply to Martin K. Petersen

Hi,

Quoted 9 lines
Quoted 5 lines

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

Quoted 3 lines

--
Martin K. Petersen Oracle Linux Engineering