From: neil.armstrong@linaro.org
To: Nitin Rawat <quic_nitirawa@quicinc.com>,
alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org,
James.Bottomley@HansenPartnership.com, huobean@gmail.com,
mani@kernel.org, martin.petersen@oracle.com, beanhuo@micron.com,
peter.wang@mediatek.com, andre.draszik@linaro.org
Cc: linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Palash Kambar <quic_pkambar@quicinc.com>
Subject: Re: [PATCH V1] ufs: core: Fix interrupt handling for MCQ Mode in ufshcd_intr
Date: Thu, 31 Jul 2025 10:27:51 +0200 [thread overview]
Message-ID: <0f3a7ae4-08a1-401a-a41e-cb8db530de36@linaro.org> (raw)
In-Reply-To: <20250728225711.29273-1-quic_nitirawa@quicinc.com>
On 29/07/2025 00:57, Nitin Rawat wrote:
> Commit 3c7ac40d7322 ("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, the patch ensures 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: 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler")
> Signed-off-by: Palash Kambar <quic_pkambar@quicinc.com>
> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
>
> ---
> drivers/ufs/core/ufshcd.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index fd8015ed36a4..5413464d63c8 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -7145,14 +7145,19 @@ static irqreturn_t ufshcd_threaded_intr(int irq, void *__hba)
> static irqreturn_t ufshcd_intr(int irq, void *__hba)
> {
> struct ufs_hba *hba = __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;
>
> + intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
> + enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
> +
> + ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS);
> +
> /* Directly handle interrupts since MCQ ESI handlers does the hard job */
> - return ufshcd_sl_intr(hba, ufshcd_readl(hba, REG_INTERRUPT_STATUS) &
> - ufshcd_readl(hba, REG_INTERRUPT_ENABLE));
> + return ufshcd_sl_intr(hba, enabled_intr_status);
> }
>
> static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag)
> --
> 2.48.1
>
>
Thanks to [1], I was able to test this change on SM8650-QRD, and it fixed the issue:
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Thanks!
Neil
[1] https://lore.kernel.org/all/20250730082229.23475-1-quic_rdwivedi@quicinc.com/
next prev parent reply other threads:[~2025-07-31 8:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 22:57 Nitin Rawat
2025-07-28 23:41 ` Bart Van Assche
2025-07-29 14:37 ` Nitin Rawat
2025-07-29 16:24 ` Bart Van Assche
2025-07-30 6:41 ` Peter Wang (王信友)
2025-07-30 16:04 ` Bart Van Assche
2025-07-31 9:22 ` Peter Wang (王信友)
2025-07-31 8:27 ` neil.armstrong [this message]
2025-08-06 1:54 ` Martin K. Petersen
2025-07-31 16:52 ` Bart Van Assche
2025-08-01 7:31 ` Peter Wang (王信友)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0f3a7ae4-08a1-401a-a41e-cb8db530de36@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=huobean@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_pkambar@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®