* [PATCH v2 0/6] nvme: few fixups
@ 2026-05-29 3:44 dmukhin
2026-05-29 3:44 ` [PATCH v2 1/6] drivers: nvme: Log I/O timeouts dmukhin
` (8 more replies)
0 siblings, 9 replies; 21+ messages in thread
From: dmukhin @ 2026-05-29 3:44 UTC (permalink / raw)
To: u-boot; +Cc: neil.armstrong, sjg, trini, dmukhin
The series adds few fixes for NVMe subsystem.
Patch 1 adds logline for tracing misbehaving NVMe drives.
Patch 2 adds plumbing for blk_flush()/blk_dflush().
Patch 3 introduces NVMe flush command.
Patch 4 enables `flush` for the currently selected block device.
Patch 5 makes nvme_shutdown() symbol public to enable use of it from
board_quiesce_devices()
Patch 6 tiny fixup for QEMU command for manual NVMe tests.
Denis Mukhin (6):
drivers: nvme: Log I/O timeouts
drivers: block: Introduce blk_flush()/blk_dflush()
drivers: nvme: Implement flush command
cmd: Add flush support for all blk devices
drivers: nvme: Export nvme_shutdown()
docs: nvme: Update QEMU command for testing
cmd/blk_common.c | 14 ++++++++++++++
cmd/ide.c | 1 +
cmd/nvme.c | 1 +
cmd/pvblock.c | 1 +
cmd/sata.c | 1 +
cmd/scsi.c | 1 +
cmd/usb.c | 1 +
cmd/virtio.c | 1 +
disk/disk-uclass.c | 6 ++++++
doc/develop/driver-model/nvme.rst | 2 +-
drivers/block/blk-uclass.c | 18 ++++++++++++++++++
drivers/nvme/nvme.c | 24 +++++++++++++++++++++++-
drivers/nvme/nvme.h | 7 -------
include/blk.h | 28 ++++++++++++++++++++++++++++
include/nvme.h | 11 +++++++++++
include/part.h | 8 ++++++++
16 files changed, 116 insertions(+), 9 deletions(-)
--
2.54.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 1/6] drivers: nvme: Log I/O timeouts
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
@ 2026-05-29 3:44 ` dmukhin
2026-05-29 9:56 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 2/6] drivers: block: Introduce blk_flush()/blk_dflush() dmukhin
` (7 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: dmukhin @ 2026-05-29 3:44 UTC (permalink / raw)
To: u-boot; +Cc: neil.armstrong, sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Current code silently swallows any timed-out commands scheduled
to NVMe. Log those to be able to debug any potential problems with
the NVMe hardware/firmware.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Changes since v1:
- added Neil's R-b
---
drivers/nvme/nvme.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index 0631b190b978..c3c44e50f19a 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -182,8 +182,10 @@ static int nvme_submit_sync_cmd(struct nvme_queue *nvmeq,
if ((status & 0x01) == phase)
break;
if (timeout_us > 0 && (timer_get_us() - start_time)
- >= timeout_us)
+ >= timeout_us) {
+ pr_warn("nvme: cmd %#x timed out\n", cmd->common.command_id);
return -ETIMEDOUT;
+ }
}
ops = (struct nvme_ops *)nvmeq->dev->udev->driver->ops;
--
2.54.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 2/6] drivers: block: Introduce blk_flush()/blk_dflush()
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
2026-05-29 3:44 ` [PATCH v2 1/6] drivers: nvme: Log I/O timeouts dmukhin
@ 2026-05-29 3:44 ` dmukhin
2026-05-29 9:57 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 3/6] drivers: nvme: Implement flush command dmukhin
` (6 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: dmukhin @ 2026-05-29 3:44 UTC (permalink / raw)
To: u-boot; +Cc: neil.armstrong, sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Add generic flush operations for committing dirty data to the storage
device.
This provides a common block-layer interface for flushing pending
writes, allowing callers to ensure that data buffered by the block
device or its backing implementation is written out to the underlying
storage.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v1:
- new patch
---
disk/disk-uclass.c | 6 ++++++
drivers/block/blk-uclass.c | 18 ++++++++++++++++++
include/blk.h | 28 ++++++++++++++++++++++++++++
include/part.h | 8 ++++++++
4 files changed, 60 insertions(+)
diff --git a/disk/disk-uclass.c b/disk/disk-uclass.c
index ee3cc4407d76..1a87f7dffa7c 100644
--- a/disk/disk-uclass.c
+++ b/disk/disk-uclass.c
@@ -122,6 +122,11 @@ unsigned long disk_blk_erase(struct udevice *dev, lbaint_t start,
blkcnt);
}
+unsigned long disk_blk_flush(struct udevice *dev)
+{
+ return blk_flush(dev_get_parent(dev));
+}
+
UCLASS_DRIVER(partition) = {
.id = UCLASS_PARTITION,
.per_device_plat_auto = sizeof(struct disk_part),
@@ -132,6 +137,7 @@ static const struct blk_ops blk_part_ops = {
.read = disk_blk_read,
.write = disk_blk_write,
.erase = disk_blk_erase,
+ .flush = disk_blk_flush,
};
U_BOOT_DRIVER(blk_partition) = {
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 73c24fd91763..0be1fdab1ba5 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -514,6 +514,19 @@ long blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
return ops->erase(dev, start, blkcnt);
}
+long blk_flush(struct udevice *dev)
+{
+ struct blk_desc *desc = dev_get_uclass_plat(dev);
+ const struct blk_ops *ops = blk_get_ops(dev);
+
+ if (!ops->flush)
+ return -ENOSYS;
+
+ blkcache_invalidate(desc->uclass_id, desc->devnum);
+
+ return ops->flush(dev);
+}
+
ulong blk_dread(struct blk_desc *desc, lbaint_t start, lbaint_t blkcnt,
void *buffer)
{
@@ -531,6 +544,11 @@ ulong blk_derase(struct blk_desc *desc, lbaint_t start, lbaint_t blkcnt)
return blk_erase(desc->bdev, start, blkcnt);
}
+ulong blk_dflush(struct blk_desc *desc)
+{
+ return blk_flush(desc->bdev);
+}
+
int blk_find_from_parent(struct udevice *parent, struct udevice **devp)
{
struct udevice *dev;
diff --git a/include/blk.h b/include/blk.h
index 8d1b70cabd31..98e1db7a58f1 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -99,6 +99,7 @@ struct blk_desc {
unsigned long (*block_erase)(struct blk_desc *block_dev,
lbaint_t start,
lbaint_t blkcnt);
+ unsigned long (*block_flush)(struct blk_desc *block_dev);
void *priv; /* driver private struct pointer */
#endif
};
@@ -275,6 +276,14 @@ struct blk_ops {
*/
int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state);
#endif /* CONFIG_BOUNCE_BUFFER */
+
+ /**
+ * flush() - commit all dirty data to storage
+ *
+ * @dev: Device to flush
+ * @return 0 if OK, -ve on error
+ */
+ unsigned long (*flush)(struct udevice *dev);
};
#if CONFIG_IS_ENABLED(BLK)
@@ -291,6 +300,7 @@ unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt, const void *buffer);
unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start,
lbaint_t blkcnt);
+unsigned long blk_dflush(struct blk_desc *block_dev);
#endif /* BLK */
@@ -331,6 +341,14 @@ long blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
*/
long blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
+/**
+ * blk_flush() - Commit data to a block device
+ *
+ * @dev: Device to flush
+ * @return 0 if operation succeeded, or -ve on error.
+ */
+long blk_flush(struct udevice *dev);
+
/**
* blk_find_device() - Find a block device
*
@@ -559,6 +577,16 @@ static inline ulong blk_derase(struct blk_desc *block_dev, lbaint_t start,
return block_dev->block_erase(block_dev, start, blkcnt);
}
+static inline ulong blk_dflush(struct blk_desc *block_dev)
+{
+ if (!block_dev->block_flush)
+ return -ENOSYS;
+
+ blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);
+
+ return block_dev->block_flush(block_dev);
+}
+
/**
* struct blk_driver - Driver for block interface types
*
diff --git a/include/part.h b/include/part.h
index 15daacd7faaa..63982d7b9370 100644
--- a/include/part.h
+++ b/include/part.h
@@ -454,6 +454,14 @@ ulong disk_blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
*/
ulong disk_blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
+/**
+ * disk_blk_flush() - commit data to a disk
+ *
+ * @dev: Device to flush
+ * Return: 0 success, or -ve error number (see the IS_ERR_VALUE() macro
+ */
+ulong disk_blk_flush(struct udevice *dev);
+
/*
* We don't support printing partition information in SPL and only support
* getting partition information in a few cases.
--
2.54.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 3/6] drivers: nvme: Implement flush command
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
2026-05-29 3:44 ` [PATCH v2 1/6] drivers: nvme: Log I/O timeouts dmukhin
2026-05-29 3:44 ` [PATCH v2 2/6] drivers: block: Introduce blk_flush()/blk_dflush() dmukhin
@ 2026-05-29 3:44 ` dmukhin
2026-05-29 9:57 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 4/6] cmd: Add flush support for all blk devices dmukhin
` (5 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: dmukhin @ 2026-05-29 3:44 UTC (permalink / raw)
To: u-boot; +Cc: neil.armstrong, sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Implement the NVM flush command (opcode 0x00) to allow callers to
synchronize any buffered data with the backing NVMe storage.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v1:
- moved generic disk_blk_flush() to a separate patch
---
drivers/nvme/nvme.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index c3c44e50f19a..d9f099a11593 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -819,9 +819,29 @@ static ulong nvme_blk_write(struct udevice *udev, lbaint_t blknr,
return nvme_blk_rw(udev, blknr, blkcnt, (void *)buffer, false);
}
+/*
+ * NVM Flush command (opcode 0x00).
+ *
+ * Applies to a single namespace; the controller must commit all dirty
+ * data for that namespace to storage before completing the command.
+ */
+static ulong nvme_blk_flush(struct udevice *udev)
+{
+ struct nvme_ns *ns = dev_get_priv(udev);
+ struct nvme_dev *dev = ns->dev;
+ struct nvme_command c;
+
+ memset(&c, 0, sizeof(c));
+ c.common.opcode = nvme_cmd_flush;
+ c.common.nsid = cpu_to_le32(ns->ns_id);
+
+ return nvme_submit_sync_cmd(dev->queues[NVME_IO_Q], &c, NULL, IO_TIMEOUT);
+}
+
static const struct blk_ops nvme_blk_ops = {
.read = nvme_blk_read,
.write = nvme_blk_write,
+ .flush = nvme_blk_flush,
};
U_BOOT_DRIVER(nvme_blk) = {
--
2.54.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 4/6] cmd: Add flush support for all blk devices
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
` (2 preceding siblings ...)
2026-05-29 3:44 ` [PATCH v2 3/6] drivers: nvme: Implement flush command dmukhin
@ 2026-05-29 3:44 ` dmukhin
2026-05-29 9:57 ` Simon Glass
2026-06-03 17:43 ` Sean Anderson
2026-05-29 3:44 ` [PATCH v2 5/6] drivers: nvme: Export nvme_shutdown() dmukhin
` (4 subsequent siblings)
8 siblings, 2 replies; 21+ messages in thread
From: dmukhin @ 2026-05-29 3:44 UTC (permalink / raw)
To: u-boot; +Cc: neil.armstrong, sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Introduce `flush` subcommand for all blk devices to allow committing
dirty data explicitly to the given block device.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v1:
- updated commit message
- updated blk commands to enable flush
---
cmd/blk_common.c | 14 ++++++++++++++
cmd/ide.c | 1 +
cmd/nvme.c | 1 +
cmd/pvblock.c | 1 +
cmd/sata.c | 1 +
cmd/scsi.c | 1 +
cmd/usb.c | 1 +
cmd/virtio.c | 1 +
8 files changed, 21 insertions(+)
diff --git a/cmd/blk_common.c b/cmd/blk_common.c
index 56529702a470..d3b00e10f17c 100644
--- a/cmd/blk_common.c
+++ b/cmd/blk_common.c
@@ -37,6 +37,20 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
printf("\nno %s partition table available\n",
if_name);
return CMD_RET_SUCCESS;
+ } else if (strncmp(argv[1], "flush", 5) == 0) {
+ struct blk_desc *desc;
+ int ret;
+
+ ret = blk_get_desc(uclass_id, *cur_devnump, &desc);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ if (blk_dflush(desc)) {
+ printf("\nfailed to flush device %s\n", if_name);
+ return CMD_RET_FAILURE;
+ }
+
+ return CMD_RET_SUCCESS;
}
return CMD_RET_USAGE;
case 3:
diff --git a/cmd/ide.c b/cmd/ide.c
index f99fb6f58246..16833e30319c 100644
--- a/cmd/ide.c
+++ b/cmd/ide.c
@@ -63,6 +63,7 @@ U_BOOT_CMD(ide, 5, 1, do_ide,
"IDE sub-system",
"reset - reset IDE controller\n"
"ide info - show available IDE devices\n"
+ "ide flush - commit all dirty data to the current IDE device\n"
"ide device [dev] - show or set current device\n"
"ide part [dev] - print partition table of one or all IDE devices\n"
"ide read addr blk# cnt\n"
diff --git a/cmd/nvme.c b/cmd/nvme.c
index f2c9acba5c32..dbccb69042bc 100644
--- a/cmd/nvme.c
+++ b/cmd/nvme.c
@@ -47,6 +47,7 @@ U_BOOT_CMD(
"scan - scan NVMe devices\n"
"nvme detail - show details of current NVMe device\n"
"nvme info - show all available NVMe devices\n"
+ "nvme flush - commit all dirty data to the current NVMe device\n"
"nvme device [dev] - show or set current NVMe device\n"
"nvme part [dev] - print partition table of one or all NVMe devices\n"
"nvme read addr blk# cnt - read `cnt' blocks starting at block\n"
diff --git a/cmd/pvblock.c b/cmd/pvblock.c
index 3a83ac9cd92c..5e4a98a6b13b 100644
--- a/cmd/pvblock.c
+++ b/cmd/pvblock.c
@@ -20,6 +20,7 @@ int do_pvblock(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
U_BOOT_CMD(pvblock, 5, 1, do_pvblock,
"Xen para-virtualized block device",
"info - show available block devices\n"
+ "pvblock flush - commit all dirty data to the current device\n"
"pvblock device [dev] - show or set current device\n"
"pvblock part [dev] - print partition table of one or all devices\n"
"pvblock read addr blk# cnt\n"
diff --git a/cmd/sata.c b/cmd/sata.c
index 8b923f9378b2..417e027cba4f 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -119,6 +119,7 @@ U_BOOT_CMD(
"init - init SATA sub system\n"
"sata stop [dev] - disable SATA sub system or device\n"
"sata info - show available SATA devices\n"
+ "sata flush - commit all dirty data to the current SATA device\n"
"sata device [dev] - show or set current device\n"
"sata part [dev] - print partition table\n"
"sata read addr blk# cnt\n"
diff --git a/cmd/scsi.c b/cmd/scsi.c
index ad7d8a4b6644..39be208f337a 100644
--- a/cmd/scsi.c
+++ b/cmd/scsi.c
@@ -47,6 +47,7 @@ U_BOOT_CMD(
"SCSI sub-system",
"scsi info - show available SCSI devices\n"
"scsi scan - (re-)scan SCSI bus\n"
+ "scsi flush - commit all dirty data to the current SCSI device\n"
"scsi device [dev] - show or set current device\n"
"scsi part [dev] - print partition table of one or all SCSI devices\n"
"scsi read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
diff --git a/cmd/usb.c b/cmd/usb.c
index 13a2996c1f00..3e156f54c50b 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -706,6 +706,7 @@ U_BOOT_CMD(
" Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]\n"
#ifdef CONFIG_USB_STORAGE
"usb storage - show details of USB storage devices\n"
+ "usb flush - commit all dirty data to the current USB storage\n"
"usb dev [dev] - show or set current USB storage device\n"
"usb part [dev] - print partition table of one or all USB storage"
" devices\n"
diff --git a/cmd/virtio.c b/cmd/virtio.c
index a42a563ab727..94f1e82cc902 100644
--- a/cmd/virtio.c
+++ b/cmd/virtio.c
@@ -44,6 +44,7 @@ U_BOOT_CMD(
"virtio block devices sub-system",
"scan - initialize virtio bus\n"
"virtio info - show all available virtio block devices\n"
+ "virtio flush - commit all dirty data to the current virtio block device\n"
"virtio device [dev] - show or set current virtio block device\n"
"virtio part [dev] - print partition table of one or all virtio block devices\n"
"virtio read addr blk# cnt - read `cnt' blocks starting at block\n"
--
2.54.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 5/6] drivers: nvme: Export nvme_shutdown()
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
` (3 preceding siblings ...)
2026-05-29 3:44 ` [PATCH v2 4/6] cmd: Add flush support for all blk devices dmukhin
@ 2026-05-29 3:44 ` dmukhin
2026-05-29 9:57 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 6/6] docs: nvme: Update QEMU command for testing dmukhin
` (3 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: dmukhin @ 2026-05-29 3:44 UTC (permalink / raw)
To: u-boot; +Cc: neil.armstrong, sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Make nvme_shutdown() public so that it can be re-used in
board-specific board_quiesce_devices() before OS hand-off.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v1:
- n/a
---
drivers/nvme/nvme.h | 7 -------
include/nvme.h | 11 +++++++++++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h
index bc1d612dde40..25a8b0b17772 100644
--- a/drivers/nvme/nvme.h
+++ b/drivers/nvme/nvme.h
@@ -698,11 +698,4 @@ struct nvme_ops {
*/
int nvme_init(struct udevice *udev);
-/**
- * nvme_shutdown() - Shutdown NVM Express device
- * @udev: The NVM Express device
- * Return: 0 if OK, -ve on error
- */
-int nvme_shutdown(struct udevice *udev);
-
#endif /* __DRIVER_NVME_H__ */
diff --git a/include/nvme.h b/include/nvme.h
index 2cdf8ce320c1..c7b301300097 100644
--- a/include/nvme.h
+++ b/include/nvme.h
@@ -90,4 +90,15 @@ int nvme_print_info(struct udevice *udev);
*/
int nvme_get_namespace_id(struct udevice *udev, u32 *ns_id, u8 *eui64);
+/**
+ * nvme_shutdown() - Shutdown NVM Express device
+ *
+ * Must be called before booting an OS to ensure cache is flushed
+ * and the controller is in a clean state for OS to re-initialize.
+ *
+ * @udev: The NVM Express device
+ * Return: 0 if OK, -ve on error
+ */
+int nvme_shutdown(struct udevice *udev);
+
#endif /* __NVME_H__ */
--
2.54.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 6/6] docs: nvme: Update QEMU command for testing
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
` (4 preceding siblings ...)
2026-05-29 3:44 ` [PATCH v2 5/6] drivers: nvme: Export nvme_shutdown() dmukhin
@ 2026-05-29 3:44 ` dmukhin
2026-05-29 9:58 ` Simon Glass
2026-05-29 9:58 ` [v2,0/6] nvme: few fixups Simon Glass
` (2 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: dmukhin @ 2026-05-29 3:44 UTC (permalink / raw)
To: u-boot; +Cc: neil.armstrong, sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Switch to x86-64 QEMU machine for NVMe testing in the docs.
Also, add `format=raw` for empty NVMe disks QEMU command line.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v1:
- n/a
---
doc/develop/driver-model/nvme.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/develop/driver-model/nvme.rst b/doc/develop/driver-model/nvme.rst
index 755181331213..0e0624925e0d 100644
--- a/doc/develop/driver-model/nvme.rst
+++ b/doc/develop/driver-model/nvme.rst
@@ -95,4 +95,4 @@ Example command line to call QEMU x86 below with emulated NVMe device:
.. code-block:: bash
- $ ./qemu-system-i386 -drive file=nvme.img,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom
+ $ qemu-system-x86_64 -nographic -drive file=nvme.img,format=raw,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom
--
2.54.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/6] drivers: nvme: Log I/O timeouts
2026-05-29 3:44 ` [PATCH v2 1/6] drivers: nvme: Log I/O timeouts dmukhin
@ 2026-05-29 9:56 ` Simon Glass
0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2026-05-29 9:56 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, neil.armstrong, sjg, trini
Hi Denis,
On 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> drivers: nvme: Log I/O timeouts
>
> Current code silently swallows any timed-out commands scheduled
> to NVMe. Log those to be able to debug any potential problems with
> the NVMe hardware/firmware.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
>
> drivers/nvme/nvme.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> @@ -179,8 +179,10 @@ static int nvme_submit_sync_cmd(struct nvme_queue *nvmeq,
> if ((status & 0x01) == phase)
> break;
> if (timeout_us > 0 && (timer_get_us() - start_time)
> - >= timeout_us)
> + >= timeout_us) {
> + pr_warn("nvme: cmd %#x timed out\n", cmd->common.command_id);
> + return -ETIMEDOUT;
> + }
Reviewed-by: Simon Glass <sjg@chromium.org>
A few suggestions:
- command_id is just an incrementing sequence (see nvme_get_cmd_id()),
so on its own it tells you very little. How about logging
cmd->common.opcode as well - that identifies the command type and is
the useful bit for debugging.
- With multiple NVMe controllers this message won't say which one
stalled. Since nvmeq->dev->udev is to hand, dev_warn() would be more
informative than pr_warn(), and would drop the need for the 'nvme: '
prefix. Or you could use log_warning() and print out what you want
- The new line is ~85 columns; please wrap it.
Regards,
Simon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 2/6] drivers: block: Introduce blk_flush()/blk_dflush()
2026-05-29 3:44 ` [PATCH v2 2/6] drivers: block: Introduce blk_flush()/blk_dflush() dmukhin
@ 2026-05-29 9:57 ` Simon Glass
0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2026-05-29 9:57 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, neil.armstrong, sjg, trini
uHi Denis,
On 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> drivers: block: Introduce blk_flush()/blk_dflush()
>
> Add generic flush operations for committing dirty data to the storage
> device.
>
> This provides a common block-layer interface for flushing pending
> writes, allowing callers to ensure that data buffered by the block
> device or its backing implementation is written out to the underlying
> storage.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> disk/disk-uclass.c | 6 ++++++
> drivers/block/blk-uclass.c | 18 ++++++++++++++++++
> include/blk.h | 28 ++++++++++++++++++++++++++++
> include/part.h | 8 ++++++++
> 4 files changed, 60 insertions(+)
> diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> @@ -514,6 +514,19 @@ long blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
> +long blk_flush(struct udevice *dev)
> +{
> + struct blk_desc *desc = dev_get_uclass_plat(dev);
> + const struct blk_ops *ops = blk_get_ops(dev);
> +
> + if (!ops->flush)
> + return -ENOSYS;
> +
> + blkcache_invalidate(desc->uclass_id, desc->devnum);
> +
> + return ops->flush(dev);
> +}
Why invalidate the read cache here? Flush pushes dirty data down to
the media; it doesn't change what a subsequent read returns, so the
cached contents are still valid. Erase/write mutate device state, but
flush does not. Please drop the blkcache_invalidate() call (and the
matching one in the non-DM inline below).
> diff --git a/include/blk.h b/include/blk.h
> @@ -99,6 +99,7 @@ struct blk_desc {
> unsigned long (*block_erase)(struct blk_desc *block_dev,
> lbaint_t start,
> lbaint_t blkcnt);
> + unsigned long (*block_flush)(struct blk_desc *block_dev);
This field lives in the !CONFIG_BLK (legacy) branch, but no legacy
driver in the series wires it up. The only consumer (NVMe) is DM-only.
Are you going to need the legacy plumbing?
> diff --git a/include/blk.h b/include/blk.h
> @@ -275,6 +276,14 @@ struct blk_ops {
> + /**
> + * flush() - commit all dirty data to storage
> + *
> + * @dev: Device to flush
> + * @return 0 if OK, -ve on error
> + */
> + unsigned long (*flush)(struct udevice *dev);
> };
Two small things: stray double space after the dash (flush() -
commit), and please place this next to .erase so the
read/write/erase/flush group is together.
> diff --git a/include/part.h b/include/part.h
> @@ -454,6 +454,14 @@ ulong disk_blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
> +/**
> + * disk_blk_flush() - commit data to a disk
> + *
> + * @dev: Device to flush
> + * Return: 0 success, or -ve error number (see the IS_ERR_VALUE() macro
> + */
> +ulong disk_blk_flush(struct udevice *dev);
Missing closing parenthesis after IS_ERR_VALUE() macro.
> diff --git a/disk/disk-uclass.c b/disk/disk-uclass.c
> @@ -122,6 +122,11 @@ unsigned long disk_blk_erase(struct udevice *dev, lbaint_t start,
> +unsigned long disk_blk_flush(struct udevice *dev)
> +{
> + return blk_flush(dev_get_parent(dev));
> +}
Please note in the commit message that flushing a partition flushes
the entire underlying device (the API has no start/blkcnt), so callers
don't expect partition-scoped semantics.
Regards,
Simon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 3/6] drivers: nvme: Implement flush command
2026-05-29 3:44 ` [PATCH v2 3/6] drivers: nvme: Implement flush command dmukhin
@ 2026-05-29 9:57 ` Simon Glass
0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2026-05-29 9:57 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, neil.armstrong, sjg, trini
kOn 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> drivers: nvme: Implement flush command
>
> Implement the NVM flush command (opcode 0x00) to allow callers to
> synchronize any buffered data with the backing NVMe storage.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> drivers/nvme/nvme.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 5/6] drivers: nvme: Export nvme_shutdown()
2026-05-29 3:44 ` [PATCH v2 5/6] drivers: nvme: Export nvme_shutdown() dmukhin
@ 2026-05-29 9:57 ` Simon Glass
0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2026-05-29 9:57 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, neil.armstrong, sjg, trini
On 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> drivers: nvme: Export nvme_shutdown()
>
> Make nvme_shutdown() public so that it can be re-used in
> board-specific board_quiesce_devices() before OS hand-off.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> drivers/nvme/nvme.h | 7 -------
> include/nvme.h | 11 +++++++++++
> 2 files changed, 11 insertions(+), 7 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/6] cmd: Add flush support for all blk devices
2026-05-29 3:44 ` [PATCH v2 4/6] cmd: Add flush support for all blk devices dmukhin
@ 2026-05-29 9:57 ` Simon Glass
2026-06-05 3:55 ` dmukhin
2026-06-03 17:43 ` Sean Anderson
1 sibling, 1 reply; 21+ messages in thread
From: Simon Glass @ 2026-05-29 9:57 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, neil.armstrong, sjg, trini
Hi Denis,
On 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> cmd: Add flush support for all blk devices
>
> Introduce flush subcommand for all blk devices to allow committing
> dirty data explicitly to the given block device.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> cmd/blk_common.c | 14 ++++++++++++++
> cmd/ide.c | 1 +
> cmd/nvme.c | 1 +
> cmd/pvblock.c | 1 +
> cmd/sata.c | 1 +
> cmd/scsi.c | 1 +
> cmd/usb.c | 1 +
> cmd/virtio.c | 1 +
> 8 files changed, 21 insertions(+)
> diff --git a/cmd/blk_common.c b/cmd/blk_common.c
> @@ -37,6 +37,20 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
> + } else if (strncmp(argv[1], 'flush', 5) == 0) {
> + struct blk_desc *desc;
> + int ret;
> +
> + ret = blk_get_desc(uclass_id, *cur_devnump, &desc);
> + if (ret)
> + return CMD_RET_FAILURE;
> +
> + if (blk_dflush(desc)) {
> + printf("\nfailed to flush device %s\n", if_name);
> + return CMD_RET_FAILURE;
> + }
> +
> + return CMD_RET_SUCCESS;
> + }
Please print the return value from blk_dflush() and the device number
in the failure message - otherwise a user can't tell -ENOSYS from a
genuine I/O error. Compare with the erase arm just below which reports
the block count. You can use %dE to get an error string if the board
enables it.
Do you want to print something on success?
It is a bit misleading to suggest that all the commands support
'flush'. But I suppose we can worry about that later.
> diff --git a/cmd/blk_common.c b/cmd/blk_common.c
> @@ -37,6 +37,20 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
> + } else if (strncmp(argv[1], 'flush', 5) == 0) {
cmd/blkmap.c also routes through blk_common_cmd(), but dispatches via
U_BOOT_SUBCMD_MKENT() so flush never reaches this function unless you
add a matching subcmd entry. Either add it for consistency or call out
in the commit message that blkmap is intentionally excluded.
Regards,
Simon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 6/6] docs: nvme: Update QEMU command for testing
2026-05-29 3:44 ` [PATCH v2 6/6] docs: nvme: Update QEMU command for testing dmukhin
@ 2026-05-29 9:58 ` Simon Glass
0 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2026-05-29 9:58 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, neil.armstrong, sjg, trini
Hi Denis,
On 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> docs: nvme: Update QEMU command for testing
>
> Switch to x86-64 QEMU machine for NVMe testing in the docs.
> Also, add format=raw for empty NVMe disks QEMU command line.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> doc/develop/driver-model/nvme.rst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/doc/develop/driver-model/nvme.rst b/doc/develop/driver-model/nvme.rst
> @@ -95,4 +95,4 @@ Example command line to call QEMU x86 below with emulated NVMe device:
>
> .. code-block:: bash
>
> - $ ./qemu-system-i386 -drive file=nvme.img,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom
> + $ qemu-system-x86_64 -nographic -drive file=nvme.img,format=raw,if=none,id=drv0 -device nvme,drive=drv0,serial=QEMUNVME0001 -bios u-boot.rom
The commit message lists two changes but the diff also adds
-nographic. Please mention it, or drop it if not required.
Also, format=raw is needed for any raw image to silence QEMU's probing
warning, not specifically for empty disks. Something like "specify
format=raw explicitly to avoid QEMU's raw-format auto-detection
warning" would read better.
Regards,
Simon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [v2,0/6] nvme: few fixups
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
` (5 preceding siblings ...)
2026-05-29 3:44 ` [PATCH v2 6/6] docs: nvme: Update QEMU command for testing dmukhin
@ 2026-05-29 9:58 ` Simon Glass
2026-06-03 16:22 ` (subset) [PATCH v2 0/6] " Neil Armstrong
2026-06-04 6:32 ` neil.armstrong
8 siblings, 0 replies; 21+ messages in thread
From: Simon Glass @ 2026-05-29 9:58 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot
Hi Denis,
On 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> Patch 4 enables flush for the currently selected block device.
It adds the flush subcommand to all the block-uclass front-end
commands (ide, nvme, pvblock, sata, scsi, usb, virtio) in one go.
Please reword.
> The series adds few fixes for NVMe subsystem.
This is more than NVMe fixes - patch 2 adds a new block-uclass op and
patch 4 touches seven command files. Since you are adding a new uclass
operation, please add a test for blk_flush()/blk_dflush() under
test/dm/blk.c covering success and -ENOSYS when .flush is absent.
> Patch 5 makes nvme_shutdown() symbol public to enable use of it from
> board_quiesce_devices()
Really we should mark the driver as DM_FLAG_ACTIVE_DMA and then this
happens automatically. The board_quiesce_devices() function should go
away at some point.
Regards,
Simon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: (subset) [PATCH v2 0/6] nvme: few fixups
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
` (6 preceding siblings ...)
2026-05-29 9:58 ` [v2,0/6] nvme: few fixups Simon Glass
@ 2026-06-03 16:22 ` Neil Armstrong
2026-06-04 6:32 ` neil.armstrong
8 siblings, 0 replies; 21+ messages in thread
From: Neil Armstrong @ 2026-06-03 16:22 UTC (permalink / raw)
To: u-boot, dmukhin; +Cc: sjg, trini
Hi,
On Thu, 28 May 2026 20:44:35 -0700, dmukhin@ford.com wrote:
> The series adds few fixes for NVMe subsystem.
>
> Patch 1 adds logline for tracing misbehaving NVMe drives.
> Patch 2 adds plumbing for blk_flush()/blk_dflush().
> Patch 3 introduces NVMe flush command.
> Patch 4 enables `flush` for the currently selected block device.
> Patch 5 makes nvme_shutdown() symbol public to enable use of it from
> board_quiesce_devices()
> Patch 6 tiny fixup for QEMU command for manual NVMe tests.
>
> [...]
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-ufs (u-boot-nvme-fixes)
[1/6] drivers: nvme: Log I/O timeouts
https://source.denx.de/u-boot/custodians/u-boot-ufs/-/commit/389363d287585d8135a554c4419a4f580346b9f8
--
Neil
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/6] cmd: Add flush support for all blk devices
2026-05-29 3:44 ` [PATCH v2 4/6] cmd: Add flush support for all blk devices dmukhin
2026-05-29 9:57 ` Simon Glass
@ 2026-06-03 17:43 ` Sean Anderson
2026-06-04 17:01 ` Simon Glass
2026-06-05 3:53 ` dmukhin
1 sibling, 2 replies; 21+ messages in thread
From: Sean Anderson @ 2026-06-03 17:43 UTC (permalink / raw)
To: dmukhin, u-boot; +Cc: neil.armstrong, sjg, trini
On 5/28/26 23:44, dmukhin@ford.com wrote:
> From: Denis Mukhin <dmukhin@ford.com>
>
> Introduce `flush` subcommand for all blk devices to allow committing
> dirty data explicitly to the given block device.
Shouldn't this be done automatically as part of blk_write? Similar to
how all FS operations in U-Boot look like
- Mount FS
- Perform operation
- Unmount FS
so the FS is never in an inconsistent state once an operation completes.
Is the performance impact too much? I'm just concerned that a lot of
existing code assumes that blk_write is persistent and that it's OK
to e.g. immediately reset after blk_write returns.
--Sean
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 0/6] nvme: few fixups
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
` (7 preceding siblings ...)
2026-06-03 16:22 ` (subset) [PATCH v2 0/6] " Neil Armstrong
@ 2026-06-04 6:32 ` neil.armstrong
2026-06-05 3:59 ` dmukhin
8 siblings, 1 reply; 21+ messages in thread
From: neil.armstrong @ 2026-06-04 6:32 UTC (permalink / raw)
To: dmukhin, u-boot; +Cc: sjg, trini
Hi,
On 5/29/26 05:44, dmukhin@ford.com wrote:
> The series adds few fixes for NVMe subsystem.
>
> Patch 1 adds logline for tracing misbehaving NVMe drives.
> Patch 2 adds plumbing for blk_flush()/blk_dflush().
> Patch 3 introduces NVMe flush command.
> Patch 4 enables `flush` for the currently selected block device.
As my thread on v1, please enable FUA or disable WC to be sure we don't use the WC.
Neil
> Patch 5 makes nvme_shutdown() symbol public to enable use of it from
> board_quiesce_devices()
> Patch 6 tiny fixup for QEMU command for manual NVMe tests.
>
> Denis Mukhin (6):
> drivers: nvme: Log I/O timeouts
> drivers: block: Introduce blk_flush()/blk_dflush()
> drivers: nvme: Implement flush command
> cmd: Add flush support for all blk devices
> drivers: nvme: Export nvme_shutdown()
> docs: nvme: Update QEMU command for testing
>
> cmd/blk_common.c | 14 ++++++++++++++
> cmd/ide.c | 1 +
> cmd/nvme.c | 1 +
> cmd/pvblock.c | 1 +
> cmd/sata.c | 1 +
> cmd/scsi.c | 1 +
> cmd/usb.c | 1 +
> cmd/virtio.c | 1 +
> disk/disk-uclass.c | 6 ++++++
> doc/develop/driver-model/nvme.rst | 2 +-
> drivers/block/blk-uclass.c | 18 ++++++++++++++++++
> drivers/nvme/nvme.c | 24 +++++++++++++++++++++++-
> drivers/nvme/nvme.h | 7 -------
> include/blk.h | 28 ++++++++++++++++++++++++++++
> include/nvme.h | 11 +++++++++++
> include/part.h | 8 ++++++++
> 16 files changed, 116 insertions(+), 9 deletions(-)
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/6] cmd: Add flush support for all blk devices
2026-06-03 17:43 ` Sean Anderson
@ 2026-06-04 17:01 ` Simon Glass
2026-06-05 3:53 ` dmukhin
1 sibling, 0 replies; 21+ messages in thread
From: Simon Glass @ 2026-06-04 17:01 UTC (permalink / raw)
To: Sean Anderson; +Cc: dmukhin, u-boot, neil.armstrong, trini
Hi Sean,
On Wed, 3 Jun 2026 at 11:43, Sean Anderson <seanga2@gmail.com> wrote:
>
> On 5/28/26 23:44, dmukhin@ford.com wrote:
> > From: Denis Mukhin <dmukhin@ford.com>
> >
> > Introduce `flush` subcommand for all blk devices to allow committing
> > dirty data explicitly to the given block device.
>
> Shouldn't this be done automatically as part of blk_write? Similar to
> how all FS operations in U-Boot look like
>
> - Mount FS
> - Perform operation
> - Unmount FS
>
> so the FS is never in an inconsistent state once an operation completes.
>
> Is the performance impact too much? I'm just concerned that a lot of
> existing code assumes that blk_write is persistent and that it's OK
> to e.g. immediately reset after blk_write returns.
This is actually for a device-level flush, so more like a Linux 'sync'
than just a write. If the hardware supports / requires it, then it
seems valuable to me.
Regards,
Simon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/6] cmd: Add flush support for all blk devices
2026-06-03 17:43 ` Sean Anderson
2026-06-04 17:01 ` Simon Glass
@ 2026-06-05 3:53 ` dmukhin
1 sibling, 0 replies; 21+ messages in thread
From: dmukhin @ 2026-06-05 3:53 UTC (permalink / raw)
To: Sean Anderson; +Cc: dmukhin, u-boot, neil.armstrong, sjg, trini
Hi Sean,
Thanks for the feedback!
On Wed, Jun 03, 2026 at 01:43:10PM -0400, Sean Anderson wrote:
> On 5/28/26 23:44, dmukhin@ford.com wrote:
> > From: Denis Mukhin <dmukhin@ford.com>
> >
> > Introduce `flush` subcommand for all blk devices to allow committing
> > dirty data explicitly to the given block device.
>
> Shouldn't this be done automatically as part of blk_write? Similar to
> how all FS operations in U-Boot look like
>
> - Mount FS
> - Perform operation
> - Unmount FS
>
> so the FS is never in an inconsistent state once an operation completes.
>
> Is the performance impact too much? I'm just concerned that a lot of
> existing code assumes that blk_write is persistent and that it's OK
> to e.g. immediately reset after blk_write returns.
In my case I need to update the GPT-backed boot counter; there are two
GPT headers, primary and backup, so I used blk_dflush() to guarantee that
both headers are updated before jumping into the OS.
So in my scenario I need to ensure that those 2 writes will land to the
NVMe.
I think FUA suggested by Neil in v1 feedback should be a robust solution
for NVMe, but I went with a 'flush' solution first.
>
> --Sean
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/6] cmd: Add flush support for all blk devices
2026-05-29 9:57 ` Simon Glass
@ 2026-06-05 3:55 ` dmukhin
0 siblings, 0 replies; 21+ messages in thread
From: dmukhin @ 2026-06-05 3:55 UTC (permalink / raw)
To: Simon Glass; +Cc: dmukhin, u-boot, neil.armstrong, trini
On Fri, May 29, 2026 at 04:57:48AM -0500, Simon Glass wrote:
> Hi Denis,
>
> On 2026-05-29T03:44:35, None <dmukhin@ford.com> wrote:
> > cmd: Add flush support for all blk devices
> >
> > Introduce flush subcommand for all blk devices to allow committing
> > dirty data explicitly to the given block device.
> >
> > Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> >
> > cmd/blk_common.c | 14 ++++++++++++++
> > cmd/ide.c | 1 +
> > cmd/nvme.c | 1 +
> > cmd/pvblock.c | 1 +
> > cmd/sata.c | 1 +
> > cmd/scsi.c | 1 +
> > cmd/usb.c | 1 +
> > cmd/virtio.c | 1 +
> > 8 files changed, 21 insertions(+)
>
> > diff --git a/cmd/blk_common.c b/cmd/blk_common.c
> > @@ -37,6 +37,20 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
> > + } else if (strncmp(argv[1], 'flush', 5) == 0) {
> > + struct blk_desc *desc;
> > + int ret;
> > +
> > + ret = blk_get_desc(uclass_id, *cur_devnump, &desc);
> > + if (ret)
> > + return CMD_RET_FAILURE;
> > +
> > + if (blk_dflush(desc)) {
> > + printf("\nfailed to flush device %s\n", if_name);
> > + return CMD_RET_FAILURE;
> > + }
> > +
> > + return CMD_RET_SUCCESS;
> > + }
>
> Please print the return value from blk_dflush() and the device number
> in the failure message - otherwise a user can't tell -ENOSYS from a
> genuine I/O error. Compare with the erase arm just below which reports
> the block count. You can use %dE to get an error string if the board
> enables it.
>
> Do you want to print something on success?
>
> It is a bit misleading to suggest that all the commands support
> 'flush'. But I suppose we can worry about that later.
>
> > diff --git a/cmd/blk_common.c b/cmd/blk_common.c
> > @@ -37,6 +37,20 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
> > + } else if (strncmp(argv[1], 'flush', 5) == 0) {
>
> cmd/blkmap.c also routes through blk_common_cmd(), but dispatches via
> U_BOOT_SUBCMD_MKENT() so flush never reaches this function unless you
> add a matching subcmd entry. Either add it for consistency or call out
> in the commit message that blkmap is intentionally excluded.
Thanks for the feedback!
Will update the patch.
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 0/6] nvme: few fixups
2026-06-04 6:32 ` neil.armstrong
@ 2026-06-05 3:59 ` dmukhin
0 siblings, 0 replies; 21+ messages in thread
From: dmukhin @ 2026-06-05 3:59 UTC (permalink / raw)
To: Neil Armstrong; +Cc: dmukhin, u-boot, sjg, trini
Hi Neil,
Thanks for the feedback!
On Thu, Jun 04, 2026 at 08:32:50AM +0200, neil.armstrong@linaro.org wrote:
> Hi,
>
> On 5/29/26 05:44, dmukhin@ford.com wrote:
> > The series adds few fixes for NVMe subsystem.
> >
> > Patch 1 adds logline for tracing misbehaving NVMe drives.
> > Patch 2 adds plumbing for blk_flush()/blk_dflush().
> > Patch 3 introduces NVMe flush command.
> > Patch 4 enables `flush` for the currently selected block device.
>
> As my thread on v1, please enable FUA or disable WC to be sure we don't use the WC.
Yes, sorry, I did not have time to respond to v1 feedback (just sent out
an email):
https://lore.kernel.org/u-boot/aiJFzMdcCu5sAktz@kraken/
I will look into FUA for NVMe.
But I also think it makes sense to add flush to the code base as
an alternative solution for ensuring data is stored.
--
Denis
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2026-06-05 3:59 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 3:44 [PATCH v2 0/6] nvme: few fixups dmukhin
2026-05-29 3:44 ` [PATCH v2 1/6] drivers: nvme: Log I/O timeouts dmukhin
2026-05-29 9:56 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 2/6] drivers: block: Introduce blk_flush()/blk_dflush() dmukhin
2026-05-29 9:57 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 3/6] drivers: nvme: Implement flush command dmukhin
2026-05-29 9:57 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 4/6] cmd: Add flush support for all blk devices dmukhin
2026-05-29 9:57 ` Simon Glass
2026-06-05 3:55 ` dmukhin
2026-06-03 17:43 ` Sean Anderson
2026-06-04 17:01 ` Simon Glass
2026-06-05 3:53 ` dmukhin
2026-05-29 3:44 ` [PATCH v2 5/6] drivers: nvme: Export nvme_shutdown() dmukhin
2026-05-29 9:57 ` Simon Glass
2026-05-29 3:44 ` [PATCH v2 6/6] docs: nvme: Update QEMU command for testing dmukhin
2026-05-29 9:58 ` Simon Glass
2026-05-29 9:58 ` [v2,0/6] nvme: few fixups Simon Glass
2026-06-03 16:22 ` (subset) [PATCH v2 0/6] " Neil Armstrong
2026-06-04 6:32 ` neil.armstrong
2026-06-05 3:59 ` dmukhin
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.