Skip to content

Scope the MacBook NVMe suspend fix to Apple's NVMe controller - #11624

Open
niconistal wants to merge 3 commits into
omacom:quattrofrom
niconistal:fix/apple-nvme-suspend-scope
Open

niconistal wants to merge 3 commits into
omacom:quattrofrom
niconistal:fix/apple-nvme-suspend-scope

Conversation

@niconistal

@niconistal niconistal commented Sep 13, 2026 •

Copy link
Copy Markdown

install/hardware/apple/fix-suspend-nvme.sh disables D3cold on 0000:01:00.0 for every model in its regex, including the 15-inch MacBookPro13,3 and 14,3. On those two models 01:00.0 is the AMD GPU and the NVMe drive is at 02:00.0. The file exists, so the check passes and the fix lands on the GPU. The drive is never touched.

From a MacBookPro14,3 on Omarchy 4.0.3:

01:00.0  [0300] AMD Radeon Pro 560 [1002:67ef]   d3cold_allowed = 0
02:00.0  [0108] Samsung SM961 NVMe [144d:a804]   d3cold_allowed = 1

The quirk comes from Dunedan/mbp-2016-linux, which scopes it to "models with Apple's NVMe controller (MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 and MacBookPro14,2)". The lspci dumps in that repo show those models with Apple's controller [106b:2003] at 01:00.0, and the 13,3 and 14,3 with the GPU there instead.

Changes

  • Leaf: drop 13,3 and 14,3 from the model match. Apply the fix only when the device at 01:00.0 reports Apple's vendor ID 0x106b, instead of just checking that a device exists there. The 12-inch MacBooks and 13-inch models keep the fix.
  • Unit: the ExecStart path loses its \: escapes, which systemd logs as "Ignoring unknown escape sequences" on every boot. The written value is unchanged.
  • Migration: existing installs where 01:00.0 is not Apple's controller have the service disabled and removed. The GPU goes back to its default at the next boot.
  • Test: test/shell.d/apple-suspend-nvme-test.sh covers both the leaf and the migration, for every affected model and both 15-inch ones.

Testing

  • test/shell.d/apple-suspend-nvme-test.sh passes.
  • ./test/shell: the only failures are four suites that also fail on a clean quattro checkout here, because there is no omarchy-pkgs checkout.
  • Not run on a 13-inch machine. The leaf's behaviour there is unchanged except for the added vendor check.

🤖 Generated with Claude Code

Fixes #10826

The fix matched MacBookPro13,3 and 14,3, where 0000:01:00.0 is the AMD GPU and
the NVMe drive sits at 02:00.0, so it disabled D3cold on the GPU instead. Only
apply it where Apple's controller (vendor 0x106b) is at 01:00.0, and remove the
service from existing installs where it is not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@iokoioko

Copy link
Copy Markdown

Data point from a MacBookPro14,3 (Radeon Pro 560 1002:67ef, subsystem 106B:0179) relevant to dropping the 01:00.0 pin on the 15-inch models.

On this machine amdgpu cannot resume the Radeon after it loses power. S3 (kernel 7.1.9-arch1-2) and S4 (7.2.5-3-omarchy) both fail the same way:

amdgpu: SMU load firmware failed
amdgpu 0000:01:00.0: amdgpu_device_ip_resume failed (-22).
PM: dpm_run_callback(): pci_pm_resume returns -22   (pci_pm_restore on S4)

s2idle resumes fine with the Radeon kept out of D3cold (d3cold_allowed=0). I have not tested s2idle with D3cold allowed on the Radeon, so I can't say whether removing the pin breaks resume. But if D3cold is reachable there, it would hit the same SMU path. It may be worth confirming an unpinned s2idle cycle on a 13,3/14,3 before the migration re-enables D3cold on the GPU.

@iokoioko

Copy link
Copy Markdown

Follow-up: I checked the ACPI tables on this 14,3. There is no _PR3 or other power resource for PEG0/GFX0, and the kernel exposes no ACPI power state for either (firmware_node/power_state is absent on 00:01.0 and 01:00.0). So the Radeon cannot reach D3cold here and the 01:00.0 pin is effectively a no-op. The SMU concern above shouldn't apply to this change.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at e9ee03c. No defects found, and nothing was pushed.

What was checked, on a disposable Omarchy worker VM:

  • A reproduction of my own, not the PR's test: the leaf runs against a fake sysfs with the AMD GPU (0x1002) at 01:00.0. On quattro it writes and enables the unit for MacBookPro13,3 and 14,3. On this head it leaves both alone and still applies the fix to 13,1, 14,2 and MacBook9,1 with Apple's controller (0x106b). With the leaf reverted to quattro on this head, it fails again.
  • test/shell.d/apple-suspend-nvme-test.sh passes on this head and fails with the leaf reverted.
  • ./test/cli and ./test/shell on this head merged into current quattro. Every failure there also fails on quattro itself.
  • systemd-analyze verify on the generated unit: the old unit logs "Ignoring unknown escape sequences" and the new one is clean.
  • Read through for these cases: the migration under bash -euo pipefail, a second user running it after the first, a machine with nothing at 01:00.0, and its older timestamp. omarchy-migrate tracks each file by its own marker, so it still runs after newer migrations have.

Second opinion: Codex Medium reviewed the same diff and found no defects. It agreed with the above, and its independence from this review is not guaranteed.

Competing fix: #10877 fixes the same issue a different way. It looks up the NVMe's real address instead. Codex Medium was asked to compare the two without my view, and both of us prefer this one, for three reasons:

The choice between them is the maintainer's. I've linked this pull request to #10826, which it fixes.

Waiting on: confirmation on real hardware. The reproduction above uses a fake sysfs, which shows the logic is right but not how it behaves on the machine. @passerini, you opened #10826 on a MacBookPro13,3. Could you test this exact commit there?

git clone https://github.com/niconistal/omarchy.git /tmp/omarchy-11624
cd /tmp/omarchy-11624 && git checkout e9ee03c9ab10c3c64c44518a030a09abe2c2a73d
bash -euo pipefail migrations/1789274148.sh             # removes the unit aimed at the GPU
systemctl status omarchy-nvme-suspend-fix.service       # expect: could not be found
bash install/hardware/apple/fix-suspend-nvme.sh         # expect: no output, no unit written
# reboot, then:
cat /sys/bus/pci/devices/0000:01:00.0/d3cold_allowed    # expect: 1

Please reply with what those print, and whether suspend behaves any differently from before.

@macmsb

macmsb commented Oct 10, 2026

Copy link
Copy Markdown

Confirming this on a MacBookPro14,3 (15" 2017, Radeon Pro 560, T1), Omarchy 4.0.4, kernel 7.2.5-3-omarchy.

NVMe pin hits the GPU. omarchy-nvme-suspend-fix.service writes d3cold_allowed=0 to 0000:01:00.0, which on this model is the dGPU (1002:67ef). The SSD is 0000:02:00.0 (Samsung 144d:a804) and was left at d3cold_allowed=1. Local workaround that targets whatever the nvme driver is bound to:

ExecStart=/bin/bash -c 'for d in /sys/bus/pci/drivers/nvme/0000:*; do echo 0 > "$d/d3cold_allowed"; done'

On its own this did not make S3 resume work here; the Alpine Ridge 8086:15d4 stall from #9899 is also present on this model (details in #12194).

amdgpu and hibernation (S4). Same failure as described above: with pm_test=devices, amdgpu's restore fails with SMU load firmware failed / amdgpu_device_ip_resume failed (-22), followed by an sdma ring timeout and a GPU hang. Things that did not help: vga_switcheroo OFF (then amdgpu_pmops_freeze returns -22 and hibernation aborts), and unbind + rebind (rebind fails with -17, "Failed initializing PREEMPT heap").

What works for us: boot the panel on the iGPU via the Apple EFI variable gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9 = 1, pin Hyprland to i915 with AQ_DRM_DEVICES (set in ~/.config/uwsm/env-hyprland only when i915 owns the connected eDP), and unbind amdgpu ~20 s after boot. With amdgpu unbound, hibernate + resume works. Trade-off: no external displays (the TB3 ports' DP is on the dGPU). The BCM43602 also needed brcmfmac unloaded before hibernate and reloaded after (its firmware traps on resume otherwise).

@omarchybot

Copy link
Copy Markdown
Collaborator

Looked again at e9ee03c, the same head as my last review. Two things changed around it. Nothing changed in it, and nothing was pushed.

Overlap with #14409. #14409 (lid-close suspend on the MacBookPro14,1) edits install/hardware/apple/fix-suspend-nvme.sh too, and the two pull requests conflict there: a trial merge of both heads stops on that file. They fix different bugs. #14409 adds a udev rule for Apple's 106b:2003 controller and kernel parameters for the 14,1, but it keeps the service that writes to 0000:01:00.0 for every model in the regex. On its own it would still pin the GPU on the 13,3 and 14,3. Both changes can coexist: whichever lands second needs the other's edits to that script folded in and reviewed again. The order is the maintainer's call.

#10877 is gone. The competing fix my last comment compared against no longer resolves on GitHub, so there is nothing left to choose between for #10826.

@macmsb's report on a MacBookPro14,3 shows the existing service landing on the Radeon at 01:00.0 and leaving the Samsung NVMe at 02:00.0 alone. That is the bug this pull request removes. It does not show a defect in this pull request. Their finding that pointing the fix at the Samsung drive did not restore S3 matches this pull request's choice to give the 15-inch models no unit at all.

Second opinion: Codex Medium reviewed these three points and found no new defect. It reached the same conclusions, but it could not reach GitHub this time and worked from my summary, so its agreement is not independent. The conflict above comes from my own trial merge, which it could not run. The worker reproduction and suite results from my last comment still stand, because the head and the script on quattro are both unchanged.

Still waiting on: a test of this exact commit on real hardware by @passerini, who opened #10826, or by a maintainer. The steps are in my previous comment. A confirmation from anyone else is useful context but cannot stand in for that test.

@jandrusk

Copy link
Copy Markdown

This is the right fix for #10826 (15" models were pinning the dGPU). Prefer over conflicting #12687. Note merge conflict risk with #14409 (same script, different bug) — whichever lands second needs a fold-in. Still would love a confirm from @passerini on real 13,3 hardware.

…nch Macs

The migration removed omarchy-nvme-suspend-fix.service on any machine whose 01:00.0 is not Apple's controller, whatever the file held. An administrator who had edited it, for instance to point it at the drive on 02:00.0 as one 14,3 owner did, lost that edit without a word. Omarchy's migration guide asks a migration to match what the installer actually wrote before deleting it, so it now removes only the unit as the leaf generated it, with or without the escaped colons, and leaves an edited, symlinked or unreadable one where it is with a note saying so. An unreadable unit is read as edited rather than failing the migration, since the leaf always wrote it world-readable and a failure would hold up every migration after this one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Andrew Boyd <andrew@formkit.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

I pushed a fix to the migration. The pull request is now at 8e2fc1d, and the hardware test I asked for earlier needs this commit instead of the old one.

What was wrong: migrations/1789274148.sh disabled and deleted omarchy-nvme-suspend-fix.service on every machine where 01:00.0 is not Apple's controller, whatever the file contained. Someone who had edited that unit would lose the edit without any message. @macmsb's change pointing it at the drive on 02:00.0 is one such edit. Omarchy's agents/skills/migrations.md says a migration must match what the installer actually wrote before deleting it. The migration now removes the unit only when it matches what the leaf generated, with or without the escaped colons. If the unit was edited, is a symlink or cannot be read, the migration leaves it in place and prints a message. It does not fail, because a failure would hold up every migration after this one. The test covers all three of those cases. @andrew-boyd's #12687 already handled customized units, so he is credited as co-author on the commit.

What was checked, on a disposable Omarchy worker VM, with this head merged into current quattro:

  • test/shell.d/apple-suspend-nvme-test.sh passes, 12 of 12. When I put back the previous version of the migration, the edited-unit case fails.
  • A reproduction of my own against a fake sysfs. Current quattro's leaf installs and enables the unit on a MacBookPro13,3 or 14,3 whose 01:00.0 is AMD (0x1002). This head leaves both alone, and still applies the fix to 13,1, 14,2 and MacBook9,1 with Apple's controller (0x106b).
  • ./test/cli passes. I did not re-run the full ./test/shell suite for this change; my first review ran it.
  • The leaf is unchanged on quattro. Converge omarchy-mac and omarchy-mx-mac into upstream Omarchy #14431 added a step that defers hardware setup to first boot for image builds. It still runs this leaf, and that does not change what the leaf does.

Second opinion: Codex Medium reviewed the head and found the problem above itself, and in a later round the unreadable-unit case. Its last round on the fix found nothing open.

#12687, raised by @jandrusk above, is not a separate fix. It is a draft built on this pull request: its first commit is this one, and its other commits change custom-unit handling and add some unrelated test fixes. Codex Medium was asked to compare the two without my view. We both keep this pull request, which is the older one. The idea #12687 had that this one lacked is now included above. Its other changes would also make hardware setup fail when the unit has been edited, and would leave the migration stuck on a machine that has the old unit and nothing at 01:00.0. The overlap with #14409 described in my last comment is unchanged.

Still waiting on: a test on real hardware, by @passerini, who opened #10826 on a MacBookPro13,3, or by a maintainer:

git clone https://github.com/niconistal/omarchy.git /tmp/omarchy-11624
cd /tmp/omarchy-11624 && git checkout 8e2fc1d46fd2c71f3ab0024991bc1fd8950ca1d7
bash -euo pipefail migrations/1789274148.sh             # removes the unit aimed at the GPU
systemctl status omarchy-nvme-suspend-fix.service       # expect: could not be found
bash install/hardware/apple/fix-suspend-nvme.sh         # expect: no output, no unit written
# reboot, then:
cat /sys/bus/pci/devices/0000:01:00.0/d3cold_allowed    # expect: 1

Please reply with what those commands print, and whether suspend behaves any differently from before.

@JPKFin

JPKFin commented Oct 27, 2026

Copy link
Copy Markdown

A data point from a MacBook8,1 (12-inch, early 2015) on Omarchy 4.0.6, kernel 7.2.8. The PR description says the 12-inch MacBooks keep the fix, but on the 8,1 the device at 01:00.0 is the Broadcom Wi-Fi, not the drive:

$ lspci -nn
01:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4350 802.11ac Wireless Network Adapter [14e4:43a3] (rev 05)
03:00.0 Mass storage controller [0180]: Apple Inc. S1X NVMe Controller [106b:2001] (rev 01)

So on quattro today, the unit sets d3cold_allowed=0 on the Wi-Fi card on this model, the same way it lands on the GPU on 13,3/14,3. With this PR, the 0x106b vendor check fails on the 8,1, so the leaf skips it and the migration removes the unit. That's the right outcome for the Wi-Fi card, but it means the 8,1 gets no NVMe quirk at all: its controller is 106b:2001 at 03:00.0.

I can't say whether the 8,1 actually needs the quirk. Its suspend problems come from the SPI keyboard under S3, which #9735 handles with mem_sleep_default=s2idle. Under s2idle this machine resumes cleanly with d3cold_allowed=0 set by hand on 03:00.0, but I haven't tested it with the default. If the model match is meant to cover the 12-inch machines, it might be worth looking the controller up by vendor ID instead of by a fixed address. Otherwise, the description could say that the 8,1 drops out.

Filed by Claude Opus 5.5 via Claude Code.

On the MacBook8,1, 0000:01:00.0 is the Broadcom Wi-Fi card, and Apple's S1X controller (106b:2001) sits at 03:00.0. The vendor check already stopped the leaf from writing the unit there, but the model match, the comments and the test all claimed the 8,1 has Apple's controller at 01:00.0. Drop it from the match, say where its devices really are, and test both the leaf and the migration against its Wi-Fi vendor ID.

Reported by JPKFin on the pull request, from lspci on a MacBook8,1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

I pushed a fix for the MacBook8,1 case @JPKFin raised. The pull request is now at 0174dda, and the hardware test I asked for earlier should use this commit.

What was wrong: the MacBook8,1 does not have Apple's controller at 01:00.0. @JPKFin's lspci shows the Broadcom Wi-Fi card there and the S1X controller (106b:2001) at 03:00.0, and the linux-nvme reports from 2015 put it at the same address. The vendor check already stopped the leaf from writing the unit on an 8,1, but the model match, the comments and the test all still said the 8,1 has Apple's controller at 01:00.0. The test even faked one there. The new commit drops the 8,1 from the model match and corrects the comments. The test now uses the 8,1's real Wi-Fi vendor ID for both the leaf and the migration. The migration message now says Wi-Fi as well as GPU.

The outcome on an 8,1 is what @JPKFin described. quattro today pins the Wi-Fi card, and this pull request removes that unit and adds nothing. The 8,1 gets no NVMe quirk, but it never had one: on quattro the unit never touched its drive. Whether it needs the quirk on 03:00.0 has not been shown on that machine. That would be a separate change, tested on an 8,1.

What was checked, on a disposable Omarchy worker VM, with this head merged into current quattro:

  • A reproduction of my own against a fake sysfs. On a MacBook8,1 with Wi-Fi (0x14e4) at 01:00.0, quattro's leaf writes and enables the unit, and this head writes nothing. The 15-inch models with the AMD GPU are still left alone. MacBook9,1 and MacBookPro14,1 with Apple's controller (0x106b) still get the fix.
  • test/shell.d/apple-suspend-nvme-test.sh passes, 14 of 14. With the previous leaf put back, the new 8,1 case fails.
  • ./test/cli passes. ./test/shell has 5 failing files out of 414 (agent-account-exec, ascii, branding-about-animation, first-run, runtime-smoke), and all 5 also fail on a clean quattro (9e0b5e2) on the same worker.

Second opinion: Codex Medium and muse-wonder (pi, thinking high) reviewed the whole diff at this head. Neither found a defect. Both agreed that dropping the 8,1 is right for this pull request and that extending the quirk to 03:00.0 needs its own hardware test. Their independence from my review is not guaranteed.

One question for the maintainer, which I have not changed: Codex Medium found a 2019 report of a MacBookPro13,3 with Apple's S3X controller (106b:2003) at 01:00.0. That gist's maintainer said it was the first such 13,3 they had heard of. On a machine like that, quattro applies the quirk to the right device. This pull request excludes the 13,3 and 14,3 by model, so the leaf would stop writing the unit there. The migration would keep an existing unit, because it checks the vendor and not the model. Leaving the 15-inch models in the match and relying on the vendor check alone would cover both layouts. This pull request deliberately chose to exclude them, so that choice is the maintainer's.

The pull request description still says the 12-inch MacBooks keep the fix. With this commit the 8,1 does not; the 9,1 and 10,1 still do. The overlap with #14409 in fix-suspend-nvme.sh is unchanged from my earlier comment.

Still waiting on: a test on real hardware. @passerini, who opened #10826 on a MacBookPro13,3, or @JPKFin on the 8,1, where the migration should remove the unit pinning the Wi-Fi card:

git clone https://github.com/niconistal/omarchy.git /tmp/omarchy-11624
cd /tmp/omarchy-11624 && git checkout 0174dda6cb1b5c0909072301b96858b5319835a3
bash -euo pipefail migrations/1789274148.sh             # removes the unit pinning the GPU or Wi-Fi card
systemctl status omarchy-nvme-suspend-fix.service       # expect: could not be found
bash install/hardware/apple/fix-suspend-nvme.sh         # expect: no output, no unit written
# reboot, then:
cat /sys/bus/pci/devices/0000:01:00.0/d3cold_allowed    # expect: 1

Please reply with what those commands print, and whether suspend or Wi-Fi behaves any differently from before.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Narrows the MacBook suspend fix to the intended models with an Apple controller at 01:00.0.

  • The suspend fix runs only for Macs with Apple’s NVMe controller at 01:00.0.
  • The migration removes the old suspend service from Macs with a different device at 01:00.0.

The focused Apple NVMe test suite passed. No actionable issues were found.

Reviews (1) · Last reviewed commit: "Leave the MacBook8,1 out of the NVMe sus..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NVMe suspend fix targets the dGPU on MacBooks with discrete graphics

6 participants