mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] nvme: check for readiness more quickly to speed up boot
@ 2026-09-27 23:03 Christian Berry via B4 Relay
  2026-09-28  8:19 ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Berry via B4 Relay @ 2026-09-27 23:03 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Christian Berry

From: Christian Berry <christiankbberry@gmail.com>

nvme_wait_ready() polls the controller status every 100ms, although
the controller may become ready much sooner. Every probe then waits
at least 100ms longer than needed, and possibly twice, since both
nvme_disable_ctrl() and nvme_enable_ctrl() wait for readiness.

Poll every millisecond instead, as Linux does since commit
3e98c2443f5c ("nvme: Check for readiness more quickly, to speed up
boot time"). The overall timeout is still based on elapsed time, so
it is unaffected.

Tested on an Arm64 SoC with a Samsung 980 SSD in a Gen3 x4
configuration, where PCIe + NVMe probe time dropped from 165 ms to
65 ms.

Signed-off-by: Christian Berry <christiankbberry@gmail.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 345707ecfe..9686268d44 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -173,7 +173,7 @@ static int nvme_wait_ready(struct nvme_ctrl *ctrl, u64 cap, bool enabled)
 		if ((csts & NVME_CSTS_RDY) == bit)
 			break;
 
-		mdelay(100);
+		udelay(1000);
 
 		if (is_timeout(start, timeout)) {
 			dev_err(ctrl->dev,

---
base-commit: 983608b439b803f72f12d56d0ab10bd6ba29e536
change-id: 20260927-nvme-ready-poll-4bd640377bab

Best regards,
-- 
Christian Berry <christiankbberry@gmail.com>





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

end of thread, other threads:[~2026-09-28 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 23:03 [PATCH] nvme: check for readiness more quickly to speed up boot Christian Berry via B4 Relay
2026-09-28  8:19 ` Ahmad Fatoum
2026-09-28 12:08   ` Christian Berry
2026-09-28 12:09     ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox