Repository navigation
Bring up T6041/J616c GPU, protected audio and HEVC - #525
RyanTheTide merged 12 commits into
Conversation
9f4d81b to
edbddfe
Compare
|
Possible cause of the reason-0 / concurrent-render restarts: TA cluster mode (0x1c890) On our J616C (M4 Max, 25G83 firmware, our own G17 port, not this branch), the reason-0 no-progress kills went away when the tiling stage runs non-clustered. The only change is one register in the TA register list: The cluster merge-buffer writes (0x1c041/0x1c9d0, 0x1c948, 0x1c888, 0x1c089/0x1c9e0, 0x16c41/0x1ca40, 0x1c920) and 0x1c9a8 stay as they are. What we measured with it:
Our guess, not verified: in clustered mode those merge-buffer registers point at buffers laid out for the two-cluster M4 Pro, which doesn't fit the M4 Max's four clusters. Non-clustered sidesteps that rather than sizing the buffers properly. Untested: 25F84 firmware and this branch's code. |
Keep all shared firmware profiles at TA 0x1c890 = 0 and enable mode 1 only in T6041's admitted 25F84 build. Pass that device/build policy through RenderArgs without changing register ordering, merge-buffer writes, fragment programs or serial-render admission. Add KUnit coverage for the policy boundary and constructor output, including SCS array shape and unchanged fragment/G17P arrays. Motivated by AxxzyWasTaken's separate J616C/25G83 implementation results: aurora-silicon#525 (comment) Those results do not validate this branch or its 25F84 firmware; the cluster merge-buffer explanation remains a hypothesis. Validation: patch application/reversal, whitespace and source-scope checks. Not yet compiled, KUnit-executed or hardware-tested. Keep the existing asahi.t6041_serial_render=1 workaround pending the concurrent-render test matrix documented in the PR.
|
Pushed experimental T6041/25F84 TA-mode workaround in c048e0e. The device's admitted 25F84 profile now enables Validation status: patch applicability/reversal, whitespace and source-scope checks passed. This commit has not been compiled, KUnit-executed, booted or hardware-tested. The earlier PR build results apply to the previous head, not this commit. AxxzyWasTaken's report concerns a separate J616C implementation with 25G83 firmware: Minecraft changed from 3 failures in 4 runs to zero in 14, and Roblox reportedly ran concurrently without the previous recoveries. It does not validate this branch or 25F84. “Non-clustered tiling” and the cluster merge-buffer explanation remain hypotheses. 1. Build and constructor regression testsUsing the branch's existing configured ARM64/16-KiB build and supported Rust/LLVM toolchain, build the affected driver once with KUnit disabled, then with make ARCH=arm64 LLVM=1 O=/path/to/existing-build-dir drivers/gpu/drm/asahi/
python3 tools/asahi/g17-firmware-selection-tests.pyBoot the KUnit-enabled kernel with 2. Four-way comparison on this J616C/25F84 machine
Reboot between cells: serial admission is configured during registry initialization. Keep firmware, Mesa commit, replay/app versions, resolution, power profile and instrumentation fixed. Record Start with at least 20 repetitions per cell of the same failing replay/workload. Add independent concurrent GL and Vulkan clients alongside the compositor/Chrome. Record pass/fail counts, time to failure, rendering correctness and frame times. If promising, extend to 100 replay runs plus at least one hour of mixed concurrent rendering over several boots; these are initial acceptance targets, not a stability guarantee. 3. Prove concurrency and watch recoveryCapture the kernel log for each test. Count reason-0 recoveries separately from other recoveries, firmware crashes, timeouts, failed fences, device loss and app/compositor restarts. A recovered desktop is not an uninterrupted pass. Reboot after a hang or incomplete recovery before starting another independent sample. Use the existing Check a representative dEQP/CTS subset including MSAA, layered/large targets and partial-render/buffer pressure. Compare performance and power/thermal behavior. An unchanged T6040/25G83 M4 Pro run is useful additional regression coverage. Keep the serial-render workaround. If mode 1 regresses, revert this commit and boot the original serial=1 control; serial=1 on this patched kernel still uses TA mode 1. No hardware result for this commit is claimed. |
c048e0e to
3d0938d
Compare
Bring the branch up to the current base. The conflicts are in the aurora-silicon#525 commits underneath, so they take the resolutions from aurora-silicon#525 at 3d0938d: the tree is aurora-silicon#525 at that commit, the 25G83 profile and this base.
Keep the shared firmware profiles' tiler segment control (0x1c890, 0x1c918) and enable mode 1 (0x1c890 = 1, 0x1c918 = 0) only in T6041's admitted 25F84 build. Pass that device/build policy through RenderArgs without changing register ordering, merge-buffer writes, fragment programs or serial-render admission. Add KUnit coverage for the policy boundary and constructor output, including SCS array shape and unchanged fragment/G17P arrays. Motivated by AxxzyWasTaken's separate J616C/25G83 implementation results: aurora-silicon#525 (comment) Those results do not validate this branch or its 25F84 firmware; the cluster merge-buffer explanation remains a hypothesis. Validation: patch application/reversal, whitespace and source-scope checks. Not yet compiled, KUnit-executed or hardware-tested. Keep the existing asahi.t6041_serial_render=1 workaround pending the concurrent-render test matrix documented in the PR. Assisted-by: LLM
3d0938d to
84612a4
Compare
RyanTheTide
left a comment
There was a problem hiding this comment.
Thanks for this. An M4 Max running niri and whisper.cpp as a daily driver is great news, and splitting the T604x DT out of t6040.dtsi is the right shape. We built and tested the whole stack (this PR plus aurora-silicon/linux PRs 732, 749 and 920) on our fleet, and the results are at the bottom. Before it can merge, these need fixing. The first two are hard blockers.
Required fixes
-
Signed-off-by on every commit (hard blocker). None of the 20 commits in this stack has a
Signed-off-by:. Every commit in aurora-silicon/linux needs the author's own DCO sign-off, and nobody else can add it for you. Please addSigned-off-by: Your Name <email>directly afterAssisted-by: LLM, with no blank line between them.git rebase --signoff integration/auroraon each branch, then a re-push, does it in one go. -
Gravity Linux provenance doc in
drivers/gpu/drm/asahi/g17/fw/initdata/v25g83.rs(hard blocker). e7c66a2 ("add T6041 and the measured 25F84 firmware profile") deletes the module doc at lines 3-17, which records that the 25G83 constants were "derived from the G16 encoders of Gravity Linux". That's the attribution for GPL-2.0-only code we owe to its authors, and it can't be removed. Please restore it exactly as it was. If you want to add a 25F84 note, put it after the existing text. The same hunk also drops theAON_TABLEdoc comment, please put that back too. -
Untested top commit 84612a4 ("scope experimental TA mode 1 to T6041 25F84"). Its message says "Not yet compiled, KUnit-executed or hardware-tested", and
hw/t6041.rs:63calls it an unverified experimental workaround. It does compile now (we built it). Please run it on your M4 Max and reword the message to say what you ran, or drop it from this PR. -
Three new module parameters. The tree's rule is that the DT and the firmware the driver finds decide behaviour, with no new module or kernel parameters.
drivers/gpu/drm/apple/dcp.c:233appledrm.t6041_fw_26_5: if 26.5.2 DCP firmware is what you run, admit it as a supported version like 26.6.2, with no opt-in and no "unqualified" warning.drivers/gpu/drm/asahi/asahi_core.rs:225asahi.t6041_serial_render: you've said concurrency is fixed now, so please drop it together withPool::serialize_renderand its caller atg17/runtime.rs:219.asahi_core.rs:229asahi.t6041_fw_log: the firmware-log switch belongs behind a debug build or dynamic debug, not a parameter.
-
Per-device policy in global statics.
g17/fw/compute.rs:36(static PROGRAM: AtomicU8) andg17/fw/compute_pool.rs:21(static BASE_BLOCKS: AtomicUsize) are written inGpu::new()and read from the queue code. Please carry both on the per-deviceVariant/CoreLayoutthat already reaches that code, the wayta_mode_1does. That's the same pattern T6040's config uses. -
Three host tests aren't registered.
tools/asahi/run-host-tests.pyfails the run on any unregistered script, so the gate currently fails onaop-bootargs-tests.py,g17-t6041-initdata-tests.pyandt604x-cpu-order-tests.py. Please add them toASAHI_TESTS(line 55) with their arguments. We ran them by hand, and aop-bootargs passes (with its negative control). cpu-order passes on the j616s, j614s and j616s-tether DTBs (14 cores) and on j616c (16 cores). -
apple-dcp host selftest
desktop-powerlog-framingno longer compiles (84/85).powerlog_report()now callsparse_system_log_mnits_pairs()anddev_info(), and the fixture intools/testing/selftests/drivers/gpu/apple-dcp/desktop.pyextracts neither. This fixes it locally, bringing the display group to 18/18 and the full run to 85/85:--- a/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py @@ -582,6 +582,8 @@ def powerlog_framing(root): prefix += block(parser, 'int parse_system_log_mnits(') + if 'int parse_system_log_mnits_pairs(' in parser: + prefix += block(parser, 'int parse_system_log_mnits_pairs(') prefix += r''' @@ -589,6 +591,7 @@ def powerlog_framing(root): #define dev_dbg(...) ((void)0) +#define dev_info(...) ((void)0) #define dev_warn(...) ((void)0)
Please also add a case that feeds the headerless pairs form, so the new fallback path is covered.
-
25F84 recovery workarounds.
g17/queue/mod.rs:168drops ECANCELED/ENODATA/EBUSY fence errors, andg17/recovery.rs:285spares a blamed VM on reason 0. The commit message itself says concurrent-render restarts and recovery are unresolved, so these hide a firmware fault rather than fix it. If your concurrency fix lives in a newer branch, please bring it in here and drop these. -
AVD HEVC admission by machine and file size.
drivers/media/platform/apple/avd/avd-drv.c:570checksof_machine_is_compatible("apple,j616c")andfw->size == 0x12000. Please drive it from match data or a DT property on the avd node instead. -
Static calibration.
hw/t6041.rs:159hardcodes leakage coefficients and max power from one machine, and T6041 skipsCalibration::read(). Leakage is per die, so like T6040 it should come from the DT the loader fills, withChipholding only the layout overlays. The emptyHW_DATA_WORDS/POWER_CONFIG_WORDStables can go until something uses them. -
Boot-log noise. The four
bring-up:dev_info!lines (g17/mod.rs:1512and following) print on every G17 boot. We see them on our M4 Pro and on the A18 Pro Neo. Please make themdev_dbg!. -
Model string.
t6041-j616c.dts:12reads"Apple MacBook Pro (16-inch, M4 Max, Nov 2024)". Our model strings carry no year or month, so please change it to"Apple MacBook Pro (16-inch, M4 Max)", matching J616s's"(16-inch, M4 Pro)". -
dtbs_check on t6041-j616c.dtb gives 19 new warnings. 4 also appear on J616s (the ANE properties), and the other 15 are J616c-only:
apple,t6041-ascwrap-v6is missing from the mailbox binding;- per-node
nonposted-mmioon aop, admac, i2c and dart, anddma-noncoherenton aop and display-subsystem; - the Wi-Fi node is
brcm,bcm4329-fmacwith nopci14e4,xxxxfirst; gpio-lowunder smc.
Please get these down to the J616s set.
-
Watchdog commit 6f8cd13 (nowayout/parent) is a good fix but isn't T6041-specific, and it adds a module parameter (
apple_wdt.c:57). Please split it into its own PR. -
Shared-code behaviour changes need their reasoning in the commit messages, since they run on our other machines:
apple_drv.c:574-581replacescommit_tail_rpmwith flip-done waiting on every machine;aop.rs:2642turns on word-access bootargs forHW_CFG_T6040, so the J616s too;macaudio.c:522-525now stops every playback stream of J616/J614 cards when the speaker lease is lost. It keeps protection on and is stricter, which is fine, but say so.
What passed on our side
Test kernel 7.3.0-aurora-am4t1 = integration/aurora 565c802 + this PR + PRs 732, 749 and 920 (clean merge; this PR is 6 commits behind its base).
- Build and gates:
- builds clean;
- W=1 adds 0 new warnings across drm/apple, the Rust GPU driver, accel/ane, AVD, soc/apple and sound/soc/apple;
- KUnit no worse than base: drm/apple 111+1 skip, display-gate 49/49, ANE boot 205/205 and transport 205/205 (base 201/201 each), AVD 40/40.
- Device trees: every existing board's DTB is byte-identical before and after, and the j616s, j616s-tether and j614s decompiled diffs are empty, so the t604x.dtsi split is a pure move.
- M4 Pro (J616s), one-shot boot, SELinux enforcing:
- same row as fleet16: no kernel errors, 0 AVCs, no failed units;
- eDP plus two external displays, Wi-Fi, BT, Touch ID;
- AOP and ALS come up with word-access bootargs, and speaker protection is active;
- glmark2 17570/17530 vs 17562/17381 on fleet16;
- 20 more warm boots were clean.
- A18 Pro (Neo), one-shot boot: same row as baseline, and glmark2 within 2% on that fanless machine.
- ANE: the H16 terminal-ring drain from PR 920 doesn't change our M4 Pro's known ANE startup stall (2 of 20 boots, against a 15% base rate). It isn't a regression, just not the fix we hoped it might be.
Once it's revised, please post from the M4 Max a boot log (dmesg), journalctl -b -p 3, getenforce, your kernel command line (with no appledrm./asahi. parameters) and a short list of what you exercised. That's the M4 Max proof we'll merge on.
t6040.dtsi keeps aurora-silicon#525's split. The base dropped dma-noncoherent from a node that moved to t604x.dtsi, so that removal goes there.
Reuse the existing SoC and PMGR descriptions as the shared T604x base. Keep the M4 Pro DRAM class in t6040.dtsi on top of it. The J614s and J616s compiled trees keep every node and property unchanged. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Describe the Max CPU, OPP and register-window differences on the shared base. Preserve the qualified J616c node and property values. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Move identical register-window constructors into a family helper. The T6040 and T6041 initialization-data checks retain their exact values. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Select a static 25F84 profile and admit the normalized loaded image measured in three qualification boots. Remove exploratory overrides and unknown-image admission from the support path. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Accept 26.5.2 firmware on the T6041 display controllers and add headerless powerlog parsing. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
A DCP commit signals flip_done from its swap completion, after the rest
of the commit tail has run. drm_atomic_helper_commit_tail_rpm() waits
with drm_atomic_helper_wait_for_vblanks(), but appledrm never calls
drm_vblank_init(), so drm_crtc_vblank_get() fails and that wait returns
at once. A blocking commit therefore returned before flip_done, and
drm_atomic_helper_setup_commit() refuses a nonblocking commit on the
same plane until flip_done. A page flip right after drmModeSetCrtc()
failed with -EBUSY ("busy with a previous commit"), which is what
glmark2-es2-drm hit on the J616c.
Wait with drm_atomic_helper_wait_for_flip_done() instead. The rest is
the sequence of drm_atomic_helper_commit_tail_rpm(), in its order. That
helper makes no runtime PM calls: its name stands for enabling CRTCs
before committing active planes, and this keeps that.
The change is not scoped to the J616c. Neither the empty vblank wait
nor the -EBUSY check depends on the SoC, so a per-machine tail would
only leave the race on the others. On every appledrm machine:
- A blocking commit returns after the swap completes and holds its
modeset locks until then.
- A nonblocking commit's worker finishes later. The next commit was
already held back by flip_done, so the flip rate does not change.
- Nothing waits when flip_done is complete early: CRTCs that stay off,
legacy cursor updates, and the T8132 backend, which sends the event
from its flush.
- A lost event costs 10 s and an error in the commit that lost it. The
next commit's dependency wait already has the same bound, so this
adds no new hang.
Framebuffer lifetime does not depend on this wait: displaced scanout is
already retained until its swap completes.
Seen and tested on the J616c only.
Assisted-by: LLM
Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Patching the AOP boot arguments read and rewrote the whole table with memcpy_fromio() and memcpy_toio(), which choose their access widths from alignment and length and write back every byte. Add an AopHwConfig setting for explicit access: read the table in aligned 32-bit words, rounded out to word boundaries so that neighbouring bytes are kept, write only the words that changed and read each one back. This was chosen for the J616c bring-up so that the first accesses to its AOP SRAM had a known width. It does not fix an observed fault: the bulk copy was not run on that machine. The setting is on in HW_CFG_T6040, so it is not J616c-only. t604x.dtsi gives the J614s, J616s and J616c the one apple,t6041-aop compatible, and HW_CFG_T8132 (J713) is a copy of HW_CFG_T6040. Scoping it to the T6041 would take a second compatible, which changes the T6040 device trees, or a machine check. On those machines the values written do not change. The access width does, and there are new ways to fail the probe: -EIO when a word does not read back, and -EINVAL for an empty table or one whose rounded end passes the window. Every other SoC keeps the bulk copy. Synthetic MMIO checks cover malformed tables, bounds and failed readback. Run on the J616c only. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Describe the six amplifiers and headphone jack in the J616c board DT. Stop playback when the speaker protection lease is lost on SN012776 cards fed by the AOP. Until now a lost lease only clamped the amp gains, and the stream kept running with its protection daemon gone or stuck in a stalled sense capture. The clamp stays; the stream now also goes to XRUN, so its client sees the loss. This is shared macaudio code and it is stricter than before. It applies to the J616c, the J616s and the J713. The J614s uses the same condition but binds no speaker link, so it has no lease and never gets here. Narrowing this to the J616c would give machines with the same amps and the same AOP path different protection, and would take a new match entry for it. The stop covers every playback stream of the speaker card, which on these machines carries only the speaker stream. The headphone jack is a card of its own and keeps playing. It is a stop, not a refusal: a client that prepares again plays at the clamped gain until the lease returns. It fires only when the speakers go from unlocked to locked, so not at boot, and not for the kernel's own lock across system sleep, where ASoC suspends the streams itself. A daemon that exits cleanly also loses the lease. Other amps and non-AOP SN012776 cards behave as before, and the MAX98360A path still stops only its software-gain streams. Lease loss was tested on the J616c only. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
The T6041 AVD shares its "apple,t6041-avd" compatible with T6040, which holds HEVC back until the firmware lists it. Give the T6041 node a more specific compatible and a variant that holds nothing back, so HEVC is also available on firmware that publishes no codec list. A firmware that does publish one still limits the set. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
Build the production initialization objects with their soft-float types and compare constants with explicit capture inputs. Keep T6040 per-chip calibration validation separate; include no captures or local defaults. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
m1n1 compares DT CPUs with its physical MPIDR enumeration. Appending the Max cores to the Pro topology put CPU 9 out of order and stopped boot before kernel entry. Define the full family topology in hardware order and remove the extra cores from T6040. Check the compiled DTB order for both SoCs. Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
macOS on J616c writes 0x1c890 = 1 and 0x1c918 = 0 for its tiling passes, where the shared firmware profiles write 0x200440 and 4. Do the same in T6041's 25F84 build and leave the shared profiles unchanged. 0x1c9a8 stays at the shared 0x3c; macOS writes 0x5c here. This does not fix the 25F84 reason-0 restarts under concurrent rendering. They still occurred with these values on an earlier base, also with 0x1c9a8 = 0x5c. Ran on J616c with 25F84, with PRs 732, 749 and 920 and Mesa ca90d8c1919, serial rendering off and the firmware log on: three boots of niri, DMS and 20 Whisper runs each, with no GPU recovery. Add KUnit coverage for the policy boundary and constructor output. Link: aurora-silicon#525 (comment) Assisted-by: LLM Signed-off-by: Artyom Astafurov <artyom.astafurov@gmail.com>
84612a4 to
18ca0a6
Compare
|
Re Item 10: Postponing this. The loader should supply T6041 calibration, but this work currently runs on a customized m1n1, and the handoff is better done properly on Aurora's m1n1 later than built on a local one. Until then, the 40-core J616c keeps the static profile, documented as such, with the handoff as a tracked follow-up. |
T6041/J616c GPU, protected audio and HEVC (supersedes #525)
|
Thanks astaff, this round covered everything from the review. Sign-offs, the Gravity Linux doc, the module parameters, the per-device policy, the host tests, the boot log, the model string, the dtbs_check warnings and the commit messages for the shared changes are all sorted. It's merged now through #958, which keeps your twelve commits as they are and adds three small ones of ours on top. That PR explains each one, the short version:
On our M4 Pro the whole stack boots the same as our current kernel with SELinux enforcing, details in 958. Item 10 is fine as a follow-up like you said. The calibration handoff and the dcpext firmware memory fill from #749 both want to live in Aurora's own loader, so when you get to it please open those against our m1n1. Also if you ever catch why the first two HDMI mode-sets fail with 0x6 at boot, that'd be great to know. |
Why
The M4 Max (T6041, J616c) is in the same SoC family as the M4 Pro. This series shares one T604x description and lets T6041 differ only where it measurably does: the 40-core GPU and its firmware profile, the board, its display firmware, protected AOP audio and HEVC.
What
arm64: dts: apple: split the shared SoC and PMGR description intot604x.dtsiand add the J616c board. J616s and J614s DTBs are byte-identical.drm/asahi: share the T604x register windows; add T6041 with its static firmware profile and a tiler segment control local to that build.drm/apple: accept the T6041 display firmware; wait forflip_donein the commit tail.soc/apple,ASoC/apple: word access for the AOP boot arguments; protected J616c audio.media/apple/avd: admit HEVC on T6041 without a codec list.tools: check T6041 initialization data against explicit captures.No module parameters or environment switches. The watchdog and ANE driver changes moved to their own PRs.
Testing
Kernel is the merge of this PR with #732, #749, #920 and the ANE and watchdog PRs, with Mesa #85 and no local patches, on a J616c running NixOS. Serial rendering is off and the command line has no driver parameters. Logs: dmesg,
journalctl -b -p 3,getenforceoutput, cmdline and the list of what was exercised are at https://gist.github.com/astaff/d1f649ba0d29f5279762e2baa427e732.dt-validateont6041-j616c.dtb: the same 3 ANE property warnings as J616s and J614s, nothing else.Limits
Companion Mesa series: aurora-silicon/mesa#85.
🤖 Generated with Claude Code