Patch "scsi: ufs: Fix error handing during hibern8 enter" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: ufs: Fix error handing during hibern8 enter

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-ufs-fix-error-handing-during-hibern8-enter.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9cbfcda264a5387ce41ad369ed11ed6a01af298d
Author: Subhash Jadavani <subhashj@xxxxxxxxxxxxxx>
Date:   Thu Nov 14 22:09:30 2019 -0800

    scsi: ufs: Fix error handing during hibern8 enter
    
    [ Upstream commit 6d303e4b19d694cdbebf76bcdb51ada664ee953d ]
    
    During clock gating (ufshcd_gate_work()), we first put the link hibern8 by
    calling ufshcd_uic_hibern8_enter() and if ufshcd_uic_hibern8_enter()
    returns success (0) then we gate all the clocks.  Now letâ??s zoom in to what
    ufshcd_uic_hibern8_enter() does internally: It calls
    __ufshcd_uic_hibern8_enter() and if failure is encountered, link recovery
    shall put the link back to the highest HS gear and returns success (0) to
    ufshcd_uic_hibern8_enter() which is the issue as link is still in active
    state due to recovery!  Now ufshcd_uic_hibern8_enter() returns success to
    ufshcd_gate_work() and hence it goes ahead with gating the UFS clock while
    link is still in active state hence I believe controller would raise UIC
    error interrupts. But when we service the interrupt, clocks might have
    already been disabled!
    
    This change fixes for this by returning failure from
    __ufshcd_uic_hibern8_enter() if recovery succeeds as link is still not in
    hibern8, upon receiving the error ufshcd_hibern8_enter() would initiate
    retry to put the link state back into hibern8.
    
    Link: https://lore.kernel.org/r/1573798172-20534-8-git-send-email-cang@xxxxxxxxxxxxxx
    Reviewed-by: Avri Altman <avri.altman@xxxxxxx>
    Reviewed-by: Bean Huo <beanhuo@xxxxxxxxxx>
    Signed-off-by: Subhash Jadavani <subhashj@xxxxxxxxxxxxxx>
    Signed-off-by: Can Guo <cang@xxxxxxxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9feae23bfd09..d25082e573e0 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3684,15 +3684,24 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 			     ktime_to_us(ktime_sub(ktime_get(), start)), ret);
 
 	if (ret) {
+		int err;
+
 		dev_err(hba->dev, "%s: hibern8 enter failed. ret = %d\n",
 			__func__, ret);
 
 		/*
-		 * If link recovery fails then return error so that caller
-		 * don't retry the hibern8 enter again.
+		 * If link recovery fails then return error code returned from
+		 * ufshcd_link_recovery().
+		 * If link recovery succeeds then return -EAGAIN to attempt
+		 * hibern8 enter retry again.
 		 */
-		if (ufshcd_link_recovery(hba))
-			ret = -ENOLINK;
+		err = ufshcd_link_recovery(hba);
+		if (err) {
+			dev_err(hba->dev, "%s: link recovery failed", __func__);
+			ret = err;
+		} else {
+			ret = -EAGAIN;
+		}
 	} else
 		ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_ENTER,
 								POST_CHANGE);
@@ -3706,7 +3715,7 @@ static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 
 	for (retries = UIC_HIBERN8_ENTER_RETRIES; retries > 0; retries--) {
 		ret = __ufshcd_uic_hibern8_enter(hba);
-		if (!ret || ret == -ENOLINK)
+		if (!ret)
 			goto out;
 	}
 out:



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux