Skip to content

Fix iMac20,2 AMDGPU startup race - #10169

Open
aurelienbottazini wants to merge 3 commits into
omacom:quattrofrom
aurelienbottazini:fix/imac20-amdgpu-uclk
Open

aurelienbottazini wants to merge 3 commits into
omacom:quattrofrom
aurelienbottazini:fix/imac20-amdgpu-uclk

Conversation

@aurelienbottazini

@aurelienbottazini aurelienbottazini commented Sep 4, 2026 •

Copy link
Copy Markdown

[!NOTE] 90% AI
It was particularly painful to do all the manual reboots and testing :)

Summary

  • Detect only the affected iMac20,2 with AMD/Apple PCI IDs
    1002:7319 / 106b:021b.
  • Add amdgpu.ppfeaturemask=0xfff7bffd to the generated Limine command line so
    the memory-clock feature group is not enabled during the fragile SMU probe.
  • Restore DPM_UCLK, MEM_VDDCI_SCALING, and MEM_MVDD_SCALING after the display
    manager starts, with guards for the boot parameter and exact hardware IDs.
  • Cover fresh installs and existing systems with an idempotent migration.

Problem

On this 2020 27-inch iMac, AMDGPU initialization fails intermittently before
the display manager starts. A failed boot consistently contains:

apple_gmux: Found gmux version 5.0.0 [T2]
amdgpu 0000:03:00.0: SMU: No response msg_reg: 6 resp_reg: 0
amdgpu 0000:03:00.0: Failed to enable requested dpm features!
amdgpu 0000:03:00.0: Failed to setup smc hw!
amdgpu 0000:03:00.0: hw_init of IP block <smu> failed -62
amdgpu 0000:03:00.0: Fatal error during GPU init

This happens during the kernel probe, so delaying SDDM did not address it.
Loading AMDGPU early from the initramfs also did not address it.

Why this workaround

The default AMDGPU feature mask on the tested kernel is 0xfff7bfff.
Clearing PP_MCLK_DPM_MASK (0x2) gives 0xfff7bffd. On Navi10 that keeps
the following features out of the initial SMU allowed-feature set:

  • DPM_UCLK, bit 3
  • MEM_VDDCI_SCALING, bit 8
  • MEM_MVDD_SCALING, bit 9

With that boot mask, the GPU initializes reliably. Once userspace reaches the
display manager, writing the original three bits back through pp_features
restores memory-clock scaling without a kernel error. The helper preserves all
other feature bits and verifies that the three requested bits were accepted.

The workaround fails closed unless both the exact kernel parameter and all four
PCI IDs match. It discovers the PCI address through sysfs rather than assuming
03:00.0.

Hardware and software tested

Model:              Apple iMac20,2 (Mac-AF89B6D9451A490B)
CPU:                Intel Core i7-10700K
GPU:                Radeon Pro 5700 XT / Navi10
PCI IDs:            1002:7319, subsystem 106b:021b
Omarchy:            4.0.2-1
Kernel:             7.1.8-arch1-Watanare-T2-3-t2

Validation

  • A captured unmasked boot reproduced all six SMU/GPU initialization errors
    above and failed the AMDGPU probe with -62.

  • amdgpu.dpm=0 was tested as a negative control. It failed differently with
    firmware loading/probe error -95 and is not used here.

  • An SDDM readiness gate was tested as a negative control. It could not help
    because the GPU failure precedes SDDM.

  • Four consecutive boots with amdgpu.ppfeaturemask=0xfff7bffd completed with
    no Failed to setup smc hw, SMU block-init, or fatal GPU-init messages.

  • The automatic late restore completed with:

    AMDGPU runtime memory-clock features enabled: 0x00000662a3d9afbb
    
  • DPM_UCLK, MEM_VDDCI_SCALING, and MEM_MVDD_SCALING all read back enabled, and
    MCLK returned from the boot-time 0 MHz state to 98 MHz idle.

  • brcmfmac remained loaded during the successful boots, so Wi-Fi driver
    removal was not responsible for the result.

Related T2 reports:

The second report independently isolates early DPM_UCLK enablement on the
iMac20,1 Radeon Pro 5300 and demonstrates a kernel-level late-enable approach.
The Omarchy change is intentionally a hardware-scoped userspace workaround
until the T2 kernel carries an equivalent fix for 1002:7319 / 106b:021b.

Tests

bash test/shell.d/imac20-amdgpu-uclk-test.sh
test/cli
git diff --check

The new focused test covers hardware matching, nearby-device rejection, feature
restoration, boot-mask enforcement, fresh setup, migration, and migration
idempotence. It passes both directly and as part of ./test/all.

./test/all was also run. It completed with five unrelated failures that
reproduce unchanged on the clean upstream checkout:

  • bar-icon-geometry-test.sh (live Quickshell geometry)
  • launch-about-test.sh (live animation check)
  • config-test.sh (missing sibling omarchy-pkgs checkout)
  • snapper-test.sh (missing sibling omarchy-pkgs checkout)
  • unowned-system-paths-test.sh (missing sibling omarchy-pkgs checkout)

@vivekchauhan

Copy link
Copy Markdown

I have faced exactly same issue with display freezing intermittently post login on Omarchy, a bug report was filed here
https://gitlab.freedesktop.org/drm/amd/-/work_items/5674

Please see if that provides any additional context.

@edschofield

Copy link
Copy Markdown
Contributor

I have a related kernel fix under review at t2linux/linux-t2-patches#60, also submitted to AMD yesterday as an RFC. It follows the delayed-UCLK work by Atharva Tiwari and Guna R. Bharati discussed in t2linux/wiki#743.

The machine I tested on is an iMac20,1 with Navi14 1002:7340 / 106b:0218, revision 0x41. The patch defers only UCLK, leaves both memory-voltage features enabled, and updates the driver's clock state after enabling it. In my local testing, the AMD staging kernel with my patch passed ten warm boots with rendering and video checks, whereas an unpatched AMD staging kernel reproduced the message-6/-62 failure. The linked RFC records the separate T2 warm/cold coverage and its limits.

The current patch does not match this PR's Navi10 7319/021b board, so I cannot claim that it fixes your machine. It may be useful as the basis for a kernel-side adaptation with testing on that hardware.

There is also a parser detail in the current helper worth checking. On my machine, pp_features begins with one line:

features high: 0x00000462 low: 0xa3dbbfbb

The T2 7.1.8 source uses that format too. Testing the helper's current awk expression against this output reads high but returns an empty value for low; the test fixture instead puts them on separate lines. Could you check
that against the helper used for your successful trials? After fixing the parser, the complete pp_dpm_mclk output would also help verify that the driver's clock table agrees with the restored firmware features.

@aurelienbottazini

aurelienbottazini commented Sep 9, 2026 •

Copy link
Copy Markdown
Author

The current patch does not match this PR's Navi10 7319/021b board, so I cannot claim that it fixes your machine.

do you mean it will not fix my machine? I don't see how it can fix my machine if it does not match my board
I think the debate is more, do we improve your PR on T2 with my board and @vivekchauhan board
or do we do it here.

I saw some other mac related patch and I don't know what's the strategy for omarchy regarding fixing it here or on t2

I am happy that we have two working fix

@edschofield

Copy link
Copy Markdown
Contributor

@aurelienbottazini Yes, the old patch excluded your board. I've now included your 7319/021b in draft T2 PR #61, alongside the 0219 board reported by @vivekchauhan here. It would be great if you and @vivekchauhan could please test the patch on your machines.

The AMD staging version has booted successfully 10 times on my 0218 iMac, with Radeon rendering and video checks each time. We still need results from your boards and from the full T2 build. There's also a difference to check on
your machine please, Aurélien: your workaround delays three memory features, while this patch delays UCLK alone.

Could you both please share your current uname -r, Linux distribution, and any workaround you're using? Aurélien, the PCI revision from lspci -nnk -s 03:00.0 would also help. We could then put together installation instructions that keep
your working kernel available. I've put the patch and shared testing outline in draft PR #61 so we can keep the results together.

@vivekchauhan

Copy link
Copy Markdown

Hi @edschofield, I have applied your patch and found success, thanks for the effort.
I think fixing this at t2-linux level would be useful for all downstream distros including omarchy.

I have uploaded the details and logs in your PR here.
t2linux/linux-t2-patches#61

@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! labels Sep 27, 2026
omarchybot and others added 2 commits October 2, 2026 05:24
smu_cmn_get_pp_feature_mask emits "features high: 0x... low: 0x..." on a single line, so matching "low:" as the second field never found it and the helper exited with "cannot parse" on every boot, leaving memory-clock scaling off. The test fixture used two lines and hid it; it now uses the kernel's layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without -e the installer's exit status is only that of its last systemctl call, so a failed Limine drop-in write still let the migration rebuild and record itself complete.

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

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5, with Codex Medium as a second opinion. This is a hardware fix a VM cannot reproduce, so it is waiting on a test from you on the iMac before it can be marked verified.

Pushed two fixes to your branch (head is now 1a74527e6d72f10ab6c6c55b8169b7673f1df73c):

  • 6e45f6ee8 — bin/omarchy-amdgpu-uclk-enable could not parse pp_features. The kernel prints both halves on one line (features high: 0x... low: 0x..., from smu_cmn_get_pp_feature_mask in smu_cmn.c), and the old awk only found low: as the second field of its own line. So at 714a616 the helper exited with "cannot parse" on every boot and memory-clock scaling stayed off, which is the parser problem @edschofield raised. The test fixture used two lines, which hid it; it now uses the kernel's layout. Reproduced on a worker: with the kernel-format fixture the focused test fails on the original helper and passes with the fix.
  • 1a74527e6 — the migration ran the installer with plain bash, so its exit status came only from the last systemctl call. If writing the Limine drop-in failed, the migration still rebuilt and marked itself complete. It now runs under -euo pipefail, the same way the migration runner does. Codex found this one.

Tested on a worker VM (no iMac hardware): ./test/cli and test/shell.d/imac20-amdgpu-uclk-test.sh pass at the new head. Codex reviewed both commits a second time and found nothing open. It also confirmed that the feature arithmetic is right (0xfff7bfff → 0xfff7bffd clears PP_MCLK_DPM_MASK, and bits 3, 8 and 9 are 0x308 on Navi10) and that the hardware gate matches only an iMac20,2 with all four IDs.

One open question needs the hardware. Codex pointed out, and navi10_ppt.c confirms, that when DPM_UCLK is off at init the driver builds a one-entry UCLK table at the boot clock. Turning the feature back on through pp_features does not rebuild that table. The firmware may still scale memory clock on its own, but pp_dpm_mclk and anything the driver derives from that table could stay stuck at the boot level. That would explain why the kernel patches in t2linux/linux-t2-patches#61 also refresh the clock state.

What would settle it: on the iMac, check out 1a74527e6d72f10ab6c6c55b8169b7673f1df73c from your branch, run omarchy dev link <checkout>, reboot with the mask in place, then run sudo omarchy-amdgpu-uclk-enable. Post its output, plus the first line of pp_features and the full pp_dpm_mclk for the GPU (both under /sys/bus/pci/devices/<gpu>/). While dev-linked, the service's /usr/bin path will not exist yet, so run the helper by hand rather than through the unit.

Related, for the maintainer: #12203 handles the Navi 14 iMac20 boards (#12197) separately. A kernel-side fix that delays UCLK has been posted to amd-gfx, and the T2 draft that covered this board (7319/021b), t2linux/linux-t2-patches#61, is closed without merging.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High risk] Adds hardware-specific boot and runtime configuration for GPU initialization.

The PR should not merge until fresh installs are assured to boot with the new AMDGPU mask.

Findings

  1. P1 Fresh installs miss boot mask ▶

Summary

The PR adds exact iMac20,2 GPU detection, a boot-time AMDGPU feature mask, a post-display-manager feature-restoration service, and an existing-system migration. The fresh-install path does not establish that its new boot parameter reaches the generated boot entries.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Detect affected iMac GPU] --> B[Write Limine mask drop-in]
  B --> C[Rebuild boot entries]
  C --> D[Boot with AMDGPU mask]
  D --> E[Restore memory-clock features]
  B -. fresh-install rebuild missing .-> D
Loading

Reviews (1) · Last reviewed commit: "Run the migration's installer under erre..."

Comment on lines +9 to +13
cat >"$limine_conf" <<'EOF'
# Work around SMU initialization failures on the iMac20,2 Radeon Pro 5700 XT.
# Memory-clock features are restored after the display manager starts.
KERNEL_CMDLINE[default]+=" amdgpu.ppfeaturemask=0xfff7bffd"
EOF

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 Fresh installs miss boot mask On a fresh iMac20,2 install, this writes the Limine setting but does not rebuild the boot entries. The remaining install steps do not rebuild them, and first-install provisioning marks the migration that would run limine-mkinitcpio as already applied. The first boot therefore lacks the AMDGPU mask: the startup race remains, and the new service skips feature restoration because its kernel-command-line condition is not met. Rebuild the boot entries after writing this setting.

@omarchybot

Copy link
Copy Markdown
Collaborator

Checked Greptile's finding that fresh installs miss the boot mask, by Claude Opus 5.5 and with Codex Medium as a second opinion, which agreed. It does not hold, so no change is needed in install/hardware/apple/fix-imac20-amdgpu-uclk.sh.

On a fresh install the hardware scripts run inside omarchy-apply-system, and the ISO installer's next phase is finalize_limine_boot, which runs limine-update in the target after reading every /etc/limine-entry-tool.d/*.conf drop-in into the command line (omacom/omarchy-iso, orchestrator/phases_impl.py). The migration being marked applied happens later, during user provisioning, and only matters for existing systems, which the migration covers by running limine-mkinitcpio itself. fix-t2.sh and intel/fred.sh write their drop-ins the same way without a local rebuild. Codex also checked deferred provisioning, which still runs system setup before the rebuild, and factory reset, which keeps the drop-in and runs limine-update in the restored root.

Nothing else has changed since the review above: this is still waiting on the hardware test described there.

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.

4 participants