Skip to content

t8132: enforce the PMP's fast-die effort, as macOS's CLPC does - #2646

Open
DjDeveloperr wants to merge 3 commits into
mainfrom
djdev/m4-mini-fast-die-effort
Open

DjDeveloperr wants to merge 3 commits into
mainfrom
djdev/m4-mini-fast-die-effort

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The T8132 PMP runs a fast die-temperature loop for each CPU cluster and publishes an effort per cluster in its PTD. On T6041, T8140 and T6050 Linux already enforces that effort through apple-soc-cpufreq. On T8132 it does not, so the only limits are the provisional apple-pmp-thermal ones. This series wires T8132 up the same way:

  • pmdomain: apple: pmp-report: expose the T8132 fast-die effort: FAST-DIE-CE is PTD entry 465 (report offset 0x1d10), with two lanes: 0 = EACC, 1 = PACC+ANE. The effort is read as a 64-bit word (fast_die_wide), the only width macOS uses in the boot trace below. The other SoCs keep their 32-bit read.
  • arm64: dts: apple: t8132: enforce the PMP's fast-die effort: apple,fast-die-effort = <&pmp_report 0> on the E cluster and <&pmp_report 1> on the P cluster, plus the lane text in the binding. apple-soc-cpufreq's existing sampled path applies it as a maximum-frequency QoS limit with its existing (255 - effort) / 255 mapping.

This started from "the Mac mini's fan doesn't respond to load on Linux". The fan side needs no change: the fan follows the SMC's own policy on both systems. See below.

Evidence

Apple device tree (J773g, 27.2)

  • The PMP node has fast-die-ctrl-loop records for EACC, PACC and ANE, each with a 110.0 C value, plus fast-die-ctrl-ts-avg-temp 100.0 and fast-die-ctrl-ts 5 ms.
  • Its ptd-range table names FAST-DIE-CE id 0x1f at entry 465, count 2. The same table has the entries pmp-report already uses on T8132: PMP-STATUS 1, SOC-DEV-PS-REQ 392, SOC-DEV-PS-ACK 400.
  • fast-die-ctrl-ce-map puts EACC on lane 0 and PACC with ANE on lane 1.
  • The clpc node's ptd-ranges include FAST-DIE-CE.

Hypervisor trace (macOS 27.2 boot)

  • macOS reads 0x1d10 as one 128-bit access, never 0x1d20, and makes no 32-bit PTD read.

macOS and the fan

  • Native macOS leaves the fan in the SMC's automatic mode (F0Md 0) and keeps it at its 1000 rpm minimum through 150 s of all-core CPU load and 150 s of Metal compute load, because its die stays at about 80 C.

Test on the Mac mini

A test module read the same words as the trace (64-bit, read only: PMP-STATUS, FAST-DIE-CE value and stamp) every 5 ms. In a second run it also applied this series' mapping as cpufreq QoS. Both runs used the same load profile as the macOS reference. No errors, stalls or warnings.

  • The P lane's effort rose only in short bursts: 5-55 ms at a time, when the PMP's sensors peaked at about 110 C (maximum effort 102-247). It was 0 otherwise. The E lane stayed 0.
  • With enforcement, the cluster was capped during those bursts and nowhere else. Sustained temperatures did not change, and that matches macOS: the loop is a peak limiter at the firmware's target.
  • Linux's die sits higher than macOS's under the same CPU load (Tp about 103-108 C against 81 C) because of its heat sources, not this loop:
    • without a GPU driver, the greeter renders on llvmpipe and keeps about 1.7 P cores busy (P-CPU rail about 8.7 W at "idle", against 0.9 W on macOS);
    • a pinned GPU adds more.
  • The SMC's fan policy responds the same way on both systems when it is hot enough: 1000 to 1430 rpm on Linux.
150 s load macOS TCMb / Tp / P rail Linux before (dcp8) Linux, effort enforced (dcp11, GPU pinned)
idle 56 / 58 C / 0.9 W 84 / 90 C / 8.7 W 99 / 108 C / 8.6 W
10 threads 80 / 81 C / 9.1 W 95 / 103 C / 11.9 W 102 / 104 C / 11.3 W
2 threads 73 / 79 C / - 101 / 107 C / 12.3 W 99 / 105 C / 11.6 W

Status

  • Host tests (pmp): 21/22 pass. The one failure, pmp-floor-tests --mutant class-twice, doesn't build with the host's newer gcc (-Wunused-but-set-variable) and passes with that warning off. This change doesn't touch it.
  • The built-in path (pmp-report plus DT on apple-soc-cpufreq) is built as a test kit on the mini's running kernel (same release, key and exports). Its boot on the J773g is scheduled; the result row will follow here. The test above emulated it from a module, with the same reads and the same mapping.
  • Follow-up, not in this PR: an interrupt-driven variant. The hypervisor trace shows macOS's boot enabling this entry's PTD interrupt: enable-set +0x18238 bit 17, and vector select at +0x184e8/+0x184ec. The AIC line the vector raises is not known yet, and those writes need proof before Linux makes them. Until then this uses the sampled path already merged for T6041, T8140 and T6050; the M5 shipped the same way in linux#1950.

@RyanTheTide

Copy link
Copy Markdown
Contributor

The read side looks right. Entry 465 at 0x1d10 is 8-byte aligned, readq() takes the whole first word, and the two lanes are its low bytes, so lower_32_bits() keeps both. The other SoCs keep their 32-bit read.

Two points:

  • Scope: the properties go in t8132.dtsi, so they apply to every T8132, including the fanless M4 Airs (J713/J715) and the J604, not only the mini. That is probably what you want, since the PMP loop is the SoC's, but the before/after should include one of them. On a fanless machine the effort will actually be applied under sustained load, so a cap that comes in too early or never lifts would show up there first. What does the cpufreq fallback limit, held "until the PMP runs", come to on T8132, and how long does it last if the PMP never reports a valid effort?
  • 0x1d10 is still a per-SoC constant, even though the entry comes from the ADT's ptd-range table (FAST-DIE-CE at 465). If the boot loader passed the entry, or the offset were a property of the pmp_report node, the next SoC would need only its DT.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr
DjDeveloperr force-pushed the djdev/m4-mini-fast-die-effort branch 3 times, most recently from 2c915cc to d94dab9 Compare November 21, 2026 02:07
@DjDeveloperr DjDeveloperr changed the title t8132: enforce the PMP's fast-die effort (Mac mini runs 15-25 C hotter than macOS) t8132: enforce the PMP's fast-die effort, as macOS's CLPC does Nov 21, 2026
@DjDeveloperr
DjDeveloperr marked this pull request as ready for review November 21, 2026 02:08
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Follow-up note: the IRQ-started variant (macOS starts its FAST-DIE-CE reads from the PTD entry interrupt) is left for a later change. The boot-time writes macOS makes to the PTD interrupt registers are known from a hypervisor trace (enable-set at +0x18238 bit 17 for this entry, vector select at +0x184e8/+0x184ec). The AIC line the vector raises still needs a trace with interrupt logging, so until then this uses the sampled path already merged for T6041/T8140/T6050.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Row on an M4 MacBook Air (J713, fanless, macOS 27.2 firmware, AC). The same lab kernel was run with this series (both commits) and without it. The J713 ADT lists FAST-DIE-CE (id 0x1f) at PTD entry 465, count 2, as on the mini. Load: 10 busy threads for 150 s after 60 s idle, sampling every 5 s.

P cur mean E cur mean die max die mean first P cap
without #2646 2815 MHz 2070 MHz 109.0 C 98.3 C 15 s
with #2646 2814 MHz 2160 MHz 107.25 C 93.6 C 25 s

On this machine the series makes no measurable difference under this load. In both runs the caps (P down to 3.1 GHz, then to 0.9-1.8 GHz) come with apple-pmp-thermal "reason=... hard" decisions, and nothing from the fast-die path is logged. So the effort may never be applied, or it may be masked by the hard limit. It also causes no regression on the Air. A debug line when the sampled effort changes would show whether it is read here at all.

Assisted-by: LLM (Claude:Opus 5.5)

The T8132 PMP runs a fast die-temperature control loop for each CPU
cluster and the ANE (the PMP node's fast-die-ctrl-loop, with a 100 C
average sensor target and a 5 ms period) and publishes its effort in the
PTD entry the PMP node's ptd-range table names FAST-DIE-CE: entry 465,
two lanes. The table also places the entries this driver already uses
on T8132, PMP-STATUS at entry 1 and the soc-device request and
acknowledgment at entries 392 and 400. Its fast-die-ctrl-ce-map puts the
EACC loop on lane 0 and the PACC and ANE loops on lane 1, as on T8140,
and the clpc node's ptd-ranges include FAST-DIE-CE.

A boot trace of macOS 27.2 under the hypervisor shows it reading
FAST-DIE-CE as one 128-bit access, and no PTD word 32 bits wide. Read the
effort as the low half of the entry's first 64-bit word on T8132; the
other SoCs keep their 32-bit read.

Describe the entry, so apple,fast-die-effort can point cpufreq at it.

Signed-off-by: Diljit Singh <[email protected]>
The T8132 PMP runs a fast die-temperature loop per CPU cluster and
publishes an effort for each. On Linux the T8132 cpufreq nodes do not
point at the effort, so only the provisional apple-pmp-thermal limits
apply.

Point both clusters at their lanes of the effort, E on lane 0 and P on
lane 1, as on T8140. apple-soc-cpufreq then enforces it as a maximum
frequency QoS limit with its (255 - effort) / 255 mapping, and holds the
fallback limit until the PMP runs.

On the Mac mini (J773g) the loop engages only on short peaks: under a
sustained all-core load the P lane's effort was non-zero for 5-55 ms at
a time, at PMP sensor peaks of about 110 C, and zero otherwise. The
limit acts at those peaks; it does not change the sustained
temperature, which follows the load. Native macOS leaves the fan in the
SMC's automatic mode on this machine, and the fan follows the SMC's own
policy on both systems.

Signed-off-by: Diljit Singh <[email protected]>
@DjDeveloperr
DjDeveloperr force-pushed the djdev/m4-mini-fast-die-effort branch from d94dab9 to d1c81d6 Compare November 21, 2026 07:22
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J773g (M4 Mac mini, macOS 27.2 firmware 26B123) row for this PR

  • Kit: Image 0aed2cca built from d660807f (010c3eb + this PR's two commits; d660807f/435991bc differ from the head d1c81d6/b2b9024a only in comments and the binding YAML's lane description text). DTB = the display-lane base 38810fbd + the two apple,fast-die-effort properties (+ the /chosen ESP line used on these boots; ef06845b as booted). Release 7.3.0-ARCH-m4drv8.
  • DT as read back (/proc/device-tree): performance-controller@210e20000 apple,fast-die-effort = <0x84 0x0>, @211e20000 <0x84 0x1> (0x84 = pmp-report@3803c0000).
  • Idle: pmp-report running: 1, lane0 0, lane1 0; the fallback cap is lifted: scaling_max == cpuinfo_max on both clusters (policy0 4104000 kHz, policy1 2892000 kHz).
  • Kernel log: only the expected pre-PMP fast die-temperature limit unavailable warning (95.09 / 95.10 s, before apple_pmp loads at ~119 s on this boot route); no invalid apple,fast-die-effort, no failed to update/set up the fast die-temperature limit.
  • Load rows (10-thread cpuload, 10 Hz samples of the effort lanes, scaling_max, the PMP die hotspot and the P rail):
    • 60 s: 600 samples, PMP running in all 600; lane0 (EACC) and lane1 (PACC) effort never > 0; scaling_max never lowered; hotspot peak 72.8 C; P rail mean 7.94 W.
    • 200 s: 2000 samples, PMP running in all 2000; efforts never > 0; scaling_max never lowered; hotspot peak 83.5 C; P rail mean 8.23 W.
    • Both stay below the PMP's ~110 C target, so no effort was asked for, as expected.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

No blockers. The read side is right: entry 465 at 0x1d10 is 8-byte aligned, readq() takes its first word, both lanes are in the low bytes, and the other SoCs keep their 32-bit read.
Three things before merge:

  1. The properties are in t8132.dtsi, so every M4 board now gets the cpufreq fallback limit until the PMP reports running. Please say in the commit message how that fallback compares with the existing max_unmanaged_pstate 4 bootstrap cap on T8132, and that it now also applies on boots where the PMP doesn't start.
  2. The sampled read keeps running across a deep sleep, when the PMP is stopped. Please add a suspend/resume row showing scaling_max returning to cpuinfo_max after the wake.
  3. The J713 row shows no difference and no fast-die activity. A row on a fanless Air that shows a non-zero effort becoming a QoS cap and then lifting, with a debug line when the sampled effort changes, would show the path works where it matters.
    Optional: the entry index and lane count are in the ADT ptd-range table. Passing them through the pmp_report node instead of the 0x1d10 constant would make the next SoC DT-only.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J713 suspend row at d1c81d6, run on the J713 default kernel (7.3.0-bj713t6+, which carries this head; default cmdline; 27.2), on a fanless M4 Air. Test: one 15 s deep sleep woken by the PMU RTC.

  • scaling_max_freq equals cpuinfo_max_freq (4464000 P, 2892000 E) immediately after the wake and again 10 s later.
  • There were zero sensor error -61 lines, no oops and no firmware crash.

The same kernel also passed 13 deep sleeps and warm reboots ×3 with full caps in the J713 default gate. Still to run: the fanless row where a non-zero effort turns into a cap and then lifts.

Assisted-by: LLM (Claude:Opus 5.5)

@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026
@DjDeveloperr
DjDeveloperr requested a review from a team as a code owner November 26, 2026 02:19
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 26, 2026 02:19
@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 26, 2026
@github-actions

Copy link
Copy Markdown

Merge readiness at 9e9006b3: not ready yet

Check Detail
CI at head no failing: kunit
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 9e9006b3, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:bringup, area:power

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 9e9006b3

Blockers:

  1. drivers/pmdomain/apple/pmp-report.c:89: adds bool fast_die_wide; to struct apple_pmp_report_offsets, which already has bool fast_die_wide; on main (line 92), causing kunit CI to fail compilation with error: duplicate member 'fast_die_wide'. Rebase/drop the duplicate struct field and re-run CI.
  2. Address the earlier non-blocking notes (document how the cpufreq fallback limit compares with max_unmanaged_pstate and ensure an exact-head row once rebased).

Checked:

  • arch/arm64/boot/dts/apple/t8132.dtsi:35-44 and Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml:9-15: lane 0 (EACC) and lane 1 (PACC) wiring and binding text match apple_pmp_offsets_t8132 (fast_die = 0x1d10, fast_die_lanes = 2, fast_die_wide = true).
  • Confirmed aurora/main already carries bool fast_die_wide in drivers/pmdomain/apple/pmp-report.c:92.
Evidence
  • kunit CI log (run 45741656886): ../drivers/pmdomain/apple/pmp-report.c:93:7: error: duplicate member 'fast_die_wide'.
  • git grep -n fast_die_wide aurora/main -- drivers/pmdomain/apple/pmp-report.c: line 92 already defines bool fast_die_wide;.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants