u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Jon Lin <jon.lin@rock-chips.com>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	zyf@rock-chips.com,  Kever Yang <kever.yang@rock-chips.com>,
	Lin Shawn <shawn.lin@rock-chips.com>,
	xxm@rock-chips.com
Subject: Re: [PATCH v2 1/2] nvme: Enable FUA
Date: Wed, 29 Sep 2021 11:17:17 +0800	[thread overview]
Message-ID: <CAEUhbmUxdxnt7ZM_SBBUHQAdvnQhBcTPiWdLVuwJcFD8djWwpw@mail.gmail.com> (raw)
In-Reply-To: <20210927212225.v2.1.Ic581ec99f46b6dfa2e0b1922e670a333ac859e82@changeid>

On Mon, Sep 27, 2021 at 9:22 PM Jon Lin <jon.lin@rock-chips.com> wrote:
>
> Most NVME devcies maintain data in internal cache for an uncertain

typo: devices

> times, and u-boot has no method to force NVME to flush cache.
> So this patch adds FUA to avoid data loss caused by power off after data
> programming.
>
> Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
> Reviewed-by: Stefan Agner <stefan@agner.ch>
> ---
>
> (no changes since v1)
>
>  drivers/nvme/nvme.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> index f6465ea7f4..5d05cb6e9e 100644
> --- a/drivers/nvme/nvme.c
> +++ b/drivers/nvme/nvme.c
> @@ -761,6 +761,9 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr,
>         c.rw.appmask = 0;
>         c.rw.metadata = 0;
>
> +       /* Always enable FUA for data integrity */
> +       c.rw.control |= NVME_RW_FUA;

I don't think we should blindly enable FUA, instead we should check
whether the Volatile Write Cache is enabled or not, and if enabled,
set FUA, or just completely disable Volatile Write Cache.

> +
>         while (total_lbas) {
>                 if (total_lbas < lbas) {
>                         lbas = (u16)total_lbas;
> --

Regards,
Bin

      parent reply	other threads:[~2021-09-29  3:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 13:22 [PATCH v2 1/2] nvme: Enable FUA Jon Lin
2021-09-27 13:22 ` [PATCH v2 2/2] nvme: Fix error in nvme_setup_prps Jon Lin
2021-09-28  0:44   ` Shawn Lin
2021-09-28  0:37 ` [PATCH v2 1/2] nvme: Enable FUA Shawn Lin
2021-09-29  3:17 ` Bin Meng [this message]

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=CAEUhbmUxdxnt7ZM_SBBUHQAdvnQhBcTPiWdLVuwJcFD8djWwpw@mail.gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=jon.lin@rock-chips.com \
    --cc=kever.yang@rock-chips.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=u-boot@lists.denx.de \
    --cc=xxm@rock-chips.com \
    --cc=zyf@rock-chips.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).