Skip to content

drm/asahi: accept the T8122 25G83 mailbox compatible list - #964

Open
satchlj wants to merge 34 commits into
integration/aurorafrom
satchlj/port-302-20261104
Open

satchlj wants to merge 34 commits into
integration/aurorafrom
satchlj/port-302-20261104

Conversation

@satchlj

@satchlj satchlj commented Nov 5, 2026

Copy link
Copy Markdown
Member

Accept the exact T8122 AGX mailbox compatible pair from 25G83 without relaxing resource or identity checks. Include the public T8122 runtime foundation that Aurora’s omacom sync held back; its policy/qualification hold remains open. Separate 7.3 adaptations retain Aurora’s identity-selected hwdata, binding ownership and MMIO lifetime/transaction rules, and use current module-metadata and DMA-address APIs.

Port of omacom/linux-aurora#302. The original PR remains untouched.

Carried dependencies (original patch, complete message, authorship and dates preserved; 7.3 adaptations are separate commits):

Original commit Carried commit Subject Original author Origin
e51f1082fa23 84ef8e4d724d drm/asahi: m3: restore the 7.1.12 T8122 runtime sources, unwired Scott Jones carried unaltered from omacom/linux-aurora
ad52c9b317f6 e45af192f61d drm/asahi: m3: start the T8122 runtime on 7.2 Scott Jones carried unaltered from omacom/linux-aurora
8e864a57c40e e16c5bbae3f8 drm/asahi: m3: map each VM's dummy page where the firmware expects it Scott Jones carried unaltered from omacom/linux-aurora
75c5823f60b3 eae5bfa6b7d3 drm/asahi: m3: quarantine a failed job's VM before signalling its fence Scott Jones carried unaltered from omacom/linux-aurora
d2666d8ca7a5 c9dcc611f3f1 drm/asahi: m3: keep the adopted UAT until ASC stops on a failed start Scott Jones carried unaltered from omacom/linux-aurora
e8023bba60e6 34b754f9d5cf drm/asahi: m3: don't let the compute stream debug read fail a job Scott Jones carried unaltered from omacom/linux-aurora
8a31fe185686 0486865371b4 drm/asahi: prepare supported M3 native GPU defaults Chris Kearney carried unaltered from omacom/linux-aurora
61eccdbbee80 6b505f46bda1 drm/asahi: m3: start the GPU firmware once per boot Scott Jones carried unaltered from omacom/linux-aurora
6246daaee9d2 00311a5359da drm/asahi: m3: don't quarantine VMs for packets the firmware never saw Scott Jones carried unaltered from omacom/linux-aurora
fc5391123e5a c297e5a44010 drm/asahi: align M3 Air startup diagnostics with board defaults Chris Kearney carried unaltered from omacom/linux-aurora
80958cd5a495 6cdb981acb5b drm/asahi: m3: take the start pin with try_module_get Scott Jones carried unaltered from omacom/linux-aurora
18c64047548c ba17f5af0ba0 drm/asahi: m3: admit clients that ask for the parameters up to the HAL generation DjDeveloperr carried unaltered from omacom/linux-aurora
4b7aa809ff54 a8f092b08ba0 drm/asahi: sync the G17 driver with aurora-silicon at d3cf19b DjDeveloperr carried unaltered from omacom/linux-aurora

@scottjones @chriskearney @DjDeveloperr @RyanTheTide

This carries Scott Jones's T8122 runtime and safety foundation from omacom/linux-aurora unaltered, because Aurora doesn't have it yet and this change builds on it. If you'd rather land it separately or differently, say so and I'll rework this.

This carries Chris Kearney's M3 native defaults and startup diagnostics from omacom/linux-aurora unaltered, because Aurora doesn't have it yet and this change builds on it. If you'd rather land it separately or differently, say so and I'll rework this.

This carries DjDeveloperr's M3 client parameter admission and timestamp adapter from omacom/linux-aurora unaltered, because Aurora doesn't have it yet and this change builds on it. If you'd rather land it separately or differently, say so and I'll rework this.

Aurora #783 held this foundation pending identity-selected constants and J613/J615 qualification. This port does not clear that hold.

Validation: arm64 defconfig + asahi.config, Image/modules/DTBs with BTF and KUnit enabled, LLVM 18/Rust 1.85.0, passed at stack top #347 (7b88ebb77e46), which includes this branch. The validated integration base is b500668. QEMU loaded the test-bearing modules successfully with no additional failures. The combined run retains four pre-existing SEP store failures (plus their suite aggregate), reproduced on the unmodified Aurora base. The unmodified pinned base also crashes in apple-av-audio-lifetime/av_lifetime_devres_order; that unrelated audio suite is explicitly excluded. All tests added by these ports run through KUnit debugfs on Cortex-A76. This is not a fully green or complete-tree KUnit run. The mailbox-compatible fixture passed normally and with optimized Python. No 7.3 hardware boot or deployment has been performed.

scottjones and others added 30 commits October 23, 2026 02:13
Bring back, unchanged, the M3 runtime that starts the T8122 (M3 MacBook
Air) GPU on the release-20 kernel (c46d7dc, the source of
linux-aurora-m3gpu 7.1.12.aurora2-20261017.20): the runtime, its
firmware admission, InitData, device, RTKit, memory, submission and
client files, the T8122 start experiment, and the 7.1.12 hw tables
(hw.rs, hw/t8122.rs, hw/agx3.rs, identity.rs).

g15_raw.rs and initdata.rs are the G15 (G15, V14_8_3) expansions of
7.1.12's fw/initdata.rs and initdata.rs: every #[versions(AGX)] item
replaced by its G15V14_8_3 instance, which 7.2's version matrix no
longer generates. The expansion keeps the source text; its eleven G15
structures match rustc's own expansion of c46d7dc field for field.

Nothing declares these modules yet, so this changes no build. The
next commits adapt them to the 7.2 driver.

Co-authored-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
Co-authored-by: Eryk Wieliczko <github@wieliczko.ninja>
Co-authored-by: Satya Benson <satya@benson.earth>
Co-authored-by: Naeem Malik <malik2015naeem@gmail.com>
Co-authored-by: garymeyerca <garymeyerca@users.noreply.github.com>
Co-authored-by: DjDeveloperr <hey@djdev.me>
Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
7.1.12 mapped each VM's dummy page at the backend's unknown_page(),
which the M3 runtime returned as 0x2ff_ffff_8000, the address its
InitData gives the firmware (unk_30). On 7.2 file.rs maps it at
uat_geometry().unk_page() instead, which is 0x3ff_ffff_8000 with the
runtime's 42-bit geometry, so the firmware's unknown page was unmapped
in every T8122 VM.

Add a gpu::Gpu::unknown_page() hook, defaulting to the geometry's page
so no other GPU changes, and have the M3 backend return
RUNTIME_UNKNOWN_PAGE, which also ends its user range, so the two can't
drift again.

Reported-by: Marcelo Alcantara <maralc@gmail.com>
Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Packet::finish signalled an error fence while the packet could still
hold its VM job guard, and nothing on the M3 path quarantined it, so
after a timeout userspace could unmap and close memory that work the
firmware had not provably stopped was using. Unmap invalidates the
TLB, so this ended in a GPU fault rather than freed memory, as on
7.1.12, but 7.2's shared job lifetime can block it.

As G15 does, quarantine a guard that is still held before the error
fence becomes visible: mapping changes wait until the runtime drops
the packet. Guards already released (work never published, or retired)
are unaffected. Fix the comment that said this already happened.

Reported-by: Marcelo Alcantara <maralc@gmail.com>
Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Once adopt_uat() points TTBAT context 0 at the kernel-owned lower root,
a failure in Config::new() or the window sync dropped the UAT and its
window inside the start closure, before stop_asc(), and the branch that
retains everything when ASC fails to stop could not retain tables that
were already freed.

Keep both outside the closure: drop them only after ASC has stopped,
and leak them with the rest when it does not.

Reported-by: Marcelo Alcantara <maralc@gmail.com>
Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Compute::new() read 48 bytes of the client's CDM stream for a debug
message, whatever the stream's length, and failed the job if the read
did. A short stream ending at a mapped page boundary with the next page
unmapped passed the stream checks but then failed its first submission,
even with debug logging off (as on 7.1.12).

Read no further than the stream, and only log when the read succeeds.

Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
A second start of the T8122 runtime in one boot (unbind and rebind, a
module reload, or a retry after a failed start) hands the firmware
freed tables. Runtime::drop and the failed-start arm free the adopted
lower root once ASC has stopped, but TTBAT context 0 still names it, and
the next start sets RUN before adopt_uat rewrites context 0. stop_asc
only clears RUN, so there is no firmware state to restart from anyway.

Refuse every start after the first one of the boot instead. The latch is
claimed just before the first ASC start and is never released, and
claiming it pins the module, so a reload can't forget it. An unbind and
rebind now ends in a clean refusal rather than a second firmware boot,
and a reboot is the only way to start the GPU again.

Pinning the module also means it can't be unloaded right after an
unbind while a completion work item is still queued, which was the
reason for draining that work in Backend::stop.

Reported-by: Marcelo Alcantara <maralc@gmail.com>
Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Since a failed job's VM is quarantined before its fence signals,
Inner::fail_pending quarantines every pending packet's VM, including
packets the firmware never saw: it finishes them without releasing their
job guards. A check against the active batches can't tell them apart,
because a pending packet can be partly published and fail_active drains
the active batches before it calls fail_pending.

Give each packet a flag that is set before the first firmware-visible
change of any batch that includes it: before the producer state of a
batch changes, so partial ring appends that overlapping firmware may
consume count as published. fail_pending releases the guard only for a
packet whose flag is unset. Everything else keeps quarantining as
before, including on ECANCELED: cancellation only withdraws a packet's
unpublished remainder, and its published commands may still be running.

Reported-by: Marcelo Alcantara <maralc@gmail.com>
Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Signed-off-by: Chris Kearney <303316+chriskearney@users.noreply.github.com>
The one-start-per-boot latch pinned the module with __module_get after
claiming it. A first probe that isn't the module-init one (deferred,
async or a sysfs bind) can run while an ordinary rmmod is under way:
once try_stop_module has dropped the reference and marked the module
GOING, __module_get revives the count unconditionally, the probe starts
ASC, and the module still unloads. The next load then gets a fresh latch
and starts the firmware a second time.

Take the reference with try_module_get before claiming the latch, and
start nothing when the module is already being removed. When another
start already holds the latch, drop only the reference this probe just
took; the winning claim keeps its reference, so an ordinary unload stays
blocked. A forced unload, or a module init that fails after the probe
started ASC, still frees the module regardless of references; neither is
new here.

The order lives in the batch policy (claim_start), so the host test
checks it: a pin that fails claims nothing, a start that loses the claim
gives back only its own reference, and the winner keeps its reference.

Reported-by: Chris Kearney <303316+chriskearney@users.noreply.github.com>
Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
…L generation

The M3 runtime admits a VM only for a file that asked GET_PARAMS for at
least AGX3_PARAMS_SIZE bytes, and that was the size of
drm_asahi_params_global. The G17 update grows the structure from 600 to
616 bytes with two optional tail fields, memory_limit and
client_memory_limit, so Mesa built against the 600-byte structure would
be refused VM creation with EOPNOTSUPP until it is rebuilt.

The check only needs to know that the client knows the AGX3 fields. Pin
the minimum at the end of gpu_hal_generation, 600 bytes, and assert that
value at build time. GET_PARAMS still copies only the size the client
asked for.

Signed-off-by: DjDeveloperr <hey@djdev.me>
The 25G83 device tree advertises the AGX-specific compatible followed by
asc-mailbox-v4. Both bind the same mailbox operations. Admit this exact
pair while retaining all resource and identity checks.

Exercise the production rejection predicate with public-DTS fixtures and
resource mutations; allow optional local DT captures for reproduction.

Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Keep the public dependency patch unchanged. The separate 7.3 adaptation
restores Aurora integration after the carried series.

Signed-off-by: Satya Benson <satya@benson.earth>
Wire the restored 7.1.12 M3 runtime to the 7.2 driver behind
CONFIG_DRM_ASAHI_M3_T8122 (default n), so the M3 MacBook Air (J613,
J615) GPU runs again on its 14.8.3 firmware. A T8122 probe still passes
the G15G identity gate and the backend selection first, and the runtime
still starts only with asahi.t8122_start=1; otherwise the probe is
refused as before. Other GPUs are not affected: T6030/T6031 keep the
G15 backend or the refusal, and the T6030/T6031 start paths and the
T6031 start experiment are dropped from the runtime.

On 7.2 the runtime:
- registers through drm::Registration as a gpu::Gpu backend, like G15
  and G17, and is stopped on unbind while its device resources are
  live; the completion worker moves from the DRM device data into the
  runtime's RTKit state;
- keeps user mappings alive across accepted work with the shared VM
  job lifetime (VmJobGuard, retain_job, deferred unmaps), the
  generalized form of 7.1.12's M3 VM job lifetime, on VMs created with
  tracked status;
- adopts the firmware's UAT as the G15 backend does on 7.2
  (Uat::new_adopted and g15::uat: the PPL exchange, TTBAT context 0,
  the host window at root entry 2 through the shared L2) instead of
  7.1.12's M3-only handoff mode in mmu.rs/pgtable.rs. The firmware-
  walked pages are cleaned to the point of coherency, the host window
  is linked before the InitData and each batch reach the firmware, and
  context 0 is invalidated when a job's command aliases go. The option
  therefore depends on DRM_ASAHI_G15;
- refuses VMs to userspace that did not ask GET_PARAMS for the whole
  global parameter structure (7.1.12's per-file client gate), through
  a new gpu::Gpu::admit_vm hook that admits every client elsewhere.

Smaller 7.2 adaptations: the IoMem/Devres, IoSysMap and RTKit buffer
APIs; Queue::submit's registration argument; quiet MMIO mappings in an
mmu::m3 helper module; the M3 debug flags, F32::to_bits,
Completion::complete/try_wait_for_completion/wait_for_completion_timeout
and RtKit::is_running/is_crashed, which 7.2 dropped; the M3 module
parameters move into m3_params, and m3_soc.rs gets back its full 7.1.12
table, cfg-gated with the runtime. asahi.m3_expose=0 is refused before
anything starts. The devcoredump fault snapshot is dropped (7.2's
kernel crate has no devcoredump binding): the first failure is logged.

Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Keep the public dependency patch unchanged. The separate 7.3 adaptation
restores Aurora integration after the carried series.

Signed-off-by: Satya Benson <satya@benson.earth>
Generated-by: LLM
Signed-off-by: Chris Kearney <303316+chriskearney@users.noreply.github.com>
Retain the newer G16 frontend and binding lifetime, and compose the public
T8122 runtime with Aurora. Original dependency patches and their complete
metadata are retained in the preceding carried commits.

Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
The following original G17 sync commit includes the M3 timestamp adapter.
Restore current Aurora integration in the separate adaptation afterwards.

Signed-off-by: Satya Benson <satya@benson.earth>
Bring drivers/gpu/drm/asahi up to the aurora-silicon/linux state at
d3cf19b, the base of the G17 performance series that follows, merged
three-way on top of integration/aurora with the 7.2.10 merge point
44d5afc as base. integration/aurora's own work is kept: the G15 backend,
the M3 T8122 runtime, UAT adoption, deferred-close binding sequences (#214)
and the 7.2.11 shared-code adaptations. The G16 (T8132) backend is not
carried.

This carries the G17 work merged on the aurora side since 7.2.10,
including the T6040 (M4 Pro) and 25G83 firmware support and the render
replay/recovery series by Jonathan Goyvaerts, the watchdog, replay and
backing-population changes by Ryan Murray, the tracked VM lifetime work by
Eryk Wieliczko, and the G17 queue, capacity and timestamp changes by
DjDeveloperr (aurora-silicon/linux #382, #391, #397, #400).

Adaptations to 7.2.11:
- module parameters return references; THIS_MODULE replaces
  kernel::module::this_module; a local raw_try_init replaces the newer
  pin-init helper; of_device_table! takes the MODULE_OF_TABLE name.
- regs.rs keeps G17's sgx window as Devres<IoMem>, as 7.2 has no
  DevresIoMem.
- The shared feature flags keep G17's opt-out of soft faults.
- G15 and the M3 runtime use the shared timestamp::Buffer and the
  reserved-table aware root walk; omacom's G15 vm_closed hook becomes
  vm_destroyed, next to the G17 vm_closed.
- Crate and helper pieces the driver needs: the shmem SG lease and
  pages_no_reclaim (drm_gem_shmem_helper), DRM file memory stats, fdinfo
  and is_current_master, and the mm RSS counter.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Keep Aurora current for all other backends. Use the carried public M3
firmware timestamp adapter and accept the new queue usage argument.

Signed-off-by: Satya Benson <satya@benson.earth>
…unner

Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Use lifetime-aware managed MMIO, the current coherent DMA address accessor and module metadata. Keep Aurora’s identity-selected hwdata block instead of restoring the older diagnostic opt-out.

Signed-off-by: Satya Benson <satya@benson.earth>
Brings in the DCP T6020 tunnel relink, the DAC backlight fade, the
tas2764/macaudio ADT amp setup, the ANE DART fault fix, the selftest
fixture updates and the aurora-sep loader SELinux domain.

Resolves tools/asahi/run-host-tests.py: integration/aurora registered
ane-tm-transient-fault-tests.py at the top of ASAHI_TESTS, where this
branch registered test-m3-mailbox.py. Keep both entries, Aurora's
first. Nothing else conflicted.
@satchlj

satchlj commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

@DjDeveloperr @RyanTheTide ready for your regression testing. It hasn't been boot-tested on J613 with 7.3 yet; I'll post the result here when I have it. It conflicts with the latest base branch right now; I'm merging that in and will push the update shortly.

@satchlj

satchlj commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

J613 boot result on 7.3 (rubra, M3 MacBook Air 13", macOS 26.6.2 / 25G83 firmware), 2026-11-05.

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