diff mbox series

[v1,1/5] scsi: ufs: Recheck bkops level if bkops is disabled

Message ID 1573200932-384-2-git-send-email-cang@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series UFS driver general fixes bundle 5 | expand

Commit Message

Can Guo Nov. 8, 2019, 8:15 a.m. UTC
From: Asutosh Das <asutoshd@codeaurora.org>

Bkops level should be rechecked upon receiving an exception.
Currently the bkops level is being cached and never updated.

Update the same each time the level is checked.
Also do not use the cached bkops level value if it is disabled
and then enabled.

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

Comments

Avri Altman Nov. 12, 2019, 7:10 a.m. UTC | #1
> 
> From: Asutosh Das <asutoshd@codeaurora.org>
> 
> Bkops level should be rechecked upon receiving an exception.
> Currently the bkops level is being cached and never updated.
> 
> Update the same each time the level is checked.
> Also do not use the cached bkops level value if it is disabled and then enabled.
> 
> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
> Signed-off-by: Can Guo <cang@codeaurora.org>
Acked-by Avri Altman <avri.altman@wdc.com>

This is essentially a bug fix:
Fixes: afdfff59a0e0 (scsi: ufs: handle non spec compliant bkops behaviour by device)
Bean Huo Nov. 13, 2019, 9:35 p.m. UTC | #2
> Subject: [EXT] [PATCH v1 1/5] scsi: ufs: Recheck bkops level if bkops is disabled
> 
> From: Asutosh Das <asutoshd@codeaurora.org>
> 
> Bkops level should be rechecked upon receiving an exception.
> Currently the bkops level is being cached and never updated.
> 

Yes, this makes sense, once receiving a bkops exception, we should recheck its level.
Because device side has changed its status.

> Update the same each time the level is checked.
> Also do not use the cached bkops level value if it is disabled and then enabled.
> 
should use current level.

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

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 3910c58..8e7c362 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5099,6 +5099,7 @@  static int ufshcd_disable_auto_bkops(struct ufs_hba *hba)
 
 	hba->auto_bkops_enabled = false;
 	trace_ufshcd_auto_bkops_state(dev_name(hba->dev), "Disabled");
+	hba->is_urgent_bkops_lvl_checked = false;
 out:
 	return err;
 }
@@ -5123,6 +5124,7 @@  static void ufshcd_force_reset_auto_bkops(struct ufs_hba *hba)
 		hba->ee_ctrl_mask &= ~MASK_EE_URGENT_BKOPS;
 		ufshcd_disable_auto_bkops(hba);
 	}
+	hba->is_urgent_bkops_lvl_checked = false;
 }
 
 static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status)
@@ -5169,6 +5171,7 @@  static int ufshcd_bkops_ctrl(struct ufs_hba *hba,
 		err = ufshcd_enable_auto_bkops(hba);
 	else
 		err = ufshcd_disable_auto_bkops(hba);
+	hba->urgent_bkops_lvl = curr_status;
 out:
 	return err;
 }