2019-11-18 03:52:45

by Can Guo

[permalink] [raw]
Subject: [PATCH v2 1/4] scsi: ufs: Recheck bkops level if bkops is disabled

From: Asutosh Das <[email protected]>

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.

Fixes: afdfff59a0e0 (scsi: ufs: handle non spec compliant bkops behaviour by device)
Signed-off-by: Asutosh Das <[email protected]>
Signed-off-by: Can Guo <[email protected]>
Reviewed-by: Bean Huo <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 3 +++
1 file changed, 3 insertions(+)

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;
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2019-11-18 13:14:35

by Alim Akhtar

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] scsi: ufs: Recheck bkops level if bkops is disabled

Hi Can

On Mon, Nov 18, 2019 at 9:21 AM Can Guo <[email protected]> wrote:
>
> From: Asutosh Das <[email protected]>
>
> 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.
>
> Fixes: afdfff59a0e0 (scsi: ufs: handle non spec compliant bkops behaviour by device)
> Signed-off-by: Asutosh Das <[email protected]>
> Signed-off-by: Can Guo <[email protected]>
> Reviewed-by: Bean Huo <[email protected]>
> ---
Feel free to add
Reviewed-by: Alim Akhtar <[email protected]>
Ran these patches on exynos7 platfrom, and no regression observed,
basic read/write works, so
Tested-by: Alim Akhtar <[email protected]
>
> drivers/scsi/ufs/ufshcd.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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;
> }
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>


--
Regards,
Alim