Repository navigation
soc: apple: T8140 PMC voters, CLPC floors, GFX PMP report and a DCS thermal limit (supersedes #212) - #219
Merged
Conversation
The PMP chooses DRAM and fabric performance states partly from the power state that the host reports for the devices it tracks. On macOS, ApplePMGR sets a device's bit in the PMP's power-state request word after it powers the device on, clears it before it powers the device off, and waits for the PMP to acknowledge the devices that require it. The pmp-report driver already provides such report entries as power domains on earlier SoCs. Allow them as children of the T8140 report aperture, with the device's PMP soc-device index as the unit address. Assisted-by: LLM Signed-off-by: Diljit Singh <[email protected]>
The PMC arbitrates the performance states of shared rails, such as the DRAM controller and the SoC fabric, between voter agents: the PMP, the host performance controller (CLPC), the GPU and the application processor. Each agent has a perf-state floor word with one 4-bit state per rail, and each rail has an interface enable word with one bit per agent; the PMC ignores the floor of an agent that is not enabled on a rail. Describe the voter and rail windows, the static agents, the dynamic agents as power domains, and the host performance controller's agent. Assisted-by: LLM Signed-off-by: Diljit Singh <[email protected]>
The PMC only honours a voter agent's perf-state floor on rails where that agent's interface is enabled. macOS enables the static agents (PMP, CLPC and AP) on all their rails when it restores the PMGR (ApplePMC::restorePMC), and enables a dynamic agent such as the GPU only while the host keeps the agent's PMGR device powered: after the power-on state write and before the power-off one (ApplePMC::stateChange). Without these enables, the PMC ignores those agents' floors. Enable the static agents listed in the device tree for as long as the PMC is bound, and restore the saved enable words when it is unbound. Provide each dynamic agent as a power domain whose parent is its device's power domain, so that genpd enables the agent after the parent powers on and disables it before the parent powers off, as macOS does. Every enable write is read back. Export the floor words so that a host performance controller can set its agent's floor. Assisted-by: LLM Signed-off-by: Diljit Singh <[email protected]>
On macOS the CLPC raises the DRAM controller (DCS) and SoC fabric floors of its PMC voter agent while the CPU clusters or the GPU are busy (AppleT8140CLPC: clpc::memory::DVFManager and clpc::soc::DVFManager, both ending in the PMC CLPC perf-state floor), and lets them fall at idle. Linux has no equivalent, so CPU-bound work runs with the DRAM controller at whatever state the other agents happen to request. Sample every cpufreq policy every 4 ms, the CLPC sampling interval from the Apple device tree. A policy whose busiest CPU was busy for at least half of the period requests a DCS and fabric state from a table indexed by its frequency quartile. Optionally, while the GPU's PMGR state reports the GPU as actually powered, request a fixed GPU floor. Each rail keeps its last request for 32 ms after demand stops, then returns to 0. The native mapping from CPU and GPU demand to DCS and fabric states is not decoded. The default tables (DCS 1-4 by quartile, no fabric request, no GPU floor) are measured policy and can be changed with module parameters. A debugfs file holds a rail at a fixed state for diagnosis only. Assisted-by: LLM Signed-off-by: Diljit Singh <[email protected]>
Describe the PMC voter interface with the PMP, CLPC and AP agents as static voters, the GPU's dynamic agent as a power domain, and the host performance controller's agent. Add the PMC's PMGR power state. Report the GPU to the PMP through a report entry for PMP soc-device 9, whose type in the Apple device tree requires an acknowledgment. The GPU now sits on the PMC GFX agent, which sits on the report entry, which sits on the GFX PMGR state. Powering the GPU on therefore writes the PMGR state, then reports it to the PMP, then enables its PMC agent, and powering it off undoes them in reverse order, as macOS does. Enable the PMC on J700. Assisted-by: LLM Signed-off-by: Diljit Singh <[email protected]>
With the previous commit the GPU's only power domain is the PMC's GFX voter domain, which only the new PMC driver provides. A kernel without that driver, or built without CONFIG_APPLE_PMC, never probes the GPU: platform 482600000.gpu: deferred probe pending: platform: wait for supplier /soc/power-management@302800000/voter@2 A device tree has to keep working with kernels that predate a driver it describes, so leave the GPU on its PMGR power state as before. The GFX voter does nothing measurable on the J700 anyway: its floor stayed 0 under every GPU load we sampled, and the GPU firmware has no mapping of the PMC window to write it through. The GPU throughput gain comes from the report entry alone. Once the PMP is told that the GPU is on, it raises its own DRAM controller (DCS) vote under GPU load, which the boot firmware already lets through on the DCS rail. With only the report bit set, a kernel without any PMC driver runs glmark2's build scene at 2199 instead of 1453; enabling every PMC agent on every rail on top of that changes it to 2218. Report the GPU as on from probe instead, as t8112 does for its display. The host never turns the GPU's PMGR state off at runtime, and hardware auto-PM already gates the GPU while it stays requested on, so the PMP sees the same thing it does with the report in the GPU's power path: a reported-on GPU that is gated whenever it idles. It votes the DCS up only under GPU load. Every kernel with the PMP report driver supports the entry. Drop the unused GFX voter node. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The words at the start of the "rails" region are not per-rail states. There is one per voter agent, and each holds that agent's floor as the PMC honours it: masked by the agent's interface enables and clamped to each rail's highest state. On the J700, with agent 1's floor set to 0x40 and its interface enabled only on rail 1, word 1 reads 0x30 (the fabric rail tops out at 3) and word 0 stays 0; enabling agent 1 on rail 0 instead with a floor of 4 makes word 1 read 4. Name the offset after what it holds and print each agent's floor next to what the PMC honours of it, and the rail enables on their own lines. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The second register region holds one word per voter agent with the floor the PMC honours for it, followed by one interface enable word per rail; say so instead of calling the first words rail states. The PMC can also limit the DRAM controller (DCS) rail on behalf of the host, which makes it a thermal cooling device. Add #cooling-cells, and an optional power model for the power allocator governor: the system power at each DCS state above the lowest one. Bound the static voter list by the 32 agents an enable word can hold. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Once the PMP is told that the GPU is on, it votes the DRAM controller (DCS) up with GPU load. On the J700 that is worth up to 2.4x in GPU throughput, but it also lets the GPU and the memory system draw up to 2.4 W more, and nothing on the host can hold that back: the CPU cooling devices do not touch it. Register the PMC as a cooling device that limits the DCS rail. At cooling state N, only the AP's own agent stays enabled on the DCS rail, and it votes what the other enabled agents ask for, capped N states below the top. A delayed work re-reads their votes every 20 ms while a limit is in place, so the rail still follows demand, including down to 0 when the GPU idles. The capped vote is in place before the others stop being honoured and is withdrawn only once they are honoured again, so the rail never dips on a change of state. Enables that the static and dynamic agents request while a limit is in place are recorded and take effect once it is lifted. With a power model in the device tree, the cooling device is a power actor for the power allocator governor: it requests the power of the state the other agents ask for and converts a granted power into the highest DCS state that fits. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The J700 device tree relies on the PMC driver for its DCS thermal limit and for letting the host performance controller's floors through, so a kernel built without it runs hotter under GPU load. Build it by default on ARCH_APPLE, as the T8140 memory cache controller driver is; it binds to nothing on SoCs without a PMC node. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
An offline CPU accrues no idle time while the wall clock keeps running, so its idle delta is zero and the sampler counted it as 100% busy. With any CPU of a policy offline, that policy then requested its top DCS state on every sample for as long as the CPU stayed down. Skip offline CPUs, and take a fresh baseline for a CPU when it comes back instead of charging it with the whole time it was away. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The sampler ran every 4 ms on a high-priority, non-freezable workqueue with a normal timer. That woke an idle CPU 250 times a second even when no vote was held, kept running through system sleep, and, once tasks are frozen and sampling stops, would leave the agent's floor at whatever the last sample before suspend asked for, typically a busy one, for the whole sleep. Sample on a freezable, power-efficient workqueue. While a vote is held, keep the normal timer so the vote still drops on time after demand stops; with no vote held, use a deferrable timer that waits for a CPU that is awake anyway. Before system sleep, stop sampling and give the floor back; resume sampling from fresh baselines afterwards. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Without a floor from the host, the J700's DRAM controller stays at its lowest state for CPU work: nothing else votes it up unless the GPU is busy. A single thread copying a 256 MiB buffer moves 6.88 GB/s (sd 0.02, three runs of 12) without the CLPC floors and 28.4 GB/s (sd 0.1-0.3) with them, the floor following the copy to DCS 4. Build the floors by default on ARCH_APPLE; the driver binds only to a host performance controller node under a PMC. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The PMC can limit the DRAM controller rail as a cooling device, so give it cooling cells. Also correct the comment on its second register region, which holds the floor the PMC honours for each agent and the interface enable word of each rail rather than per-rail states. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Once the PMP knows that the GPU is on, it votes the DRAM controller (DCS) up with GPU load. On a GPU-bound load the CPU zones cannot hold the resulting heat back, because the CPUs request little power: with the performance governor the CPU die sensors passed 95 C within 35 s and reached 104 C before the CPUs throttled. Add a zone that limits that vote through the PMC. Its sensor, the SMC's Tp0t, reads at or above every CPU die sensor under GPU load. Describe the measured system power of each DCS state so that the power allocator can drive the limit, and make the sustainable power the whole DCS range, so that the vote is only trimmed above the control trip. With the zone, three minutes of mixed GL and Vulkan load under the performance governor peak at 97 C on the CPU zones, as the same load does without any DCS vote, and ten minutes of it under schedutil keep within 1-2% of the throughput of the uncontrolled vote. Tp0t becomes channel 6 of the SMC hwmon so that the zone can refer to it by index, as the CPU zones do. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
RyanTheTide
added a commit
that referenced
this pull request
Oct 26, 2026
…r binds The T6040 PMC description still excludes PMP agent 0 from the earlier bring-up, when the firmware did not run and iBoot's top-state floor would have stayed in force. PMP startup is now supported and the GPU's report entry follows its power lifetime, but the PMC cannot honour that demand while the agent remains disabled. Use the existing apple,pmp supplier dependency before enabling static PMP, CLPC and AP voters, as in the Neo voter integration. The T6040 match data continues to restrict them to the established DCS/SOC rail mask; no display rail, voltage, power ceiling or new control is introduced. Confirm live PMP votes, idle release and sustained GPU/CPU thermal behaviour on J616s before qualifying this candidate. Link: #219 Link: #402 Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #212 at DJ's request. DJ's five commits are carried unmodified; the commits after them are fixes, the
thermal limit and two Kconfig defaults, all measured on the J700.
Commits
From #212 (DjDeveloperr), unmodified:
dt-bindings: power: apple,t8140-pmp-report: describe report entriesdt-bindings: power: add Apple PMC voter interfacepmdomain: apple: add PMC voter interface driversoc: apple: add host performance controller floorsarm64: dts: apple: t8140: describe the PMC and report GFX to the PMPOn top:
arm64: dts: apple: t8140: keep the GPU on its PMGR state. With soc: apple: T8140 PMC voters, CLPC DCS/fabric floors and GFX PMP report #212's tree the GPU's only power domain is thePMC's GFX voter domain, which only the new PMC driver provides. A kernel without that driver never probes the GPU:
platform 482600000.gpu: deferred probe pending: platform: wait for supplier /soc/power-management@302800000/voter@2(booted on the J700 with the currentaurora-wipkernel). The GPU stays onits PMGR state as before, and the GFX report entry is marked
apple,always-on(as t8112's display entry is), so thePMP is told the GPU is on from probe. The GFX voter node is dropped: its floor stayed 0 under every GPU load we
sampled, and the GPU firmware has no mapping of the PMC window to write it through. The driver keeps its support for
dynamic voters.
pmdomain: apple: pmc: report the honoured floor of each agent. The words at the start of the PMC's second regionare one per agent (the floor the PMC honours for it, masked by the agent's enables and clamped per rail), not
per-rail states.
dt-bindings: power: apple,pmc: describe the DCS limitandpmdomain: apple: pmc: limit the DCS rail as a cooling device. At cooling state N the PMC stops honouring the other agents on the DRAM controller (DCS) rail and votes whatthey ask for through the AP's own agent, capped N states below the top; it follows their votes every 20 ms while
limited, so the rail still drops to 0 when the GPU idles. With a power model in the device tree it is a power actor
for the power allocator.
pmdomain: apple: build the PMC driver by defaultsoc: apple: clpc: do not count offline CPUs as busy. An offline CPU has no idle time accruing, so it read as 100%busy and held its policy's DCS request at the top state.
soc: apple: clpc: stop waking idle CPUs and release the floor in sleep. Sampling moves to a freezable,power-efficient workqueue with a deferrable timer while no vote is held, and the floor is given back across system
sleep instead of staying at the last busy sample.
soc: apple: build the CLPC floors by defaultarm64: dts: apple: t8140: describe the PMC's DCS limitandarm64: dts: apple: t8140-j700: limit the DCS vote when the die runs hot: a J700 thermal zone on the SMC's Tp0t sensor (control 95 C) that drives the DCS limit, with themeasured system power of each DCS state.
ps_pmcstays as #212 has it. With it, the PMGR driver turns on hardware auto-PM for the PMC block, which the bootfirmware leaves off; the PMC then idles clock-gated and wakes on access. The PMP boots and runs normally with that,
on kernels with and without the PMC driver, and every PMC path in this series (enables with read-back, floors, the
PMP's own vote, the DCS limit) was exercised in that state.
What makes the GPU faster
Measured before any of this was applied, flipping only the hardware bits from userspace (glmark2
build, 7-10 s,panel on, single runs; run-to-run spread is about 1%):
Once the PMP is told the GPU is on, it votes DCS 4 through its own agent, which the boot firmware already enables on
the DCS rail, and only while the GPU is busy (its floor reads 0 at idle with the report set). The PMC enables matter for
the CLPC floors and the thermal limit, not for this. Because the report now comes from the PMP report driver alone,
kernels without the PMC driver get the GPU gain too, without the thermal limit.
DCS state vs GPU throughput and system power, glmark2
terrain(800x600, 10 s), forced through one agent:The DCS limit reproduces the same steps when driven by hand (359, 331, 303, 264, 155 fps for states 0-4).
CPU memory bandwidth (CLPC)
Without a host vote the DRAM controller stays at DCS 0 for CPU work. One thread copying a 256 MiB buffer, 12 copies
per run after 2 warm-up copies, three alternating pairs on the same boot:
Benchmarks
J700, GNOME session, panel kept on, Mesa Honeykrisp (GL through Zink). Before = current
aurora-wipkernel with thecurrent device tree; after = this branch (kernel and device tree), CLPC loaded. Each column is its own boot.
glmark2 runs start only once the hottest P-core zone is at or below 72 C (60 s cap).
(1) Iterations of glmark2 at 1920x1200 (build, texture, terrain, refract, shadow, jellyfish, 10 s each) followed by
vkcube for 20000 frames. The "before" run fell from about 415 to about 171 in its third iteration and stayed there,
with the CPU zones at 60-68 C and no cooling device engaged; a single run right after the load was back to normal. The
same kernel family held 417-419 for ten iterations in an earlier run. We have not chased it.
(2) One 2 s sample early in the run (cpu-p3 100 C, others 87-95 C); IPA and the DCS limit both engaged and the next
sample read 94 C. The rest of the run stayed at or below 92 C.
(3) Both idle runs on the final device tree (the "before" kernel then reports the GPU too, which changes nothing at
idle: the PMP's floor reads 0 when the GPU is idle), auto-brightness off, backlight at 161.
Without the DCS limit (report set, no limit), the same performance-governor load took the CPU zones to 104 C within
36 s, at which point the test stopped it. With the limit at a 95 C or 97 C control trip on Tp0t (two development
runs), the peak was 97 C and 98 C, and the ten-minute schedutil composite averaged 1013 and 1015 against 1016-1038 with
no limit (about 1-2% lower).
Testing
pmc.o,clpc.oandpmp-report.o.dt_binding_checkpasses for both bindings;dtbs_checkoft8140-j700.dtbshows thesame three pre-existing GPU
regwarnings asaurora-wipand nothing new. checkpatch --strict: only theAssisted-byformat warning.one each with the
aurora-wipkernel, an olderaurora-wipkernel and a downstream kernel; every oneof them has the GPU, display, Wi-Fi and Bluetooth up and no WARN/Oops/SError.
aurora-wipkernel loses the GPU (deferred onvoter@2), the PMP startsnormally with
ps_pmc; with this branch's kernel the GPU works.down to 0 when the GPU idles; the power allocator drives it on the thermal zone in the runs above.
floor back.
APPLE_PMC=ybuildswith 0 warnings under an M2 configuration and only registers its driver.
Known gaps
state off at runtime, and hardware auto-PM already gates the GPU while it is reported on.
limit is conservative for them.
-62) showed up on 1 of the 7 default boots; it is being fixed separately.
Our commits were written for this tree; register layouts and behaviour come from measurement on the J700.
🤖 Generated with Claude Code