All of lore.kernel.org
 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>,
	xxm@rock-chips.com,  Lin Shawn <shawn.lin@rock-chips.com>,
	zyf@rock-chips.com,  Kever Yang <kever.yang@rock-chips.com>
Subject: Re: [PATCH v3 1/2] nvme: Enable FUA
Date: Wed, 27 Oct 2021 19:51:47 +0800	[thread overview]
Message-ID: <CAEUhbmU02GnqEEfuqNrSj8R5XEZkmkTUaLp1+BMbYQNdzTUZ7A@mail.gmail.com> (raw)
In-Reply-To: <20211019104049.v3.1.Ic581ec99f46b6dfa2e0b1922e670a333ac859e82@changeid>

Hi Jon,

On Tue, Oct 19, 2021 at 10:41 AM Jon Lin <jon.lin@rock-chips.com> wrote:
>
> Most NVME devcies maintain data in internal cache for an uncertain
> 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>
> ---
>
> Changes in v3:
>   Only enable FUA when vwc is enabled
>
>  drivers/nvme/nvme.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> index 3c529a2fce..9623c896a1 100644
> --- a/drivers/nvme/nvme.c
> +++ b/drivers/nvme/nvme.c
> @@ -762,6 +762,10 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr,
>         c.rw.appmask = 0;
>         c.rw.metadata = 0;
>
> +       /* Enable FUA for data integrity if vwc is enabled */
> +       if (dev->vwc)

Still this does not look correct to me.

The dev->vwc field only indicates the presence of the Volatile Write
Cache, but not the enable status of it.

> +               c.rw.control |= NVME_RW_FUA;
> +
>         while (total_lbas) {
>                 if (total_lbas < lbas) {
>                         lbas = (u16)total_lbas;

Regards,
Bin

  parent reply	other threads:[~2021-10-27 11:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19  2:40 [PATCH v3 1/2] nvme: Enable FUA Jon Lin
2021-10-19  2:40 ` [PATCH v3 2/2] nvme: Fix error in nvme_setup_prps Jon Lin
2021-11-18 19:14   ` Tom Rini
2021-10-27 11:51 ` Bin Meng [this message]
2021-11-18 19:14 ` [PATCH v3 1/2] nvme: Enable FUA Tom Rini
2021-11-19  0:56   ` Bin Meng
2021-11-19  1:14     ` Tom Rini
2021-11-22  1:41       ` Jon Lin

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=CAEUhbmU02GnqEEfuqNrSj8R5XEZkmkTUaLp1+BMbYQNdzTUZ7A@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.