Skip to contentSkip to conversation

scsi: ufs: no sw reset after last linkstartup fail

PATCH In review Seunghui Lee 2 participants 4 messages Jun 30, 2022 – Jul 5, 2022 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20220630041602epcas1p3f3427b4ceac68f8325d3f89bc8635603@epcas1p3.samsung.com

#1 lore raw

PATCH 1/1 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.

---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
index 7c1d7bb9c579..2cdc14675443 100644
@@ -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);
Signature · 1 line
2.29.0
#2 lore raw

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.

Quoted 37 lines

-----Original Message-----
From: Seunghui Lee <[email protected]>
Sent: Thursday, June 30, 2022 1:48 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Seunghui Lee <[email protected]>
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.

---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c index renamed from drivers/ufs/core/ufshcd.c +0 -0

7c1d7bb9c579..2cdc14675443 100644

drivers/ufs/core/ufshcd.c +1 -2
@@ -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

reviewer
#3 lore raw
Quoted 8 lines

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.

Quoted 8 lines

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

Quoted 44 lines
Quoted 5 lines

-----Original Message-----
From: Seunghui Lee <[email protected]>
Sent: Thursday, June 30, 2022 1:48 PM
To: [email protected]; [email protected];

[email protected];

Quoted 1 line

[email protected]; [email protected]; linux-

[email protected];

Quoted 3 lines

[email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected];

[email protected];

Quoted 1 line

[email protected]; [email protected];

[email protected];

drivers/ufs/core/ufshcd.c static int ufshcd_link_startup(struct ufs_hba

Quoted 18 lines

Seunghui Lee <[email protected]>
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.

---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c index renamed from drivers/ufs/core/ufshcd.c +0 -0

7c1d7bb9c579..2cdc14675443 100644

drivers/ufs/core/ufshcd.c +0 -0
@@ -4753,7 +4753,7 @@ static int ufshcd_link_startup(struct ufs_hba

*hba)

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

#4 lore raw
Quoted 32 lines

-----Original Message-----
From: Avri Altman <[email protected]>
Sent: Tuesday, July 5, 2022 3:51 PM
To: Seunghui Lee <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH] scsi: ufs: no sw reset after last linkstartup fail

Quoted 2 lines

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.

Quoted 4 lines

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.

Quoted 3 lines

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

times.

Quoted 7 lines

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.

Quoted 6 lines

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.

Quoted 47 lines
Quoted 47 lines
Quoted 7 lines

-----Original Message-----
From: Seunghui Lee <[email protected]>
Sent: Thursday, June 30, 2022 1:48 PM
To: [email protected]; [email protected];

[email protected];

Quoted 1 line

[email protected]; [email protected]; linux-

[email protected];

Quoted 3 lines

[email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected];

[email protected];

Quoted 1 line

[email protected]; [email protected];

[email protected];

drivers/ufs/core/ufshcd.c static int ufshcd_link_startup(struct ufs_hba

Quoted 19 lines

Seunghui Lee <[email protected]>
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.

---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +0 -0

index
7c1d7bb9c579..2cdc14675443 100644

drivers/ufs/core/ufshcd.c +0 -0
@@ -4753,7 +4753,7 @@ static int ufshcd_link_startup(struct ufs_hba

*hba)

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