Repository navigation
drm/asahi: enable T8103 (G13G) on GPU firmware 27.2 and support g14_v27_2 deep sleep warm restart - #3171
Conversation
Extend the g14_v27_2 backend to support T8103 (G13G) on firmware 27.2 (26B131) on the default kernel command line: - Map ASC control and MMU fault-status registers with ioremap_np() to honor Apple SoC nonposted-mmio; a posted write to ASC_CPU_CONTROL resets T8103 immediately. - Add T8103 REGISTERS_V27_2 and WRITABLE_V27_2 register aperture tables (including PMP doorbell slot 2 and PMGR scratch / PMP telemetry slot 5) and route apple,agx-t8103 with apple,firmware-compat = <27 2 0> to probe_g14_v27_2(). - Build the G13G 27.2 HwDataB, globals, power, and calibrated thermal / DVFS controller from the 13.5 configuration and device tree (deriving SRAM voltages from apple,min-sram-microvolt when adt-perf-states-sram is absent, and omitting G14-only CRE and per-sensor coefficient tables). - Encode G13 vertex and fragment JobParameters1 layouts in g14_v27_2_render.rs and allow 3000 ms for the initial idle-policy handshake while G13G runs its first DVFS transition. Signed-off-by: Erik Bourget <[email protected]>
RootV27_2::controller() seeded the power-controller output at +0xa48 to max_state and relocated pwr_min_duty_cycle to +0xa00, but left the power controller's own parameter block (+0x9c8..+0xa14) zero. While the GPU stays powered, +0xa48 keeps its initial max_state value. Once the GPU powers off for at least two 8 ms power-sample periods (such as across deep sleep or an idle power-off), the firmware's power-up replay recomputes +0xa48 from +0xa08, +0xa04, and the controller gains. With +0xa04 and +0xa08 zero, +0xa48 clamps to 0, driving the overall performance target (+0x50) to 0 (reason 1) and forcing the firmware into below-minimum-pstate duty-gating on an 8 ms cadence (~26x slowdown). Populate +0x9c8..+0xa14 from the board's calibrated 13.5 hwdata_a parameters (derived from device tree) and reject a zero pwr_filter_time_constant in RootV27_2::build(). Signed-off-by: Erik Bourget <[email protected]>
Allow the G13/G14 firmware 27.2 backend to participate in firmware-driven deep sleep (S2R) via commit-time coprocessor stop and warm restart: - In driver.rs, pass pm_suspend_via_firmware() into backend.sleep_prepare() instead of unconditionally refusing deep sleep with -EBUSY. - In g14_v27_2.rs, map the Fender operating-point page alongside the ASC control page, drain pending work and worker queues during deep sleep prepare, switch the firmware idle policy to allow-off, and register a commit-time stop callback (apple_sleep_coproc_register_first) that runs apple_rtkit_sleep_idle_polled(), disables mailbox receive, and clears ASC_RUN only after all sleep refusals have passed. - In sleep_complete(), restore keep-powered if the sleep was refused before commit; after a real firmware-driven wake, warm-restart RTKit (apple_rtkit_warm_restart), re-assert ASC_RUN, re-boot RTKit, restore keep-powered, and wait for the Fender operating point to report powered. - In gpu/v27_2.rs, add PoC cache maintenance to drain() and firmware_running(), enable the G13 sleep/wake and RTKit power-callback inline words, remove the stale zeroing of +0x10cc/+0x10d0 that clobbered uat_ttb_base, add compile-time offset assertions before 0xfc0, and populate the warm-restart wake operands (+0x9c..+0xa8). Signed-off-by: Erik Bourget <[email protected]>
Track per-coprocessor platform wake errors on apple_sleep_coproc (reset alongside stop_ret when readied) and export apple_sleep_coproc_wake_error() so coprocessor drivers can check whether their power domain and fabric restored cleanly after a deep-sleep wake before touching MMIO or RTKit. Signed-off-by: Erik Bourget <[email protected]>
…er gating Address deep-sleep concurrency, rollback, and DT calibration invariants: - Track whether all four GPU power-controller tuning properties were explicitly supplied by the machine's DT/ADT (pwr_controller_from_dt) in PwrConfig::load(). Only populate the 27.2 power controller (+0x9c8..+0xa14) and allow deep sleep when those properties are present, avoiding fallback coefficients on boards whose DT omits them. - Synchronize deep_sleeping toggles under Notify::runtime's spinlock so no RTKit notification or retry can race queue.drain(). - Track whether an allow-off idle-policy record was published during sleep_prepare(), confirm keep-powered rollback before reopening submissions (failing the backend if rollback cannot be confirmed), and require Fender to report powered-off with no request pending (0x1f == 0) before arming commit stop. - In g14_v27_2_commit_stop(), return immediately without clearing ASC_RUN if RTKit idle fails. In sleep_complete(), check commit.idle_ret and apple_sleep_coproc_wake_error() before touching ASC or RTKit. - Hold CommitStop alive across apple_sleep_coproc_unregister() in stop(), use typed *mut bindings::device FFI prototypes, and remove redundant PoC cache maintenance on shared telemetry/status cursors in gpu/v27_2.rs. Signed-off-by: Erik Bourget <[email protected]>
Persist hardware_unreachable in State when sleep_complete() sees a refused sleep after commit stop or a commit/wake error, and skip live RTKit and ASC MMIO operations in stop() while still retaining the firmware's page-table backing. Signed-off-by: Erik Bourget <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 3577ce0e4885
Blockers: none
Checked: Full 8-file diff audit across drivers/gpu/drm/asahi/{driver,g14_v27_2,g14_v27_2_render,gpu/v27_2,hw/mod,hw/t8103}.rs and drivers/soc/apple/sleep.c / include/linux/soc/apple/sleep.h (verified G13/G14 register and JobParameters1 separation preserves G14 paths unchanged, non-posted ioremap_np + paired iounmap on ASC/Fender/FaultStatus, deep_sleeping spinlock ordering and worker/queue drain before commit-stop registration, try_set_idle_policy rollback only when published, CommitStop lifetime held across apple_sleep_coproc_unregister, hardware_unreachable teardown guard on failed sleep/wake, and mutex-guarded apple_sleep_coproc_wake_error with reset on set_ready); no Apple material, no model/board gates, human DCO across all 6 commits; exact-head J313 hardware verification row (cold boot, s2idle, pm_test=core, 3 consecutive S2R wakes with live Hyprland and Borealis compute/render); all 26 CI check-runs green with zero active checks.
Evidence
- Head:
3577ce0e4885ca23f43b62087503b078b2fbee64(6 commits, all signed off by Erik Bourget). - Diff audited: 8 files (
+1009/-368),g14_v27_2deep-sleep prepare/rollback/commit-stop/warm-restart andhardware_unreachableteardown invariants verified. - Author hardware evidence at exact head
3577ce0e4885: M1 MacBook Air (J313, G13G B1) cold boot (G13 firmware 27.2 running), pre-sleep Borealis compute (4460/0) & render (200/0),s2idle(4459/0),pm_test=core(4497/0), and 3 consecutive physical S2R cycles (0 -> 1 -> 2 -> 3, warm restart2.8-5.1 ms). - CI: 26/26 check-runs completed and passing (
0active,0failing).
DjDeveloperr
left a comment
There was a problem hiding this comment.
LGTM — audited the full 8-file diff across T8103 (G13G) firmware 27.2 registration/register-table wiring, g14_v27_2_render.rs G13 vs G14 layout split (preserving G14 unchanged), gpu/v27_2.rs optional SRAM table & DT-gated power controller parameters, non-posted MMIO (ioremap_np), IRQ-off CommitStop registration with race-free Notify::set_deep_sleeping queue drain, abort_deep_prepare rollback, hardware_unreachable teardown guard, and apple_sleep_coproc_wake_error() export. All 25 CI jobs are green with 3-cycle J313 S2R + Borealis verification; holding merge for an M2 (T8112/G14G) no-regression check covering the shared g14_v27_2 path.
|
|
What: Enable T8103 (M1 / G13G) GPU acceleration on firmware 27.2 (
g14_v27_2), populate the missing GPU power-controller parameters, and add deep-sleep warm restart and failure-handling hardening for theg14_v27_2backend.Tested: J313 (M1 MacBook Air, exact head
3577ce0e4885merged unchanged with T8103 S2R697fc879d990atc808a9c12341+ companion aura-silicon/aura#529f5ddfff2, live accelerated Hyprland onApple M1 (G13G B1)): cold bootG13 firmware 27.2 running, pre-sleep Borealis compute (4460/0) & render (200/0),s2idle(4459/0),pm_test=core(4497/0), and 3 consecutive physical S2R wakes (0 -> 1 -> 2 -> 3) with GPU warm restart in 2.8-5.1 ms and Borealis compute & render passing on every wake.Risk: two-way door · M1 (T8103 / G13G) and M2 (T8112 / G14G) GPUs using the
g14_v27_2firmware 27.2 backend.Not yet: M2 (T8112 / G14G) runtime verification on
3577ce0e4885(G14gpu/v27_2.rspaths preserved unchanged fromorigin/main).Details
Companion Aura PR: aurora-silicon/aura#529 (publishes the T8103 GPU 27.2 DT handoff).
Commits:
drm/asahi: enable T8103 (G13G) on GPU firmware 27.2(e4a69b150876) — adds T8103/G13G hardware andv27_2initdata/firmware wiring alongside G14G without altering G14G behavior.drm/asahi: g14_v27_2: populate the GPU power controller parameters(baf523ed93a3) — populates the power-controller fields needed for clean T8103/G13G firmware bring-up and runtime stability.drm/asahi: g14_v27_2: support deep sleep warm restart(f03b064ad184) — drains queues, halts the ASC at sleep commit, and warm-restarts GPU firmware 27.2 on physical wake.soc: apple: sleep: export apple_sleep_coproc_wake_error()(3bdddf1caa53) — exports the wake-error query used by theg14_v27_2driver.drm/asahi: g14_v27_2: harden deep-sleep prepare, rollback, and DT power gating(33239c32c0b3) — handles refused sleeps before commit (pm_test=core), restores keep-powered state on rollback, and gates power transitions via DT properties.drm/asahi: g14_v27_2: skip hardware teardown after failed sleep or wake(3577ce0e4885) — avoids touching dead GPU MMIO during teardown if sleep commit or wake fails.Evidence
ewb-m1, M1 MacBook Air) at exact head3577ce0e4885(combined test mergec808a9c12341with T8103 S2R697fc879d990,BIOS aura 1.0.0b17-gf5ddfff2, stockmesa-aurora):aurora 206400000.gpu: G13 firmware 27.2 running; DRM device registered, live accelerated Hyprland PID4646onApple M1 (G13G B1).compute-check 54460 runs / 0 bad;render-check 200200/200 (0 wrong).s2idle: GPU held/released cleanly (running=Ok(1) pending=0); Borealiscompute-check 54459 runs / 0 bad.pm_test=core:GPU: deep sleep refused before commit; restoring keep-powered; Borealiscompute-check 54497 runs / 0 bad.boot object resumes 0 -> 1):GPU firmware 27.2 back in 5071 us (commit idle=0 130 us, pending=0), Borealis 4203/0 + 200/200, Hyprland PID4646unchanged.boot object resumes 1 -> 2):GPU firmware 27.2 back in 4031 us (commit idle=0 140 us, pending=0), Borealis 4167/0 + 200/200, Hyprland PID4646unchanged.boot object resumes 2 -> 3):GPU firmware 27.2 back in 2800 us (commit idle=0 150 us, pending=0), Borealis 4174/0 + 200/200, Hyprland PID4646unchanged.aurora-sep.servicefailed (expected after cold boot before first interactive password unlock, same as daily boot); 0 new GPU/DRM kernel errors.Imageanddrivers/gpu/drm/asahi/aurora.kobuild cleanly at3577ce0e4885againstorigin/main;git diff --checkclean; clean merge withorigin/main(0c1f4530e220).