Repository navigation
soc: apple: pmc, clpc, mcc: add T6040 (M4 Pro) - #385
Merged
RyanTheTide merged 6 commits intoOct 23, 2026
Merged
RyanTheTide merged 6 commits into
RyanTheTide merged 6 commits into
Conversation
The T6040 (M4 Pro) PMC has the T8140 voter interface with one more DCS state, and its CLPC agent needs its own demand table, so both get their own compatibles. On the T6040 the voters block lies at the same address as the DCP's PMGR range, so the node is named after its rails block and lists that block first. The driver looks the blocks up by name; allow either order. Signed-off-by: Jonathan Goyvaerts <[email protected]> Assisted-by: LLM
The T6040 (M4 Pro) cache planes have the T8140 registers; it has four memory controllers with four planes each, 16 in all. Signed-off-by: Jonathan Goyvaerts <[email protected]> Assisted-by: LLM
The T6040 (M4 Pro) PMC has the T8140 layout: a floor word per agent every 0x4000 bytes in the voters block, the honoured words and the rail enable words in the rails block. Agents are 0 (PMP), 1 (CLPC), 2 (GFX) and 3 (AP); rails are 0 (DCS), 1 (SOC), 2 (DISP_INT) and 3 (DISP_EXT). The DCS has six states (0-5) where the T8140 has five. The driver enables an agent on every rail. The T6040's voter-agent rail mask in Apple's device tree is 0x7 (DCS, SOC and DISP_INT). Add a per-SoC mask of the rails an agent is enabled on and enable the T6040 agents on DCS and SOC only: iBoot leaves both at their lowest state, so an agent with a zero floor changes nothing there, while how DISP_INT arbitrates zero floors is not known. A SoC that sets no mask, like the T8140, keeps every rail. A KUnit case checks the T6040 mask. Signed-off-by: Jonathan Goyvaerts <[email protected]> Assisted-by: LLM
The T6040 (M4 Pro) has DCS states 0-5 on PMC rail 0 and fabric states 0-2 on rail 1. macOS writes the CLPC agent's floor word as MEM | SOC << 4 from the cluster performance levels, through a mapping it receives from user space, so this table is measured, like the T8140 one. A busy cluster in the upper half of its frequency range asks for DCS 5 and fabric 2. With that floor held the CPUs reach 237-242 GB/s at 135 ns DRAM latency, against 41 GB/s and 314 ns at the lowest states (macOS on the same machine: 248 GB/s, 121 ns). The DCS returns to its lowest state within 40 ms of the floor being dropped. No cluster runs below a quarter of its maximum, so the first column only completes the table. The second column (DCS 2, fabric 1) is provisional until the power of each DCS state is measured. Signed-off-by: Jonathan Goyvaerts <[email protected]> Assisted-by: LLM
The T6040 (M4 Pro) has four memory controllers with four system level cache planes each, 16 in all; the T8140 has four. The plane registers are the same: ways at +0x2800, powered ways at +0x2804, allocation disable at +0x82c and flush at +0x2844. iBoot leaves every plane with its ways enabled and powered and allocation disabled, as on the T8140. Raise the plane limit to 16. Enabling allocation on the 16 planes takes the CPUs' 16 MiB access latency from 136 to 48 ns. Signed-off-by: Jonathan Goyvaerts <[email protected]> Assisted-by: LLM
The driver samples each cluster every 4 ms and requests a state as soon as one sample is busy. On the T6040 any CPU half busy for one sample raises the floor for 36 ms, and short bursts of background work do that often: the floor sat above its lowest state 56-69 % of the time on an idle desktop, which cost about 0.75 W against the driver not loaded. Add a per-SoC count of consecutive busy samples a cluster needs before it requests a state. With three (12 ms) on the T6040 the idle floor time falls to 10-13 % and idle power matches the driver not loaded. Letting only the full-capacity clusters vote, as macOS does, brought the idle floor time down only to 45 %, and added nothing on top of three samples. A SoC that sets no count, like the T8140, keeps the previous behaviour. Signed-off-by: Jonathan Goyvaerts <[email protected]> Assisted-by: LLM
RyanTheTide
pushed a commit
that referenced
this pull request
Oct 23, 2026
Add: - the PMC voter interface (floor words at 0x5_04800000, honoured and rail enable words at 0x5_048aa000), with the CLPC agent (1) and the AP agent (3) as static voters; - the CLPC floor driver on agent 1; - the 16 SLC planes (4 AMCC x 4). The PMP's agent (0) is not a static voter while the PMP does not run under Linux: iBoot leaves its floor word at 0x15 (DCS 5, fabric 1), and enabling the agent would pin the DCS at its top state. GFX (2) is dynamic and not described yet. The SLC waits for the display subsystem, as on T8140: the display takes over the scan-out DMA that iBoot left running. The PMC windows lie inside the display's PMGR window, which the DCP driver only passes to its firmware, so the two do not conflict; the PMC node takes its rails range's unit address. The layout comes from the J616s ADT and the macOS T6041 PMC, CLPC and MCC drivers, and matches T8140's nodes. Binding: apple,t6041-pmc, -clpc and -mcc from #385 ("soc: apple: pmc, clpc, mcc: add T6040 (M4 Pro)"). Signed-off-by: Jonathan Goyvaerts <[email protected]> Assisted-by: LLM
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.
T6040 (M4 Pro) data for the PMC, CLPC and MCC drivers that integration already has for the T8140.
apple,t6041-pmcandapple,t6041-clpcas their own compatibles;apple,t6041-mccwith theapple,t8140-mccfallback and up to 16 planes. On the T6040 the PMC's voters block sits at the same address as the DCP's PMGR range, so the node is named after its rails block and lists that block first.reg-namestherefore allows either order (the driver looks the blocks up by name).agent_railsmask enables the T6040 agents on DCS and SOC only. Apple's voter-agent rail mask is 0x7 (DCS, SOC, DISP_INT), but how DISP_INT arbitrates zero floors is not known. A SoC that sets no mask keeps every rail, so the T8140 is unchanged. A new KUnit case checks the mask.sustainsets how many consecutive busy 4 ms samples a cluster needs before it requests a state. It is 3 on the T6040; unset (the T8140) keeps the old behaviour.Naming: the SoC blocks use
apple,t6041-*, after the T6041 (M4 Max) die the M4 Pro is cut from. Apple's device tree on an M4 Pro names the SoCarm-io,t6041, and Yureka Lilian's acked t604x bindings (#372) already use t6041 for the blocks.Hardware tested on: Apple MacBook Pro (16-inch, M4 Pro, 2024), J616s / T6040, macOS 26.x firmware, booted by our own loader with our private T6040 device tree. It has run Linux 7.3.0-m4.3 daily since 2026-10-22.
How tested: all on the J616s.
sustain = 3, the idle floor is raised 10-13 % of the time instead of 56-69 %, and idle power matches running without the driver.Not tested / limits:
agent_railsandsustainwere changed so that a zero (unset) value keeps the T8140 behaviour. Before, the T8140 table set them explicitly. On the T6040 the logic is unchanged, but this exact version was compile-checked only, not booted.Relation to #366 (T8132): #366 adds T8132 entries to the same drivers. The C code merges cleanly with #366: the new struct fields sit apart from #366's
has_pendingandgpu_demand, and with the zero defaults #366'sapple_pmc_hw_t8132andapple_clpc_hw_t8132keep their behaviour without changes. Two binding hunks conflict textually: both PRs turn theconstcompatibles of apple,pmc.yaml (PMC and CLPC) and apple,t8140-mcc.yaml into lists. Whichever PR lands second needs a few lines of rebase.Dependencies: none. A T6040 device tree using these compatibles also needs the t604x bindings in #372.
Base:
integration/aurora(51cda52). Built and checked there:m4_defconfigwith KUnit andAPPLE_PMC_KUNIT_TESTon, W=1 on pmc.o, clpc.o and mcc.o at every commit (no warnings, same as the base),checkpatch --strictclean, and dt_binding_check of apple,pmc.yaml and apple,t8140-mcc.yaml with dtschema 2026.9.🤖 Generated with Claude Code