Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

From: Stanley Chu
Date: Thu Dec 24 2020 - 02:53:28 EST


Hi Can,

On Thu, 2020-12-24 at 10:21 +0800, Can Guo wrote:
> On 2020-12-23 12:41, Can Guo wrote:
> > On 2020-12-23 12:19, Stanley Chu wrote:
> >> Hi Can,
> >>
> >> On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote:
> >>> On 2020-12-22 15:29, Stanley Chu wrote:
> >>> > Flush during hibern8 is sufficient on MediaTek platforms, thus
> >>> > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling
> >>> > fWriteBoosterBufferFlush during WriteBooster initialization.
> >>> >
> >>> > Signed-off-by: Stanley Chu <stanley.chu@xxxxxxxxxxxx>
> >>> > ---
> >>> > drivers/scsi/ufs/ufs-mediatek.c | 1 +
> >>> > 1 file changed, 1 insertion(+)
> >>> >
> >>> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c
> >>> > b/drivers/scsi/ufs/ufs-mediatek.c
> >>> > index 80618af7c872..c55202b92a43 100644
> >>> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> >>> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> >>> > @@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
> >>> >
> >>> > /* Enable WriteBooster */
> >>> > hba->caps |= UFSHCD_CAP_WB_EN;
> >>> > + hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
> >>> > hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
> >>> >
> >>> > if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
> >>>
> >>> I guess we need it too...
> >>
> >> AHHA, if you decide to add this in your platform too later, maybe we
> >> could change the way it does: Keep manual flush disabled by default
> >> and
> >> remove this quirk.
> >>
> >
> > Yeah... I will get back with an answer later.
>
> Hi Stanley,
>
> Do you see any substantial benefit of having fWriteBoosterBufferFlushEn
> disabled?

1. The definition of fWriteBoosterBufferFlushEn is that host allows
device to do flush in anytime after fWriteBoosterBufferFlushEn is set as
on. This is not what we want.

Just Like BKOP, We do not want flush happening beyond host's expected
timing that device performance may be "randomly" dropped.

2. Another related concern is that currently fWriteBoosterBufferFlushEn
may keep on while device is not in Active Power Mode during suspend
period. I am not sure if such configuration would confuse the device.

Thanks,
Stanley Chu

>
> Thanks,
> Can Guo.
>
> >
> > Thanks,
> >
> > Can Guo.
> >
> >> Thanks,
> >> Stanley Chu
> >>>
> >>> Change LGTM.
> >>>
> >>> Regards,
> >>>
> >>> Can Guo.