Repository navigation
drm/asahi: g17p: take the firmware DATA base from the bound GPU - #2659
Conversation
The g17p_diag_knobs and g17p_fw_peek module parameters, and the e2e power samples, translate fixed G17P firmware DATA LINK addresses with g17p_gfx_link_to_physical(), which adds a hard-coded physical base: the start of the J700 (MacBook Neo, T8140) GFX data segment. The parameters exist on every Mac that loads aurora.ko, so reading them maps and reads that address whatever GPU is bound. On an M2 (G14) reading g17p_diag_knobs oopses in diag_get+0x208, and any other SoC whose firmware data lives elsewhere would read unrelated memory. Publish the base from the bound GPU instead. When a G17P GPU probes, take the start of its fw-data reserved-memory region, which the loader fills with the data segments of both firmware roles, GFX (ADT sgx gfx-data) first, if the region is page aligned and holds the whole 0x134000-byte GFX DATA segment. A J700 boot whose device tree has no fw-data region falls back to the address its loader is known to use, which is the old constant, so the diagnostics keep working there. Withdraw the base on unbind. g17p_gfx_link_to_physical() now returns None while nothing is published or for a LINK address outside the DATA segment, and no caller touches memory then: diag_get still prints the knobs and reports each firmware word as "none (no G17P bound)", and peek_get prints "error: no G17P bound". Fixes: b2e300a ("drm/asahi: g18: import the G18G (T8152) backend") Closes: #2627 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Blockers: 1.
The rest is sound. HW row: J700 booted with a Stage 2 that carries aura#204 ( Assisted-by: LLM (Claude:Opus 5.5) |
The previous change published the G17P GFX DATA base from the GPU's fw-data reserved-memory region, and fell back to a fixed physical address when the bound GPU was a T8140 and the region was absent. That fallback was a chip-id compare carrying a loader-specific address. The device tree already describes this memory. t8140.dtsi declares /reserved-memory/gpu-fw-data and the GPU node names it fw-data; the loader fills it from the ADT sgx gfx-data and gfx1-data segments, GFX first, which is the layout g17p_fw_data_start() checks. A boot whose loader leaves the region disabled has nothing to publish. Drop the fixed address and the chip-id compare and publish only from the region. Without a usable region g17p_gfx_link_to_physical() returns None, so no diagnostic reads memory: g17p_diag_knobs reports each firmware word as "none (no G17P fw-data region)" and g17p_fw_peek prints "error: no G17P fw-data region". Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Addressed in 449130b. The fixed address and the chip-id compare are gone. The base is published only from the Rows on the J700 at this head: the production Stage 2 predates aura#204 and leaves Still open: a J700 boot on a Stage 2 that carries aura#204, to exercise the filled region, and an M1 Pro re-run at this head. Both are queued. |
|
Merge-train adversarial review (MERGETRAIN-LINUX2) at 449130b: NO BLOCKERS. Code read only, nothing built here. Before the merge it still needs Dj's verdict at this head; the missing rows are listed below. Full review#2659 drm/asahi: g17p: take the firmware DATA base from the bound GPU @449130bfVERDICT: NO BLOCKERS Code checks
Nits
Missing rows
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review at 449130bf67c8ec49505f0703c398908ef65c8cd4: 0 code/policy/attribution blockers (CI host-tests: pass; mergeable/clean). Holding only for missing §5 hardware verification rows.
Checklist audit (§1–§6)
- §1 No model gating: Pass.
449130bfremoves the T8140 chip-id compare and fixed physical base; the base is read solely from the DTfw-datareserved-memory region (g17p.rs:35-48). TheGpuVariant::Pguard indriver.rs:606is the narrowest hardware property matching the G17P firmware DATA LINK layout (G17P_GFX_LINK_DATA_BASE..END). - §2 Production-ready: Pass. Works on the default kernel command line with no new knobs, delays, or lab-only paths.
- §3 Safety: Pass.
g17p_fw_data_start()rejectsstart == 0, non-page-aligned starts (UAT_PGMSK), and regions smaller than0x134000;g17p_gfx_link_to_physical()range-checks the link and returnsNonewhen unpublished; unpublishing runs in bothunbind()andAsahiPlatformDriverData::drop(). - §4 Clean-room & attribution: Pass. Both commits (
3a9590ad,449130bf) carry human-only author/committer metadata andSigned-off-by: Ryan Murray <ryan@aurorasilicon.org>with no agent trailers; PR body ends withAssisted-by: LLM (Claude:Opus 5.5). Clean-room diff. - §6 Naming: Pass.
Non-blocking nits
drivers/gpu/drm/asahi/g18/compat/e2e.rs:223-231: whenokisfalse(no G17Pfw-dataregion),map_power_sources()still runsioremap(GPC_STATE_PHYS, 4)before returningfalse. Pre-existing and never dereferenced becausee2e_setfails the arm, but returning early (if !ok { return false; }) avoids mapping0x4_80e0_1000on non-G17P Macs.- Consider squashing
3a9590ad+449130bfsogit bisectdoes not land on the removed T8140 fallback.
Remaining §5 HW rows required before merge
- J700 / MacBook Neo (G17P) at
449130bfon a Stage 2 carryingaura#204(gpu-fw-datapopulated and enabled — the positive publish path at this head has not yet run on hardware):g17p_diag_knobslive words (powerups/state/idleoff/keepon),g17p_fw_peekdump,dEQP-VKsmoke, and regression counts (0 SELinux denials, 0 failed systemd units, 0 new kernel errors). - Non-G17P Mac at
449130bf— M2 (G14, the #2627 oops reproducer) and/or M1 Pro (G13X, previously run only at3a9590adwithout regression counts): confirmg17p_diag_knobsandg17p_fw_peekreportnone/errorwith 0 oops, 0 SELinux denials, 0 failed units, and 0 new kernel errors. - Non-P G17 Mac (e.g. J616s / G17S) at
449130bf: confirm theGpuVariant::Pgate leaves diagnostics reportingnonewith clean regression counts.
Assisted-by: LLM (Gemini 4 Neon)
|
On row 3: the J616s is an M4 Pro, which is G17P like the Neo ( Assisted-by: LLM (Claude:Opus 5.5) |
|
J700 (A18 Pro) row with the fw-data region filled in, at 449130b: PASS. Our Neo's production Stage 2 (b12.1) predates aura#204, so this row booted aura main 6affb8ec (which has aura#204) as a one-shot aura-try Stage 2, on the normal path. The kernel is fleet79 with two aurora.ko builds: A = fleet79 as is, C = fleet79 + this PR. The loaded build-id was checked on each boot.
With this PR the DATA base comes from the bound GPU's fw-data region, and it reads the same live firmware words as the old fixed address. powerups is a counter, so it differs from boot to boot. Together with the earlier row on today's Stage 2 (no region: How it was run
Assisted-by: LLM (Claude:Opus 5.5) |
|
The J700 rows now cover both paths, with no fw-data region and with the region filled by aura#204. Still needed: an M2 (J413) or M1 Pro (J316s) row at 449130b showing the diagnostics report none with 0 oops and clean regression counts, and a non-P G17 row from an M4 Max (T6041) or M5 Mac. |
|
J616C (Apple MacBook Pro 16", M4 Max, 32-core T6041, non-P G17C,
Assisted-by: LLM (Google:Gemini 4 Neon) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal adversarial §1–§6 pre-PR re-review at live head 449130bf67c8ec49505f0703c398908ef65c8cd4 (checked against live integration/aurora 70a00e583b03: not superseded).
§1–§6 Checklist Audit
- Correctness / locking / memory / lifetime / DT / ABI: Clean.
g17p_fw_data_start()(g17p.rs:35-48) reads thefw-datareserved-memory region and rejectsstart == 0(disabled placeholder), non-page-aligned starts (UAT_PGMSK), and regions shorter than0x134000(G17P_GFX_LINK_DATA_END - G17P_GFX_LINK_DATA_BASE).g17p_publish_gfx_data()/g17p_unpublish_gfx_data()useRelease/Acquireatomics and are symmetrically paired acrossprobe_g17()(GpuVariant::P),unbind(), andAsahiPlatformDriverData::drop().- Verified against all
drivers/gpu/drm/asahi/hw/*.rsconfigs onintegration/aurora:GpuVariant::Pmatchest8140alone (t6040isS,t6041isC,t6050isS/C/D,t8142/t8152areG). - Every caller of
g17p_gfx_link_to_physical()(e2e.rs,g17p.rs,timing_buffer.rs) handlesNonewithout touching firmware memory and bounds-checks the LINK range.
- §1 No model gating: Pass — commit
449130bfremoved thet8140chip-id compare and fixed physical base; base is read solely from DTfw-data, withGpuVariant::Pas the narrowest hardware property matching the G17P firmware DATA LINK layout. - §2 Production-ready: Pass — works on the default kernel command line with no new knobs, sleeps, or lab-only paths.
- §3 Safety: Pass — closes active non-G17P kernel oops (
#2627) and refuses unaligned/short/absent regions cleanly. - §4 Clean-room & attribution: Pass — both commits (
3a9590adfbee,449130bf67c8) carry human author/committer and humanSigned-off-by:only (zero AI trailers); PR body carriesAssisted-by:. - §5 Evidence: Pass — every modified code path is now verified at exact live head
449130bf67c8with full regression gates:- J700 / MacBook Neo (T8140,
GpuVariant::P) — positive path (aura#204gpu-fw-datapopulated): exact head449130bf, liveg17p_diag_knobsandg17p_fw_peekreadings match baseline,dEQP-VK api.smoke8/8, 0 oops / 0 AVC / 0 failed units / 0 kernel errors. - J700 / MacBook Neo (T8140,
GpuVariant::P) — unpublished path (disabledgpu-fw-data): exact head449130bf, all 4 wordsnone (no G17P fw-data region), peekerror, 0 oops, GPU rows match base. - J616C / M4 Max (T6041, non-P
GpuVariant::C) — non-P gate with livegpu-fw-datanode: exact head449130bf67c8(CONFIG_DRM_ASAHI_G18=y, default cmdline),g17p_diag_knobs3× reads + write/readbacknone,g17p_fw_peekerror/-EINVAL,g17p_e2earm 4-ENOMEM,dEQP-VK8/8 + 624-case subset +glmark2OK, 0 oops / 0 errors / 0 failed units / 0 AVC. - M1 Pro (G13X, legacy non-G17): verified at
3a9590ad(4nonewords, peek error, 0 oops; commit449130bfonly touchedGpuVariant::Pand the status string). - Host tests & lint:
run-host-tests.py --only g1790/90,checkpatch.pl --strict0/0/0.
- J700 / MacBook Neo (T8140,
- §6 Naming & live CI: Pass (
host-tests:success;MERGEABLE/CLEAN).
(Non-blocking follow-up nit: in e2e.rs:221-229, returning false early when !ok would avoid running the pre-existing ioremap(GPC_STATE_PHYS, 4) on non-G17P Macs when g17p_e2e refuses arm 4.)
Ready for MERGETRAIN-LINUX4.
Assisted-by: LLM (Gemini 4 Neon)
Problem.
g17p_diag_knobsandg17p_fw_peekare module parameters, so they exist on every Mac that loads aurora.ko. Reading them translates G17P firmware DATA addresses with a hard-coded physical base, the J700's GFX data segment, and maps that page whatever GPU is bound. On a non-G17P Mac the read oopses indiag_get(#2627). On another G17P SoC it would read unrelated memory.Change. The bound G17P GPU publishes the base at probe and withdraws it at unbind. The base comes only from the GPU's
fw-datareserved-memory region, and only if that region holds the whole 0x134000-byte GFX DATA segment. t8140.dtsi declares/reserved-memory/gpu-fw-dataand the loader fills it from the ADTgfx-data/gfx1-datasegments (aura#204). There is no fixed-address fallback and no chip check; the second commit removes the J700 fallback the first commit had.g17p_gfx_link_to_physical()now returnsOptionand isNonewhen nothing is published or the address is outside the DATA segment. In that case no caller touches memory:g17p_diag_knobsstill prints the knob value, then<word> none (no G17P fw-data region)for each firmware word;g17p_fw_peekprintserror: no G17P fw-data region;Testing.
gpu-fw-datadisabled. All four words readnone (no G17P fw-data region), the peek printserror: no G17P fw-data region, there are 0 oops/BUG lines, and the GPU rows (gpubench, multi-pass, IRQ rate) match the base module.g17p_diag_knobsreads,g17p_fw_peekdumped the DATA rows, knob round trip OK, 0 oops, dEQP-VK api.smoke 8/8.nonewords and the peek error, 0 oops, and the GPU initialised normally.checkpatch.pl --strict0/0/0, no new compiler warnings,tools/asahi/run-host-tests.py --only g1790/90.Still to run. The J700 on a Stage 2 that carries aura#204, so that the region is filled and the diagnostics publish from it. An M1 Pro re-run at 449130b.
Notes for review
GpuVariant::Ppublishes. In this tree that's T8140 alone; T6040 is S and T6041 is C. An M4 Pro therefore never gets J700-laid-out addresses.g17p_fw_data_start()rejects the disabled placeholder (reg = <0 0 0 0>gives start 0), an unaligned start and a short region.Fixes:names b2e300a, which added the constant,diag_get's firmware reads andpeek_get.Assisted-by: LLM (Claude:Opus 5.5)