Skip to content

drm/asahi: build the M3 Air GPU runtime without the G15 backend - #204

Merged
chriskearney merged 1 commit into
integration/aurorafrom
review/m3-t8122-without-g15
Oct 24, 2026
Merged

chriskearney merged 1 commit into
integration/aurorafrom
review/m3-t8122-without-g15

Conversation

@scottjones

Copy link
Copy Markdown
Collaborator

Summary

DRM_ASAHI_M3_T8122 (#187) depends on DRM_ASAHI_G15 only because the T8122 runtime adopts the firmware's UAT with the G15 backend's handoff helpers (g15::uat::Window, g15::memory_mode). So turning the M3 Air on would also turn the G15 backend on for M3 Pro/Max. This splits the adoption out, so the two options are independent:

+config DRM_ASAHI_UAT_ADOPTION          # hidden: the shared UAT handoff adoption
 config DRM_ASAHI_M3_T8122
-	depends on DRM_ASAHI_G15
+	select DRM_ASAHI_UAT_ADOPTION
 config DRM_ASAHI_G15
+	select DRM_ASAHI_UAT_ADOPTION

 asahi_core.rs
   #[cfg(G15)] mod g15;                  # the backend, unchanged
+  #[cfg(all(UAT_ADOPTION, not(G15)))]   # just g15/{uat,regs,hw}.rs, via #[path]
+  mod g15;                              # (g15/adopt.rs), no probe, no registration
  • The three RAM helpers memory_mode needs move from g15/glue.c to g15/uat_glue.c. That file is built for either option, so the T8122 runtime doesn't pick up glue.c's display and PMP dependencies.
  • In uat.rs, regs.rs and hw.rs, only what uses G15's Config or ADT is gated on G15: adopt(), Window::new, Regs::identity and the T6030/T6031 tables.
  • The shared mmu.rs/pgtable.rs items the runtime uses move from G15 to UAT_ADOPTION. These are the adopted Uat, with_tracked_status, read_user and the point-of-coherency cleaning, and they're all off unless a backend turns them on.
  • G15 builds are unchanged, because G15 selects UAT_ADOPTION.
  • M3_T8122 now states its own dependency on APPLE_PMP, whose power votes the runtime calls directly. Before, nothing in Kconfig implied it; M3 Pro/Max: G15 as the T6030/T6031 GPU driver, and integration/#358 display and platform union #148 adds the same dependency to DRM_ASAHI.

This doesn't touch asahi.config. Marcelo asked in #187 for the switch-on to be its own small PR, with the one-start-per-boot latch, the pending-packet quarantine and the t8122_start default in or before it.

Evidence

The asahi driver objects and pmp-report.o were built in four configurations (LLVM 22.1.8, Rust 1.85.0, bindgen 0.72.1) against the untouched tip b6f070c9:

G15 M3_T8122 this branch b6f070c
off off 0 errors, 2 Rust warnings the same 2
on off 0 errors, 31 Rust warnings the same 31
off on 0 errors, 0 warnings not possible (depends on G15)
on on 0 errors, 27 Rust warnings the same 27

In every configuration that builds on b6f070c9, the warning set is identical. Turning M3_T8122 on without G15 adds only CONFIG_DRM_ASAHI_M3_T8122, CONFIG_DRM_ASAHI_UAT_ADOPTION and CONFIG_APPLE_T8122_GPU_PMP_LINK to the config. A G15-only config differs from b6f070c9 only by CONFIG_DRM_ASAHI_UAT_ADOPTION. The full tools/aurora-ci host-test manifest passes, apart from the apple-dcp selftest, which fails the same way on b6f070c9 locally. Two suites needed updates: the asahi-g15 selftest now reads the RAM helpers from uat_glue.c, and g15-zero-words-tests.py pins the new hw.rs, whose only change is the two #[cfg] lines. Its separate T6030 table pin is unchanged.

In the M3-only configuration with DRM_APPLE off as well, a full vmlinux and modules build links asahi.ko through modpost, with no warnings in the GPU driver. So the runtime needs no display driver.

Not run on hardware. With G15=n the M3 Pro/Max paths are the ones b6f070c9 builds with the option off: driver.rs keeps refuse_probe() for T6030/T6031, and no G15 driver is registered.

Merge Danger

Door: two-way

Blast Radius: build only

Nothing changes at runtime for any configuration that builds today. The new combination (M3_T8122=y, G15=n) compiles the UAT adoption code without the G15 backend.

DJ, this overlaps #148, which removes DRM_ASAHI_G15 and makes g15/ the T6030/T6031 driver. If #148 lands first, this reduces to M3_T8122 depending on DRM_ASAHI and keeping the three helpers in uat_glue.c. If this lands first, #148's rebase can drop adopt.rs and the UAT_ADOPTION gates. Which order do you and Chris prefer?

🤖 Generated with Claude Code

DRM_ASAHI_M3_T8122 depended on DRM_ASAHI_G15 only because the T8122
runtime adopts the firmware's UAT with the G15 backend's handoff
helpers (g15::uat::Window and g15::memory_mode). Turning the M3 Air on
therefore also turned the G15 backend on for M3 Pro/Max.

Split the adoption out behind a hidden DRM_ASAHI_UAT_ADOPTION, selected
by both options:
- without G15, g15/adopt.rs builds only g15/{uat,regs,hw}.rs (no probe,
  no driver registration); what in them needs G15's Config or ADT
  (adopt(), Window::new, Regs::identity and the T6030/T6031 tables) stays
  under G15;
- the RAM helpers memory_mode needs move from g15/glue.c to
  g15/uat_glue.c, so the runtime doesn't take glue.c's display helpers;
- M3_T8122 now states its own dependency on APPLE_PMP, whose PMP votes
  the runtime calls directly (before, it was implied by nothing);
- the mmu and pgtable items the runtime uses (the adopted
  Uat, with_tracked_status, read_user and point-of-coherency cleaning)
  are built with UAT_ADOPTION instead of G15.

G15 selects UAT_ADOPTION, so every configuration that builds today is
unchanged: off, G15 only and G15 with T8122 give the same warnings as
before, and M3_T8122 alone now builds without warnings. The asahi-g15
selftest reads the helpers from their new file, and the g15-zero-words
test pins the new hw.rs (its separate T6030 table pin is unchanged).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
@scottjones
scottjones marked this pull request as ready for review October 24, 2026 18:17
@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR lets the M3 Air runtime build without enabling the M3 Pro/Max backend.

  • The M3 runtime builds without enabling the G15 backend.

No actionable issues were found. This review checked source paths and build guards; it did not run a kernel build or test hardware.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  M3["DRM_ASAHI_M3_T8122"] --> Shared["DRM_ASAHI_UAT_ADOPTION"]
  G15["DRM_ASAHI_G15"] --> Shared
  Shared --> C["g15/uat_glue.o"]
  Shared --> MMU["Shared MMU and page-table support"]
  G15 --> Full["Full G15 backend and registration"]
  M3 --> Choice{"G15 enabled?"}
  Choice -->|No| Adopt["g15/adopt.rs: shared UAT code only"]
  Choice -->|Yes| Full
Loading

Reviews (1) · Last reviewed commit: "drm/asahi: build the T8122 runtime witho..." · Reviewed by Greptile

@chriskearney chriskearney left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 9dff537. No source blocker found. The three C helper bodies are unchanged by the move, and the shared MMU/page-table changes preserve the existing behavior through the new feature gate. G15 probe/registration remains under DRM_ASAHI_G15.

Independent checks: LLVM 22.1.8 / Rust 1.93.1 W=1 component builds (asahi.o and pmp-report.o) in all four combinations; the Air-only case has DRM_APPLE=n and no apple_drm_/apple_dcp_ imports or G15 registration name in the linked object. The PMP Kconfig built-in/module dependency checks pass. G15 host and golden-record tests pass, including the host suite on current main + this PR, which retains #202. These are source/component checks, not a new hardware qualification or full-kernel build.

My preferred order is this PR first on 7.2, then #148 ported onto that main. #148 is still a 7.1.12 tree and overlaps nine files here; its port needs to retain the current #177/#182/#187/#202 fixes. If that port removes the G15 switch, drop the thin adopt.rs dispatch and redundant feature gates there, while keeping the shared helpers and reachable PMP dependency. Air default-on should remain the separate small PR with Marcelo’s remaining #187 startup/lifetime requirements addressed.

Thanks for keeping the build split separate from the enablement decision. Reviewed with Codex.

@chriskearney
chriskearney added this pull request to the merge queue Oct 24, 2026
Merged via the queue into integration/aurora with commit 7b96998 Oct 24, 2026
25 checks passed

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @scottjones. Reviewed 9dff537.

Checked and fine:

  • T8122 with G15=n. Everything the runtime uses moves to UAT_ADOPTION: new_adopted, Window::from_regions, the tracked VM status, read_user and the PoC cleaning (mmu.rs:1668-1674,1756-1777, pgtable.rs:335-357). The G15 gates that stay are G15-only: leaf_bits, is_closed, inherited_error, probe_g15. gem::prepare_new_object becomes the EINVAL stub, but only file.rs:637 calls it, behind prepare_new_objects(), which defaults to false and only G15 overrides (gpu.rs:332). So no T8122 path changes.
  • M3 Pro/Max with G15=n. driver.rs:192-201 still sends T6030/T6031 to the M3 refuse path, and no G15 driver is registered (asahi_core.rs:45-75).
  • G15=y. It selects UAT_ADOPTION, memory_mode reaches the same C body, and each helper is defined once (uat_glue.c), so nothing changes there.
  • Kconfig. APPLE_PMP=y || (APPLE_PMP=m && DRM_ASAHI=m) allows y/y, m/y and m/m and refuses DRM_ASAHI=y with a modular PMP, which is what the direct apple_pmp calls in m3_device.rs need.
  • #[path] loading. hw.rs/regs.rs/uat.rs resolve beside adopt.rs, and the t6031 gate avoids the g15/t6031.rs lookup. The allow(dead_code) only covers that subtree.

Policy: nothing turns on. M3_T8122 stays default n, asahi.t8122_start unset still means off, and asahi.config is untouched. An existing G15=y config stays y. As before, selecting the option builds the T8122 PMP link in whether or not t8122_start is set.

Order with #148: I'd land this first, as Chris said. When #148 is ported onto main and the G15 switch goes, drop adopt.rs and the UAT_ADOPTION gates but keep the adoption code built for T8122, the helpers in uat_glue.c and the APPLE_PMP dependency.

This answers the DRM_ASAHI_G15=y point from #187. The switch-on PR still needs the one-start-per-boot latch, the may-have-been-published flag for pending packets, the t8122_start default, and a J615 run, a cold boot and an unbind/rebind.

@joshuaswarren

Copy link
Copy Markdown

Hand build of the integration/aurora tip 7b96998 (contains the merges of this PR and #199, #202, #203, #204). Package release 7.2.11-tip-ARCH+, package sha256 52830bb4538e8e8f5344eacff87fbdb9ab26cc553540c36e993ba4e097561c23.

Tested so far (one-shot boot only, stock untouched):

machine boots result
14-inch M2 Max yes (candidate boot 3c4b9246, return 1beecd62) smoke equal to stock; omarchy-m-test 0.1.13: https://omarchy-m-testing.org/reports/6qHb7QcJkwg2Ref7zubzgZuA (stock reference: https://omarchy-m-testing.org/reports/RVXdswZ8LJoUJKF7vRh2KAHf)
13-inch M1 pending — machine reserved for an all-night test run; will add a line when it ran
16-inch M1 Max pending — same

CI on this PR: 9 pass, 4 skipped (attest, KUnit, boot, package).

Regressions: none found. dmesg error classes on the candidate boot match the stock baseline (known flakes only: dp-xbar -517 deferrals, brcmfmac join_pref/assoc noise, Bluetooth codec-capabilities -110). m-test check list identical to stock except two tool-level deltas, neither a functional failure: (1) hardware.drivers counts apple,mesa-fingerprint unclaimed on the tip (the node exists, no functional impact seen); (2) sep.attach reads SKIP because the SEP diagnostics ABI moved 1 -> 2 and the tool's reader expects 1 — the driver itself is up on the tip (apple_sep loaded, SEP platform profile T6020/J414s, xART scanned, trusted-keys registered, endpoints discovered), and the audio.microphone checks still pass.

Not tested: M3 paths (this PR's T8122-without-G15 build path is M3-family; the M3 Pro GPU startup in #202 and the J615 camera path in #203 compiled and booted in this build on M1/M2 but their M3-only code paths were not exercised — no M3 machine in this lab).

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.

4 participants