linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bean Huo <huobean@gmail.com>
To: Stanley Chu <stanley.chu@mediatek.com>,
	linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
	avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com
Cc: beanhuo@micron.com, asutoshd@codeaurora.org, cang@codeaurora.org,
	matthias.bgg@gmail.com, bvanassche@acm.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kuohong.wang@mediatek.com,
	peter.wang@mediatek.com, chun-hung.wu@mediatek.com,
	andy.teng@mediatek.com, chaotian.jing@mediatek.com,
	cc.chou@mediatek.com, jiajie.hao@mediatek.com,
	alice.chao@mediatek.com
Subject: Re: [PATCH] scsi: ufs: Enable WB flush during suspend only if WB is enabled
Date: Mon, 07 Dec 2020 11:59:31 +0100	[thread overview]
Message-ID: <062aa9e8f37c2e50032241ff8ddc1dcbc8051ba9.camel@gmail.com> (raw)
In-Reply-To: <20201207055006.24471-1-stanley.chu@mediatek.com>

On Mon, 2020-12-07 at 13:50 +0800, Stanley Chu wrote:
> WriteBootser flush during suspend is not necessary to be enabled if
> WriteBooster feature is disabled. Simply adding a check to prevent
> unexpected power drain.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 4879e87577e1..89fa8b9ac11d 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -5458,7 +5458,7 @@ static bool ufshcd_wb_need_flush(struct ufs_hba
> *hba)
>         u32 avail_buf;
>         u8 index;
>  
> -       if (!ufshcd_is_wb_allowed(hba))
> +       if (!ufshcd_is_wb_allowed(hba) || !hba->wb_enabled)
>                 return false;
>         /*
>          * The ufs device needs the vcc to be ON to flush.


Hi Stanley

In the 3.1 Spec:

"If the fWriteBoosterEn flag is set to zero, data written to any
logical unit is written in normal storage.
If the fWriteBoosterEn flag is set to one and the device is configured
in “shared buffer” mode, data written to any logical unit is written in
the shared WriteBooster Buffer."

so, IMO, fWriteBoosterEn is independant with WB buffer flush.

as for the flush:

"There are two methods for flushing data from the WriteBooster Buffer
to the normal storage: one is using an explicit flush command, the
other enabling the flushing during link hibernate state. If the
fWriteBoosterBufferFlushEn flag is set to one, the device shall flush
the data stored in the WriteBooster Buffer to the normal storage. If
fWriteBoosterBufferFlushDuringHibernate is set to one, the device
flushes the WriteBooster Buffer data automatically whenever the link
enters the hibernate (HIBERN8) state."

IMO, for the flush, it is controlled by fWriteBoosterBufferFlushEn and
fWriteBoosterBufferFlushDuringHibernate.

how do you understand the above two paragraphs from Spec?


thanks,
Bean



  reply	other threads:[~2020-12-07 11:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  5:50 [PATCH] scsi: ufs: Enable WB flush during suspend only if WB is enabled Stanley Chu
2020-12-07 10:59 ` Bean Huo [this message]
2020-12-07 13:43   ` Stanley Chu

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=062aa9e8f37c2e50032241ff8ddc1dcbc8051ba9.camel@gmail.com \
    --to=huobean@gmail.com \
    --cc=alice.chao@mediatek.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andy.teng@mediatek.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=cc.chou@mediatek.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=chun-hung.wu@mediatek.com \
    --cc=jejb@linux.ibm.com \
    --cc=jiajie.hao@mediatek.com \
    --cc=kuohong.wang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthias.bgg@gmail.com \
    --cc=peter.wang@mediatek.com \
    --cc=stanley.chu@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;
as well as URLs for NNTP newsgroup(s).