Skip to content

Use s2idle on T2 Macs with a discrete GPU - #9105

Open
T1mmsquared wants to merge 2 commits into
omacom:quattrofrom
T1mmsquared:t2-s2idle-on-discrete-gpu
Open

T1mmsquared wants to merge 2 commits into
omacom:quattrofrom
T1mmsquared:t2-s2idle-on-discrete-gpu

Conversation

@T1mmsquared

Copy link
Copy Markdown

install/hardware/apple/fix-t2.sh detects T2 Macs by PCI ID (106b:180[12]) and gives every one of them the same kernel command line, including mem_sleep_default=deep. That works on integrated-only models, but a T2 Mac with a discrete GPU can never complete a deep suspend.

On a MacBookPro16,1 (Radeon Pro 5500M), every suspend attempt fails and falls back:

PM: suspend entry (deep)
amdgpu 0000:03:00.0: GPU mode1 reset failed
amdgpu 0000:03:00.0: PM: pci_pm_suspend_noirq(): amdgpu_pmops_suspend_noirq [amdgpu] returns -22
amdgpu 0000:03:00.0: PM: dpm_run_callback(): pci_pm_suspend_noirq returns -22
amdgpu 0000:03:00.0: PM: failed to suspend noirq: error -22
PM: noirq suspend of devices failed
PM: suspend exit
PM: suspend entry (s2idle)   <- systemd retries, this one succeeds

Counted over the journal on this machine: 3 deep attempts, 3 noirq suspend of devices failed, 3 GPU mode1 reset failed — a 100% failure rate. The machine still sleeps, because systemd retries with s2idle, so the symptom is easy to miss.

Two costs beyond the wasted transition:

  1. Every lid close spends ~3 seconds suspending and then unwinding the entire device tree before the retry.
  2. The failed pass tears down and recreates four Apple EFI variables each cycle — AppleSecureBootFailureReason, AppleSecureBootKernelFailureReason, AppleSecureBootWindowsFailureReason, AppleFailedBootVolumeUUID — so every suspend/resume writes NVRAM on hardware where that wear is not free.

Approach

mem_sleep_default=deep was added deliberately in #6562, so this does not remove it. It selects the sleep state from the GPU configuration using the existing omarchy-hw-hybrid-gpu helper:

if omarchy-hw-hybrid-gpu; then
  sleep_state="s2idle"
else
  sleep_state="deep"
fi

Integrated-only T2 Macs produce a byte-identical config file to today, so #6562's fix is preserved exactly where it works. Only discrete-GPU models change, and they change to the state the kernel was already falling back to on its own.

Included

  • install/hardware/apple/fix-t2.sh — pick the sleep state from the GPU configuration
  • migrations/1788072498.sh — move existing discrete-GPU installs off deep and rebuild the boot image, following the repair-marker pattern from migrations/1785944594.sh so a pre-reboot rerun stays idempotent
  • test/shell.d/t2-hardware-test.sh — a stubbed omarchy-hw-hybrid-gpu, plus coverage for the discrete-GPU repair, its idempotency, the integrated-only path that must keep deep, and non-T2 hardware

Testing

  • test/shell.d/t2-hardware-test.sh — 10/10 pass (6 pre-existing, 4 new)
  • ./test/all — 4 failures, all pre-existing and environmental on this machine: three need a sibling omarchy-pkgs checkout that isn't present, one is a network-dependent theme URL check. None touch T2, suspend, or migrations.
  • Verified on the affected hardware: MacBookPro16,1, Omarchy 4.0.1, linux-t2 7.1.8. After the change /sys/power/mem_sleep reads [s2idle] deep and the failing deep pass is gone.

Scope of the evidence

I can only confirm this directly on a MacBookPro16,1. The other T2 models with discrete GPUs — MacBookPro15,1 / 15,3 / 16,4, iMacPro1,1, MacPro7,1 — should be affected by the same amdgpu failure, but I have not tested them. Happy to adjust the detection if a T2 owner reports otherwise.

Deep suspend cannot complete where a discrete GPU is present: amdgpu fails its
noirq suspend ("GPU mode1 reset failed", pci_pm_suspend_noirq returns -22), the
whole transition unwinds, and systemd retries with s2idle anyway. Every failed
pass also rewrites four Apple EFI secure-boot variables.

Integrated-only T2 Macs still get deep, so the suspend fix from omacom#6562 is kept
where it works. A migration moves existing discrete-GPU installs off deep and
rebuilds the boot image.
@jacobkjones

Copy link
Copy Markdown

Chiming in:
MacBookPro16,1, Omarchy 4.0.2, linux-t2 7.1.8 t2bce, BCM4364, panel on AMD. pm_async=off already. Deep hung (forced off). systemd MemorySleepMode=s2idle still self-rebooted ~1 min later; no PM: suspend entry flushed, no pstore. Cmdline-only apple_gmux.force_igd=1 muxed (Switching to IGD) then CATERR ~1 min after SDDM login.

Happy to retest a branch, would love a durable fix to get merged.

The unanchored VGA|3D|Display pattern also matched the T2 chip's two "Non-VGA unclassified device" lines, so every T2 Mac read as hybrid. That made the s2idle gate in fix-t2.sh and migration 1788072498 fire on integrated-only T2 Macs too, moving them off the deep sleep they resume from, and showed the Hybrid GPU menu entry on machines with one GPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 54fecac, and I pushed one fix as 5f29ed8.

What was wrong. The gate this relies on, omarchy-hw-hybrid-gpu, counted every lspci line matching VGA|3D|Display. Every T2 Mac lists its T2 chip as two Non-VGA unclassified device lines (T2 Bridge Controller, Secure Enclave Processor), and VGA matches inside Non-VGA. So an integrated-only T2 Mac counted as three GPUs and read as hybrid: fix-t2.sh and migration 1788072498 would have moved every T2 Mac to s2idle, including the integrated-only models where deep resumes and which the description says should stay byte-identical. 5f29ed8 anchors the match on the class name (VGA compatible controller, 3D controller, Display controller) and adds two cases to test/shell.d/hw-hybrid-gpu-test.sh: a single GPU plus the T2 lines reads as not hybrid, and two GPUs plus the T2 lines still read as hybrid. The same fix also stops the Hybrid GPU menu entry appearing on single-GPU T2 Macs.

What ran, and where. On a disposable Omarchy worker VM, with a stubbed lspci reporting an Iris Plus T2 Mac with and without a Radeon Pro 5500M, the migration at 54fecac switched both machines to s2idle. With 5f29ed8, the integrated-only one keeps deep and the Radeon one moves to s2idle. test/shell.d/hw-hybrid-gpu-test.sh (10/10), test/shell.d/t2-hardware-test.sh (10/10) and ./test/cli pass at 5f29ed8. The suspend failure itself needs the hardware, so a worker cannot reproduce it.

Second opinion. None this time. The configured reviewer (Codex Medium) answered a ping, but the review was refused because the day's review budget was spent. So this review is one model's reasoning: Claude Opus 5.5.

Related. #9830 also changes this line of fix-t2.sh, but moves every T2 Mac to s2idle. Its own thread has a MacBookAir9,1 report of overnight deep sleep resuming cleanly on the current t2bce stack, which supports scoping the change to discrete-GPU models the way this PR does. The two conflict on that line, so which one lands is the maintainer's call. A smaller point for the author: iMacPro1,1, MacPro7,1 and iMac20,1 show only the Radeon in lspci, so the hybrid gate keeps them on deep, even though the description lists the first two as likely affected. That only matters if someone confirms those models fail the same way.

Waiting on. A test of the full head on affected hardware. @T1mmsquared, or @jacobkjones since you offered: on a MacBookPro16,1, please run

git clone https://github.com/T1mmsquared/omarchy.git omarchy-9105 && cd omarchy-9105
git checkout 5f29ed8ad19987e1b9bd4fb98867b6a4566e9a8f
PATH="$PWD/bin:$PATH" bash migrations/1788072498.sh

Then reboot, close the lid once, and reply with the output of cat /sys/power/mem_sleep and journalctl -b -k | grep -E 'PM: suspend entry|noirq suspend|mode1 reset'. The first should read [s2idle] deep, and the second should show s2idle entries with no deep attempt. On an integrated-only T2 Mac, PATH="$PWD/bin:$PATH" omarchy-hw-hybrid-gpu; echo $? from the same checkout should print 1.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Critical risk] Changes kernel boot parameters and suspend behavior on T2 Macs.

The PR is not ready to merge because T2 Macs with a single discrete GPU remain configured for the suspend state this change intends to avoid.

Findings

  1. P1 Single GPUs keep deep suspend ▶
  2. P2 Fresh setup is untested ▶

Summary

The PR selects s2idle for detected hybrid-GPU T2 Macs, migrates existing configurations, and narrows GPU counting so T2 bridge devices are excluded.

  • The hybrid-GPU check does not cover T2 Macs with a single discrete GPU.
  • The fresh-install tests do not execute the changed setup path.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[T2 hardware detected] --> B{Hybrid-GPU helper succeeds?}
  B -- Yes --> C[Configure or migrate to s2idle]
  B -- No --> D[Configure deep or skip migration]
  E[One discrete GPU and no integrated GPU] --> F[Helper counts fewer than two GPUs]
  F --> D
Loading

Reviews (1) · Last reviewed commit: "Count only display controllers in the hy..."

# transition unwinds, and systemd retries with s2idle anyway. The doomed pass
# also rewrites four Apple EFI secure-boot variables on every cycle, so ask
# for s2idle directly on those models.
if omarchy-hw-hybrid-gpu; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Single GPUs keep deep suspend

If a T2 Mac has one discrete GPU and no integrated GPU, omarchy-hw-hybrid-gpu returns false when supergfxctl is absent because it requires two GPU entries. Fresh setup then writes mem_sleep_default=deep, and the migration skips the repair. That leaves the machine attempting the deep suspend this change is meant to avoid. The same condition affects the migration at migrations/1788072498.sh:14.

Knowledge Base Used: Hardware profiles and device controls

Comment on lines +13 to +18
grep -Fq 'omarchy-hw-hybrid-gpu' "$fix_t2" ||
fail "T2 setup picks the sleep state from the GPU configuration"
grep -Fq 'sleep_state="s2idle"' "$fix_t2" ||
fail "T2 setup uses s2idle where a discrete GPU blocks deep suspend"
grep -Fq 'sleep_state="deep"' "$fix_t2" ||
fail "T2 setup keeps deep suspend on integrated-only models"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Fresh setup is untested

These assertions only search the setup script for the helper name and both sleep-state assignments. They would still pass if the branches were reversed, while fresh installs would write the wrong sleep state. An execution-level test of the generated configuration for each GPU case would catch that regression.

Knowledge Base Used: Hardware, devices, and power

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

3 participants