Skip to content

soc: apple: pmc, clpc, mcc: add T6040 (M4 Pro) - #385

Merged
RyanTheTide merged 6 commits into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/pmc-clpc-mcc-t6040
Oct 23, 2026
Merged

RyanTheTide merged 6 commits into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/pmc-clpc-mcc-t6040

Conversation

@jgoyvaerts

Copy link
Copy Markdown
Contributor

T6040 (M4 Pro) data for the PMC, CLPC and MCC drivers that integration already has for the T8140.

  • Bindings: apple,t6041-pmc and apple,t6041-clpc as their own compatibles; apple,t6041-mcc with the apple,t8140-mcc fallback 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-names therefore allows either order (the driver looks the blocks up by name).
  • pmc: the T8140 voter layout with six DCS states (0-5). A new per-SoC agent_rails mask 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.
  • clpc: the T6040 demand table, measured: a busy cluster in the upper half of its range asks for DCS 5 and fabric 2. A new per-SoC sustain sets 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.
  • mcc: allow 16 cache planes (4 memory controllers with 4 planes each). The plane registers are the same as on the T8140.

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 SoC arm-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.

  • With the CLPC floor held at DCS 5 and fabric 2, the CPUs reach 237-242 GB/s at 135 ns DRAM latency. At the lowest states they get 41 GB/s at 314 ns; macOS on the same machine gets 248 GB/s at 121 ns. The DCS drops back to its lowest state within 40 ms of the floor being released.
  • With allocation enabled on all 16 SLC planes, 16 MiB access latency falls from 136 to 48 ns.
  • With 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:

  • For this PR, agent_rails and sustain were 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.
  • The new KUnit case was built, not run.
  • The GFX agent and the DISP_INT/DISP_EXT rails are left alone.
  • The second column of the CLPC table (DCS 2, fabric 1) is provisional until the power of each DCS state has been measured.

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_pending and gpu_demand, and with the zero defaults #366's apple_pmc_hw_t8132 and apple_clpc_hw_t8132 keep their behaviour without changes. Two binding hunks conflict textually: both PRs turn the const compatibles 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_defconfig with KUnit and APPLE_PMC_KUNIT_TEST on, W=1 on pmc.o, clpc.o and mcc.o at every commit (no warnings, same as the base), checkpatch --strict clean, and dt_binding_check of apple,pmc.yaml and apple,t8140-mcc.yaml with dtschema 2026.9.

🤖 Generated with Claude Code

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
@RyanTheTide
RyanTheTide merged commit 8154384 into aurora-silicon:integration/aurora Oct 23, 2026
@jgoyvaerts
jgoyvaerts deleted the m4pro/pmc-clpc-mcc-t6040 branch October 24, 2026 16:14
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.

2 participants