mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 01/26] nvme: use barebox-appropriate 64-bit type for timeouts
Date: Fri, 26 Jun 2026 10:42:12 +0200	[thread overview]
Message-ID: <20260626084608.1388806-2-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260626084608.1388806-1-a.fatoum@barebox.org>

The unsigned timeout that is used across the nvme support is in terms of
jiffies in Linux, where unsigned as type makes sense.

barebox has no jiffies though and we use the parameter to hold a nanosecond
time duration instead, which already overflows for ADMIN_TIMEOUT and
SHUTDOWN_TIMEOUT (60s and 5s, respectively) as they exceed the ~4s max.

Switch over to passing ktime_t around to fix this.

Fixes: aedcb568afe4 ("drivers: Import a very basic NVME implementation from Linux")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/nvme/host/core.c | 2 +-
 drivers/nvme/host/nvme.h | 4 ++--
 drivers/nvme/host/pci.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index fcc21677638a..98731ffe7cb2 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -8,7 +8,7 @@ int __nvme_submit_sync_cmd(struct nvme_ctrl *ctrl,
 			   struct nvme_command *cmd,
 			   union nvme_result *result,
 			   void *buffer, unsigned bufflen,
-			   unsigned timeout, int qid)
+			   ktime_t timeout, int qid)
 {
 	return ctrl->ops->submit_sync_cmd(ctrl, cmd, result, buffer, bufflen,
 					  timeout, qid);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 90121bd7a3e0..11942140ce32 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -77,7 +77,7 @@ struct nvme_ctrl_ops {
 			       union nvme_result *result,
 			       void *buffer,
 			       unsigned bufflen,
-			       unsigned timeout, int qid);
+			       ktime_t timeout, int qid);
 };
 
 static inline bool nvme_ctrl_ready(struct nvme_ctrl *ctrl)
@@ -120,7 +120,7 @@ int __nvme_submit_sync_cmd(struct nvme_ctrl *ctrl,
 			   struct nvme_command *cmd,
 			   union nvme_result *result,
 			   void *buffer, unsigned bufflen,
-			   unsigned timeout, int qid);
+			   ktime_t timeout, int qid);
 int nvme_submit_sync_cmd(struct nvme_ctrl *ctrl,
 			 struct nvme_command *cmd,
 			 void *buffer, unsigned bufflen);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 672c4cc2331a..765821aa0a65 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -384,7 +384,7 @@ static int nvme_pci_submit_sync_cmd(struct nvme_ctrl *ctrl,
 				    union nvme_result *result,
 				    void *buffer,
 				    unsigned int buffer_len,
-				    unsigned timeout, int qid)
+				    ktime_t timeout, int qid)
 {
 	struct nvme_dev *dev = to_nvme_dev(ctrl);
 	struct nvme_queue *nvmeq = &dev->queues[qid];
-- 
2.47.3




  reply	other threads:[~2026-06-26  8:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  8:42 [PATCH 00/26] block: add support for non-512 byte sectors Ahmad Fatoum
2026-06-26  8:42 ` Ahmad Fatoum [this message]
2026-06-26  8:42 ` [PATCH 02/26] nvme: fix buffer advancement when chunking due to max_hw_sectors Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 03/26] nvme: allow flush opcode Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 04/26] nvme: honor namespace block size for I/O Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 05/26] bootscan: fix detection of GPT Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 06/26] block: clarify that writebuffer_io_len returns sector counts Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 07/26] block: fix wrong type for discard_start/size byte ranges Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 08/26] block: fix discard zeroing too little memory Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 09/26] block: use logical block size for reparse checks Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 10/26] block: require lower bound of sector size to be 512 bytes Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 11/26] filetype: don't hardcode sector size in file_detect_partition_table Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 12/26] block: define helpers for non-512-byte sector support Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 13/26] bootscan: use block size for partition table probe Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 14/26] ramdisk: validate exported sector size Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 15/26] efi: block: fix sector size mismatch in block device registration and ops Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 16/26] efi: loader: disk: report block device size in Block I/O Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 17/26] efi: loader: file: report cdev block size in file info Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 18/26] partitions: use byte offset for first partition policy Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 19/26] partitions: dos: allocate correctly sized buffer for dos_partition_desc Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 20/26] partition: support non-512 byte sectors Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 21/26] fs: fat: fix garbage read when writing with bigger block size Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 22/26] fs: fat: support larger block device sectors Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 23/26] usb-storage: preserve READ CAPACITY sector size Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 24/26] fuzz: add 4K-sector partition ramdisk target Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 25/26] commands: parted: prepare use of non-512-byte sectors Ahmad Fatoum
2026-06-26  8:42 ` [PATCH 26/26] commands: parted: exit if block size if not 512 Ahmad Fatoum

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=20260626084608.1388806-2-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox