Skip to content

drm/asahi: T8112 G14G GPU on firmware 27.2: compute DRM device - #2473

Closed
satchlj wants to merge 1 commit into
integration/aurorafrom
satchlj/j413-gpu-27.2
Closed

satchlj wants to merge 1 commit into
integration/aurorafrom
satchlj/j413-gpu-27.2

Conversation

@satchlj

@satchlj satchlj commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf.

Brings up the T8112 (G14G B0) GPU on the macOS 27.2 (26B123) GPU firmware and hands the running firmware to a compute-only DRM device (aurora, one render node). Based on integration/aurora 449c6a1. Compute only: render commands are refused.

What it does

  • gpu/j413_root.rs builds the 26B123 root, directory and channels from the existing 13.5 G14G graph (the versioned code is also instantiated as G14/V27_2), starts the firmware, and runs one kernel-owned compute job. With t8112_drm=1 the firmware stays running and j413.rs takes it over.
  • Client compute commands come through the existing 26.x submission front end (m3_submit) and are re-encoded as 26B123 G14G compute commands. Client contexts are bound through the adopted UAT. Queues of this backend reject render commands with EINVAL.
  • Fixes for behaviour seen on hardware, all inside the new backend:
    • the DRM scheduler gets one run queue per client priority (4);
    • the front end's control-stream launch check (written for the G15 CDM launch format) is skipped for G14 streams, which it misread;
    • the firmware unlinks a command's tracking slot only when its retirement cursor reaches the value it recorded, so the host writes that value on retirement and reuses a slot only once it is unlinked;
    • with several commands in flight the shared stamp can be written out of order, so retirement follows the queue's retired position, which the firmware advances in order;
    • the firmware-to-host event ring and the firmware log rings are now consumed. Without that the event ring filled after 255 events, and the 256th client command was never fetched.
  • Any take-over failure halts the firmware (allow-off, RTKit power-off, ASC run bit) and keeps all firmware-reachable memory.

Selection

  • Device tree: the driver only takes this path for a GPU node with compatible apple,agx-t8112-identify and apple,firmware-version = <27 2 0>. The bring-up also checks the node's resources and properties (the sgx and asc regions, the shared-l2 reservation, apple,coredump-copy-buffer, apple,meta-sw-interrupt).
  • Module parameters: everything is off unless t8112_handshake and t8112_drm enable it (both default 0).
  • Build: the bring-up and the backend reuse the M3 submission front end, so they are compiled only with CONFIG_DRM_ASAHI_M3_T8122.
  • No other machine's behaviour changes. The asahi-m4 retention test's UatInner stand-in gains the clean_poc field that bind_inner now reads.

What it needs

  • macOS 27.2 (26B123) GPU firmware on the Aurora boot stub.
  • A boot loader that publishes the J413 27.2 GPU node as above. The one used here is Aura built from local J413 commits (GPU resource inventory, power model, interrupt source, coredump extent). Those are not yet an Aura PR.
  • The tested parameter set: t8112_handshake=14 t8112_telemetry_ro=1 t8112_idle_policy=1 t8112_dashboard_ram=1 t8112_cre=1 t8112_performance_control=1 t8112_event_completion=1 t8112_base_request=1 t8112_mtr_sensors=1 t8112_fast_die_fields=4 t8112_alarm_fields=13 t8112_power_curve=1 t8112_calibrated_sensors=26624 t8112_power_filter=1 t8112_command_service=1 t8112_service_stage=0 t8112_firmware_log=1 t8112_active_followup=2 t8112_command_notifier=12 t8112_drain_statistics=1 t8112_stock_header=1 t8112_completion_record=1 t8112_power_zones=0 t8112_dashboard_real=1 t8112_firmware_trace=1 t8112_drm=1 t8112_job_context=0 t8112_priority_row=2 t8112_tail_probe=3 t8112_hw_legacy=448 t8112_queue_lane=1 t8112_compute_job=1 t8112_state_cap=100 t8112_forced_stop=1. Many of the other t8112_* parameters are bring-up diagnostics.
  • With t8112_dashboard_ram=1, a 16 KiB snapshot of the live slot-9 register page as apple/t8112-gpu-slot9-seed.bin, saved before the module loads.

Tested: MacBook Air M2 (J413), firmware 27.2 (26B123)

The module was built from this branch against the machine's running 7.3 kernel, with three build-only substitutions for things that kernel predates: the mesh-output UAPI constant, the recv_message_timed RTKit callback member, and the v27 SoC sleep helpers used by g17/sleep.c. T8112 never reaches those paths. Each trial was a one-shot boot under the hardware watchdog, returning unattended to the normal kernel.

  • Vulkan (Mesa Borealis 26.3.0-devel) enumerates "Apple M2 (G14G B0)" and runs a SPIR-V compute shader. 3 dispatches of 1024 words, then 300 dispatches of 4096 words, every word checked on the CPU: 0 bad. 303 of 303 commands completed, past the old 256-command limit. No MMU fault, Oops or BUG.
  • rmmod aurora stops the firmware normally: allow-off acknowledged, status 0, no forced power-off.
  • Passed three times on this base: d216aba7, 6c62f79e (after the build-config split) and the final head e1487598.
  • The earlier, pre-rebase version of the same backend also passed 233 dispatches, including four concurrent processes.
  • CI: host tests and the SEP kunit build. The kunit configuration has DRM_ASAHI_M3_T8122 off, and it was also built that way on an arm64 host.

Not tested

  • Render. Not in this PR. The tiler and fragment path is still in bring-up and is kept on a separate branch.
  • A kernel built from this base (only the module was).
  • Any other machine, and J413 on other firmware. Without the apple,agx-t8112-identify node, the probe is unchanged.
  • Suspend and resume with the DRM device loaded.
  • Concurrent clients on this exact version.

🤖 Generated with Claude Code

@satchlj
satchlj force-pushed the satchlj/j413-gpu-27.2 branch 2 times, most recently from d216aba to 6c62f79 Compare November 20, 2026 04:35
Bring up the T8112 (G14G B0) GPU with the macOS 27.2 (26B123) firmware and
hand the running firmware to a compute-only DRM device.

The bring-up path builds the 26B123 root, directory and channels from the
existing 13.5 G14G graph (the versioned code is also instantiated as
G14/V27_2), starts the firmware with GPU-owned writable registers, runs one
kernel-owned compute job and, with t8112_drm=1, keeps the firmware running
for a DRM backend instead of stopping it. Client compute commands come
through the 26.x submission front end and are re-encoded as 26B123 G14G
compute commands; client contexts are bound through the adopted UAT.

Runtime behaviour found on hardware and handled here:
- the DRM scheduler needs one run queue per client priority (4);
- the front end's control-stream launch check decodes the G15 CDM launch
  format and is skipped for G14 streams;
- the firmware unlinks a command's tracking slot only when its retirement
  cursor reaches the value it recorded; the host writes that value on
  retirement and reuses a slot only once it is unlinked;
- with several commands in flight the shared stamp can be written out of
  order, so retirement follows the queue's retired position, which the
  firmware advances in order;
- the firmware-to-host event ring and the firmware log rings are
  acknowledged by advancing their consumers; without that the event ring
  filled after 255 events and the 256th client command was never fetched.

Every take-over failure halts the firmware (allow-off, RTKit power-off,
ASC run bit) and keeps all firmware-reachable memory.

The DRM device is compute-only: its queues reject render commands.

All of it is gated by module parameters (t8112_handshake, t8112_drm,
default off) and by the GPU node's device-tree resources and properties;
nothing changes for other machines. The bring-up root and the backend
reuse the M3 submission front end, so they are built only with
DRM_ASAHI_M3_T8122 (gpu/j413_root.rs, j413.rs).

The asahi-m4 retention test's UatInner stand-in gains the new clean_poc
field that bind_inner now reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj force-pushed the satchlj/j413-gpu-27.2 branch from 6c62f79 to e148759 Compare November 20, 2026 04:42
@satchlj
satchlj marked this pull request as ready for review November 20, 2026 04:51
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for this. A compute device on the M2's 27.2 firmware is a big step.

We prefer that a machine works with the default kernel and build, so a few things block merging this form:

  • drivers/gpu/drm/asahi/asahi_core.rs:182-430 adds 62 t8112_* module parameters. The device exists only with t8112_handshake (:426) and t8112_drm (:326) set, and the description's tested set has about a dozen more. What the GPU needs should come from the device tree and firmware version; diagnostics can stay out of tree.
  • asahi_core.rs:30 and driver.rs:57 onward build it only with CONFIG_DRM_ASAHI_M3_T8122, so the M2 needs another chip's config.
  • gpu/j413_root.rs and j413.rs are a separate backend named after a board. The existing versioned G14 code, extended with V27_2, should cover any G14G on that firmware.
  • mmu.rs:4245-4248 re-kicks the engine on a timer, where completion should come from the firmware's event.

Could you split out the shared fixes and land the backend as the G14 firmware-27.2 path? We can then run rows on our M2 (G14G), M1 Pro, M4 Pro and A18 Pro.

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Thanks, I agree with all four points. I read the whole review against the branch (e1487598). I'm not pushing a quick rework: this needs a rewrite in steps, each re-tested on the J413. Here is what I found and the plan. Tell me if you'd rather I close this and open the series instead.

What the parameters are. Of the 62, about 35 carry the tested set. The rest are of two kinds:

  • trial selectors: t8112_handshake levels 1–14, job_order, engine_classes, priority_row, queue_lane, and similar;
  • diagnostics: firmware_trace/trace_bits/trace_show, tail_probe, start_probe, private_scan, ring_start, drm_ring_skew, rekick_ms.

So "working defaults" means keeping one path, the tested one, and deleting the others, not just flipping defaults.

The mmu.rs:4245 re-kick is one of those diagnostics: t8112_rekick_ms defaults to 0 and is not in the tested set. Completion in the tested path already comes from the firmware: its event ring and the queue's retired position. The re-kick and the whole bring-up sequence around it, which sits in mmu.rs for no good reason, go away in step 2.

One more blocker you didn't list. The tested set needs t8112_dashboard_ram=1 plus a 16 KiB snapshot of the live slot-9 register page, saved by hand before the module loads. A default build can't depend on that. The driver has to capture the page itself at probe, before anything touches it.

Plan (each step as its own PR, each re-run on J413 27.2: the 303-dispatch Vulkan compute check and a clean rmmod, under the watchdog):

  1. Shared pieces first, in separate PRs:
    • the fw/* field visibility and the UatInner clean_poc stand-in;
    • one DRM scheduler run queue per priority;
    • the G14 skip in the 26.x front end's CDM launch check;
    • consuming the firmware event and log rings.
  2. The backend as the G14 firmware-27.2 path: j413_root.rs/j413.rs folded into the versioned G14 code as V27_2, the tested values as constants, every other trial branch and parameter deleted, and the slot-9 page captured by the driver. The device is created when the DT publishes a G14G GPU with firmware 27.2. No parameters, except possibly one firmware-log knob if it earns its place (I'd rather use dynamic debug).
  3. Build: compile the 26.x submission front end for G14 without CONFIG_DRM_ASAHI_M3_T8122.

Not started yet, and nothing pushed for this review. Render stays out of scope.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the careful read and the plan. A series is what we would prefer: shared pieces first, then the backend as the G14 firmware-27.2 path, then the build change. Keeping this PR open as the tracking reference until step 2 is up, then closing it, works for us.

Capturing the slot-9 page in the driver at probe is the right call, and dynamic debug for the firmware log is better than a parameter. We will run M2 rows on each step as it lands.

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Closing in favour of the split you asked for, as three stacked PRs:

  1. drm/asahi: share the 26.x wire helpers and clean bound TTBAT slots #2543: the 26.x wire helpers shared with the M3 code, and the TTBAT write-back in bind.
  2. drm/asahi: G14 compute on GPU firmware 27.2 #2544: the backend as the G14 firmware-27.2 path. It is selected by a G14G GPU with DT apple,firmware-version 27.2.0; the board-named backend and the extra compatible are gone. The raw root and hardware-data layouts are versioned as V27_2. There are no module parameters, no hand-saved register snapshot and no re-kick timer.
  3. drm/asahi: build the G14 firmware-27.2 path without the M3 runtime #2545: its own Kconfig option, DRM_ASAHI_G14_V27_2 (default y), and the 26.x front end built without CONFIG_DRM_ASAHI_M3_T8122.

One correction to my plan comment above: the slot-9 snapshot was not actually needed. In the tested set, t8112_dashboard_real=1 overrode t8112_dashboard_ram=1, so the firmware always got the real page, and the snapshot was never read. #2544 simply deletes that path.

On phellos (J413, firmware 27.2) the packaged default kernel loaded each final head's module with no parameters. Vulkan compute passed on both: 303 dispatches, every word checked, normal stop, clean rmmod, unattended return. What is untested is listed in each PR.

The 27.2 root is still built on the records of a 13.5 G14 manager; GpuManager itself is not instantiated at V27_2. #2544 says so.

🤖 Generated with Claude Code

@satchlj satchlj closed this Nov 20, 2026
@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Sorry, I closed this before I saw your 08:53 reply. The series is in the order you asked for: #2543 (shared pieces), #2544 (the backend as the G14 firmware-27.2 path), #2545 (the build change). Step 2 is up, so I've left this closed as the tracking reference, per your note.

On your two points:

  • Capturing the slot-9 page at probe. My plan comment was wrong that the driver needed a copy. In drm/asahi: T8112 G14G GPU on firmware 27.2: compute DRM device #2473's tested set, t8112_dashboard_real=1 took precedence over t8112_dashboard_ram=1. So the firmware always got the real push-telemetry page (0x23b3d0000) mapped read-write, and the snapshot was never read; the pr1–pr3 kernel logs show slot 9 on the real page. drm/asahi: G14 compute on GPU firmware 27.2 #2544 maps that page directly, as those runs did, so there is nothing to capture. I haven't added a capture, because it would be unused code. If you would still like a probe-time copy, for example as a fallback, say so and I'll add it to drm/asahi: G14 compute on GPU firmware 27.2 #2544.
  • Firmware log. There is no parameter for it now. The log gate in the runtime directory stays clear, which is the stock value, so the firmware writes no log records. The log rings are still drained in case it ever does. If a log turns out to be useful, I'll add it behind dynamic debug, not a parameter.

Both final heads passed on phellos: #2544 in the default config, and #2545 built without CONFIG_DRM_ASAHI_M3_T8122. Each ran 303 Vulkan compute dispatches with every word checked, then a normal stop and a clean rmmod. Thanks for running M2 rows on each step.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants