Skip to contentSkip to conversation

ufs: introduce UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR quirk

PATCH Superseded Kiwoong Kim 2 participants 2 messages Nov 15, 2016 SCSI

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ufs: introduce UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR quirk

If UFS driver resets interrupt aggregation timer and counter when there are some pended tasks, an IO competion interrupt of any corresponing task may be issued.
That would casue a command timeout.

One thing you should mind to use interrupt aggreation with this quirk is that the host controller should be able to refresh interrupt aggreation counter or timer in other way, such as doing it automatically when receiving any response.

V2
- modify the commit message
- change the name of the quirk
(s/ UFSHCI_QUIRK_SKIP_INTR_AGGR/UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR)

---
 drivers/scsi/ufs/ufshcd.c | 3 ++-
 drivers/scsi/ufs/ufshcd.h | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +2 -1
index 8aac98f..7b62d8b 100644
@@ -3713,7 +3713,8 @@ 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_RESET_INTR_AGGR))
 		ufshcd_reset_intr_aggr(hba);
 
 	tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
drivers/scsi/ufs/ufshcd.h +7 -0
index dfa17ac..d6861ed 100644
@@ -505,6 +505,13 @@ struct ufs_hba {
 	 */
 	#define UFSHCD_QUIRK_BROKEN_HCE				UFS_BIT(9)
 
+	/*
+	 * This quirk is only not to reset interrupt aggregation logic
+	 * in ISR. The reset can make the host controller miss an event
+	 * of previously completed IO.
+	 */
+	#define UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR		UFS_BIT(10)
+
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec. */
 
 	/* Device deviations from standard UFS device spec. */
Signature · 1 line
2.1.4
#1 lore raw
Quoted 5 lines · Kiwoong Kim

If UFS driver resets interrupt aggregation timer and counter when there are some pended tasks, an IO competion interrupt of any corresponing task may be issued.
That would casue a command timeout.

Quoted 7 lines

One thing you should mind to use interrupt aggreation with this quirk is that the host controller should be able to refresh interrupt aggreation counter or timer in other way, such as doing it automatically when receiving any response.

V2

As Martin mentioned in other email, please separate this version history from commit text with line having "----" before the start of version history. Rest all looks good but i will wait for updated patch fixing above before giving Reviewed-By.

Quoted 44 lines

- modify the commit message
- change the name of the quirk
(s/ UFSHCI_QUIRK_SKIP_INTR_AGGR/UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR)

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

resetting

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_RESET_INTR_AGGR))
 		ufshcd_reset_intr_aggr(hba);
 
 	tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
drivers/scsi/ufs/ufshcd.h +7 -0
index dfa17ac..d6861ed 100644
@@ -505,6 +505,13 @@ struct ufs_hba {
 	 */
 	#define UFSHCD_QUIRK_BROKEN_HCE				UFS_BIT(9)
 
+	/*
+	 * This quirk is only not to reset interrupt aggregation logic
+	 * in ISR. The reset can make the host controller miss an event
+	 * of previously completed IO.
+	 */
+	#define UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR		UFS_BIT(10)
+
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec. */
 
 	/* Device deviations from standard UFS device spec. */
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project