[PATCH 03/26] nvme: allow flush opcode
Ahmad Fatoum
a.fatoum at barebox.org
Fri Jun 26 01:42:14 PDT 2026
The NVMe flush opcode was already wired as block_device_ops::flush,
but it was doomed to fail as without a DMA direction set,
nvme_pci_submit_sync_cmd() would early exit with -EINVAL.
As the command isn't DMAng any data, set dma_dir to DMA_NONE to get the
flush command flushed.
Fixes: aedcb568afe4 ("drivers: Import a very basic NVME implementation from Linux")
Assisted-by: Codex:gpt-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
drivers/nvme/host/pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 765821aa0a65..6343af25026b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -414,6 +414,9 @@ static int nvme_pci_submit_sync_cmd(struct nvme_ctrl *ctrl,
break;
case NVME_QID_IO:
switch (cmd->rw.opcode) {
+ case nvme_cmd_flush:
+ dma_dir = DMA_NONE;
+ break;
case nvme_cmd_write:
dma_dir = DMA_TO_DEVICE;
break;
--
2.47.3
More information about the barebox
mailing list