Skip to content

Commit 034d319

Browse files
Nitin Rawatmartinkpetersen
authored andcommitted
scsi: ufs: core: Fix interrupt handling for MCQ Mode
Commit 3c7ac40 ("scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler") introduced a regression where the UFS interrupt status register (IS) was not cleared in ufshcd_intr() when operating in MCQ mode. As a result, the IS register remained uncleared. This led to a persistent issue during UIC interrupts: ufshcd_is_auto_hibern8_error() consistently returned true because the UFSHCD_UIC_HIBERN8_MASK bit was set, while the active command was neither UIC_CMD_DME_HIBER_ENTER nor UIC_CMD_DME_HIBER_EXIT. This caused continuous auto hibern8 enter errors and device failed to boot. To fix this, ensure that the interrupt status register is properly cleared in the ufshcd_intr() function for both MCQ mode with ESI enabled. [ 4.553226] ufshcd-qcom 1d84000.ufs: ufshcd_check_errors: Auto Hibern8 Enter failed - status: 0x00000040, upmcrs: 0x00000001 [ 4.553229] ufshcd-qcom 1d84000.ufs: ufshcd_check_errors: saved_err 0x40 saved_uic_err 0x0 [ 4.553311] host_regs: 00000000: d5c7033f 20e0071f 00000400 00000000 [ 4.553312] host_regs: 00000010: 01000000 00010217 00000c96 00000000 [ 4.553314] host_regs: 00000020: 00000440 00170ef5 00000000 00000000 [ 4.553316] host_regs: 00000030: 0000010f 00000001 00000000 00000000 [ 4.553317] host_regs: 00000040: 00000000 00000000 00000000 00000000 [ 4.553319] host_regs: 00000050: fffdf000 0000000f 00000000 00000000 [ 4.553320] host_regs: 00000060: 00000001 80000000 00000000 00000000 [ 4.553322] host_regs: 00000070: fffde000 0000000f 00000000 00000000 [ 4.553323] host_regs: 00000080: 00000001 00000000 00000000 00000000 [ 4.553325] host_regs: 00000090: 00000002 d0020000 00000000 01930200 Fixes: 3c7ac40 ("scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler") Co-developed-by: Palash Kambar <[email protected]> Signed-off-by: Palash Kambar <[email protected]> Signed-off-by: Nitin Rawat <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8650-QRD Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Peter Wang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 383cd6d commit 034d319

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7133,14 +7133,19 @@ static irqreturn_t ufshcd_threaded_intr(int irq, void *__hba)
71337133
static irqreturn_t ufshcd_intr(int irq, void *__hba)
71347134
{
71357135
struct ufs_hba *hba = __hba;
7136+
u32 intr_status, enabled_intr_status;
71367137

71377138
/* Move interrupt handling to thread when MCQ & ESI are not enabled */
71387139
if (!hba->mcq_enabled || !hba->mcq_esi_enabled)
71397140
return IRQ_WAKE_THREAD;
71407141

7142+
intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
7143+
enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
7144+
7145+
ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS);
7146+
71417147
/* Directly handle interrupts since MCQ ESI handlers does the hard job */
7142-
return ufshcd_sl_intr(hba, ufshcd_readl(hba, REG_INTERRUPT_STATUS) &
7143-
ufshcd_readl(hba, REG_INTERRUPT_ENABLE));
7148+
return ufshcd_sl_intr(hba, enabled_intr_status);
71447149
}
71457150

71467151
static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag)

0 commit comments

Comments
 (0)