Skip to content

Commit ddc25fc

Browse files
craftyguymps-x
authored andcommitted
main/libnvme: add patch to support Apple nvme transport
This patch was submitted upstream: linux-nvme/libnvme#1071 Without this, libnvme is unable to detect NVMe storage attached to Apple silicon.
1 parent a38f865 commit ddc25fc

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From cd1238744243e837f8b33f47f9cddff9d96de03c Mon Sep 17 00:00:00 2001
2+
From: Clayton Craft <[email protected]>
3+
Date: Mon, 15 Sep 2025 08:19:27 -0700
4+
Subject: [PATCH] tree: support apple-nvme transport
5+
6+
Apple silicon support on Linux uses a separate platform driver called
7+
'apple-nvme', and libnvme doesn't know about this transport. This fixes
8+
a "No transport address for 'apple-nvme'" error when running on Apple
9+
silicon, where libnvme was unable to enumerate nvme storage attached to
10+
this platform.
11+
12+
$ nvme list
13+
Node Generic SN Model Namespace Usage Format FW Rev
14+
--------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- --------
15+
/dev/nvme0n1 /dev/ng0n1 xxxxxxxxxxxxxxxx APPLE SSD AP2048Z 0x1 2.00 TB / 2.00 TB 4 KiB + 0 B 532.140.
16+
...
17+
18+
Signed-off-by: Clayton Craft <[email protected]>
19+
---
20+
src/nvme/tree.c | 3 ++-
21+
1 file changed, 2 insertions(+), 1 deletion(-)
22+
23+
diff --git a/src/nvme/tree.c b/src/nvme/tree.c
24+
index d7970743..e4ac90a3 100644
25+
--- a/src/nvme/tree.c
26+
+++ b/src/nvme/tree.c
27+
@@ -1417,7 +1417,8 @@ struct nvme_ctrl *nvme_create_ctrl(nvme_root_t r,
28+
return NULL;
29+
}
30+
if (strncmp(transport, "loop", 4) &&
31+
- strncmp(transport, "pcie", 4) && !traddr) {
32+
+ strncmp(transport, "pcie", 4) &&
33+
+ strncmp(transport, "apple-nvme", 10) && !traddr) {
34+
nvme_msg(r, LOG_ERR, "No transport address for '%s'\n",
35+
transport);
36+
errno = EINVAL;
37+
--
38+
2.51.0
39+

main/libnvme/APKBUILD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Natanael Copa <[email protected]>
22
pkgname=libnvme
33
pkgver=1.15
4-
pkgrel=0
4+
pkgrel=1
55
pkgdesc="C Library for NVM Express on Linux"
66
url="https://github.com/linux-nvme/libnvme/"
77
arch="all"
@@ -25,6 +25,7 @@ checkdepends="diffutils"
2525
subpackages="${pkgname}mi:mi $pkgname-dev py3-nvme-pyc py3-nvme:_py3"
2626
source="https://github.com/linux-nvme/libnvme/archive/v$pkgver/libnvme-v$pkgver.tar.gz
2727
doc-test.patch
28+
0001-tree-support-apple-nvme-transport.patch
2829
"
2930

3031
build() {
@@ -59,4 +60,5 @@ mi() {
5960
sha512sums="
6061
7357685b3f47eda445387965420e7885a326a6b60b3da5af4a8bb942d4f924534babbde3d4aae8468c8a2f0ee4971f2896fadc133f4c387d59f9f620ed2450aa libnvme-v1.15.tar.gz
6162
6ca036287d964db018a2ddfb5480b0b46e6f2edd9f0a7c39dbf5977ce58d8da4d619705e16a3f269bfa7c619d6da5aeff20d9b558c697f6d68e5d89a73ef586e doc-test.patch
63+
be631ef5c619b9b74678d4a7b053bfd60f3cd5bfe94fe2e2a59678b1836c1a777a20e267a7121009400b55196c86bcd1516a520aca82f5d9d01977b5a37f3ccd 0001-tree-support-apple-nvme-transport.patch
6264
"

0 commit comments

Comments
 (0)