scsi: ufs: Recheck bkops level if bkops is disabled
authorAsutosh Das <asutoshd@codeaurora.org>
Tue, 26 Nov 2019 06:53:30 +0000 (22:53 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:32:16 +0000 (16:32 -0500)
commit 24366c2afbb0539fb14eff330d4e3a5db5c0a3ef upstream.

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

Update bkops 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)
Link: https://lore.kernel.org/r/1574751214-8321-2-git-send-email-cang@qti.qualcomm.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/ufs/ufshcd.c

index d25082e573e0acc3ab83f48e98106782786e39ea..7ada4f2722588175ad4cba98e6fba645e783b6d0 100644 (file)
@@ -4812,6 +4812,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;
 }
@@ -4836,6 +4837,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)
@@ -4882,6 +4884,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;
 }