From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBCDDC433F5 for ; Tue, 28 Sep 2021 01:05:12 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5082611CE for ; Tue, 28 Sep 2021 01:05:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C5082611CE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5ADFB83135; Tue, 28 Sep 2021 03:04:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 68D7082D1C; Tue, 28 Sep 2021 02:37:33 +0200 (CEST) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B87C880C58 for ; Tue, 28 Sep 2021 02:37:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=shawn.lin@rock-chips.com Received: from localhost (unknown [192.168.167.16]) by regular1.263xmail.com (Postfix) with ESMTP id 79B721E24; Tue, 28 Sep 2021 08:37:24 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from [172.16.12.69] (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P13673T140479970662144S1632789444131878_; Tue, 28 Sep 2021 08:37:24 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: shawn.lin@rock-chips.com X-SENDER: lintao@rock-chips.com X-LOGIN-NAME: shawn.lin@rock-chips.com X-FST-TO: xxm@rock-chips.com X-RCPT-COUNT: 7 X-LOCAL-RCPT-COUNT: 5 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: <64865abee38843c6252b69babcef692f> X-System-Flag: 0 Cc: shawn.lin@rock-chips.com, u-boot@lists.denx.de, zyf@rock-chips.com, Kever Yang , xxm@rock-chips.com Subject: Re: [PATCH v2 1/2] nvme: Enable FUA To: Jon Lin , Bin Meng References: <20210927212225.v2.1.Ic581ec99f46b6dfa2e0b1922e670a333ac859e82@changeid> From: Shawn Lin Message-ID: Date: Tue, 28 Sep 2021 08:37:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210927212225.v2.1.Ic581ec99f46b6dfa2e0b1922e670a333ac859e82@changeid> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Tue, 28 Sep 2021 03:03:56 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean ÔÚ 2021/9/27 21:22, Jon Lin дµÀ: > 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 > Reviewed-by: Stefan Agner This sounds reasonable, so FWIW: Shawn Lin > --- > > (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; > + > while (total_lbas) { > if (total_lbas < lbas) { > lbas = (u16)total_lbas; >