Repository navigation
drm/asahi: validate legacy firmware compatibility before starting the ASC - #3940
RyanTheTide wants to merge 3 commits into
Conversation
… ASC In AsahiPlatformDriver::probe(), the legacy path currently calls Resources::new(), init_mmio(), and Resources::start_cpu() before checking whether (gpu_gen, gpu_variant, apple,firmware-compat) has a matching legacy GpuManager backend. When a bootloader enables a legacy GPU node with an unsupported firmware compat version (such as T6020/T6021/T6022 advertising [27, 2, 0] before a matching 27.2 backend exists), probe sets the GFX ASC RUN bit on the preloaded firmware and then returns -ENODEV, leaving the coprocessor running with no driver. Extract LegacyGpuManagerKind and select_legacy_gpu_manager() and validate the combination before touching DMA masks, MMIO, or starting the ASC CPU. Add host tests covering manager selection, rejection of unsupported combinations, and probe call ordering. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 7f894f6 (code clean; waiting on CI + exact-head hardware row)
Blockers:
- Wait for the queued Actions CI checks (
apple-build,host-tests,KUnit plan,readiness) to complete green at7f894f60118d. - Post the exact-head hardware regression row (currently listed as queued under Not yet; a clean G13/G14 regression boot or paired J414s T6020 probe row confirming
-ENODEVbeforestart_cpu()).
Checked:
- Audited the full diff at
7f894f60118d(drivers/gpu/drm/asahi/driver.rs,tools/asahi/legacy-probe-compat-tests.py,tools/asahi/run-host-tests.py): no code blockers found. select_legacy_gpu_manager()preserves the exact 5 supported legacy(gpu_gen, gpu_variant, compat)combinations and runs immediately after thehas_g14_handoff && compat == [27, 2, 0]branch, returning-ENODEVbeforedma_set_mask_and_coherent(),Resources::new(),init_mmio(), andregs::Resources::start_cpu().- Post-
start_cpu()dispatch matches exhaustively overLegacyGpuManagerKind, preventing drift between the pre-check and instantiation tables. tools/asahi/legacy-probe-compat-tests.pyverifies both probe ordering and compat rejection (including[27, 2, 0]across G13/G14 variants) with two killed mutations registered inrun-host-tests.py.
|
Exact-head hardware rows posted at
|
|
Draft sweep 12-05: merged main @ f02bd68 (bafda83, clean) and out of draft. The 12-02 review's two blockers were CI and the exact-head rows; the J316s and J413 rows at 7f894f6 are posted above (rc=0, restored). main's changes to driver.rs since the base are next to, not in, this change: T6020 moved to |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
What: Validate
(gpu_gen, gpu_variant, apple,firmware-compat)viaselect_legacy_gpu_manager()before touching DMA masks, MMIO, or callingResources::start_cpu()inAsahiPlatformDriver::probe(). Fixes the Linux-side safety blocker noted on aurora-silicon/aura#649 where aProbeConfig::LegacyGPU (such as T6020/T6021/T6022 with[27, 2, 0]) had its GFX ASC CPU started before probe returned-ENODEV.Tested: Two Macs at exact head
7f894f60118d(7.3.0-aurora-m2fam3940, default cmdline, restored cleanly):apple,agx-t6000,ProbeConfig::Legacy,[13, 5, 0],boot_id=76dd0f45-110c-4fab-9019-df1960b63fd7):auroraprobesG13S(16 active cores, RTKit v12,/dev/dri/renderD128), 1x 12s RTCs2idlePASS (0->1), 0 oops, 0 AVCs, 0 DART/GPU faults,Enforcing.apple,agx-t8112,ProbeConfig::LegacyWithG14Handoff,[27, 2, 0],boot_id=1cc6f69c-8018-425b-b758-cf82005827bf):/dev/dri/renderD128up on 27.2 handoff, 1x 12s RTCs2idlePASS (0->1), 0 oops, 0 DART/GPU faults,Enforcing.Host testsCI PASS (legacy-probe-compat-tests3/3 incl. 2 mutations killed).Risk: two-way · M1 / M2 family (
ProbeConfig::LegacyandProbeConfig::LegacyWithG14Handoff: T8103, T8112, T6000/1/2, T6020/1/2); a plain revert restores the previous probe order.Not yet: Live J414s T6020 27.2 boot paired with
aura#649(no T6020 in our lab; covered bylegacy-probe-compat-testsassertingselect_legacy_gpu_manager(G14, S, &[27, 2, 0]) == NonebeforeResources::new/init_mmio/start_cpu).Row: 7f894f6 + J316s (M1 Pro, ProbeConfig::Legacy) + J413 (M2 Air 27.2, ProbeConfig::LegacyWithG14Handoff) + PASS
Details
In
drivers/gpu/drm/asahi/driver.rs,AsahiPlatformDriver::probe()previously calleddma_set_mask_and_coherent(),Resources::new(),resources.init_mmio(),Resources::start_cpu(), and DRM/binding setup before checking whether(cfg.gpu_gen, cfg.gpu_variant, compat.as_slice())matched a supported legacyGpuManagervariant.When Aura enables a
ProbeConfig::LegacyGPU node with an unsupportedapple,firmware-compattuple (for example T6020 advertising[27, 2, 0]before a G14S 27.2 kernel backend lands), probe set the GFX ASC RUN bit on the preloaded firmware and then exited with-ENODEV, leaving the coprocessor running without a driver.This change extracts
LegacyGpuManagerKindandselect_legacy_gpu_manager()and runs the check right after thehas_g14_handoff && [27, 2, 0]branch, returning-ENODEVwith the existing"Unsupported GPU/firmware combination"message before any hardware setup. The laterGpuManager*::new()dispatch matches exhaustively onLegacyGpuManagerKind, keeping the selector and constructor arms in lockstep.Evidence
7f894f60118d291c7f4535707a731e8e9b1763d1pr-textSUCCESS,pr-readinessSUCCESS,Host testsSUCCESS (legacy-probe-compat-tests3/3 incl. mutationsstart-cpu-before-selectandaccept-g14x-27-2killed with Rust exit 101)scripts/checkpatch.pl --no-signoff: 0 errors, 0 warningsapple,j316s,apple,t6000,apple,agx-t6000ProbeConfig::Legacy,[13, 5, 0], Stage 21.0.0b18):7.3.0-aurora-m2fam3940(boot_id=76dd0f45-110c-4fab-9019-df1960b63fd7, default cmdline, slim test config)aurora 406400000.gpu: Probing...->MMU: initialized->Type: G13S(Active cores: 16) ->RTKit: Initializing (protocol version 12)->[drm] Initialized aurora 1.0.0 for 406400000.gpu on minor 0/dev/dri/renderD128present;s2idleviartc1(12s):rc=0 success=0->1oops=0,avc=0,dart_faults=0,gpu_faults=0,post_oops=0,post_gpu_faults=0,selinux=Enforcing7.3.0-aurora-edge(boot_id=71478a8c-bcc4-4e16-bd48-ef16e640e58a),custom.cfgbyte-identical,next_entryempty,boot_success=1,Enforcing,failed=0apple,j413,apple,t8112,apple,agx-t8112ProbeConfig::LegacyWithG14Handoff,[27, 2, 0], Stage 21.0.0b18-g16648d69):7.3.0-aurora-m2fam3940(boot_id=1cc6f69c-8018-425b-b758-cf82005827bf, default cmdline, slim test config)/dev/dri/renderD128present;s2idleviartc1(12s):rc=0 success=0->1oops=0,dart_faults=0,gpu_faults=0,post_oops=0,post_gpu_faults=0,selinux=Enforcing7.3.0-aurora-fleet94(boot_id=33ca8950-587b-4e71-8d21-f4830f20f1f3),next_entryempty,boot_success=1,Enforcing,failed=0