Skip to contentSkip to conversation

Two additional UFS patches

PATCH Applied Bart Van Assche 2 participants 5 messages May 19, 2021 – May 26, 2021 SCSI

lore
Share & tools
lore
#0 lore raw

cover Two additional UFS patches

Hi Martin,

There are two UFS patches in this series. One bug fix and one cleanup patch. Please consider the bug fix for kernel v5.13 and the cleanup patch for kernel v5.14.

Thanks,

Bart.

Bart Van Assche (2):
ufs: Suppress false positive unhandled interrupt messages
ufs: Use designated initializers in ufs_pm_lvl_states[]

 drivers/scsi/ufs/ufshcd.c | 17 +++++++++--------
 drivers/scsi/ufs/ufshcd.h | 14 +++++++-------
 2 files changed, 16 insertions(+), 15 deletions(-)
#1 lore raw

PATCH 1/2 ufs: Suppress false positive unhandled interrupt messages

From ufshcd_transfer_req_compl():
<quote>Resetting interrupt aggregation counters first and reading the DOOR_BELL afterward allows us to handle all the completed requests. In order to prevent other interrupts starvation the DB is read once after reset. The down side of this solution is the possibility of false interrupt if device completes another request after resetting aggregation and before reading the DB.</quote>

This patch prevents that ufshcd_intr() reports a false positive "Unhandled interrupt" message if the above scenario is triggered.

---
 drivers/scsi/ufs/ufshcd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +2 -1
index c541b6953863..d330eae02890 100644
@@ -6454,7 +6454,8 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
 	}
 
 	if (enabled_intr_status && retval == IRQ_NONE &&
-				!ufshcd_eh_in_progress(hba)) {
+	    (!(enabled_intr_status & UTP_TRANSFER_REQ_COMPL) ||
+	     hba->outstanding_reqs) && !ufshcd_eh_in_progress(hba)) {
 		dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x (0x%08x, 0x%08x)\n",
 					__func__,
 					intr_status,
#2 lore raw

PATCH 2/2 ufs: Use designated initializers in ufs_pm_lvl_states[]

In reply to Bart Van Assche

The comments in the enum ufs_pm_level definition are redundant. Remove the comments from the ufs_pm_level enum and use designated initializers in the ufs_pm_lvl_states[] definition instead.

Cc Stanley Chu <[email protected]>
Cc Can Guo <[email protected]>
Cc Bean Huo <[email protected]>
Cc Jaegeuk Kim <[email protected]>
Cc Asutosh Das <[email protected]>
---
 drivers/scsi/ufs/ufshcd.c | 14 +++++++-------
 drivers/scsi/ufs/ufshcd.h | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/scsi/ufs/ufshcd.c +7 -7
index d330eae02890..ed8b570f929c 100644
@@ -162,17 +162,17 @@ enum {
 	((h)->eh_flags &= ~UFSHCD_EH_IN_PROGRESS)
 
 struct ufs_pm_lvl_states ufs_pm_lvl_states[] = {
-	{UFS_ACTIVE_PWR_MODE, UIC_LINK_ACTIVE_STATE},
-	{UFS_ACTIVE_PWR_MODE, UIC_LINK_HIBERN8_STATE},
-	{UFS_SLEEP_PWR_MODE, UIC_LINK_ACTIVE_STATE},
-	{UFS_SLEEP_PWR_MODE, UIC_LINK_HIBERN8_STATE},
-	{UFS_POWERDOWN_PWR_MODE, UIC_LINK_HIBERN8_STATE},
-	{UFS_POWERDOWN_PWR_MODE, UIC_LINK_OFF_STATE},
+	[UFS_PM_LVL_0] = {UFS_ACTIVE_PWR_MODE, UIC_LINK_ACTIVE_STATE},
+	[UFS_PM_LVL_1] = {UFS_ACTIVE_PWR_MODE, UIC_LINK_HIBERN8_STATE},
+	[UFS_PM_LVL_2] = {UFS_SLEEP_PWR_MODE, UIC_LINK_ACTIVE_STATE},
+	[UFS_PM_LVL_3] = {UFS_SLEEP_PWR_MODE, UIC_LINK_HIBERN8_STATE},
+	[UFS_PM_LVL_4] = {UFS_POWERDOWN_PWR_MODE, UIC_LINK_HIBERN8_STATE},
+	[UFS_PM_LVL_5] = {UFS_POWERDOWN_PWR_MODE, UIC_LINK_OFF_STATE},
 	/*
 	 * For DeepSleep, the link is first put in hibern8 and then off.
 	 * Leaving the link in hibern8 is not supported.
 	 */
-	{UFS_DEEPSLEEP_PWR_MODE, UIC_LINK_OFF_STATE},
+	[UFS_PM_LVL_6] = {UFS_DEEPSLEEP_PWR_MODE, UIC_LINK_OFF_STATE},
 };
 
 static inline enum ufs_dev_pwr_mode
drivers/scsi/ufs/ufshcd.h +7 -7
index 0f0e62bfdafd..91f0a8d6d750 100644
@@ -155,13 +155,13 @@ enum uic_link_state {
  * power off.
  */
 enum ufs_pm_level {
-	UFS_PM_LVL_0, /* UFS_ACTIVE_PWR_MODE, UIC_LINK_ACTIVE_STATE */
-	UFS_PM_LVL_1, /* UFS_ACTIVE_PWR_MODE, UIC_LINK_HIBERN8_STATE */
-	UFS_PM_LVL_2, /* UFS_SLEEP_PWR_MODE, UIC_LINK_ACTIVE_STATE */
-	UFS_PM_LVL_3, /* UFS_SLEEP_PWR_MODE, UIC_LINK_HIBERN8_STATE */
-	UFS_PM_LVL_4, /* UFS_POWERDOWN_PWR_MODE, UIC_LINK_HIBERN8_STATE */
-	UFS_PM_LVL_5, /* UFS_POWERDOWN_PWR_MODE, UIC_LINK_OFF_STATE */
-	UFS_PM_LVL_6, /* UFS_DEEPSLEEP_PWR_MODE, UIC_LINK_OFF_STATE */
+	UFS_PM_LVL_0,
+	UFS_PM_LVL_1,
+	UFS_PM_LVL_2,
+	UFS_PM_LVL_3,
+	UFS_PM_LVL_4,
+	UFS_PM_LVL_5,
+	UFS_PM_LVL_6,
 	UFS_PM_LVL_MAX
 };
 
#3 lore raw
In reply to Bart Van Assche

Bart,

Quoted 3 lines

There are two UFS patches in this series. One bug fix and one cleanup patch. Please consider the bug fix for kernel v5.13 and the cleanup patch for kernel v5.14.

Applied patch #2 to 5.14/scsi-staging, thanks!

Minor nit: Please send separate series for separate trees. b4 doesn't deal particularly gracefully with parts of a series ending up in different branches.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw
In reply to Bart Van Assche
Quoted 9 lines · Bart Van Assche

There are two UFS patches in this series. One bug fix and one cleanup patch. Please consider the bug fix for kernel v5.13 and the cleanup patch for kernel v5.14.

Thanks,

Bart.

[...]

Applied to 5.14/scsi-queue, thanks!

[1/2] ufs: Suppress false positive unhandled interrupt messages
(no commit info)
[2/2] ufs: Use designated initializers in ufs_pm_lvl_states[]

      https://git.kernel.org/mkp/scsi/c/e2ac7ab281c0
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering