Repository navigation
drm/asahi: g16: run the M4 GPU on the macOS 27.2 firmware (26B123) - #2676
DjDeveloperr wants to merge 6 commits into
Conversation
|
An early read of the power side, since it affects fanless machines:
Assisted-by: LLM (Claude:Opus 5.5) |
Hardware-row tree only. #2676's apple_pmp_t8132_retained_board() follows apple_t8132_pmp_path() here, as it must once both land. Signed-off-by: Diljit Singh <hey@djdev.me>
Hardware-row tree only. #2676's apple_pmp_t8132_retained_board() follows apple_t8132_pmp_path() here, as it must once both land. Signed-off-by: Diljit Singh <hey@djdev.me>
50dd3ee to
923d1ec
Compare
|
|
|
Blockers: 6. Full review of all 39 commits at 923d1ec, paths under Unknown firmware builds fail closed: a handoff or loaded image that matches no known build is refused with EINVAL, and nothing falls through to 26B123. Selecting struct layouts and encoders by the firmware's own build identity is fine. The problems are the hardware-protecting values, the words replayed from macOS, and behaviour selected by board or firmware build. Blockers
Major
Nits: Rows. No machine has run this head yet. To merge:
Pass for every run: 0 GPU faults or recoveries, 0 AVC, 0 failed units, 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
Rename the retained-session predicate to apple_pmp_t8132_retained_board() and detect the retained T8132 PMP power-vote bridge from the device tree's own `pmp` node (`apple,t8132-pmp-v2`, available, `apple,tunable-soc-device` present) rather than gating on a board list, root SoC compatible, or OS firmware version string. Keep apple_pmp_j713_board() as an inline alias for existing callers. Signed-off-by: Diljit Singh <hey@djdev.me>
… and run to top p-state Admit the J773g 25G83 firmware images, including the boot-filled B000 ranges zeroed before digest verification, and cover them in fwid.rs unit tests. Derive the firmware DVFS table row count (10-row 6-pair vs 11-row 5-pair+top) directly from the preserved ADT performance-state table rather than gating on a board compatible, and let the utilization governor, cooling ceiling, and reported p-state bound run up to the board table's top state (S10 on 11-row tables). Signed-off-by: Diljit Singh <hey@djdev.me>
… PB heap, and close VM caches Carry the G16 parameter-buffer and compute-pipelining updates needed under the 26B123 runtime: - unconditionally reuse a pass slot's retired PB epoch for the same VM and binding (no runtime toggle or mutable debugfs); - keep compute commands in flight on dedicated per-unit UMA slots; - share one 64 MiB PB heap per VM across render allocators, sizing the PB manager descriptor fields to the actual backed heap_blocks rather than hardcoding 256 MiB, and recycle never-exposed spare epochs; - let closed VMs release arenas while slot leases retain only their own backing, and drain spare epochs in both Registry::prune() and Gpu::vm_closed() to break the Cache -> Arc<VmState> cycle; - avoid redundant submit-path publication while a render is active. Signed-off-by: Diljit Singh <hey@djdev.me>
… idle power-off
Support the 26B123 G16 GPU firmware (also shipped in 26B131) while
leaving 25G83 byte-for-byte unchanged. Firmware selection keys strictly
on the boot loader's handoff fields and loaded TEXT digest, failing
closed on unknown builds.
Firmware layout, ABI, and ADT derivation:
- Add V25G83/V26B123 layout tables for InitData, device-control opcodes,
queue info, and TA/FS/compute work records, with compile-time
layout_fits() bounds and collision checks.
- Set POWER_PERFORMANCE +0xa4 = 1 (required power-up state selector)
with no undocumented static InitData policy words.
- Derive 26B123 power sampling (+4/+8, +0x2b48/+0x2bbc/+0x2c10) and the
average-power IIR filter (+0x29e4..+0x29f8) from /arm-io/sgx
gpu-pwr-sample-period-aic-clks, CNTFRQ_EL0, and /arm-io/pmgr/clpc
cpu-avg-limiter-input-tc; derive the low-peak (PPM) limiter filter and
PI gains (+0xa80..+0xae0) from cpu-lowpeak-limiter-{input-tc,ki,kp}
and gpu-power-sample-period (65536.0 PI integrator clamp at +0xaa8).
Fail closed with EINVAL when any required ADT property is missing or 0.
- Read coredump-copy-buffer from /arm-io/gfx-asc/iop-gfx-nub in the
preserved ADT to size InitData MAIN +0xfa8 and the 26B123 host
crash-log buffer (failing closed when absent or invalid).
Start, idle power-off, and runtime:
- Admit 26B123 firmware-owned page tables and perform the PPL magic
handshake, clearing handoff +8 before RUN and returning ETIMEDOUT if
the firmware answer does not arrive.
- Start 26B123 without a PMP AGX vote (enabling GFXCAXI2AF and leaving
loaded DATA to the firmware), hand over the host crash-log buffer
before AP power-on, and run the standard boot NOP + IMPORT_GLOBALS +
START sequence while accepting a pending InitData scheduler request.
- Publish the RETENTION table at RUNTIME +0x2c8 (leaving MAIN +0xfa0
zero) so 26B123 can power the GPU down when idle, and guard all SGX
MMIO reads/writes (engine busy/fault state, pstate(), and runtime
set_generation()) inside Session::while_powered() under the PPL lock.
- Attempt all three Globals ceiling selectors without short-circuiting
in floor_power() at fail-stop, drain all receive rings per pass, read
the 26B123 queue-info busy flag at +0x54, read compute work ticks from
compute::Layout::work_ticks with a tear-free hi/lo/hi loop, and check
the session once per poll pass plus before publish_checked().
Signed-off-by: Diljit Singh <hey@djdev.me>
… tests Add check-abi-26b123.rs and test-abi-26b123.py to verify 26B123 layout selection, compile-time policy collision guards, and exact byte-for-byte InitData/work/queue encoding parity against independent per-field offset tables. Extend test-perf.py for ADT power-sampling, low-peak limiter, and coredump-copy-buffer parsing; extend test-vm.py for 26B123 firmware page tables, +8 clear before RUN, and ETIMEDOUT on missing magic answer; and update the remaining host suites for the 26B123 ABI and compute work tick layout. Signed-off-by: Diljit Singh <hey@djdev.me>
923d1ec to
ed41e08
Compare
|
Rebased onto Blockers (1–6)
Majors (7–16) & Nits
Verification
Keeping in draft pending CI on Assisted-by: LLM (Gemini:4 Neon) |
…ives a deep wake The 26B123 POWER_PERFORMANCE layout inserts four u32s at +0x9c. G16 writes only +0xa4, the powered-up state selector. That is enough for a cold boot, but not for the firmware's warm restart after a deep sleep: on the J713 (M4 Air) the first deep wake ends with "GPU firmware back in 691 us" and, 0.3 ms later, "RTKit: co-processor has crashed" in the firmware's power-up path, before any client has submitted work. The GPU is gone until reboot. macOS 27.2 sets all four words to 1, and so did this driver before the 26B123 layout was reworked. Write +0x9c, +0xa0 and +0xa8 again, next to +0xa4. The words belong to the 26B123 layout, so they are selected by the firmware ABI, as before; 25G83 is unchanged. On the J713 (macOS 27.2 firmware, default kernel command line) with the external monitor and the USB4 peer attached: 3 of 3 deep sleeps wake with the GPU alive, with vkmark running across the first sleep, then dEQP-VK smoke and glmark2 after the wakes. Without the change the same kernel crashed on the first wake. The host tests and the 26B123 offset oracle are updated for the three words. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Re-review at 2244998 (series rewritten since our last review at 923d1ec). Most of the earlier points are fixed. Remaining and new: Still open
New in 2244998
Rows at 2244998: J713 deep-sleep cycles plus a sustained load with package power and die temperature, J773g boot and idle/wake on this head, a 25G83 regression boot on both, one more T8132 board (J715 or J604), and a forced fail-stop under load with die temperature logged. Assisted-by: LLM (Claude:Opus 5.5) |
Runs the G16 GPU (M4, T8132) on the 26B123 GPU firmware (also shipped in 26B131). 25G83 keeps its existing start and every 25G83 byte is unchanged. The driver selects the firmware layout strictly from the firmware's own identity — the boot loader's handoff fields (
apple,g16-handoff-version, segment VAs and flags) and the loaded TEXT digest — and fails closed on unknown builds. It never checks a board, SoC compatible, or OS firmware version string for this.Depends on the GPU temperature input workstream (
apple_pmp_telemetry_get_gpu(), branchlab/j713-g16-agx-temponce onintegration/aurora).Commit series (
origin/integration/aurora..2244998f3fc6, 6 commits)45b05cdbf811—soc: apple: pmp: detect retained T8132 PMP bridge from the device treeDetects the retained T8132 PMP power-vote bridge from the DT
pmpnode (apple,t8132-pmp-v2, available,apple,tunable-soc-devicepresent) rather than gating on a board list, root SoC compatible, or OS firmware version string.9717482bed54—drm/asahi: g16: admit J773g 25G83 images, derive DVFS table from ADT, and run to top p-stateAdmits J773g 25G83 and boot-filled B000 images, derives the firmware DVFS row count (10-row vs 11-row) directly from the preserved ADT performance-state table (no board-gated
asahi_g16_perf_rows()), and lets the governor, cooling ceiling, and p-state check run up to the board's top state (S10 on 11-row tables).0fb26972a7d6—drm/asahi: g16: reuse PB epochs, keep compute in flight, share 64 MiB PB heap, and close VM cachesUnconditionally reuses retired pass-slot PB epochs (no
g16_pb_reuseparameter oraurora-g16/tunemutable debugfs;aurora-g16/statsstays read-only), keeps compute in flight on per-unit UMA slots, shares one 64 MiB PB heap per VM with PB manager descriptor fields sized to actual backedheap_blocks, and closesresources::Cachein bothRegistry::prune()andGpu::vm_closed()to break the spare-epochArc<VmState>reference cycle.b0b5e93eb066—drm/asahi: g16: run the M4 GPU on 26B123 firmware with ADT config and idle power-offV25G83/V26B123InitData, devctl, queue-info, and TA/FS/compute work tables with compile-timelayout_fits()bounds and collision checks; drops undocumented static GLOBALS/POWER_PERFORMANCE policy words.+4/+8,+0x2b48/+0x2bbc/+0x2c10) and average-power IIR filter (+0x29e4..+0x29f8) from/arm-io/sgxgpu-pwr-sample-period-aic-clks,CNTFRQ_EL0, and/arm-io/pmgr/clpccpu-avg-limiter-input-tc; derives the low-peak (PPM) limiter filter and PI gains (+0xa80..+0xae0) fromcpu-lowpeak-limiter-{input-tc,ki,kp}andgpu-power-sample-period(Q16.16 unity65536.0integrator clamp at+0xaa8); readscoredump-copy-bufferfrom/arm-io/gfx-asc/iop-gfx-nubfor InitDataMAIN +0xfa8and the 26B123 host crash-log buffer. Fails closed withEINVALwhen any required property is missing or zero.+8before RUN and returningETIMEDOUTon timeout); starts 26B123 without a PMP AGX vote and runs the standard boot NOP + separateIMPORT_GLOBALSandSTARTdoorbells (no boot idle workarounds or 1 ms sleep); publishesRETENTIONatRUNTIME +0x2c8(leavingMAIN +0xfa0zero) and guards all SGX MMIO reads/writes (engine_state,pstate(), runtimeset_generation()) insideSession::while_powered()under the PPL handoff lock.floor_power()across all three Globals ceiling selectors, full receive-ring drain per pass, 26B123 queue-info busy flag (+0x54), tear-free hi/lo/hi reads ofcompute::Layout::work_ticks(+0x7ec/+0x7f4), and single-check-per-pass polling withsession.check()beforepublish_checked().ed41e08f7a02—selftests: drm/asahi-m4: add 26B123 ABI offset-oracle and update host testsAdds
check-abi-26b123.rs/test-abi-26b123.py(independent per-field offset oracle + policy-collision assertions), extendstest-perf.py(ADT power sampling, low-peak limiter,coredump-copy-buffer) andtest-vm.py(26B123 firmware page tables,+8clear,ETIMEDOUT), and updates the remaining host suites.2244998f3fc6—drm/asahi: g16: Write all four 26B123 power-up words, so the GPU survives a deep wake(from drm/asahi: g16: Write all four 26B123 power-up words, so the GPU survives a deep wake #2742)Writes all four 26B123
POWER_PERFORMANCEpower-up words (0x9c,0xa0,0xa4,0xa8=1). A/B on J713: with only0xa4 = 1, the first deep wake crashes the firmware right after the RTKit handshake; with all four set, 3/3 deep wakes complete with GPU alive (vkmarkacross sleep,glmark2, Vulkan smoke after each).Tests
Compile & Host Tests
tools/testing/selftests/drivers/gpu/asahi-m4/run-host-tests.py): 24/24 PASS at2244998f3fc6.CONFIG_DRM_ASAHI_G16=y, LLVM=1):drivers/soc/apple/apple-pmp.oanddrivers/gpu/drm/asahi/aurora.kobuilt cleanly with 0 errors and 0 new warnings.Hardware Tests
2244998f3fc6(#2742A/B on J713)vkmarkacross sleep,glmark2, Vulkan smoke after each); without+0x9c/+0xa0/+0xa8first deep wake crashes firmware.dcp45d(pr2676-drop-a1cb982f, exact G16 code ofed41e08f7a02built against7.3.0-ARCH-m4drv8010c3eb7)vk-mustpass-shortPASS;vk-smoke4/4 PASS; KWin on GPU (0.0%CPU);gpubench:compute.heavy alu554.38 us(down from595.17 usat S9),render.heavy fill1080p388.21 us,render.heavy geom495.42 us,bw2922.50 us,buf2buf2939.50 us,fill708.23 us; 0 GPU fault/recovery/stall/SError lines across full boot (3,803journal lines), PMU panic counter0x00 -> 0x00. Re-run at2244998f3fc6(with deep sleep) in progress (dcp63).Remaining notes (why still draft)
2244998f3fc6boot + deep-sleep row (dcp63, in progress), J713 sustained-load + power/die-temp + deep-sleep-under-load rows, 25G83 regression row, and one more T8132 board (J715 or J604).apple_pmp_telemetry_get_gpu()(lab/j713-g16-agx-temp) lands onintegration/aurora.integration/auroraalso requires the PMP side (#2533) for retained 27.2 PMP support; that is tracked separately.Assisted-by: LLM (Gemini:4 Neon)