public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-scsi@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 06/17] scsi: ufs-pci: Fix recovery from hibernate exit errors for Intel controllers
Date: Mon,  4 Jan 2021 19:59:04 -0500	[thread overview]
Message-ID: <20210105005915.3954208-6-sashal@kernel.org> (raw)
In-Reply-To: <20210105005915.3954208-1-sashal@kernel.org>

From: Adrian Hunter <adrian.hunter@intel.com>

[ Upstream commit 044d5bda7117891d6d0d56f2f807b7b11e120abd ]

Intel controllers can end up in an unrecoverable state after a hibernate
exit error unless a full reset and restore is done before anything else.
Force that to happen.

Link: https://lore.kernel.org/r/20201207083120.26732-4-adrian.hunter@intel.com
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/ufs/ufshcd-pci.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index 5d33c39fa82f0..888d8c9ca3a55 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -178,6 +178,23 @@ static int ufs_intel_resume(struct ufs_hba *hba, enum ufs_pm_op op)
 		      REG_UTP_TASK_REQ_LIST_BASE_L);
 	ufshcd_writel(hba, upper_32_bits(hba->utmrdl_dma_addr),
 		      REG_UTP_TASK_REQ_LIST_BASE_H);
+
+	if (ufshcd_is_link_hibern8(hba)) {
+		int ret = ufshcd_uic_hibern8_exit(hba);
+
+		if (!ret) {
+			ufshcd_set_link_active(hba);
+		} else {
+			dev_err(hba->dev, "%s: hibern8 exit failed %d\n",
+				__func__, ret);
+			/*
+			 * Force reset and restore. Any other actions can lead
+			 * to an unrecoverable state.
+			 */
+			ufshcd_set_link_off(hba);
+		}
+	}
+
 	return 0;
 }
 
-- 
2.27.0


  parent reply	other threads:[~2021-01-05  1:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  0:58 [PATCH AUTOSEL 5.10 01/17] workqueue: Kick a worker based on the actual activation of delayed works Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 02/17] scsi: ufs: Fix wrong print message in dev_err() Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 03/17] scsi: ufs: Clear UAC for RPMB after ufshcd resets Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 04/17] scsi: ufs-pci: Fix restore from S4 for Intel controllers Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 05/17] scsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk ->poweroff() Sasha Levin
2021-01-05  0:59 ` Sasha Levin [this message]
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 07/17] scsi: ufs-pci: Enable UFSHCD_CAP_RPM_AUTOSUSPEND for Intel controllers Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 08/17] scsi: block: Introduce BLK_MQ_REQ_PM Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 09/17] scsi: ide: Do not set the RQF_PREEMPT flag for sense requests Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 10/17] scsi: ide: Mark power management requests with RQF_PM instead of RQF_PREEMPT Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 11/17] scsi: scsi_transport_spi: Set RQF_PM for domain validation commands Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 12/17] scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 13/17] local64.h: make <asm/local64.h> mandatory Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 14/17] kdev_t: always inline major/minor helper functions Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 15/17] lib/genalloc: fix the overflow when size is too big Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 16/17] depmod: handle the case of /sbin/depmod without /sbin in PATH Sasha Levin
2021-01-05  0:59 ` [PATCH AUTOSEL 5.10 17/17] scsi: ufs: Clear UAC for FFU and RPMB LUNs Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210105005915.3954208-6-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox