Skip to content

drm/asahi: m3: T8122 GPU states 6 to 8 under the thermal limit, with the J615 die zone and CPU thermal zones - #2203

Open
freber wants to merge 21 commits into
aurora-silicon:integration/aurorafrom
freber:t8122-pstate-73-on-2147
Open

freber wants to merge 21 commits into
aurora-silicon:integration/aurorafrom
freber:t8122-pstate-73-on-2147

Conversation

@freber

@freber freber commented Nov 18, 2026

Copy link
Copy Markdown

Claude Code prepared this series and wrote this up from my tests on a J615 (15-inch M3 MacBook Air).

Stacked on #2147. Until that merges, this PR also shows its commits. Please review only the eight commits listed below. Without #2147 the T8122 GPU doesn't power up on 7.3, so the series needs it underneath to run on a J615. Once #2147 merges, the branch rebases onto integration/aurora without conflicts.

What it carries

On the 7.2 line these are three omacom/linux-aurora PRs. Eric Juta wrote #410 and #491 and I wrote #500. 7.3 ships from here, so I ported them. Eric's commits keep his authorship and his Signed-off-by.

Commit Author From
hwmon: macsmc: expose complete J615 SoC die temperature set Eric Juta omacom #410
drm/asahi: preserve state-2 fallback for T8122 thermal boost Eric Juta omacom #410
docs: asahi: document guarded T8122 performance ceilings Eric Juta omacom #410
arm64: dts: apple: t8122-j615: Add CPU thermal zones Eric Juta omacom #491
drm/asahi: m3: host tests for the T8122 knobs and the thermal limit's range Fredrik Silfver omacom #500
drm/asahi: m3: keep the thermal check running above the safe cap Fredrik Silfver omacom #500
drm/asahi: m3: accept asahi.t8122_pstate_cap 6 to 8 under the thermal limit Fredrik Silfver omacom #500
drm/asahi: m3: tunable thermal thresholds Fredrik Silfver omacom #500

The series lets the M3 runtime's thermal limit run the T8122 GPU above state 5 (up to 1338 MHz at state 8), steered by the hottest of the 12 SoC die keys.

  • The hwmon commit is smaller on 7.3. The die keys already come from apple,soc-die-keys in t8122.dtsi, so phy: apple: t6040: USB3 on every replug and flip (stop the PHY coprocessor on detach) #410's J615 key table is gone. What stays is its J615 rule that macsmc_soc_die registers only when all 12 keys are present, so a missing GPU key can't leave a CPU-only zone. On 7.3 that is an of_machine_is_compatible("apple,j615") check in macsmc_hwmon_die_register(). Other boards are unchanged. If you'd rather have a device tree property for this, I can change it.
  • The CPU thermal zones go into the J615 tree as in HID: dockchannel: Enable T6050 keyboard reports on open #491 (6 zones, power allocator, control at 95 C, critical at 110 C).
  • The docs now name apple,soc-die-keys instead of the macsmc_hwmon.soc_die_keys parameter that 7.3 removed.
  • My four commits apply as they did on 7.2. The second keeps the after-job thermal check running whenever the ceiling is above the safe cap, so one client that keeps the pipeline full can't stop the cap from coming down. The third accepts t8122_pstate_cap 6 to 8 only with m3_thermal=on. With hold or off the driver lowers it to 5 and says so. The fourth adds m3_thermal_hot (up to 92 C, critical stays 8 C above it) and m3_thermal_cool_gap (3 to 10 C), both writable at runtime.

The defaults don't change (hot 80 C, gap 10 C) and caps above 5 need an explicit boot option.

On 7.3 the module is aurora.ko, so the boot options are aurora.t8122_pstate_cap, aurora.m3_thermal and so on. The commit subjects and the driver's messages say asahi., as the rest of the 7.3 driver does.

Results on a J615

The kernel was integration/aurora 59b02d5ef with #2145 to #2157 (so #2147 underneath), #2090, #1985, this series and one local commit that keeps the DRM driver name "asahi" for my installed Mesa. It booted with aurora.t8122_pstate_cap=8 aurora.m3_thermal=on aurora.m3_thermal_hot=90 aurora.m3_thermal_cool_gap=3, on AC with the lid open.

At boot the macsmc_soc_die zone logged "12 of 12 listed keys present", the six CPU zones came up and the runtime cap rose from 2 to 8 once the first die reading arrived. On a cool die short loads run at state 8. Under a long GPU load the cap settles between 3 and 5.

The thresholds are writable at runtime, so I compared them in the same hour on the same boot. I used gpubench w4 for throughput (10 s runs, mean of 3), pace for latency and w10 at depth 2 for the sustained load.

hot, gap Throughput w4 Sustained w10, first 265 s Pace p50 Hottest die key, mean / max Most common cap
80, 10 (default) 256 fps 99.6 fps 6.9 ms 72.6 / 88.3 C 3
90, 3 312 fps 122.5 fps 5.2 ms 87.2 / 92.5 C 5

The full 600 s load gave 98.1 fps at the defaults in that hour. At 90 and 3 it gave 117.4 fps in an earlier run on the same boot, with a peak of 92.9 C. The 90 and 3 run in the table stopped at 267 s on my test guard (see below), so the table uses the first 265 s of both.

A 300 s combined run at 90 and 3, with all 8 CPU cores busy on top of the GPU load, gave 80.2 fps. The GPU sat at state 2 throughout, because the CPU keys were the hottest. The #491 zones held the P cluster back (cooling state about 15 of 19) and the hottest key averaged 94.5 C with a peak of 97.6 C. My test guard is 100 C for combined runs, since the CPU zones hold about 95 C.

The kernel logged no GPU errors, faults or timeouts in three boots.

All these runs were on schedutil. This kernel didn't have #2199 yet, so every power profile ended up on schedutil. With the performance governor the CPUs stay at full clock during a GPU load, which heats the shared die, so the limit holds the GPU lower. On the 7.2 line at 90 and 3 the 600 s load gave 88 fps on performance against 123 fps on schedutil. Compare settings under the same governor.

At hot 90 the die sits at 88 to 90 C under GPU load. Twice in six GPU sessions a CPU burst of a second or two pushed the hottest key past my test's 95 C guard (100.1 C while I copied a file over SSH, later 96.0 C). The driver drops the GPU to state 2 at 98 C and the CPU zones handle the CPU keys, so I'm keeping 90 for daily use.

Merge danger

Door: two-way

Blast radius: T8122 on the 14.8.3 firmware path. On the GPU side nothing changes until someone sets a cap above 5 with the thermal limit on. The hwmon rule and the CPU zones touch the J615 only. A J613 on the 26.6.2 firmware runs the Extended profile, which doesn't use this cap or limit. With #2147 the J504 gets the same knob range.

Evidence

  • The m3 host tests pass at every commit on this branch. m3-runtime-tests goes from 82 at the base to 124 at the head and m3_thermal_policy from 2 to 28.
  • tools/asahi/run-host-tests.py gives the same 387 of 427 at the head as at the base (40 local failures because fdtget is missing and rustc is 1.85, the same list at both). I ran that on the same series on integration/aurora, before restacking it on drm/asahi: T8122: run the M3 runtime as on 7.2, and admit the J504 #2147.
  • make W=1 apple/t8122-j615.dtb apple/t8122-j613.dtb builds without warnings. The J615 dtb differs from the base only by the thermal-zones node, which matches the J613's.
  • The full kernel (Image, modules, dtbs) builds with the 7.3 package config, LLVM 18 and Rust 1.85 with no new warnings from the series. It booted three times on the J615 as described above.

Not tested

omacom/linux-aurora#317 took the other route and raised the default ceiling. It isn't on 7.3.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TqFXgsntBCgau1RkXP1KRQ

javanoo6 and others added 21 commits November 17, 2026 06:22
The J514S 14.7 boot chain can load a T6030 firmware build whose full TEXT
digest is not in the admission table. Probe refuses it and no GPU render
node is created.

Desktop use with the explicit prefix override reaches firmware READY and
reduces Hyprland CPU use from several cores to single-digit percentages.
Pin the complete measured digest only for J514S, with its segment sizes
and marker, rather than requiring a persistent bring-up override.

Exercise the production firmware table and exact lookup with the override
disabled. Reject other boards, altered digest suffixes, sizes and markers.

Link: omacom/linux-aurora#247
Signed-off-by: Nikita Konkov <95355711+javanoo6@users.noreply.github.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
The J514S cd05 FirmwareBuild row adds 15 lines to the T6030 firmware
table, which changes the pinned hw.rs file and t6030 module digests.
With that row removed both digests are their previous values, so the
T6030 profile itself is unchanged. Refresh the two pins and record why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Some 16-inch M3 Pro (J516S) units on the 14.7 boot chain load a B0 GPU
firmware image whose TEXT digest differs from the pinned J516S row:
TEXT 0x5c000, DATA 0x114000, GKTS marker 0x58e88 and TEXT sha256
cd05af6a828b52e4c2fed20086d3d18a7db42e03a8fd6f8354f9f06e0a61363e. The
build is refused with "loaded GFX TEXT identity mismatch", so there is
no render node and the compositor falls back to llvmpipe. The GPU only
starts with the g15_accept_text_prefix bring-up override.

Add this build as a J516S-only row. Rows still pin on the machine they
name; nothing changes on the J514S or on other machines. Extend the
maintained-handoff host test to check the new row and refresh the
zero-words golden pins for hw.rs and the T6030 module, which change by
exactly this one row.

Measured on a J516S (apple,j516s apple,t6030; os-fw 14.7, system-fw
15.5, iBoot2 iBoot-10151.140.19.700.2) with linux-aurora
7.2.11.aurora14-1 and the override: the admission line reports the
identical sizes, marker and digest, and the GPU reaches READY with
renderD128 present.

Link: omacom/linux-aurora#247
Link: omacom/omarchy#17739
Signed-off-by: joel cristobal <joelcristobal97@gmail.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
Some 14-inch (J514S) and 16-inch (J516S) M3 Pro units on the 14.7 boot
chain load a third B0 GPU firmware image: TEXT 0x5c000, DATA 0x114000,
GKTS marker 0x58e88 and TEXT sha256
411833a7ded773feeac4a181552e3ff5582eaf4435f2dd8f620c1ed0b31df1b0. No
row pins it, so probe fails with "loaded GFX TEXT identity mismatch",
there is no render node and the compositor falls back to llvmpipe.

Three machines have reported it in issue omacom/linux-aurora#247, all on the 14.7 stub with
system firmware 26.6.2: a J514S and a J516S (both iBoot-10151.140.19.700.2,
mBoot-18000.161.10), which logged the identical sizes, marker and digest,
and a second 14-inch M3 Pro. With g15_accept_text_prefix=0x411833a7ded773fe
all three reached firmware READY with renderD128 present. The boot
chain matches the J514S cd05 reports, so the chain alone does not
select the image.

Add one row per board, J514S then J516S, so each pin still names the
machine it was measured on; nothing changes for other machines. Extend
the maintained-handoff host test: both boards pin to their own row with
the override disabled, other boards are refused, and an altered digest
suffix, TEXT or DATA size or marker is refused. Refresh the zero-words
golden pins for hw.rs and the T6030 module; with the two rows removed
both are their previous values.

Link: omacom/linux-aurora#247
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Scott Jones <scottajones@gmail.com>
Before the module's final activate() step, the G15 probe returned
-EPROBE_DEFER. That put the GPU on the driver core's deferred-probe list.
activate() then runs the real probe through driver_attach(), but if that
probe fails for good, for example because the firmware is rejected, the
driver core does not take the device off the list. It stays in
/sys/kernel/debug/devices_deferred until the deferred-probe work next
runs, so anything that waits on that list keeps waiting.

Return -ENODEV instead. activate() already reprobes every unbound device
once MODULE_READY is set, and a device added later sees it set, so
nothing needs the deferred list to retry. The display and PMP waits
inside the real probe still return -EPROBE_DEFER.

g15-probe-init-tests.py now checks that every probe before activation
returns -ENODEV, and adds a mutant that defers again.

Assisted-by: Claude:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>

(cherry picked from commit 6447458068e3 on omacom/linux-aurora, omacom/linux-aurora#470)
[7.3 base: the probe-init test also runs with the G16 registration here, so
 its pre-activation probe count follows the registration order; the new
 mutant is added to this base's expected-failure table.]
…e M3 runtime

The 7.2 rebase replaced the T8122 14.x branch of
apple_pmp_report_wait_supplier_ready() with a T6030-only one, so on an M3
MacBook Air every GPU power vote returns -ENODEV even with the PMP
running. With the new hidden APPLE_T8122_GPU_PMP_LINK, which
DRM_ASAHI_M3_T8122 selects (as DRM_ASAHI_G15 selects
APPLE_T6030_GPU_PMP_LINK), wait for the unique T8122 report's display
request (DISP, reg 7) to be ready and acknowledged before AGX, as on the
7.1.12 kernel the runtime was qualified with.

The PMP graph and supplier host tests copy the dispatch, so they copy the
T8122 wait too, built off there; their mutations still target the T6030
path.

Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
The supplier suite built apple_pmp_report_wait_t8122_14() only with
APPLE_T8122_GPU_PMP_LINK off, so every case returned at its first
check. Build it also as the M3 runtime does (T6030 and T8122 links on)
and run the T8122 graph: the unique, available report linked to this
PMP, with DISP (reg 7) acked, and its failures (machine, supplier and
report compatibles, a duplicate or disabled report, the apple,pmp shape
and identity, a missing, duplicate, disabled, incompatible or no-ack
DISP entry, the managed start and its readiness). With the link off, a
well-formed T8122 graph is refused.

Mutants cover the wait's config scope, compatibles, report checks,
readiness result and entry reference, and the dispatch's machine
scope in both directions.

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>
The 14" M3 MacBook Pro (J504) runs the same T8122 DCP image as the M3
MacBook Airs (90F849E1-..., named by the J504 ADT), so the 14.x IOMFB
path can drive its panel once the boot loader hands the display over.
Its panel is the J514S mini-LED panel: 3024x1964 with 74 notch rows,
at 60 or 120 Hz.

Add a J504 record with that geometry, ProMotion allowed, bring-up
logging on, and this image's colour matrix methods. The panel level
block is not qualified on this board, so brightness stays closed, and
its swaps keep zero timestamps as on the Airs. Other T8122 Macs (the
J433 and J434 iMacs) still have no record.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Scott Jones <scottajones@gmail.com>
The J504 (14" M3 MacBook Pro) loads the same 14.8.3 G15G firmware image
as the M3 MacBook Airs (UUID DF697F05-..., TEXT 0x64000, from its ADT).
Move the T8122 board list into t8122_admission as T8122_BOARDS, add the
J504, and test the exact list on the host. Firmware identity, resource
admission, the performance-state cap and the thermal limit are
unchanged; the J504 starts at the same conservative cap (state 2) as
the Airs. The J433 and J434 iMacs stay unlisted.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Scott Jones <scottajones@gmail.com>
Give the J504 DCP its panel node (the J514S 14" mini-LED panel: 302 x
196 mm, 189 mm below the notch, 500 nits) and point the boot
framebuffer at it, as on the J613, so simpledrm and the DCP driver use
the same physical size.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Scott Jones <scottajones@gmail.com>
The J504 runs the J613's DCP image, whose panel level block (brightness
in nits) is qualified on the J613. Mark the J504 record panel_nits and
admit the J504 machine for it, with the KUnit and host tests.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Scott Jones <scottajones@gmail.com>
On 7.3 the M3 MacBook Air runtime adopts the firmware's UAT through
Uat::new_adopted_with_user_upper(), which always asks for a
write-combined mapping of the handoff and TTBAT regions. On these Macs
the boot loader leaves both regions in the kernel's memory map as
reserved RAM, and memremap() refuses a write-combined mapping of RAM:

  memremap attempted on ram 0x00000103fff70000 size: 0x4000
  aurora 292400000.gpu: probe with driver aurora failed with error -12

On 7.2 the same helper chose the mapping per region: write-back for
reserved RAM, write-combined for a carveout. Uat::new_adopted() still
does that on 7.3.

Add Uat::new_adopted_ram_with_user_upper(), which makes the same
per-region choice and keeps the caller's choice of user upper half, and
use it for the M3 runtime. The M4 caller keeps the write-combined
constructor; no other backend calls either.

Seen on a J613 with a 7.3 kernel on the m1n1 1.6.1.aurora23 handoff.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Scott Jones <scottajones@gmail.com>
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>

(ported from commit 9dff537 on omacom/linux-aurora)
[7.3 base: G15 keeps this base's "default y" and selects the new option. The
 base builds what the runtime shares with G15 under "G15 or G16" and keeps
 the point-of-coherency cleaning unconditional, so the mmu and pgtable gates
 become "UAT_ADOPTION or G16" and gain no new #[cfg] on clean_poc. The
 module is aurora.ko here. g15-zero-words-tests pins hw.rs after the test's
 own normalisation. Built with G15 and T8122 (same warnings as before) and
 with T8122 alone: that builds, and none of its dead-code warnings is in
 g15/, m3/, mmu.rs or pgtable.rs. Not run on hardware.]
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
[Fredrik Silfver: 7.3 already lists the twelve T8122 die keys in
 t8122.dtsi for every board, so the J615 board entry is dropped. Only
 the check that all twelve are present remains, keyed on the J615
 compatible. The hwmon documentation notes the J615 exception.]
Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>

Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
[Fredrik Silfver: 7.3 has no macsmc_hwmon.soc_die_keys parameter, so
 the warning now names the apple,soc-die-keys list in t8122.dtsi.]
Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
Nothing limits the J615's CPU temperature: with all eight cores busy the
die sensors pass 105 C in 150 s, still rising, and a -j8 kernel build
holds 110-114.6 C for 22 minutes. The J613 got CPU thermal zones for the
same reason; the J615 has the same die, the same six CPU die sensors in
t8122.dtsi and no fan either, but no zones.

Add the J613's zones unchanged: one zone per CPU die sensor, each
throttling both clusters through the power allocator, switch-on 58 C,
control 95 C, critical 110 C, E cluster weighted three to one and capped
at cooling state 3. The compiled thermal-zones node is identical to the
J613's.

sustainable-power stays at the J613's 6 W after load tests on a J615
with these zones applied as a boot-time DT overlay: eight busy cores for
170 s peak at 87.7 C with the P cores at 3.1-3.6 GHz, and a 20 minute
-j8 kernel build holds a level 91-92 C with the P cores at 2.9 GHz (peak
97.2 C, 6 of 545 samples at or above 95 C). 8 W peaks at 96.3 C under
the eight-core load with no gain in P-core frequency.

Not tested: CPU and GPU load together, and the critical trip.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Eric Juta <ericjohnjuta@gmail.com>
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
… range

Two gaps in the host tests that the rest of this series leans on.

The nine unit tests in m3/t8122_knobs.rs have never run. No file in
tools/asahi includes the module. It does not compile on its own either,
because it takes its default InitData version from m3_firmware, which
needs the kernel crate. pstate_cap_accepts_one_to_five_only, the test
that pins the range of asahi.t8122_pstate_cap, is one of them. Include
the module in tools/asahi/m3-runtime-tests.rs, the suite the kernel CI
already runs, with a stand-in for that one constant. The stand-in's
value is checked by defaults_are_the_plan_baseline, so it cannot drift
from m3_firmware without a failing test.

Policy in m3_thermal_policy.rs moves the runtime cap between the safe
cap and the ceiling. The cap_tests from aurora-silicon#410 drive it with a ceiling of
5 over a safe cap of 2. Nothing covers ceilings 6 to 8, or the check
that finds a firmware ignoring the cap. Add tests for the rules as
they are, for ceilings 6 to 8 above a safe cap of 5 and for ceilings 1
to 5:

- the cap starts at the safe cap and rises one state per 2 s on cool
  readings, never above the ceiling;
- between cool and hot it holds;
- hot lowers one state per fresh reading, at most every 500 ms, never
  below the safe cap;
- critical, no reading, a failed, stale, implausible (including the
  -2.849 C an unpowered SMC GPU key reads) or stuck reading returns to
  the safe cap at once, with the previous cap tolerated for 1 s;
- after a fallback the cap climbs again at the same pace;
- hold never leaves the safe cap;
- a ceiling equal to the safe cap never moves;
- a firmware that stays above a lowered cap is found after 20 checks
  spanning at least 3 s.

Three mutations of Policy (critical keeps the cap, the 3 s span dropped,
the raise not bounded by the ceiling) each fail one to three of the new
tests.

No driver code changes.

Link: omacom/linux-aurora#317
Link: omacom/linux-aurora#410
Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqFXgsntBCgau1RkXP1KRQ
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
The thermal limit moves the runtime cap only inside
Config::check_pstate. That runs after a job only in two conditions,
which a ceiling above the safe cap makes matter.

First, the job thread runs the check only when asahi.m3_retire_mmio has
bit 2 (the performance-state register read). The parameter is
root-writable at runtime, so writing 0 to 3 stops both the thermal limit
and the check that the firmware stays within the runtime cap. Once the
ceiling is above the safe cap, the runtime cap is the only thing that
keeps the firmware below the ceiling. A frozen governor would leave it
at whatever state it last allowed. Add Policy::above_safe()
(host-testable), Governor::enforces() (the limit is on or holding and
the ceiling is above the safe cap) and Config::pstate_check_required().
Run the after-job check when bit 2 is set or the check is required. Bit
2 is the T8122 default, so this forces only what runs by default. The
first retirement of a module load at which the check runs although bit 2
is clear logs one line, so a write that leaves bit 2 out is not silently
overridden.

Second, the check runs only at a retirement with no later batch in
flight. The T8122 default pipeline depth is 2. A render batch of the
same VM is published behind the running one while its passes fit the
4000 us budget. So one client that keeps submitting short passes, with
no other client rendering (a still or blanked screen, offscreen work),
can keep the check from running at all, at 90 C too. While the ceiling
is above the safe cap, pipeline_slot() now refuses a slot behind batches
in flight once the last check is 500 ms or more old
(Policy::overlap_allowed, CHECK_EVERY_NS), so the pipeline drains and
the existing checked retirement runs. The sensor is read every 500 ms
while busy, so more frequent checks would see no newer reading. The
longest time between checks is then 500 ms plus the run time of the
batches in flight. Every firmware-visible action stays where it runs
today, after the last batch has retired and the pipes are idle. The
other way, moving the cap on a pipelined retirement, would be a Globals
store with a later batch running on the GPU, which has never been done
on this firmware.

With aurora-silicon#410 the T8122 safe cap is 2, so both already apply to boots that
set asahi.t8122_pstate_cap to 3 to 5 with the thermal limit on or
holding. Those boots now drain the pipeline once per 500 ms under
sustained pipelined load. With the ceiling at the safe cap nothing
changes, since overlap_allowed() returns true before reading the clock.

New tests in m3_thermal_policy.rs simulate a client that keeps the
pipeline full (depth 1 to 4, batches of 0.1 to 50 ms). Without the bound
it is checked once, at boot, so 90 C leaves the cap at 8. With it the
longest gap between checks is within 500 ms plus the batches in flight,
the cap falls from 8 to the safe cap within that time of a critical
reading, a firmware that ignores the cap in hold mode is found. With the
ceiling at the safe cap, the publication order is identical to today's.
Three mutations of the bound each fail two to four of them.

Link: omacom/linux-aurora#317
Link: omacom/linux-aurora#410
Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqFXgsntBCgau1RkXP1KRQ
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
… limit

asahi.t8122_pstate_cap refuses anything above 5 (PSTATE_CAP_MAX in
t8122_knobs.rs). The stated reason is that J613 and J615 had no SoC die
temperature zone, so there was no temperature feedback above the
driver's no-feedback limit. Both boards have one now (macsmc_soc_die).
The rest of the path already exists. The firmware always gets the whole
eight-state table. With the thermal limit on, PstatePolicy::new already
makes the cap the ceiling, so only the knob range keeps the governor
below 6.

Accept 6 to 8, as the thermal limit's ceiling only. With aurora-silicon#410 below
this, the runtime cap of every T8122 boot starts at state 2 and falls
back to it, whatever the ceiling.

- asahi.m3_thermal=on (the default). The ceiling is the cap. The runtime
  cap starts at 2 and rises one state per 2 s only on usable, cool
  readings of the SoC die zone. No zone, or a failed, stale,
  implausible, stuck or critical reading, puts it back to 2 at once.
  These are the governor's existing rules.
- asahi.m3_thermal=hold. 6 to 8 are lowered to 5, with one boot line.
  The firmware gets 5 and the runtime cap stays at 2.
- asahi.m3_thermal=off. 6 to 8 are lowered to 5, with one boot line.
  aurora-silicon#410's fixed cap without the limit then gives the firmware 2. These
  values were refused before in every mode (ENODEV, no GPU for that
  boot). A cap left on the command line from a ranging boot while the
  thermal limit is switched off should not cost the GPU.

Values of 0, 9 and up are refused as before.

Whether the zone is usable can only be decided at runtime. On a J615 the
GPU firmware starts about 1.6 s into boot from the initramfs. The
macsmc_soc_die zone appears at about 7.6 s, when macsmc_hwmon registers
it. A probe-time zone check would refuse every boot, so the zone
condition is the governor's existing rule that only a usable reading
raises the runtime cap. The line the governor logs for a usable reading
now ends in "the runtime cap may rise above 2 up to N (MHz)" while the
ceiling is above the safe cap, so the boot log shows when the higher
states became possible. It is one line per change of the reading's
source, as before.

pstate_cap_use() in t8122_knobs.rs states the rules above in plain code
that the host tests drive. PstatePolicy::new gets the lowered ceiling
from admitted_cap(). Contents::select refuses the start if what
PstatePolicy::new computed is ever more than pstate_cap_use() allows, so
the two cannot drift apart silently. A host test checks that they are
equal for every cap and mode. Const assertions tie the no-feedback limit
(5) and the fallback (2) to the two constants of m3_thermal_policy.rs
that PstatePolicy::new uses. The boot lines name the case (lowered,
ranging or held) and the knob's value, which asahi.m3_max_pstate can
still lower later. When that parameter is given they say so and point to
the "firmware highest state" line, which has the result.
tools/aurora-sep/M3-GPU.md gets a paragraph on caps 6 to 8.

Tested on a J615 (15-inch M3 MacBook Air) with this series and aurora-silicon#410 on
bed544b (the 7.2 line), asahi.t8122_pstate_cap=8 and the thermal limit
at its defaults. On a cool die the runtime cap rose from 2 to 8 within
10 s of boot. Under GPU load the die passed 80 C within about 2 s at
state 8 and the cap fell back to 2 one state per 500 ms. A 600 s GPU
load and a 300 s combined CPU and GPU load ran without asahi errors,
faults or timeouts.

Link: omacom/linux-aurora#317
Link: omacom/linux-aurora#410
Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqFXgsntBCgau1RkXP1KRQ
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
The M3 thermal limit lowers the runtime cap at asahi.m3_thermal_hot
(default 80 C, at most 85 C) and raises it again only 10 C below that.
On a J615 under a sustained GPU load the die then settles between the
two (83 to 84 C with hot at 85). The cap stays at the safe state 2 for
the whole load, since nothing ever reaches the cool point again.

Let both be set further for boards and users that want it. The defaults
do not change.

- asahi.m3_thermal_hot goes up to 92 C. Critical stays 8 C above it, so
  at most 100 C, below the 110 C critical trip of the J613 and J615 CPU
  thermal zones.
- asahi.m3_thermal_cool_gap (default 10 C, 3 to 10 C) sets how far below
  hot the die must be before the cap rises again.
- Both are writable at runtime in /sys/module/asahi/parameters. The
  governor reads them at each update, applies the clamped values from
  the next reading with the usual pacing and logs the new thresholds.

The bounds and the clamping move into m3_thermal_policy so the host
tests cover them. New tests cover the clamping, the default gap, a
narrower gap, a higher hot and thresholds changed at runtime.

Tested on a J615 with asahi.t8122_pstate_cap=8, stepping the two values
at runtime. A 600 s GPU load (gpubench w10, depth 2) ran at 80.0 fps
with the defaults, 85.8 fps with hot 88 and gap 3, 88.1 fps with hot 90
and gap 3 and 95.2 fps with hot 92 and gap 3. A 300 s combined CPU and
GPU load stayed at the safe state 2 at every setting. The CPU thermal
zones kept the hottest die sensor at 92 to 94 C on average, with peaks
of 93.9 to 97.6 C.

Link: omacom/linux-aurora#317
Link: omacom/linux-aurora#410
Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqFXgsntBCgau1RkXP1KRQ
Signed-off-by: Fredrik Silfver <1684291+freber@users.noreply.github.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for porting these and for keeping Eric's authorship.

Two things do not match how we do things here. We select behaviour by a hardware property, not by machine, and we avoid boot options that a machine needs to run as intended.

  1. drivers/hwmon/macsmc-hwmon.c:1425 requires all die keys only when of_machine_is_compatible("apple,j615"). The rule (no CPU-only zone when a GPU key is missing) holds for any board that lists apple,soc-die-keys, so it could apply whenever that property is present, or follow a DT property if some board needs a partial set. As you offered, a DT property is fine too.
  2. GPU states 6-8 are only reachable through aurora.t8122_pstate_cap plus m3_thermal=on, with new m3_thermal_hot and m3_thermal_cool_gap parameters (drivers/gpu/drm/asahi/m3/m3_params.rs:572, :578, :663; m3/t8122_knobs.rs:39-44). If the thermal limit makes 6-8 safe, it should be the default where the die keys are described, with the parameters kept only as overrides.

A CI run on the head is also missing.

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.

6 participants