From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38E061A680C; Mon, 13 Apr 2026 16:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776098650; cv=none; b=MGCujsCV8kG9oU/X/nQwvjoRa9J7pIVA052caKsb8mMPYU2MaVYeLkovYto4/Qm65N/hcioMm29cD+0LnDtxXHJD6yMJzrVby77gVNhVgVU51NkdbzhFrJGfHCnWfP7E20IJimZlxPoHhTEkfChzYHRlYBHT6zfb+gep2oIXo7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776098650; c=relaxed/simple; bh=kOPw+MXt73mps9WTu/j2bP6eMV3wB1LcS10XwWiz3/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LVevkHnOch20WYTV5PYYiNB794FA3WAhzSLjwGzllJ9hvb7028OfJ68osxbUou6ysPmqWDUoC2VFLdHE/f8ynhMZE1uX9Wp8JV0PAxy77aAykYqwZnBGcAYuLa3vsicWdQi1joZrGZ4uWBUoQJM6x/jo1d2a6DRDHP3f8y1e4Nc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pJywiHhQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pJywiHhQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3894C2BCAF; Mon, 13 Apr 2026 16:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776098650; bh=kOPw+MXt73mps9WTu/j2bP6eMV3wB1LcS10XwWiz3/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJywiHhQ9gVpboLS4vZ1x86xTtorlij7Rku8MM29f93I5cDs+xOnxLl4PhAyE8EOh 4GR3tqTRMJgkoAJgHQU3pQaWyokU4a0Wt49Jlj9xe0cCHsFJvL+aThJzsEoX7bofpB 9sxlcYNKvXwYuaF2PA0n7LVTWscj7znrnQVsUIlE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Wang , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 004/491] scsi: ufs: core: Move link recovery for hibern8 exit failure to wl_resume Date: Mon, 13 Apr 2026 17:54:09 +0200 Message-ID: <20260413155819.215507926@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155819.042779211@linuxfoundation.org> References: <20260413155819.042779211@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Wang [ Upstream commit 62c015373e1cdb1cdca824bd2dbce2dac0819467 ] Move the link recovery trigger from ufshcd_uic_pwr_ctrl() to __ufshcd_wl_resume(). Ensure link recovery is only attempted when hibern8 exit fails during resume, not during hibern8 enter in suspend. Improve error handling and prevent unnecessary link recovery attempts. Fixes: 35dabf4503b9 ("scsi: ufs: core: Use link recovery when h8 exit fails during runtime resume") Signed-off-by: Peter Wang Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/20260223103906.2533654-1-peter.wang@mediatek.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c5f41023c71b8..c7bf0e6bc303d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -3880,14 +3880,6 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) spin_unlock_irqrestore(hba->host->host_lock, flags); mutex_unlock(&hba->uic_cmd_mutex); - /* - * If the h8 exit fails during the runtime resume process, it becomes - * stuck and cannot be recovered through the error handler. To fix - * this, use link recovery instead of the error handler. - */ - if (ret && hba->pm_op_in_progress) - ret = ufshcd_link_recovery(hba); - return ret; } @@ -8727,7 +8719,15 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) } else { dev_err(hba->dev, "%s: hibern8 exit failed %d\n", __func__, ret); - goto vendor_suspend; + /* + * If the h8 exit fails during the runtime resume + * process, it becomes stuck and cannot be recovered + * through the error handler. To fix this, use link + * recovery instead of the error handler. + */ + ret = ufshcd_link_recovery(hba); + if (ret) + goto vendor_suspend; } } else if (ufshcd_is_link_off(hba)) { /* -- 2.51.0