Repository navigation
Conversation
…cBook Pros Two system-sleep hooks for the Apple T1 generation (MacBookPro13,x and 14,x), installed at setup time and by a migration for existing installs: - brcmfmac-reload unloads the BCM43602 driver before sleep and reloads it after, so every resume takes the firmware-reload path instead of the hot-resume path that leaves Wi-Fi down with dead firmware about half the time. - thunderbolt-remove-rescan removes the Thunderbolt upstream ports cleanly before sleep and rescans the PCI bus after resume. The platform firmware powers the Alpine Ridge controllers off in S3 regardless of the kernel's requests, and after a dirty loss the kernel cannot re-allocate the bridge windows, which leaves USB-C dead until a power cycle. With a clean removal the chipset root ports keep their windows and the rescan re-enumerates the whole tree. Both measured on a MacBookPro14,2 (Omarchy 4.0.2 and 4.0.3, kernel 7.1.9) over about thirty suspend cycles. Limits that are the platform's, not the hooks': a sleep of a few seconds leaves the Thunderbolt tree dead until the next sleep of a few minutes, and the tree returns on new bus numbers below the upstream ports. The hooks never block sleep and act on plain suspend only. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
MacBookPro14,3 hardware follow-up — 2026-09-19 Additional observations from the dual-GPU MacBookPro14,3 may help research alongside the MacBookPro14,2 results here. The local trials below used related, guarded experiments, not this PR's exact hooks; they do not establish a regression in this PR or successful S3 support on 14,3. Reliable low-power platform suspend remains unresolved. The related T1 driver and earlier hardware results are documented in my comment on the package PR. Environment: Omarchy Topology on the tested boot: Radeon New findings that may save other researchers time:
Firmware leads, still hypotheses: locally disassembled ACPI exposes Useful next work: isolate Radeon SMU/firmware restoration across actual S3; explain the unexpectedly early wake; then validate Wi-Fi reprobe plus PCI protection across real sleep, with empty Thunderbolt branches and repeated successful recovery. Inspect the ACPI branch differences without assuming a global OS override is safe. Intel/GMUX is another unvalidated route: the internal panel currently works through AMD while i915 fails eDP link initialization; do not assume merely detecting the Intel GPU makes it a working alternative. For comparisons on this model, record actual suspend entry/exit, real firmware resume versus |
|
MacBookPro14,1 (2017 13", no Touch Bar, single JHL6540): confirmed, and here it presents as a resume hang, not just dead USB-C Independently arrived at the same remove-before-sleep / rescan-after-resume fix on a MacBookPro14,1 before finding this PR. Data in case it helps get it merged — the 14,1 is in your Symptom on 14,1 (Omarchy 4.0.4, kernel 7.2.5-3-omarchy, Why it looks like a hard hang. Bisected with A second run stalled 35 s in With the hook (my minimal version: Two other data points:
Will also report the kernel side (thunderbolt/PCI PM spending 70 s on a controller the platform has powered off) to the upstream thunderbolt maintainers. Attachments (full dmesg of the boot + stall run with |
|
MacBookPro14,1 follow-up: retracting "brcmfmac-reload not needed" — it is, and the failure mode on the BCM4350 is worse than a driver reload can fix Correction to my comment above. After a few more hours with only the Thunderbolt hook installed, the 14,1's BCM4350 hit exactly the failure this PR's What happened. Four deep-sleep cycles resumed cleanly with Wi-Fi reconnecting on its own. The fifth entered S3 and woke back out immediately — Scanning and connecting were dead for the rest of the session. Every subsequent suspend then failed as well, because the driver could not put the dead chip into D3 ( Why a driver reload alone would not have recovered it. On the 14,1 the chip went fully off the PCIe bus, not just "registers readable, firmware dead" as you describe for the 43602 on the 14,2. Only a shutdown with the charger unplugged brought it back. So Suggested addition to the hook: drop the Wi-Fi root port as an S3 wake source. Out of the box the BCM4350's root port is armed: Nothing on Omarchy configures Wake-on-WLAN, so this wake source does no useful work, and a PME glitch from a card mid-power-transition is a plausible source of the instant wake that started all this (I could not prove the wake reason from the log, so treat this as a hypothesis). One line in With the reload + wakeup-disable hook in place (minimal version below, same shape as yours): a 97 s deep sleep, driver deregistered before RP=/sys/bus/pci/devices/0000:00:1d.0 # RP09, WiFi root port on 14,1
case "$1" in
pre) echo disabled > $RP/power/wakeup; modprobe -r brcmfmac_wcc brcmfmac ;;
post) modprobe brcmfmac ;;
esacFull filtered journal of the failed boot (the successful cycles, the early-wake cycle, the cascade of failed suspends, the failed probe after warm reboot, the clean probe after the cold boot) added to the gist: https://gist.github.com/spamnbeans/819fde7de388f7899d5c11a149685aa6 — |
|
The MacBookPro14,3 driver patches are not in this pull request. The systemd-sleep hooks here ( Untested packaging proposal (not compiled, not runtime-tested): omacom/omarchy-pkgs#596 Ordered status on this MacBookPro14,3 (kernel 7.2.5-3-omarchy, s2idle). Nothing below is a verified fix:
|
|
@spamnbeans thanks for the 14,1 data, and for following up with the correction. The 77 s noirq resume under On the wake source: the PR already does this, in the Thunderbolt hook rather than the Wi-Fi one. Before every plain suspend, For comparison, the 6 to 8 s lid-closed self-wakes described in the PR keep happening on the 14,2 with S3 wake disabled on all four root ports, so there the root ports are not what wakes it. Your wake came about 3 ms after entering S3, which looks like a different event, so I can't say from the 14,2 whether RP09 caused it. One question, if you have the data: how short were your short sleeps, and did USB-C come back at full speed after them? On the 14,2 a sleep of a few seconds leaves the Thunderbolt tree dead until a later, longer sleep. In your early-wake log I'm leaving the PR as it is for now, since both hooks already install on the 14,1 through the |
|
MacBookPro14,3 reference (kernel 7.2.5-3-omarchy, s2idle). Not a test of the hooks in this PR. A loaded local module is not a result for the package in omarchy-pkgs#596. Reported on this thread for other machines. Not retested here:
Shown on this 14,3:
Still open on this 14,3:
PC6, the fans, and the lamp are outside what those systemd hooks change. Nothing above says the hooks fix or break this 14,3. |
|
MacBookPro14,3 update, 2026-09-23 (kernel 7.2.5-3-omarchy, s2idle). This replaces parts of my previous comment. Still not a test of the hooks in this PR. Thunderbolt: cause confirmed on 14,3, and a kernel-side alternative.
Wi-Fi BCM43602. The Keyboard backlight, correction. The Two test-method notes.
Still open here: package PC6, fans during sleep, and the resume latency above. Nothing in this comment says the hooks in this PR fix or break this 14,3. |
|
MacBookPro14,3 update, 2026-09-24 (kernel The 14,3 now suspends and resumes with Wi-Fi, Thunderbolt, the keyboard light, fans and audio working. That needs the fixes below; none of them are systemd-sleep hooks. The patches and test data are in omarchy-pkgs#596.
Dependencies. Limits found.
|
|
MacBookPro14,1 (A1708, single JHL6540): this PR's exact hooks tested, one fix for the xHCI count, and a third hook for Bluetooth LE devices Omarchy 4.0.4, kernel 7.2.5-3-omarchy, 1. The xHCI count is hard-coded for the 14,2. STATE=/run/thunderbolt-remove-rescan.roots
+# xHCI controllers expected once the tree is back: the count before removal
+# (3 on two-controller models like the 14,2; 2 on the single-controller 14,1).
+XHCI_STATE=/run/thunderbolt-remove-rescan.xhci
+XHCI_WANT=$(cat "$XHCI_STATE" 2>/dev/null || echo 3)
@@ pre)
sync
+ xhci >"$XHCI_STATE"
thunderbolt_ports >"$STATE"
@@ post) / retry)
- (( $(xhci) >= 3 )) (three places)
+ (( $(xhci) >= XHCI_WANT ))With this the 14,1 logs 2. Bluetooth LE devices do not come back on their own (BCM4350 Bluetooth half, It is in the same gist. Whether it belongs in this PR or in a follow-up is your call; it fits the 3. A note on the short-sleep question. Not measured here yet: every real cycle so far was 1.5 to 2.5 minutes, and all came back on the first rescan. Happy to run a series of 5-10 s sleeps if useful. |
|
Follow-up on the short-sleep question, MacBookPro14,1 with this PR's hooks (plus the xHCI-count fix above): a 15 s deep sleep ( So on the single-controller 14,1 a sleep of seconds does not leave the Thunderbolt tree dead, unlike the 14,2 behaviour you describe. USB-C and Wi-Fi were usable right after resume. |
thunderbolt-remove-rescan counted the Thunderbolt tree as back once three xHCI controllers were bound. That is the four-port models' number: the chipset's controller plus one per Alpine Ridge. The two-port 13,1 and 14,1 have one Alpine Ridge, so a full tree there has two, the check never passed, and every resume ran the retry unit for about 12 s and ended with a false "tree NOT back" warning while USB-C worked. Reported and measured on a MacBookPro14,1 by stefanoverna on the pull request. The expected count now comes from the model: 2 on the 13,1 and 14,1, 3 on the others. It is not the count at sleep entry, because a short sleep can leave the tree dead going into the next one: 34 of the 65 sleeps in a MacBookPro14,2's hook log started with both sides dead, and a count taken then would report a dead tree as back and skip the retries. The comparison stays >=, so an extra controller from a dock does not matter. Behaviour on the four-port models is unchanged. The installer comment no longer calls every covered model a Touch Bar machine with a BCM43602, and the migration banner drops "Touch Bar", since the gate also covers the 13,1 and 14,1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@stefanoverna thanks for testing the hooks exactly as they are in the PR, on a second model, and for tracking down the xHCI count. You're right: Recording the count in Thanks for the 15 s run as well. On the 14,2 a 13 s sleep left the whole tree dead, so the 14,1 doesn't seem to share that limit. The second Alpine Ridge controller is one difference that might explain it, but that's a guess. If you do run the 5 to 10 s series, it would show whether the 14,1 has any lower limit at all, but it isn't needed for this PR. On the Bluetooth hook, I'd keep it out of this PR and suggest a separate one from you. One correction on the chip: the 14,2's Wi-Fi chip, the BCM43602, has no Bluetooth, and the Bluetooth there is a separate BCM20703A2 on the UART. So the 14,2 can't check a fix for the BCM4350's Bluetooth half, and LE reconnect across sleep hasn't been tried on it. A separate PR with your 14,1 logs would be easier to review, and it keeps this one to Wi-Fi and USB-C. @angellindo, on your note that only the first sleep after a boot is a valid Thunderbolt test: on the 14,2 in deep sleep with this hook, a later sleep does bring a dead tree back within the same boot. In one lid close, a 13 s self-wake left the tree dead, and the 46 minute sleep that followed brought it back on the first rescan. So the short-sleep limit in the PR doesn't look like the first-sleep effect you describe, though that may well be what you're seeing in s2idle on the 14,3. |
|
Suspend-hook review from the 11,5 Wi-Fi trenches (BCM43602, same chip):
The state tracking + post-fallback + never-blocks-sleep design is good. My hardened v2 with both changes runs live across lid cycles on 11,5 — happy to help converge the two hooks. |
|
Three notes from the MacBookPro14,1 side (I wrote the competing omarchy#10758 / omarchy-pkgs#349). 1. A 14,1 S3 hazard this PR's gate walks into. From omarchy#10593: on the 14,1, if anything is physically present in a Thunderbolt port when the machine enters S3, Apple's EFI S3 resume script function-disables root port RP05 ( The 2. Interaction with 3. BCM4350 fails in s2idle too. Kernel 7.2.5-3-omarchy, stock It was the first failure in 8 s2idle cycles that boot; the other 7 (lid or keyboard wakes, 1 min to 22 h) reconnected on their own. The only known difference is the wake source (RTC vs lid), which is a hypothesis, not a finding. So the 14,1 needs @angellindo, I've answered your ACPICA question on omarchy-pkgs#349 rather than here. 🤖 Generated with Claude Code |
|
Confirming from the 11,5 side that the hardening covers your note-3 failure mode. "Registers readable, firmware dead" (ring error, then every Our datapoint for the matrix: 11,5 (BCM43602, different chip from your 4350) suspends to On notes 1–2: nothing to add from 11,5. Ours are Thunderbolt 2 ports with no peripherals to test against, a different generation from the RP05 hazard, and the 14,1 reconciliation (hooks vs shim vs s2idle-default) is for the PR authors. One interaction worth keeping explicit as that decision lands: your own note 3 means s2idle-default does not remove the need for the reload hook on the 14,1. |
|
Reviewed at 3c960e4 by Claude Opus 5.5, with Codex Medium as a second opinion. Both read the diff against What ran. On a disposable Omarchy VM (not a Mac): Findings, most significant first:
The concerns rand0mdud3 raised (bring the interface down before Competing pull requests. Several other open pull requests change the same behaviour on the same machines:
Systemd runs every hook in What happens next. This waits on the author for the first two findings, and on the maintainer to choose among the competing fixes. Because the bug only shows on hardware a VM cannot provide, it cannot be marked verified until it has been confirmed on a gated Mac at the final head. |
|
Data from another MacBookPro14,2 (firmware 529.140.2.0.0, linux-omarchy 7.2.15-1, this hook at 3aab5a0, T1Bridge 0.1.12). On battery, lid-closed S3 holds (2 of 2, three minutes each), with the full tree back on the first rescan. On the charger it never holds, including the first lid close after a fresh boot: 21 sleeps in four lid closes on 2 and 3 November ended by themselves after 6 to 18 s, and logind re-suspended each time, with the battery charging or full. |
|
Charger: a 250 W Anker USB-C charger, always in the left rear port (nearest the hinge). The T1 runs the keyboard-mode stack ( Later in a boot, a close here can still wake once or twice after 3 to 5 s before a sleep holds. Today on the charger, one close woke after 5 s and then held 4 min 37 s on the next sleep. Closes here have always settled into a held sleep within about two minutes, so T1Bridge and the T1's USB wake are the two differences I can see. |
|
@dreinecke, on the T1Bridge difference @bjhinkle points to: one concrete thing that changes with it is whether the T1 is told the host is going to sleep. On my 14,3, GPE 0x33 belongs to the T1: in the SSDT, the T1's ACPI device From reading the macOS kext, macOS evaluates #!/bin/sh
# /usr/lib/systemd/system-sleep/t1-socw-sleep
case "$1/${SYSTEMD_SLEEP_ACTION:-$2}" in
pre/suspend) v=0x0 ;;
post/suspend) v=0x1 ;;
*) exit 0 ;;
esac
modprobe acpi_call 2>/dev/null || exit 0
printf '%s %s' '\_SB.PCI0.XHC1.RHUB.ASOC.SOCW' "$v" > /proc/acpi/call
logger -t t1-socw-sleep "$1: SOCW($v): $(tr -d '\0' < /proc/acpi/call)"It needs Don't send If the T1 is the cause, then with the hook in place a lid-closed sleep on the charger should hold, and This is only a guess. It doesn't explain why your sleeps hold on battery. And on my 14,3, with T1Bridge and without |
|
@makoni, the 14,2's tables differ from your 14,3 there.
|
|
@bjhinkle, thanks, that corrects my 14,3 reading for the 14,2. With 0x32 and 0x33 being the Thunderbolt hot-plug handlers on your 14,2, as you found, a one-per-sleep rise on both points to the Thunderbolt side, though the counters alone can't say whether it comes before the wake or after it. That takes back two things from my previous comment. The Your run with the T1's USB wake disabled shows that isn't what separates your machine from @dreinecke's, so the sleep hook is still the test I'd try next. It's still a guess: your machine sends |
|
MacBookPro14,3 update, 2026-11-04: S3 with an occupied USB-C port now has a working local kernel configuration in four cycles across two cold boots. This is a kernel-path test report, not validation of the exact sleep hook in this PR, and not a claim that all 13,x/14,x models are fixed. Artifact and dependencies. My experimental Why the old local workaround matters. With my Blocking only that local module for the trial boot (
All four returned with both upstream links at 8 GT/s x4, both NHIs and xHCI controllers present, no For the USB3-attached cycles, a Kingston DataTraveler 70 remained connected on the tested side at SuperSpeed 5000 Mbit/s, under Remaining observation: The local 0664 module skips |
|
Data from a MacBookPro14,2 after updating to Omarchy 4.5.0-3 (from 4.0.6), One lid close on 2026-11-05: the first three deep sleeps ended by themselves after about 6 s each, and each left the Thunderbolt tree down until a longer sleep, which is the known short-sleep behavior on this model. The fourth sleep held for 25 minutes until the lid was opened, and the hook's rescan brought both sides back on its first attempt (3 xHCI controllers, 32 PCI devices). Wi-Fi, audio and the Touch Bar came back as well. That's the same model, Omarchy release and kernel as hanscnelson's test of the #12211 approach (#12211 (comment)), where the lid-closed cycle cost the Thunderbolt xHCI controllers until a reboot. Separately, hibernation on this model needs |
|
@makoni, follow-up to my RAM note: that turned out to be overheating, since fixed. Here are v3 results on a 13,3 (Omarchy 7.2.15, subsystem
So with v3 the unload/reload half of the hook isn't needed on this model, at least in these tests. I can't easily send a properly threaded reply to the list from here, so in case it's useful for a v4: Tested-by: Alex McCubbin [email protected] # MacBookPro13,3 |
|
@acmccubbin, thanks, and good to hear the RAM problem was overheating and is fixed. I've forwarded your Tested-by to the v3 thread on linux-wireless with a link to your comment, and Cc'd you there in case you want to confirm it. If a v4 is needed, it will carry the tag. |
|
A note on test hardware: the MacBookPro14,2 I've been testing this on goes back to its owner on 2026-11-12, so I can't retest on it after that. It ran this hook at |
|
Read the ten comments since the last review against the hook at 3aab5a0, by Claude Opus 5.5 with Codex Medium and muse-wonder (pi, thinking high) as second opinions. The head has not moved, so nothing was rerun. @dreinecke's 14,2 narrows one claim in the description. It is the first run of this head on a second 14,2. On battery, lid-closed S3 held 2 of 2 with the tree back on the first rescan, which matches @bjhinkle's results. On the charger, none of 21 sleeps held. So the last Known limits bullet, that this hook's removal did not stop a charger S3 from holding on the 14,2 (4 of 4 on @bjhinkle's machine), is true of that machine and not of every 14,2. It does not show that the hook causes the wakes: the two machines run different Touch Bar stacks, and a sleep that ends in 6 to 18 s strands the tree whatever woke it, as the description already says of short sleeps. The stack difference is stock against a replacement. Omarchy installs One test would settle whether the hook is involved there. @dreinecke, if you have the time: on the charger, same port, from a fresh boot with nothing else changed, move Nothing else here changes the diff. @bjhinkle's run on Omarchy 4.5.0-3 and Both second opinions read the comments the same way and named the same test without being given it. Their independence from this session is not guaranteed. Not marked verified. @bjhinkle's 14,2 went back to its owner on 2026-11-12, so any further run of this head on a 14,2 has to come from someone else. @dreinecke's battery run is at this head, but on a stack Omarchy does not install and with the charger case open, so it does not verify this head on its own. Nothing is required from @bjhinkle, though the charger bullet could mention @dreinecke's result. The maintainer chooses whether to keep the machine-wide xHCI count or take the per-side one, and which sleep mode these Macs default to, between this, #10758, #12211, #14409, #14692 and the opt-in #14894. |
|
One correction to the stack comparison above. The premise is right as far as the source goes:
On my 14,3 the package's DKMS build failed on every kernel after I installed it on 15 September, and I removed it on 2 November; the keyboard there runs on the in-tree |
|
@makoni is right, and the previous comment's paragraph "The stack difference is stock against a replacement" was wrong. Checked by Claude Opus 5.5, with Codex Medium and muse-wonder (pi, thinking high) as second opinions. The head (3aab5a0) has not moved, so nothing was rerun. What was checked. The omarchy-pkgs recipe for What that changes. On the shipped kernel, a stock install never gets the The diff doesn't change. The hook touches only Thunderbolt removal and the PCI rescan, never the Touch Bar drivers or The test asked of @dreinecke still stands, and it matters more now that their setup is the closer match for stock on The package that no longer builds is a problem of its own, already reported in #9831 and #10825, with #9880 proposing to stop installing it. It is outside this diff. Still not marked verified. No one has run this head on a stock 14,2. @bjhinkle's machine is gone, and @dreinecke's run is on T1Bridge with the charger case open. Besides that hardware run, it waits on the maintainer: whether to keep the machine-wide xHCI count or take the per-side one, and which sleep mode these Macs default to, between this, #10758, #12211, #14409, #14692 and the opt-in #14894. Both second opinions came to the same reading. They were asked what @makoni's comment meant without being told my conclusion, but their independence from this session is not guaranteed. |
|
Physical test of I ran the exact unmodified hook from
Context on
Note on the previously reported |
|
Checked the new report against 3aab5a0 by GPT-6 in Codex (high effort), with Opus 5.5 High and muse-wonder via pi (thinking high) as second opinions. No code changed and no tests were rerun in this review; a VM cannot reproduce Alpine Ridge suspend behavior. @angellindo's report adds one successful cycle of the current hook on a 14,3: after 298 seconds of lid-closed S3 on battery, both NHIs and xHCI controllers returned on the first rescan. The hook's reported hash prefix matches this head. This is evidence for that configured machine. The kernel package was stock, but the sleep configuration, Radeon/SOCW hooks and DKMS modules were local, including a Thunderbolt sleep module. The hooked cycle used empty ports, so it established re-enumeration without testing a USB-C device after resume. It does not settle the stock-system or charger cases. The reported fixture matches the existing count finding at Both second opinions agreed with these limits; their independence from this session is not guaranteed. No new code defect was found. Hardware confirmation, the outstanding 14,2 charger comparison, and the maintainer's controller-check and sleep-mode decisions remain open, so this stays waiting on the maintainer without verification. |
|
Data point from a MacBookPro14,3 (Radeon Pro 560, SM961, BCM43602), Omarchy,
So for the 14,3 at least, the remove/rescan seems needed whatever the sleep state is. My hook, plus the other fixes this model needed, is at https://github.com/mihneadevries/mbp14-3-linux-sleep-fix. |
|
Checked the new s2idle report against 3aab5a0 by GPT-6 in Codex (high effort), with Opus 5.5 High and muse-wonder via pi (thinking high) as second opinions. No code changed or tests were rerun; a worker VM cannot reproduce Alpine Ridge suspend behavior. @mihneadevries, this adds a possible s2idle limit on the 14,3. At To isolate the Thunderbolt change, please give the helper's full commit SHA and an A/B/A comparison with the other settings held fixed: removal off, on, then off again. Include the effective sleep mode, cycle counts and durations, charger/battery and USB-C device state, and the available suspend/resume journal. Your notes say some earlier hangs were stopped after 30–60 seconds, so please distinguish those from a stall that eventually resumes; allow at least three minutes before classifying a run as hung. For real sleep cycles, confirm Both second opinions found no new defect established in the promised S3 behavior and agreed that this report does not verify the unchanged head; their independence from this session is not guaranteed. Extending the gate to s2idle remains a maintainer decision alongside #14692. This stays waiting on the maintainer, with hardware verification and the earlier controller-count decision still outstanding. |
|
A/B/A as requested, on the MacBookPro14,3 ( Each run enters s2idle directly (
Both "off" runs went well past 3 minutes, so these are hangs rather than a stall that eventually resumes. Earlier real s2idle cycles with removal on (RTC-timed and lid close/open, Limits: this is |
|
Checked the new response and its pinned test script against 3aab5a0 by GPT-6 in Codex (high effort), with Opus 5.5 High and muse-wonder via pi (thinking high) as second opinions. This was a source review; no code changed or tests were rerun on a worker, which lacks Alpine Ridge hardware. @mihneadevries, the off/on/off result answers the timing question: the two failed runs went beyond three minutes, with a 7.1-second return between them. It strengthens the evidence for the Thunderbolt preparation path on your 14,3. One control remains in the pinned script: the Your limit on Both second opinions found no new defect established in the promised S3 behavior and agreed with these evidence limits; their independence from this session is not guaranteed. Extending this hook to s2idle remains a maintainer decision alongside #14692. The installer also now conflicts with current |
|
Results from real s2idle cycles on my MacBookPro14,3: whether the remove/rescan matters outside S3, and a problem with USB-C devices plugged in after the wake. Setup: Omarchy 4.5.0-3, stock
Cycles 1–3 were in one boot, 4 and 5 in the next one, after a full power-off. Root-port wake was the same in cycles 2 and 3: cycle 1's Without the removal, the tree is lost in s2idle here too: in all 14 of my boots since early October that had an s2idle (7.2.5–7.2.15, one of them a local test build, no hook), both Alpine Ridge xHCIs were removed on the first wake, with the same 12 So on this 14,3 the header note in A device plugged in after the wake. After a fresh boot, all ten Alpine Ridge bridges (
The sample is small: one run without the removal (cycle 3) against four with it, one each way with the SSD attached through sleep, and one run with the |
|
GPT-6 in Codex (high effort) reviewed @makoni's new report and pinned helper against 3aab5a0, with second opinions from Opus 5.5 High and muse-wonder via pi (thinking high). Both found no newly established defect in this head; their independence from this session is not guaranteed. This was a source review; the head is unchanged, no code changed or tests were rerun, and a worker lacks Alpine Ridge hardware. Cycles 2 and 3 kept root-port wake disabled in both runs, so that setting does not explain their difference. These are real s2idle sleeps, adding evidence beyond the earlier platform tests. Cycle 3 entered sleep on an already-rescanned tree, so tree history remains a difference. The result shows Thunderbolt loss in s2idle on this setup; it does not establish whether firmware cuts power or verify this S3-only hook. The new hot-plug observation is relevant to the S3 check: this head rescans and counts xHCIs but does not preserve @angellindo, on an S3-capable machine, the useful next check is with ports empty during sleep: after waking, record the Alpine Ridge bridges' |
|
Follow-up to my s2idle report above: the hung reads in cycle 4 don't reproduce on Same MacBookPro14,3, firmware, out-of-tree modules and SSD (JMicron
In all four, both trees came back (rescan 57–130 ms, links at 8.0 GT/s x4) and the SSD enumerated at 5 Gb/s with This also answers an open question in my earlier report: the Alpine Ridge bridges are Why I think the old hang was in xHCI: in cycle 4 the two stuck commands were readahead reads of the partition (sectors 2368 and 2816). They were still So on 7.2.15-4, removing the tree before sleep, rescanning after and getting the bridges back to |
|
GPT-6 in Codex (high effort) reviewed the follow-up against 3aab5a0. Opus 5.5 High and muse-wonder via pi (thinking high) also reviewed it. Both found no newly established defect in this head; their independence from this session is not guaranteed. This was a source review; no code changed or tests were rerun, and a worker lacks Alpine Ridge hardware. @makoni, the four successful 512 MiB reads on 7.2.15-4 update the earlier storage finding: your helper with bridge-policy restoration now has successful late-plug I/O on this s2idle setup. The restore-off test was on 7.2.15-1, so these new runs do not establish whether restoration is still needed on -4. The kernel explanation remains plausible rather than proven. Identifying your local boot script as the source of the bridges' These runs still use a different helper in s2idle. They do not verify this S3-only head. The existing request for a post-S3 plug/read comparison with fresh boot remains open, alongside hardware confirmation and the maintainer's controller-check and sleep-mode decisions. The installer conflict with current |
|
Follow-up on the stock-behaviour point: I have since tested it, and the hot-plug part has a kernel cause with an upstream fix. Stock 7.2.15-4, no sleep.
So in the kernel's default runtime-PM state this does not depend on sleep. A real default boot does reach that state: the patched kernel below booted without my rule or script, with root ports at Cause and fix.
Patched kernel on this MacBookPro14,3.
What this means for this PR's head.
Details are in omacom/omarchy-pkgs#3475. |
|
GPT-6 in Codex (high effort) reviewed the new report, the upstream PME change and draft omacom/omarchy-pkgs#3475 against 3aab5a0. Opus 5.5 High and muse-wonder via pi (thinking high) also reviewed them; both found no newly established defect in this head. Their independence from this session is not guaranteed. This was source review; no code changed or tests were rerun, and a worker lacks Alpine Ridge hardware. The new observations support the kernel explanation for idle hot-plug. The Apple path omits native PME handling, and polling skips devices behind a runtime-suspended bridge. Upstream 2d89ca89b01f enables native PME; the patch carried in draft #3475 matches it. The reported patched-kernel results cover fresh-boot hot-plug and one s2idle cycle with a different helper. They do not verify this head in S3 or show that its remove/rescan is obsolete. For the outstanding S3 plug/read comparison, record the kernel version, whether the boot log lists PME, any keep-awake rule or script, and bridge |
Summary
This adds one
systemd-sleephook. With it, a 2017 13-inch MacBook Pro (MacBookPro14,2, Apple T1) suspends to S3 and comes back with USB-C and Thunderbolt working, which it does not do with the stock setup. The measurements below come from that machine: about twenty suspend cycles on 2026-09-05, normal use through three kernel changes, and a run of the current code from 2026-10-18 to 2026-10-20. The hook installs on the 2016-2017 MacBook Pros (MacBookPro13,x and 14,x). A MacBookPro14,1 and a MacBookPro14,3 have since been tested with it (see the paragraphs below).Environment for the 2026-09-05 measurements: Omarchy 4.0.2, kernel 7.1.9-arch1-2, Mac firmware 529.140.2.0.0, this repository at 8e479f0 (unmodified),
snd_hda_macbookproat ef27884. The same machine has since run Omarchy 4.0.4 onlinux-omarchy7.2.5-3 (from 2026-09-17) and Omarchy 4.0.5 and 4.0.6 onlinux-omarchy7.2.8-9 (from 2026-10-18). See How this was tested.Earlier versions of this PR also carried a Wi-Fi hook,
brcmfmac-reload. It was removed in 0123087. Only one Wi-Fi fix should land, the reviews pick #7333, and unloadingbrcmfmacgoes through the same driver teardown where a P2P interface race has caused kernel oopses (a driver fix is on its way upstream, per the #7333 thread).Changes after the review
prestops any retry unit left from the previous resume before it removes anything. The hook acts only when the sleep is S3 (deep), andpostacts only ifpredid. The mounted-device check also covers active swap. The migration installs the hook unconditionally.brcmfmac-reload(see above)./sys/power/stateand acts only when it ismemwithmem_sleepatdeep, soSuspendState=freezeno longer looks like S3.prewaits only for the root ports of the sides it removed, since the root port of a side kept for a mount may never runtime-suspend and waiting on it cost 5 s.postand the retry unit count the tree as back at the model's xHCI count less one for each kept side.The problem: Thunderbolt and USB-C are dead after suspend
The platform firmware removes power from the Alpine Ridge controllers in S3 regardless of what the kernel asks. On resume the bridges come back with collapsed windows, the kernel cannot re-allocate them at runtime ("can't assign; no space"), pciehp removes both Thunderbolt-side xHCI controllers, and USB-C is gone until a power cycle. The Touch Bar, keyboard, audio and camera survive because the T1 sits on the chipset's own xHCI.
On the 14,2 this is not limited to short or lid-open sleeps. Without the hook, from a fresh boot with the USB-C ports empty, a 23-minute lid-closed sleep lost both sides, and so did a lid-open sleep that woke after 3 s. In the three runs without the hook, resume also froze for 80 to 104 s while the PM core timed out on the dead bridges, against 12 to 13 ms with the hook. On a 14,3 without this hook, angellindo saw Thunderbolt survive long lid-closed sleeps with the ports empty (3 of 3), so the models may differ.
Things that do not help, all measured:
d3cold_allowed=0on every device in the tree (the ports failed from D3hot, not D3cold),pcie_port_pm=off,pcie_ports=compat, forcing the root ports to D0 and rescanning, and evaluating the firmware's own power-on methods withacpi_call(the GPIO pads read the same on a dead side and a live side, and the rails belong to the platform).What does help: remove the two Thunderbolt upstream ports (
03:00.0and79:00.0, the children of root ports00:1c.4and00:1d.0) cleanly before sleep, and rescan after resume. The chipset root ports never lose their windows, so the rescan re-enumerates the whole tree with fresh assignment.thunderbolt-remove-rescandoes that, plus:memto/sys/power/state(the firstSuspendState=entry the kernel supports), and/sys/power/mem_sleepmust selectdeep.postacts only ifpredid. The power loss it works around is an S3 behavior, so in s2idle, however it is selected, the hook stands down instead of dropping attached devices on every sleep.prestops any retry unit still running from the previous resume, so a late retry cannot rescan the tree back in afterpreremoves it.syncfirst and skips a side if a mounted filesystem, any member of a mounted multi-device btrfs, or active swap is reached through it (a USB-C disk would otherwise be torn before the kernel's suspend sync).systemd-run --collect, because post hooks run whileuser.sliceis still frozen and a plain backgrounded subshell is killed with the hook. "Back" means the model's count of xHCI controllers (2 on the two-port 13,1 and 14,1, 3 on the four-port models), less one for each side kept for a mount.Measured behavior with the hook installed (MacBookPro14,2, kernel 7.1.9, before the 5884ffa changes):
06:00.0and7c:00.0to2c:00.0anda2:00.0, the same numbers on every cycle). Nothing may key on addresses below03:00.0or79:00.0.On a MacBookPro14,1 (one JHL6540), stefanoverna ran the hooks as they were at 89fe6bf, plus a local fix for the xHCI count. Before them every lid close ended in a black screen that needed a power-button hold. With them, lid-close sleeps of about two minutes resume cleanly with the tree back on the first rescan. A 15 s sleep there also came back complete, so the short-sleep limit above has not been seen on the 14,1. spamnbeans reported the same resume hang on another 14,1 and reached the same Thunderbolt fix independently. The 14,1's full tree has two xHCI controllers rather than three, which is why the count is per model (3c960e4, after stefanoverna's run).
On a MacBookPro14,3, makoni ran this head (936d96b) for 12 S3 cycles on
linux-omarchy7.2.5-3, on battery with nothing in the ports. Every cycle brought the tree back on the first rescan, with 3 xHCI controllers, 37 PCI functions and both links at 8 GT/s. The hook found the 14,3's upstream ports (04:00.0and7a:00.0, under the CPU root ports00:01.1and00:01.2) with no address in the code. Three of the 12 cycles ran the hook unchanged, and the other nine varied its wake handling or ran it on a patched kernel. That machine also carried a localamdgpuquirk so that S3 resumes at all, andpower/control=onon every PCIe port, which made the settle wait run to its 5 s cap on each cycle. makoni's first report of Wi-Fi loss with the hook was later corrected: on battery the BCM43602 loses power in S3 with or without the hook, and makoni has sent a brcmfmac fix for that to linux-wireless.Known limits
deepsleep breaks Thunderbolt on resume — working s2idle enablement, patches forthcoming #10593), where the root port stayed disabled until a cold boot. The four-port models do it too: on a 14,3 without this hook, angellindo lost the side holding an unmounted USB 3 stick after long lid-closed sleeps (2 of 2, once with the device deauthorized in software first), and simbilim's own remove-and-rescan helper lost the controller on a 13,3 with a USB Ethernet adapter attached. On the 14,2 this hook removes that side's upstream port before sleep, and the side is still lost (two different sticks). What the hook changes there: the empty side survives, the device keeps working at USB 2.0 through the chipset controller, resume does not freeze, and the lost side came back with the next long sleep once the port was empty (one run). Without the hook, the same test lost both sides and the stick entirely. Fix Thunderbolt suspend on the MacBookPro14,1 #10758 avoids the 14,1 case by defaulting the 14,1 to s2idle, and this hook does nothing in s2idle, so the two do not collide.suspend-then-hibernate, external displays over USB-C across a sleep, and Thunderbolt PCIe devices. Omarchy does not configuresuspend-then-hibernate, but upower's default critical-battery action requests it. On the 14,2 at 2 % battery, the first of those sleeps went into S3 with the hook standing down, left both sides dead and froze resume for 102 s. Each of those sleeps also woke within 4 s with the lid open, so the hibernate step never ran and the battery ran flat. SettingCriticalPowerAction=PowerOffin upower makes it shut down instead.amdgpu(SMU load firmware failed,-22) with the panel left black. That failure is in the graphics driver, not Thunderbolt, so this hook cannot help with it. Sleep in s2idle on the MacBookPro14,3 #14692 (draft) would move the 14,3 to s2idle, and this hook does nothing in s2idle, so the two do not collide. darrellgum's 14,3 in the next item gets past theamdgpufailure on a kernel that also carries two mainlineamdgpucommits for that Radeon variant (a5be7ad8f5f0,a22e5e4f2ebb). makoni's 14,3 run above used a localamdgpuquirk for its Radeon Pro 560, since superseded by Maciej Kucharek's series on amd-gfx, which is not in a kernel release yet. The 13,3 has the same Radeon-on-panel design, and simbilim runs S3 on one with the Radeon powered off and their own remove-and-rescan helper. Nobody has posted a run of this hook on a 13,3.Things to expect
Lid-closed sleeps sometimes wake on their own a few seconds in and then re-suspend: at 6 to 8 s on 7.1.9 (4 of 8 hands-off lid closes on 2026-09-05), once at 13 s in the first lid close on 7.2.5, and at 3.2 and 3.6 s in 2 of 12 lid-closed sleeps on 7.2.8. That short sleep leaves the tree dead as above until the next long sleep. On 7.1.9 every wake source the kernel can see was ruled out with controls (GPE counters, wakeup sources, the PM1 status register, the raw GPE0 block), so the cause looks firmware-side.
With the lid open, early wakes are more common: on 7.2.8 a
systemctl suspendwoke after 2.7 to 4.4 s on three of four boots on the 14,2, with and without the hook, and angellindo saw the same on a 14,3 in 9 of 9 cycles. For a long sleep, close the lid.A USB device plugged into a USB-C port is not detected while the Alpine Ridge xHCIs (
8086:15d4) are runtime-suspended, with or without this hook, including on a fresh boot before any sleep. Setting theirpower/controltoonmakes the device appear at once, and angellindo's udev rule keeps it there.One more scope note: this is for the keyboard-mode Touch Bar stack (apple-ib-tb lineage). The t1bridge display-mode stack replaces those drivers and lists sleep/wake as not working. This hook may still apply there since it touches Thunderbolt, not the T1, but that is untested.
Files
default/systemd/system-sleep/thunderbolt-remove-rescan: the hook, beside the packagedkeyboard-backlight,force-igpuandunmount-fuse. Root-owned 0755, every path exits 0, and it acts only on a suspend into S3.install/hardware/apple/fix-t1-suspend.sh: installs it whenproduct_namematchesMacBookPro13,[123]orMacBookPro14,[123](all six 2016-2017 models), wired intoinstall/hardware/all.shafterfix-brcmfmac-supplicant.sh.migrations/1789242220.sh: the same for existing installs. It installs unconditionally, so a copy the user carries is also reset to root:root 0755. Nothing to restart, since the hook takes effect at the next suspend.The hook finds the upstream ports from the NHIs bound to the
thunderboltdriver (NHI, downstream port, upstream port), so no PCI addresses are hard-coded. Its only model-specific value is the xHCI count that marks the tree as back. Delete the file to undo.How this was tested
Hands-off cycles with an RTC alarm as the only wake (
echo $(( $(date +%s) + 100 )) > /sys/class/rtc/rtc0/wakealarm; systemctl suspend), with the tree counted before and after byls /sys/bus/pci/devices | wc -l,ls -d /sys/bus/usb/devices/usb*, andls /sys/bus/pci/drivers/xhci_hcd, and the journal grepped forcan't assign,Unable to change power stateandHost halt failed. Then five real lid-close cycles, then daily use. Anyone reproducing this should touch nothing for the first ten seconds of a lid-open sleep, because an early wake strands the tree.The hook then ran unchanged on the 14,2 through three kernel changes: 7.2.3-arch1-3 from 2026-09-12,
linux-omarchy7.2.5-3 (Omarchy 4.0.4, 2026-09-17) andlinux-omarchy7.2.8-9 (Omarchy 4.0.5, 2026-10-18). On 7.2.5, one lid close held both cases: a 13 s self-wake left the tree dead, and the 46-minute sleep that followed brought the full tree back on the first rescan. On 7.2.8, an 11.5-minute lid-closed sleep with no self-wake brought the full tree back on the first rescan.The changes after 3c960e4 were first checked off the hardware (syntax, the gating and retry-stop paths against stubbed sysfs and a stubbed systemd config, and omarchybot's VM runs), then on hardware in makoni's 14,3 cycles above and in a 14,2 run at 936d96b and 3aab5a0 from 2026-10-18 to 2026-10-20 (results). That run covered long and short sleeps, s2idle, the retry stop, a device left in a port and a mounted disk with and without the hook, and the lid-closed and lid-open controls without it, mostly one run per case.
🤖 Generated with Claude Code