2019-11-08 08:16:46

by Can Guo

[permalink] [raw]
Subject: [PATCH v1 1/5] 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.

Signed-off-by: Asutosh Das <[email protected]>
Signed-off-by: Can Guo <[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-12 07:14:06

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v1 1/5] 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.
>
> Signed-off-by: Asutosh Das <[email protected]>
> Signed-off-by: Can Guo <[email protected]>
Acked-by Avri Altman <[email protected]>

This is essentially a bug fix:
Fixes: afdfff59a0e0 (scsi: ufs: handle non spec compliant bkops behaviour by device)

2019-11-13 21:37:05

by Bean Huo (beanhuo)

[permalink] [raw]
Subject: RE: [EXT] [PATCH v1 1/5] scsi: ufs: Recheck bkops level if bkops is disabled

> Subject: [EXT] [PATCH v1 1/5] 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.
>

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 <[email protected]>
> Signed-off-by: Can Guo <[email protected]>
Reviewed-by: Bean Huo <[email protected]>