From 49f8b8de4e6fa0aeb6c5eabec149b2537e94618b Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Tue, 19 May 2026 18:08:34 +0200 Subject: [PATCH 1/5] MAINTAINERS: Add myself to the list of NVMe maintainers Adding myself to continue Bin's work to help maintain the NVMe support in U-boot. Acked-by: Tom Rini Link: https://patch.msgid.link/20260519-u-boot-pci-nvme-maintainer-v1-1-363593cbbfdc@linaro.org Signed-off-by: Neil Armstrong --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index ea646f618a5..2613929cdf5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1506,6 +1506,7 @@ T: git https://source.denx.de/u-boot/custodians/u-boot-nios.git F: arch/nios2/ NVMe +M: Neil Armstrong M: Bin Meng S: Maintained F: drivers/nvme/ From d6eb327828a384c3bf325de05633a77f66688f53 Mon Sep 17 00:00:00 2001 From: Prashant Kamble Date: Mon, 18 May 2026 11:38:44 +0530 Subject: [PATCH 2/5] nvme: fix command ID wraparound handling nvme_get_cmd_id() returns 0 after cmdid reaches USHRT_MAX, but fails to reset cmdid itself. As a result, all subsequent calls keep returning 0 indefinitely. Reset cmdid when wraparound occurs so command IDs continue incrementing correctly. Signed-off-by: Prashant Kamble Reviewed-by: Neil Armstrong Link: https://patch.msgid.link/20260518060915.45607-1-prashant.kamble223@gmail.com Signed-off-by: Neil Armstrong --- drivers/nvme/nvme.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 2b14437f69c..4f9473367d3 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -112,7 +112,10 @@ static __le16 nvme_get_cmd_id(void) { static unsigned short cmdid; - return cpu_to_le16((cmdid < USHRT_MAX) ? cmdid++ : 0); + if (cmdid >= USHRT_MAX) + cmdid = 0; + + return cpu_to_le16(cmdid++); } static u16 nvme_read_completion_status(struct nvme_queue *nvmeq, u16 index) From 63f0f19803ee28a3612dfbef719ae7bac5143eef Mon Sep 17 00:00:00 2001 From: Francois Berder Date: Sat, 9 May 2026 22:13:31 +0200 Subject: [PATCH 3/5] nvme: apple: Check memalign return value memalign returns NULL if it fails. This commit ensures that we handle this failure before filling the buffer with 0s. Signed-off-by: Francois Berder Reviewed-by: Neil Armstrong Link: https://patch.msgid.link/BESP194MB280542535B098A33C8A815EEDA3A2@BESP194MB2805.EURP194.PROD.OUTLOOK.COM Signed-off-by: Neil Armstrong --- drivers/nvme/nvme_apple.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/nvme_apple.c b/drivers/nvme/nvme_apple.c index 3e7d95c2b54..e674eda8344 100644 --- a/drivers/nvme/nvme_apple.c +++ b/drivers/nvme/nvme_apple.c @@ -88,6 +88,9 @@ static int apple_nvme_setup_queue(struct nvme_queue *nvmeq) } priv->tcbs[nvmeq->qid] = (void *)memalign(4096, ANS_NVMMU_TCB_SIZE); + if (!priv->tcbs[nvmeq->qid]) + return -ENOMEM; + memset((void *)priv->tcbs[nvmeq->qid], 0, ANS_NVMMU_TCB_SIZE); switch (nvmeq->qid) { From 4e91d9ff3324866d5cdfc0bc73e3382ce6fcc3d7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 8 May 2026 14:21:21 +0200 Subject: [PATCH 4/5] nvme: Staticize and constify driver ops Set the ops structure as static const. The structure is not accessible from outside of this driver and is not going to be modified at runtime. Signed-off-by: Marek Vasut Reviewed-by: Neil Armstrong Link: https://patch.msgid.link/20260508122128.512798-1-marek.vasut+renesas@mailbox.org Signed-off-by: Neil Armstrong --- drivers/nvme/nvme-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/nvme-uclass.c b/drivers/nvme/nvme-uclass.c index 44c88ad27f3..4ab9567450f 100644 --- a/drivers/nvme/nvme-uclass.c +++ b/drivers/nvme/nvme-uclass.c @@ -44,7 +44,7 @@ UCLASS_DRIVER(nvme) = { .id = UCLASS_NVME, }; -struct bootdev_ops nvme_bootdev_ops = { +static const struct bootdev_ops nvme_bootdev_ops = { }; static const struct udevice_id nvme_bootdev_ids[] = { From 4f510505988928e129e109811587c4a00d28ec56 Mon Sep 17 00:00:00 2001 From: Prashant Kamble Date: Mon, 18 May 2026 07:55:35 +0530 Subject: [PATCH 5/5] nvme: Fix PRP list pointer arithmetic for chained transfers The PRP setup code advances prp_pool using u64 pointer arithmetic: prp_pool += page_size; This increments the pointer by page_size * sizeof(u64) bytes instead of page_size bytes, resulting in invalid PRP list addresses when multiple PRP list pages are required. The issue becomes visible for large transfers, typically above 2 MiB when MDTS > 9. Fix it by using byte-wise pointer arithmetic when advancing to the next PRP list page. Signed-off-by: Prashant Kamble Reviewed-by: Neil Armstrong Link: https://patch.msgid.link/20260518022535.17197-1-prashant.kamble223@gmail.com Signed-off-by: Neil Armstrong --- drivers/nvme/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 4f9473367d3..0631b190b97 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -94,7 +94,7 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, *(prp_pool + i) = cpu_to_le64((ulong)prp_pool + page_size); i = 0; - prp_pool += page_size; + prp_pool = (u64 *)((uintptr_t)prp_pool + page_size); } *(prp_pool + i++) = cpu_to_le64(dma_addr); dma_addr += page_size;