diff mbox series

[v2,2/2] ufs: core: force reset after mcq abort all

Message ID 20240826034509.17677-3-peter.wang@mediatek.com
State New
Headers show
Series ufs: core: fix err handler mcq abort defect | expand

Commit Message

Peter Wang (王信友) Aug. 26, 2024, 3:45 a.m. UTC
From: Peter Wang <peter.wang@mediatek.com>

In mcq mode gerneal case, cq (head/tail) pointer is same as
sq pointer (head/tail) if the hwq is empty.

But if command send to device and abort it,
no response return and cq point will less than sq.
In this case will have unpredictable error.
This patch force reset for this case.

Below is error log
[   34.976612][    C3] ufshcd-mtk 112b0000.ufshci: OCS error from controller = 3 for tag 19

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

Comments

Bart Van Assche Aug. 27, 2024, 3:55 p.m. UTC | #1
On 8/25/24 8:45 PM, peter.wang@mediatek.com wrote:
> From: Peter Wang <peter.wang@mediatek.com>
> 
> In mcq mode gerneal case, cq (head/tail) pointer is same as

Please capitalize "MCQ" and please fix the spelling of "general".

> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 4bcd4e5b62bd..d9ef8f0279da 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -6519,6 +6519,8 @@ static bool ufshcd_abort_all(struct ufs_hba *hba)
>   	/* Complete the requests that are cleared by s/w */
>   	ufshcd_complete_requests(hba, false);
>   
> +	if (is_mcq_enabled(hba))
> +		return true;
>   	return ret != 0;
>   }

Please add a comment above the new if-test that explains why that code
is present otherwise it will be hard to understand why that statement
has been introduced.

Thanks,

Bart.
Peter Wang (王信友) Aug. 28, 2024, 1:44 p.m. UTC | #2
On Tue, 2024-08-27 at 11:55 -0400, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 8/25/24 8:45 PM, peter.wang@mediatek.com wrote:
> > From: Peter Wang <peter.wang@mediatek.com>
> > 
> > In mcq mode gerneal case, cq (head/tail) pointer is same as
> 
> Please capitalize "MCQ" and please fix the spelling of "general".
> 
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index 4bcd4e5b62bd..d9ef8f0279da 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -6519,6 +6519,8 @@ static bool ufshcd_abort_all(struct ufs_hba
> *hba)
> >   /* Complete the requests that are cleared by s/w */
> >   ufshcd_complete_requests(hba, false);
> >   
> > +if (is_mcq_enabled(hba))
> > +return true;
> >   return ret != 0;
> >   }
> 
> Please add a comment above the new if-test that explains why that
> code
> is present otherwise it will be hard to understand why that statement
> has been introduced.
> 
> Thanks,
> 
> Bart.

Hi Bart,

Sorry, I need to abandon this patch series because I've discovered 
the reason why the aborted command hasn't returned.
And this patch 93e6c0e19d5b ("scsi: ufs: core: Clear cmd if abort
succeeds in MCQ mode")
should reverted.

I will submit another patch to fix this issue.

Thanks.
Peter

>
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 4bcd4e5b62bd..d9ef8f0279da 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -6519,6 +6519,8 @@  static bool ufshcd_abort_all(struct ufs_hba *hba)
 	/* Complete the requests that are cleared by s/w */
 	ufshcd_complete_requests(hba, false);
 
+	if (is_mcq_enabled(hba))
+		return true;
 	return ret != 0;
 }