Skip to contentSkip to conversation

ufs: introduce UFSHCI_QUIRK_SKIP_INTR_AGGR quirk

PATCH Superseded Kiwoong Kim 2 participants 5 messages Nov 8, 2016 – Nov 10, 2016 SCSI

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ufs: introduce UFSHCI_QUIRK_SKIP_INTR_AGGR quirk

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, an interrupt of IO completion of a corresponding task may be missed.
That would cause a command timeout.

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, a competion interrupt of a corresponing task may be issued.
That would casue a command timeout.

---
 drivers/scsi/ufs/ufshcd.c | 4 +++-
 drivers/scsi/ufs/ufshcd.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +3 -1
index c904854..65bbf59 100644
@@ -3730,7 +3730,9 @@ static void ufshcd_transfer_req_compl(struct ufs_hba *hba)
 	 * false interrupt if device completes another request after resetting
 	 * aggregation and before reading the DB.
 	 */
-	if (ufshcd_is_intr_aggr_allowed(hba))
+	if ((ufshcd_is_intr_aggr_allowed(hba))
+		&& !(hba->quirks & UFSHCI_QUIRK_SKIP_INTR_AGGR))
+		ufshcd_reset_intr_aggr(hba);
 		ufshcd_reset_intr_aggr(hba);
 
 	tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
drivers/scsi/ufs/ufshcd.h +1 -0
index 6a96f24..6a9c6e9 100644
@@ -497,6 +497,7 @@ struct ufs_hba {
 	#define UFSHCD_QUIRK_BROKEN_DWORD_UTRD                  UFS_BIT(7)
 	#define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR                UFS_BIT(8)
 	#define UFSHCD_QUIRK_USE_OF_HCE				UFS_BIT(9)
+	#define UFSHCI_QUIRK_SKIP_INTR_AGGR			UFS_BIT(10)
 
 
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec. */
Signature · 1 line
2.1.4
#1 lore raw
Quoted 24 lines · Kiwoong Kim

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, an interrupt of IO completion of a corresponding task may be missed.
That would cause a command timeout.

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, a competion interrupt of a corresponing task may be issued.
That would casue a command timeout.

---
 drivers/scsi/ufs/ufshcd.c | 4 +++-
 drivers/scsi/ufs/ufshcd.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +0 -0
index c904854..65bbf59 100644
@@ -3730,7 +3730,9 @@ static void ufshcd_transfer_req_compl(struct 
 ufs_hba *hba)
 	 * false interrupt if device completes another request after 

resetting

drivers/scsi/ufs/ufshcd.c static void ufshcd_transfer_req_compl(struct ufs_hba *hba) · line 3734

Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +2 -1
 	 * aggregation and before reading the DB.
 	 */
-	if (ufshcd_is_intr_aggr_allowed(hba))
+	if ((ufshcd_is_intr_aggr_allowed(hba))
+		&& !(hba->quirks & UFSHCI_QUIRK_SKIP_INTR_AGGR))

Why do we need this new quirk? If controller has the issue with interrupt aggregation, you can remove this UFSHCD_CAP_INTR_AGGR to disable the aggregation altogether.

Quoted 16 lines
drivers/scsi/ufs/ufshcd.c +1 -0
+		ufshcd_reset_intr_aggr(hba);
 		ufshcd_reset_intr_aggr(hba);
 
 	tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
drivers/scsi/ufs/ufshcd.h +1 -0
index 6a96f24..6a9c6e9 100644
@@ -497,6 +497,7 @@ struct ufs_hba {
 	#define UFSHCD_QUIRK_BROKEN_DWORD_UTRD                  UFS_BIT(7)
 	#define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR                UFS_BIT(8)
 	#define UFSHCD_QUIRK_USE_OF_HCE				UFS_BIT(9)
+	#define UFSHCI_QUIRK_SKIP_INTR_AGGR			UFS_BIT(10)
 
 
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec. */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
Quoted 25 lines
Quoted 25 lines

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, an interrupt of IO completion of a corresponding task may be missed.
That would cause a command timeout.

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, a competion interrupt of a corresponing task may be issued.
That would casue a command timeout.

---
 drivers/scsi/ufs/ufshcd.c | 4 +++-
 drivers/scsi/ufs/ufshcd.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +0 -0
index c904854..65bbf59 100644
@@ -3730,7 +3730,9 @@ static void ufshcd_transfer_req_compl(struct
 ufs_hba *hba)
 	 * false interrupt if device completes another request after

resetting
* aggregation and before reading the DB.

Quoted 8 lines

drivers/scsi/ufs/ufshcd.c static void ufshcd_transfer_req_compl(struct ufs_hba *hba) · line 3734

Quoted 4 lines
drivers/scsi/ufs/ufshcd.c +2 -1
 	 */
-	if (ufshcd_is_intr_aggr_allowed(hba))
+	if ((ufshcd_is_intr_aggr_allowed(hba))
+		&& !(hba->quirks & UFSHCI_QUIRK_SKIP_INTR_AGGR))

Why do we need this new quirk? If controller has the issue with interrupt aggregation, you can remove this UFSHCD_CAP_INTR_AGGR to disable the aggregation altogether.

This fragment doesn't mean disabling interrupt aggregation. It just means that interrupt aggregation logic would not be reset in ISR.

But I think that the name of the quirk doesn't represent the function of it expectedly.
I'll change the name with another one, such as UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR.

Quoted 26 lines
Quoted 10 lines
drivers/scsi/ufs/ufshcd.c +1 -0
+		ufshcd_reset_intr_aggr(hba);
 		ufshcd_reset_intr_aggr(hba);
 
 	tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
drivers/scsi/ufs/ufshcd.h +0 -0
index 6a96f24..6a9c6e9 100644

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 503

Quoted 7 lines
drivers/scsi/ufs/ufshcd.h +1 -0
@@ -497,6 +497,7 @@ struct ufs_hba {
 	#define UFSHCD_QUIRK_BROKEN_DWORD_UTRD                  UFS_BIT(7)
 	#define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR                UFS_BIT(8)
 	#define UFSHCD_QUIRK_USE_OF_HCE				UFS_BIT(9)
+	#define UFSHCI_QUIRK_SKIP_INTR_AGGR			UFS_BIT(10)
 
 
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec.

*/

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 9 lines · Kiwoong Kim
Quoted 9 lines
Quoted 9 lines

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, an interrupt of IO completion of a corresponding task may be missed.
That would cause a command timeout.

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, a competion interrupt of a corresponing task may be issued.
That would casue a command timeout.

Please add how are you fixing the issue in commit text.

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
---
 drivers/scsi/ufs/ufshcd.c | 4 +++-
 drivers/scsi/ufs/ufshcd.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +0 -0
index c904854..65bbf59 100644
@@ -3730,7 +3730,9 @@ static void ufshcd_transfer_req_compl(struct
 ufs_hba *hba)
 	 * false interrupt if device completes another request after

resetting
* aggregation and before reading the DB.

Quoted 8 lines

drivers/scsi/ufs/ufshcd.c static void ufshcd_transfer_req_compl(struct ufs_hba *hba) · line 3734

Quoted 4 lines
drivers/scsi/ufs/ufshcd.c +2 -1
 	 */
-	if (ufshcd_is_intr_aggr_allowed(hba))
+	if ((ufshcd_is_intr_aggr_allowed(hba))
+		&& !(hba->quirks & UFSHCI_QUIRK_SKIP_INTR_AGGR))

Why do we need this new quirk? If controller has the issue with interrupt aggregation, you can remove this UFSHCD_CAP_INTR_AGGR to disable the aggregation altogether.

Quoted 2 lines

This fragment doesn't mean disabling interrupt aggregation. It just means that interrupt aggregation logic would not be reset in ISR.

ok.

Quoted 5 lines

But I think that the name of the quirk doesn't represent the function of it expectedly.
I'll change the name with another one, such as UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR.

May be UFSHCD_QUIRK_BROKEN_INTR_AGGR_RESET ?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/ufs/ufshcd.c +1 -0
+		ufshcd_reset_intr_aggr(hba);
 		ufshcd_reset_intr_aggr(hba);
Quoted 10 lines
Quoted 10 lines

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 500

Quoted 10 lines
drivers/scsi/ufs/ufshcd.c +0 -0
 	tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
drivers/scsi/ufs/ufshcd.h +1 -0
index 6a96f24..6a9c6e9 100644
@@ -497,6 +497,7 @@ struct ufs_hba {
 	#define UFSHCD_QUIRK_BROKEN_DWORD_UTRD                  UFS_BIT(7)
 	#define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR                UFS_BIT(8)
 	#define UFSHCD_QUIRK_USE_OF_HCE				UFS_BIT(9)
+	#define UFSHCI_QUIRK_SKIP_INTR_AGGR			UFS_BIT(10)

Please also add code comments explaining what this quirk means and when should we use it? Please add same for other quirks you introduced in different patches.

Quoted 12 lines
Quoted 12 lines

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 501

Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +0 -0
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec.

*/

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw
In reply to Subhash Jadavani

Hi, Subhash

I'll update this patch referring what you said (including adding comments of other quirks)

Quoted 59 lines
Quoted 24 lines

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, an interrupt of IO completion of a corresponding task may be missed.
That would cause a command timeout.

If UFS driver resets interrupt aggregation timer and counter when there is a pending doorbell, a competion interrupt of a corresponing task may be issued.
That would casue a command timeout.

---
 drivers/scsi/ufs/ufshcd.c | 4 +++-
 drivers/scsi/ufs/ufshcd.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +0 -0
index c904854..65bbf59 100644
@@ -3730,7 +3730,9 @@ static void ufshcd_transfer_req_compl(struct
 ufs_hba *hba)
 	 * false interrupt if device completes another request after

resetting

drivers/scsi/ufs/ufshcd.c static void ufshcd_transfer_req_compl(struct ufs_hba *hba) · line 3734

Quoted 5 lines
drivers/scsi/ufs/ufshcd.c +2 -1
 	 * aggregation and before reading the DB.
 	 */
-	if (ufshcd_is_intr_aggr_allowed(hba))
+	if ((ufshcd_is_intr_aggr_allowed(hba))
+		&& !(hba->quirks & UFSHCI_QUIRK_SKIP_INTR_AGGR))

Why do we need this new quirk? If controller has the issue with interrupt aggregation, you can remove this UFSHCD_CAP_INTR_AGGR to disable the aggregation altogether.

Quoted 9 lines
drivers/scsi/ufs/ufshcd.c +1 -0
+		ufshcd_reset_intr_aggr(hba);
 		ufshcd_reset_intr_aggr(hba);
 
 	tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
drivers/scsi/ufs/ufshcd.h +0 -0
index 6a96f24..6a9c6e9 100644

drivers/scsi/ufs/ufshcd.h struct ufs_hba { · line 503

Quoted 7 lines
drivers/scsi/ufs/ufshcd.h +1 -0
@@ -497,6 +497,7 @@ struct ufs_hba {
 	#define UFSHCD_QUIRK_BROKEN_DWORD_UTRD                  UFS_BIT(7)
 	#define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR                UFS_BIT(8)
 	#define UFSHCD_QUIRK_USE_OF_HCE				UFS_BIT(9)
+	#define UFSHCI_QUIRK_SKIP_INTR_AGGR			UFS_BIT(10)
 
 
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec.

*/

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html