Repository navigation
drm/asahi: start the M2 Pro GPU (T6020, G14S) on GPU firmware 27.2 - #3998
DjDeveloperr wants to merge 14 commits into
Conversation
On T602x (M2 Pro, Max and Ultra) with GPU firmware 27.2, the PMP grants the GPU clusters only while the soc-device record named AGX holds a device-power vote, as on T6030. Add apple_pmp_t602x_agx_vote(). It looks the record's ID up in the PMP's apple,tunable-soc-device table (ID 11 on T6020 and T6021) and sends the vote. It returns -EPROBE_DEFER until an available PMP has registered and -EAGAIN while the PMP is asleep. The caller owns the vote. Signed-off-by: DjDeveloperr <hey@djdev.me>
Add the PMP report entry for soc-device "GFX_" (position 10 of the ADT's iop-pmp-nub soc-device list on T6020, T6021 and T6022), backed by ps_gfx, and make it the GPU's power domain when the PMP is used. The PMP then sees the GPU requested whenever the GPU's domain is on. Signed-off-by: DjDeveloperr <hey@djdev.me>
The 27.2 runtime fails compute work as hung once the front command has run longer than COMMAND_TIMEOUT_MS. The clock starts when a command is published, though, so when several commands are published together the later ones also count the time spent running the commands ahead of them. A backlog of slow commands that were all making progress was failed although nothing had stopped. Compute commands run in queue order: restart the next command's clock when the one ahead of it retires. Signed-off-by: DjDeveloperr <hey@djdev.me>
Start the M2 Pro GPU (T6020, G14S) when its boot loader reports GPU firmware 27.2, on the runtime that already starts G13G and G14G there. The G14S firmware's records differ from G14G's. A per-family layout now maps every G14G offset the root writes (hardware data, power controller, Globals, control, power and directory records) piecewise to its G14X place, and the G14G layout is the identity. Unit tests pin both layouts and check that the G14G and G13G records and encodings stay byte-for-byte the same. Power-up: - Fill the CS and AFR auxiliary operating-point tables. Without them the firmware caps its performance request at state 0 and never powers the clusters. - Fill the peak-power limiter configuration from the 13.5 shared power tables, where the G14X controller and Globals keep it. Left zero, the firmware programs every power budget and threshold as zero. - Enable the fabric performance-state monitor with the chip's tunables. - Give the firmware the active memory-cache mask, keep it off its host-assisted power-up path, and vote AGX with the PMP before the run bit. Commands: - Lay out the G14X queue header (scheduler pointer at +0x78) and scheduler context. - Lay out the G14X compute (0x8e0), TA (0x960) and 3D (0xca0) commands. They carry register lists the GPU fetches by address, so commands come from the GPU read-only allocator. The compute command takes the event slot at +0x824 and the tracking index at +0x828. - Add the scene's user buffer and control word registers to the TA and 3D register lists, and name the control word in the scene. - Name the GPU's parameter-buffer descriptor page at directory +0x2d0 and +0x2d8; the parameter manager reads it. - Enable the firmware log on G14X. When the firmware fails to start, a boot job fails, or a render is stopped, log the firmware and queue state from host memory and the MMU fault status. Signed-off-by: DjDeveloperr <hey@djdev.me>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: CHANGES at ab7f9d1ab63b: fix three host tests and one chip check, then three hardware runs at the new head. The approach is right.
Blockers:
- Host tests break. Merged onto main
53732c475cb2,tools/asahi/run-host-tests.pypasses 1006 of 1020. All 14 failures come from this PR; the same tests pass on main (25/25 and 1/1). Fix the harnesses and keep their mutation runs:g14-v27-2-try-bind-tests.py(10 runs): itsKVechas nofirst_mut, whichg14_v27_2.rs:1909now calls.g14-v27-2-pool-tests.py(3 runs): it does not knowCommandPool's newlayoutfield (gpu/v27_2.rs:507).display26-tests.py(1 run): its stubs lackof_find_compatible_node, used atpmp-export.c:167, and the newlinux/unaligned.hinclude leaves its helpers unused, which it treats as errors.
driver.rs:482picks the register tables withmatch cfg.chip_id. Main selected them by GPU generation; this is a new chip check in shared probe code. Put the table, the writable mask and the memory-cache mask inHwConfig(for examplev27_2: Option<...>) and read them fromcfg; no entry meansENODEV. The device-tree compatible already selects the config.- No hardware run at this head. The J414s numbers are from
1ed7f1bdfb9f, a bring-up branch on an older base. The shared 27.2 code under it has changed since then (ring and boot-job cache maintenance ingpu/v27_2.rs, the sleep hooks indriver.rs). Needed:- J414s: boot, 3D, compute and one s2idle cycle, with aura
7cdedb7f80c5. - One M1 or M2 (T8103/T8112) on GPU firmware 27.2: 3D, compute, s2idle. The shared root builder, power controller, queue header and render encoders are rewritten. Only the compute encoder is compared byte for byte with the old one; the body's "encodings are byte-identical (unit-tested)" does not cover the rest.
- M2 Max (T6021): GPU probe and one s2idle cycle. Its GPU now powers on through PMP entry 0xa, which waits up to 50 ms for the PMP's answer and fails the GPU if a running PMP does not give it.
- J414s: boot, 3D, compute and one s2idle cycle, with aura
Checked: other GPUs and firmware versions, register windows and their write permissions, the G14X record maps, command memory, power domains and sleep, what aura hands over, builds, device trees. No Apple material, no new parameters, no attribution lines.
Evidence and small things
What I verified:
- T6021, T6022 and T600x stay on the old path. On T6020 any firmware other than 27.2 still takes the 13.5 path. With this PR, T6020 on 27.2 never reaches
start_cpu()without the handoff. - By reading the diff: the G13G/G14G layouts map every offset to itself, and the T8103/T8112 sensor masks and
global_unk_54equal the constants they replace. Every controller word the G14G writer sets has a place in the G14X map, so none is dropped. - The T6020 windows and read/write modes match the 13.5 T602x mappings. The compute, TA and 3D register lists match the 13.5 G14X lists, plus the additions named in the comments.
- aura copies
soc-devicetoapple,tunable-soc-device, so the vote finds its record. Itsapple,sleep-retainedmark now lands on the PMP entry, where nothing reads it;sleep_pd.cholds that domain in s2idle, as on T8112. arm64W=1 at the merge:drivers/gpu/drm/asahi/,pmp-export.o,pmp.obuild, no new warnings in changed code. ABI unit tests 62/62. Eight T602x device trees build with W=1, no warnings; schema check on J414s, J414c, J180d gives the same output as main apart from phandle numbers. T6022's GPU stays onps_gfx.- checkpatch --strict: 0 errors; 24 long lines, one missing blank line at
pmp.h:28. - Merges cleanly with linux#3940.
Small things, not blocking:
g14_v27_2.rs:638: if the PMP vote fails, the driver warns and still sets the run bit, although the comments say the firmware then waits for clusters that never come. Return the error instead.g14_v27_2.rs:711: the failed-boot path reads the fault registers without thegpu_powered()check the timeout path uses.g14_v27_2.rs:1698: every recovery that stopped a render now prints several long error lines; a client can trigger these. Rate-limit them.Kconfig: M1 and M2 now also needAPPLE_PMP; only the G14S vote does.g14_v27_2_render.rs:242: T6020 tiles on one cluster only, while the 13.5 path uses both for large renders. Please list it under Not yet.- Register 0x1c9e8 uses mask 0x47ff where 13.5 uses 0x4fff. Same value for every allowed layer count, but the comment says 13.5 values.
Not run: no GPU tests here; J414s is unreachable.
The 27.2 probe selected the register table, its writable slots and the memory-cache mask by chip ID. Keep them in the SoC's HwConfig, which the compatible already selects. A SoC without an entry gets ENODEV as before. The tables do not change. Signed-off-by: DjDeveloperr <hey@djdev.me>
The G14S firmware waits without a timeout for the GPU clusters, which the PMP grants only on the AGX vote. Return the vote's error instead of starting the firmware without it. Only the G14S makes the vote, so do not require APPLE_PMP for the G13G and G14G. Keep out the one combination that cannot link: a built-in driver with a modular apple-pmp. Signed-off-by: DjDeveloperr <hey@djdev.me>
The report of a failed boot job read the MMU fault registers even when the GPU was off. Check gpu_powered() first, as the firmware-timeout path does. Signed-off-by: DjDeveloperr <hey@djdev.me>
A client can cause recoveries, and each one that stopped a render logs several long lines. Put the snapshot entries and the render report under the rate limit of the other GPU fault reports. The one-line summary of each recovery stays; recovery itself does not change. Signed-off-by: DjDeveloperr <hey@djdev.me>
The G14X TA list is documented to carry the 13.5 values, but it masked 0x1c9e8 with 0x47ff where the 13.5 path uses 0x4fff. Both give the same value for every allowed layer count (at most 2048). Use the 13.5 mask. Signed-off-by: DjDeveloperr <hey@djdev.me>
Separate the T602x AGX vote's stub from the function before it, as checkpatch --strict asks. Signed-off-by: DjDeveloperr <hey@djdev.me>
Teach the harnesses what the production code they extract now uses: - g14-v27-2-try-bind: KVec::first_mut. - g14-v27-2-pool: CommandPool's layout. - display26: the device-tree helpers, the errno and the unaligned header of the T602x AGX vote. Also check that a J613 PMP never gets that vote. The mutation runs do not change. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Addressed review 6160682149 with plain commits pushed on top of
Remaining (blocker 3): exact-head |
Exact-head hardware receipt (
|
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 6a2ac7dbaf18. The code needs no change; two hardware rows are missing.
Blockers:
- One M1 or M2 (T8103/T8112) on GPU firmware 27.2 at this head: GPU probe, 3D, compute, one s2idle cycle. They run the shared code this PR rewrites, and two things change for them: the compute timeout now starts when a command reaches the front of the queue (
g14_v27_2.rs:1933), and a firmware timeout event now also reads the fault registers (g14_v27_2.rs:1853). - One M2 Max or M2 Pro on GPU firmware 13.5: GPU probe, 3D, one s2idle cycle.
t602x-die0.dtsi:1082puts the GPU of every T6020 and T6021 behind PMP entry 0xa. A running PMP that does not answer within 50 ms leaves the GPU without power. The J414s row shows the answer comes with 27.2 firmware; 13.5 has no row. An M2 Max covers T6021 as well.
Checked: the code points of the earlier review (host tests, the chip check, the small things) are fixed. The whole diff, error paths, other chips, builds, device trees, KUnit build, host tests. The J414s row at this head covers T6020 on 27.2. No Apple material, no new parameters, no chip or board checks, no attribution lines.
Evidence
Merge of 6a2ac7dbaf18 into main 13dc5a79c0ec (tree e2082cafb8a6, no conflicts):
- Host tests in the Ubuntu 24.04 host-tests image, every
run-host-tests.pyjob matchingg14|legacy|display26|display-sleep|pmp|pmgr|agx|asahi|t602|rtkit|event|t8112|t8103|uapi|t6030-: 118/118. That includes all G14 27.2 mutations andg14-v27-2-abi-tests(62 cases). - Hosted host-tests is red only on
apple/pmgr-inherited(1027/1028, merged onto2b2681932a5c, before #4025). It passes on this merge tree. - arm64
W=1 drivers/soc/apple/ drivers/gpu/drm/asahi/(GCC 16.2, rustc 1.100.1): builds, no new warnings in the changed files. The same withCONFIG_KUNIT=y:drivers/gpu/drm/asahi/builds. The KUnit cases themselves were not run. - 8 T602x device trees with
W=1: same warnings as main. Decompiled, J414s and J414c differ from main only in the newreport@aand the GPU's power domain; on J180d nothing uses the new node, and it starts off. checkpatch --stricton the whole diff: 0 errors; long lines and one spelling only.
G13G/G14G on 27.2, by reading:
- Render encoders: with the G14G offset maps (identity) applied to both versions, the normalized old and new source write the same values at the same offsets. Compute encoder, queue header, root records, controller and register tables: same sizes, offsets and values;
fast_sensor_mask,global_unk_54and the T8112 sensor coefficients give the old constants. - T6021, T6022 and T600x have no 27.2 entry and stay on the old path; T6020 on any other firmware does too. T6020 on 27.2 never reaches
start_cpu(). - PMP vote: taken before the run bit, its error is returned, and a missing PMP defers the probe. With
APPLE_PMP=nonly the G14S start is refused.
Not blocking: the vote is made only at probe. A later T6020 deep sleep (#3999) restarts the PMP and has to make it again before the firmware runs.
Signed-off-by: DjDeveloperr <hey@djdev.me>
… Pro only The GPU power domain moved to the PMP GFX report entry on T6020 and T6021. Only T6020 has a 27.2 GPU backend that waits for the PMP to grant the clusters. M2 Max (T6021) still starts its GPU on 13.5 firmware from ps_gfx, and a PMP that did not answer the new request would leave it without a GPU. Keep ps_gfx in the shared file and point only the T6020 GPU at the report entry. The T6020 device trees are unchanged byte for byte. On T6021 the entry has no user: it starts off and writes nothing. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merged Changed: the DT commit keeps the GPU of M2 Max and M2 Ultra on Still open
Checks and what was readOn the merge
Order with aura#649:
Other Macs:
|
A Mac with GPU firmware 13.5 does not need the PMP for its GPU. With the PMP GFX_ report entry as its power domain, the GPU would only probe where that Mac's PMP acknowledges the request: genpd turns a request the running PMP does not acknowledge within 50 ms into -EPROBE_DEFER. Nothing shows that the 13.5 PMP on T6020 does. Only firmware 27.2 waits for the GPU clusters, and only the boot loader knows the firmware when the device tree is made. Keep ps_gfx here, so 13.5 runs as before, and let the boot loader move the GPU to the entry when it hands over 27.2 (aura#649). The entry itself stays: without a consumer it writes nothing. Signed-off-by: DjDeveloperr <hey@djdev.me>
What
Starts the M2 Pro GPU (T6020, G14S) when its boot loader reports GPU firmware 27.2, on the runtime that already starts G13G and G14G there. Eleven commits on
main(bf7d80caf992), with review fixes pushed on top ofab7f9d1ab63b:soc: apple: pmp: add the T602x AGX vote: the PMP grants the GPU clusters on T602x 27.2 only while the AGX soc-device record (ID from the PMP'sapple,tunable-soc-devicetable) holds a device-power vote.arm64: dts: apple: t602x: request GFX from the PMP for the GPU: a PMP report entry for soc-deviceGFX_, backed byps_gfx. Since51e809cf3c3dno DT uses it as it ships: every T602x GPU keepsps_gfx, as onmain, and the unused entry writes nothing. aura#649 moves the GPU of an M2 Pro on firmware 27.2 to the entry in its handoff; with firmware 13.5 nothing changes.drm/asahi: time 27.2 compute commands from the front of the queue: the compute timeout started at publication, so a backlog of slow commands that were all progressing was failed as a hang. The clock now restarts when a command reaches the front. Applies to G13G/G14G too.drm/asahi: start the G14S (T6020) GPU with firmware 27.2:05ede094d569..6a2ac7dbaf18: move firmware 27.2 per-SoC data intoHwConfig::v27_2(removing thechip_idmatch in shared probe code), fail cleanly if the PMP AGX vote fails (and drop the unconditionalAPPLE_PMPKconfig dependency), gate failed-boot fault reads ongpu_powered(), rate-limit recovery dumps, mask0x1c9e8with0x4fffas on 13.5, fixpmp.hformatting, and update the three host-test harnesses.Tested
Static checks at exact head
6a2ac7dbaf18:run-host-tests.py(CI image) on merge withmain:main@5fe340acef00(2bdab222827e): 1028/1028 PASS, 0 failures.main@cebaa8a69fea(9a186229a4cb) andmain@2b2681932a5c(9bca1d16eea4): 1027/1028 PASS; the sole failure (apple/pmgr-inherited, missingapple_pmgr_ps_probe_auto_enable) reproduces identically on plainmainatcebaa8a69feaand2b09f588bbd7.g14-v27-2-try-bind-tests.py,g14-v27-2-pool-tests.py,display26-tests.py): controls pass, all 2 pool mutations and all 9 try-bind mutations killed (exit 101).W=1object builds for changed paths: 0 errors, 0 warnings in changed lines; Kconfig checks verified withAPPLE_PMP=nandDRM_ASAHI=y+APPLE_PMP=m.CLIPPY=1ondrivers/gpu/drm/asahi/: 0 errors, identical warning list vs baseline (0 new warnings).checkpatch --stricton05ede094d569..6a2ac7dbaf18: 0 errors, 0 warnings, 0 checks.Pre-rebase hardware qualification (J414s M2 Pro, 16-core G14S B1, firmware 27.2,
aura#6497cdedb7f80c5, bring-up head1ed7f1bdfb9f,boot_id=4e597297-7f3d-4036-815e-102a0881c5da):/dev/dri/card0+/dev/dri/renderD128); Vulkan 1.4.363 (Borealis), OpenGL 4.6 / GLES 3.2, and Rusticl OpenCL enumerateApple M2 Pro (G14S B1).fma_mad_control8/8 PASS.clpeak-3.1.0 --opencl --single-precision-compute:float 5.22,float2 5.60,float4 5.65 TFLOPS(98.7% of 16-core @ 1398 MHz peak, ABBA 0.00 variance, governor state 8 at 24.02 W peak).Merge with
main@c09b61228e62(6a35e126703e, no conflicts;maintouches none of these files exceptasahi/Kconfig) and the T6020-only DT commit on top:LLVM=1 W=1 drivers/gpu/drm/asahi/ drivers/soc/apple/ drivers/pmdomain/apple/: builds, warnings identical tomain. The eight T602x DTBs build withW=1.fb5b5f56cc01leaves the T6020 DTBs byte-identical to those at6a2ac7dbaf18(t6020-j414s.dtbe889ef6ffd0e).DT-only commit on top (T6020 GPU back on
ps_gfx):t6020-j414s.dtbis2b6e512e51af(the parent reproducese889ef6ffd0e).mainthe DT change is thereport@anode only, so firmware 13.5 has itsmainwiring on every T602x Mac.e889ef6ffd0etree apart from phandle numbers, so the J414s run below stands for firmware 27.2.run-host-tests.pyat6a35e126703e: 1037/1039, the other two (pmp-agx-vote-tests) were stopped by the container's seccomp filter and pass without it.Tested: J414s (M2 Pro, GPU firmware 27.2) at 6a2ac7d with aura#649 7cdedb7f80c5: GPU desktop on the panel, vkmark 1926, clpeak 5.64 TFLOPS, deqp smoke 8/8 before and after s2idle, 0 faults.
Risk: two-way · G14G/G13G compute encoder is byte-identical (unit-tested); compute front-of-queue timeout and failure-only logging apply across G14 27.2; firmware 13.5 wiring is
main's on every T602x Mac; T6020 on 27.2 needs aura#649 (older aura leaves the GPU off there), and a boot loader withoutapple,tunable-soc-devicefails that probe with ENODEV instead of warning.Not yet
6a2ac7dbaf18. It has not been repeated since the merge of main and the two DT commits (same effective tree with aura#649). Either merge order is safe: without aura#649 the GPU of a 27.2 M2 Pro stays off, and aura#649 leaves it off with a DT that lacks the entry. Only an unmerged aura#649 build older thanbfa2557cdoes not fit this DT.