[PATCH v1] ufs: core: Avoid IRQ thread wakeup during active UIC command

peter.wang at mediatek.com peter.wang at mediatek.com
Tue Mar 3 23:12:45 PST 2026


From: Peter Wang <peter.wang at mediatek.com>

Only return IRQ_WAKE_THREAD when MCQ and ESI are not enabled
and no UIC command is active. Since the default UIC command
timeout is 500ms, handling IRQs in a thread during an active UIC
command can easily lead to timeouts due to delayed processing.

Signed-off-by: Peter Wang <peter.wang at mediatek.com>
---
 drivers/ufs/core/ufshcd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 9908375b2f98..3f18c1a39f27 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -7201,8 +7201,11 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
 	u32 intr_status, enabled_intr_status;
 
 	/* Move interrupt handling to thread when MCQ & ESI are not enabled */
-	if (!hba->mcq_enabled || !hba->mcq_esi_enabled)
-		return IRQ_WAKE_THREAD;
+	if (!hba->mcq_enabled || !hba->mcq_esi_enabled) {
+		/* UIC commands should be processed promptly */
+		if (!hba->active_uic_cmd)
+			return IRQ_WAKE_THREAD;
+	}
 
 	intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
 	enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
-- 
2.45.2




More information about the Linux-mediatek mailing list