All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] nvme: Enable FUA
@ 2021-10-19  2:40 Jon Lin
  2021-10-19  2:40 ` [PATCH v3 2/2] nvme: Fix error in nvme_setup_prps Jon Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jon Lin @ 2021-10-19  2:40 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot, xxm, Lin Shawn, zyf, Kever Yang, 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 <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)
+		c.rw.control |= NVME_RW_FUA;
+
 	while (total_lbas) {
 		if (total_lbas < lbas) {
 			lbas = (u16)total_lbas;
-- 
2.17.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-22  1:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v3 1/2] nvme: Enable FUA Bin Meng
2021-11-18 19:14 ` Tom Rini
2021-11-19  0:56   ` Bin Meng
2021-11-19  1:14     ` Tom Rini
2021-11-22  1:41       ` Jon Lin

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.