From: Bart Van Assche <bvanassche@acm.org>
To: peter.wang@mediatek.com, linux-scsi@vger.kernel.org,
martin.petersen@oracle.com, avri.altman@wdc.com,
alim.akhtar@samsung.com, jejb@linux.ibm.com
Cc: wsd_upstream@mediatek.com, linux-mediatek@lists.infradead.org,
chun-hung.wu@mediatek.com, alice.chao@mediatek.com,
cc.chou@mediatek.com, chaotian.jing@mediatek.com,
jiajie.hao@mediatek.com, powen.kao@mediatek.com,
qilin.tan@mediatek.com, lin.gui@mediatek.com,
tun-yu.yu@mediatek.com, eddie.huang@mediatek.com,
naomi.chu@mediatek.com, ed.tsai@mediatek.com,
quic_nguyenb@quicinc.com
Subject: Re: [PATCH v9 3/3] ufs: core: add a quirk for MediaTek SDB mode aborted
Date: Wed, 25 Sep 2024 09:56:13 -0700 [thread overview]
Message-ID: <03b34628-d70b-4ce6-ad87-3c2070105bfa@acm.org> (raw)
In-Reply-To: <20240925095546.19492-4-peter.wang@mediatek.com>
On 9/25/24 2:55 AM, peter.wang@mediatek.com wrote:
> From: Peter Wang <peter.wang@mediatek.com>
>
> Because the MediaTek UFS controller uses UTRLCLR to clear commands
> and fills the OCS with ABORTED, this patch introduces a quirk to
> treat ABORTED as INVALID_OCS_VALUE.
>
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> ---
> drivers/ufs/core/ufshcd.c | 5 ++++-
> drivers/ufs/host/ufs-mediatek.c | 1 +
> include/ufs/ufshcd.h | 6 ++++++
> 3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 4fff929b70d6..d429817fca94 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -5404,7 +5404,10 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
> }
> break;
> case OCS_ABORTED:
> - result |= DID_ABORT << 16;
> + if (hba->quirks & UFSHCD_QUIRK_OCS_ABORTED)
> + result |= DID_REQUEUE << 16;
> + else
> + result |= DID_ABORT << 16;
> dev_warn(hba->dev,
> "OCS aborted from controller for tag %d\n",
> lrbp->task_tag);
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
> index 02c9064284e1..8a4c1b8f5a26 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -1021,6 +1021,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
> hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
> hba->quirks |= UFSHCD_QUIRK_MCQ_BROKEN_INTR;
> hba->quirks |= UFSHCD_QUIRK_MCQ_BROKEN_RTC;
> + hba->quirks |= UFSHCD_QUIRK_OCS_ABORTED;
> hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
>
> if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 0fd2aebac728..8f156803d703 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -684,6 +684,12 @@ enum ufshcd_quirks {
> * single doorbell mode.
> */
> UFSHCD_QUIRK_BROKEN_LSDBS_CAP = 1 << 25,
> +
> + /*
> + * Some host controllers set OCS_ABORTED after UTRLCLR (SDB mode),
> + * this quirk is set to treat OCS: ABORTED as INVALID_OCS_VALUE
> + */
> + UFSHCD_QUIRK_OCS_ABORTED = 1 << 26,
> };
>
> enum ufshcd_caps {
ufshcd_transfer_rsp_status() only has one caller, namely
ufshcd_compl_one_cqe(). The previous patch makes sure that that
ufshcd_compl_one_cqe() is not called if a SCSI command is aborted. So
why does this patch modify how OCS_ABORTED is processed? Is this patch
necessary or can it perhaps be dropped?
Thanks,
Bart.
next prev parent reply other threads:[~2024-09-25 16:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 9:55 [PATCH v9 0/3] fix abort defect peter.wang
2024-09-25 9:55 ` [PATCH v9 1/3] ufs: core: fix the issue of ICU failure peter.wang
2024-09-25 9:55 ` [PATCH v9 2/3] ufs: core: fix error handler process for MCQ abort peter.wang
2024-09-25 16:49 ` Bart Van Assche
2024-09-26 3:45 ` Peter Wang (王信友)
2024-09-26 18:26 ` Bart Van Assche
2024-09-27 7:51 ` Peter Wang (王信友)
2024-09-28 23:10 ` Bart Van Assche
2024-09-30 6:45 ` Peter Wang (王信友)
2024-09-30 17:25 ` Bart Van Assche
2024-10-01 7:46 ` Peter Wang (王信友)
2024-09-25 9:55 ` [PATCH v9 3/3] ufs: core: add a quirk for MediaTek SDB mode aborted peter.wang
2024-09-25 16:56 ` Bart Van Assche [this message]
2024-09-26 3:42 ` 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=03b34628-d70b-4ce6-ad87-3c2070105bfa@acm.org \
--to=bvanassche@acm.org \
--cc=alice.chao@mediatek.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=cc.chou@mediatek.com \
--cc=chaotian.jing@mediatek.com \
--cc=chun-hung.wu@mediatek.com \
--cc=ed.tsai@mediatek.com \
--cc=eddie.huang@mediatek.com \
--cc=jejb@linux.ibm.com \
--cc=jiajie.hao@mediatek.com \
--cc=lin.gui@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=naomi.chu@mediatek.com \
--cc=peter.wang@mediatek.com \
--cc=powen.kao@mediatek.com \
--cc=qilin.tan@mediatek.com \
--cc=quic_nguyenb@quicinc.com \
--cc=tun-yu.yu@mediatek.com \
--cc=wsd_upstream@mediatek.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