Skip to content

fix(block/darwin): detect NVMe controller on Apple Silicon - #474

Merged
jaypipes merged 1 commit into
jaypipes:mainfrom
mdevils:fix/darwin-block-tools-and-nvme
Sep 19, 2026
Merged

jaypipes merged 1 commit into
jaypipes:mainfrom
mdevils:fix/darwin-block-tools-and-nvme

Conversation

@mdevils

@mdevils mdevils commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

storageControllerFromPlist only matched IONVMeController in the device tree path to detect NVMe. On Apple Silicon Macs the internal SSD is attached through the SoC's own storage fabric instead, and the device tree node name varies by chip generation (AppleANS2Controller on T2 Macs, AppleANS3NVMeController on M-series Macs, etc.), so it never matched and every internal disk was misclassified as StorageControllerSCSI.

Fix: also match BusProtocol == "Apple Fabric", which macOS reports consistently for this bus regardless of the exact controller node name.

Verified against a real M-series Mac: Disk.StorageController now correctly reports NVMe for the internal SSD instead of SCSI.

Test plan

  • Added pkg/block/block_darwin_test.go covering: standard IONVMeController path, Apple Silicon AppleANS3NVMeController + Apple Fabric, T2 AppleANS2Controller (no "NVMe" substring in path) + Apple Fabric, and a non-Apple-Fabric SATA/USB disk staying SCSI.
  • go build ./... and go vet ./pkg/block/...
  • Manually verified with ghw.Block() against real hardware (M-series MacBook Pro internal SSD)

storageControllerFromPlist only recognized IONVMeController in the
device tree path, which never matches on Apple Silicon: the internal
SSD is attached via the SoC's own storage fabric and shows up as
AppleANS2Controller/AppleANS3NVMeController depending on chip
generation, misclassifying it as SCSI. Match on BusProtocol ==
"Apple Fabric" instead, which macOS reports consistently regardless
of the exact controller node name.

Signed-off-by: Marat Dulin <github-commit@maratd.com>
@mdevils
mdevils force-pushed the fix/darwin-block-tools-and-nvme branch from fec9696 to 43a4cbd Compare September 19, 2026 08:33

@jaypipes jaypipes left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this contribution @mdevils! Much appreciated :) Code and tests lgtm.

@jaypipes
jaypipes merged commit 28bab22 into jaypipes:main Sep 19, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants