Skip to content

soc: apple: clpc: Take the Low Power mode ceiling from the DT (rebased on #2784) - #2816

Merged
RyanTheTide merged 2 commits into
integration/aurorafrom
clpc/lpm-dt-ceiling-after-2784-20261123
Nov 22, 2026
Merged

RyanTheTide merged 2 commits into
integration/aurorafrom
clpc/lpm-dt-ceiling-after-2784-20261123

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

This is #1906 by @m0d16l14n1, rebased onto integration/aurora now that #2784 (High Power mode from the DT) has landed. The two PRs conflict in drivers/soc/apple/clpc.c, and the fork branch can only be updated by its author, so this carries Nick's two commits unchanged in authorship and message, with the conflict resolved in the second one (noted in brackets above the second sign-off).

Problem. #1906 takes the Low Power mode CPU ceiling from apple,low-power-frequency-max-mhz in the CLPC node (the loader copies it from the ADT), and falls back to the SoC table. #2784 added four new reads of the table value clpc->hw->low_power_khz: the profile/SMC gates in probe, the cpufreq policy notifier, the profile name (apple-clpc vs apple-smc) and the idle-sampling decision. One of them (idle sampling) merges without a textual conflict and is still wrong. On a machine whose ceiling comes only from the DT (T6040: table value 0, loader writes 2808 MHz), the profile would register as apple-smc, never apply its ceiling, and sample deferrably in low-power.

Change. All four reads use clpc->low_power_khz (DT ceiling, else table, else 0). The host test model in tools/asahi/clpc-gpu-demand-tests.py carries the new field. One wrapped line for checkpatch. Otherwise identical to #1906 head 0cbf68d.

Testing.

Still to run. Nothing on the J616s: this head booted there on the fleet81 candidate (row: #2816 (comment), apple-clpc from the DT ceiling alone, low-power 2868 MHz at 8.80 W). On Fedora the low-power profile only reaches the class through aurora-silicon/aurora-platform#38, so a distro pin carrying this should ship together with it.

Supersedes #1906 (credit and authorship stay with Nick).

Resolution (clpc.c, against integration/aurora)
-	if (!clpc->hw->low_power_khz || time_before(jiffies, clpc->power_next))
+	if (!clpc->low_power_khz || time_before(jiffies, clpc->power_next))
...
-			 !(clpc->hw->low_power_khz && READ_ONCE(clpc->low_power)));
+			 !(clpc->low_power_khz && READ_ONCE(clpc->low_power)));
...
-	if ((clpc->hw->low_power_khz || high_power) && IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)) {
+	if ((clpc->low_power_khz || high_power) && IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)) {
...
-	if ((clpc->hw->low_power_khz || clpc->high_power) && IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)) {
+	if ((clpc->low_power_khz || clpc->high_power) &&
+	    IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)) {
...
-		if (clpc->hw->low_power_khz && !clpc->policy_nb_added) {
+		if (clpc->low_power_khz && !clpc->policy_nb_added) {
...
-		ppdev = devm_platform_profile_register(dev, clpc->hw->low_power_khz ? "apple-clpc" :
+		ppdev = devm_platform_profile_register(dev, clpc->low_power_khz ? "apple-clpc" :

The rest of the diff is #1906 as reviewed (DT property read in probe, the profile: debugfs line, apple_clpc_profile_ceilings()), plus the binding commit unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

Let the boot loader pass the CPU frequency ceiling of macOS's Low Power
mode, which the ADT has as pmgr/clpc cpu-low-power-frequency-max, on
the performance controller node. The property keeps the ADT's unit
(MHz), so the loader copies the value as it is. The name and text match
the property proposed for the same ADT key on the M4 Pro and Max
MacBook Pros.

Signed-off-by: Nick <nekreshen@yandex.ru>
The ADT has macOS's Low Power mode CPU ceiling as pmgr/clpc
cpu-low-power-frequency-max: 2220 MHz on the J704, J813 and J815 (M5),
2088 MHz on the J713 (M4 Air), 3144 MHz on the J700. The boot loader
now copies it into the CLPC node as apple,low-power-frequency-max-mhz.

Register the low-power platform profile wherever the node has that
property, with its value as the ceiling. A node without it keeps the
SoC's built-in value where there is one, so the T6041 and T8140
profiles stay as they are under an older loader.

With the same ceiling built into the driver for the J815, low-power
took its P cluster from 4464 to 2220 MHz and back (M5, 27.2 stub).

Signed-off-by: Nick <nekreshen@yandex.ru>
[Ryan: rebased onto the DT High Power mode change (68986f0, ef719df):
 the four places that read hw->low_power_khz for the profile (the
 profile and SMC gates, the policy notifier, the profile name and the
 idle-sampling decision) now read clpc->low_power_khz, so a DT-only
 ceiling registers as apple-clpc and keeps its ceiling; the host test
 model carries the new field.]
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pre-PR Checklist Review (§1–§6) — 4e0335927443de39e3c14c101e10649afa80e50b

Clean rebase of #1906 onto #2784 (2b67c4e0). Approving on the code; wait for the in-progress dt-checks job to finish green before merging (all other 7/8 CI jobs — source, kunit, host-tests, rust-build, and all 3 DWC3/ATC matrix builds — are already passing, which explains the transient UNSTABLE state).

§1–§6 Audit

  • §1 No model gating: PASS. Reads apple,low-power-frequency-max-mhz from the CLPC DT node (populated from ADT by the bootloader) and preserves the existing hw->low_power_khz fallback when absent, matching the §1 chicken-and-egg rule.
  • §2 Production-ready, no hacks: PASS. Audited every low_power_khz site in drivers/soc/apple/clpc.c against integration/aurora: all four sites introduced by #2784 (SMC parse gate, profile registration gate, cpufreq policy notifier gate, "apple-clpc" vs "apple-smc" profile name) plus the silent non-conflicting idle-sampling check in apple_clpc_sample(), apple_clpc_profile_limit(), and apple_clpc_status_show() now read clpc->low_power_khz. tools/asahi/clpc-gpu-demand-tests.py is updated in lockstep to cover the runtime field.
  • §3 Safety: PASS. Ceiling comes from hardware ADT/DT; absent property falls back to existing table or 0 (profile off). Minor non-blocking note: mhz * 1000 in apple_clpc_probe() has no overflow guard if a malformed DT ever supplied mhz > U32_MAX / 1000 (not an issue for real ADT MHz values).
  • §4 Clean-room & attribution: PASS. Both commits preserve Nick's authorship and messages verbatim (Signed-off-by: Nick <nekreshen@yandex.ru>), with a clear [Ryan: ...] rebase note above Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>, zero AI trailers in commits, and Assisted-by: disclosure in the PR body.
  • §5 Evidence: PASS. Verified on J616s (MacBook Pro 16" M4 Pro, T6040, Fedora 45, #2784#issuecomment-7080567187) with the exact same conflict resolution (only a checkpatch line wrap differs): registers apple-clpc (low-power balanced performance), holds P-cluster at 2868 MHz (8.70–8.78 W vs 4512 MHz / ~12.6–12.9 W), SMC High Power record toggles cleanly, 0 failed units, 0 AVCs, 0 kernel errors. Host tests, KUnit, and W=1 clang build are clean.
  • §6 Naming: PASS.

Merge notes: Wait for dt-checks to complete green, ship alongside aurora-silicon/aurora-platform#35 for Fedora tuned-ppd wiring, and close superseded #1906 once merged.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J616s (MacBook Pro 16" M4 Pro, T6040) row with this head (as 62688a9c + e8b6cccc cherry-picked onto the fleet81 candidate 4bf9f69d, which also carries #2784 and #2671; fleet config). Production Device Tree: the loader writes apple,low-power-frequency-max-mhz = 2808 and the driver table has no T6040 ceiling.

  • The platform profile registers as apple-clpc (not apple-smc), choices low-power balanced performance, so the DT-only ceiling reaches the profile name, the policy notifier and the ceilings.
  • Class written directly, one busy thread on a P core (cpu9) for 8 s, SMC Total System Power:
class P clock (median) system power
low-power 2868 MHz 8.80 W
balanced 4512 MHz 12.82 W
performance 4512 MHz 13.05 W
balanced 4512 MHz 12.78 W
  • debugfs in low-power: ceilings (kHz): cpu0 2868000 cpu1 2592000 cpu9 2868000; none in balanced/performance.
  • 0 failed units, 0 AVC, 0 kernel errors. The test kernel was removed afterwards.

With Fedora's shipped aurora-power-budget (0.1.13-5), tuned-ppd's Power Saver still leaves the class at balanced (4104 MHz, 12.7 W). aurora-silicon/aurora-platform#38 closes that; its row on the same boot is posted there.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at 4e03359.

  1. clpc.c:1514-1519: without apple,low-power-frequency-max-mhz, the driver still falls back to the per-SoC hw->low_power_khz (2808000 in apple_clpc_hw_t6041 at clpc.c:1731 and apple_clpc_hw_t6050 at clpc.c:2150). The loader already copies the ADT value (aura kboot.c dt_set_clpc_low_power()), so the table entries should go. Without the property, the driver should register no low-power ceiling, the same as for every other SoC. Drop .low_power_khz from struct apple_clpc_hw and update the KUnit expectations (clpc.c:1924-1925) to match.
  2. Commit message: "so the T6041 and T8140 profiles stay as they are". The table entries are on apple_clpc_hw_t6041 ("apple,t6041-max-clpc") and apple_clpc_hw_t6050. T8140 has none. This goes away with (1). Otherwise please fix the wording in the bracketed note.
  3. Follow-up, not added here: the low-power power target .low_power_mw = 15000 (clpc.c:2151) and .high_power_machine = "apple,j714s" are still per-SoC/per-board values in the same profile path. Please say whether there is a machine source for them, or track their removal.
  4. Binding nit: the -mhz suffix gives a uint32-array; add maxItems: 1.
  5. Rows at this head: J616s (T6040) boot of this exact commit. Macs that now gain a low-power profile from the loader property and had none before: J713 (T8132, 2088 MHz), J700 (3144 MHz), J704/J813/J815 (2220 MHz). For each: profile name apple-clpc, the low-power ceiling held, back to balanced, 0 failed units. Also a T6050 (J714s) row, where the DT value now replaces the 2808 MHz table value.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merge-train adversarial review (MERGETRAIN-LINUX4) at 4e03359: no blockers. Merges clean on integration/aurora 00cbc67.

Full review

VERDICT: NO BLOCKERS

Reviewed at head 4e03359 (commits e641792 binding, 4e03359 driver) on integration/aurora 00cbc67. The merge-base is bb9f8ec, and
git log bb9f8ec4..00cbc67d touches none of clpc.c, apple,pmc.yaml or clpc-gpu-demand-tests.py, so the head is current for these files.
Line numbers below are in the head's files.

What was verified

  • Readers of the ceiling. After the merge, every reader of the profile ceiling in drivers/soc/apple/clpc.c uses clpc->low_power_khz:
    profile_limit gate :863, top step :889-892, idle-sampling :1004, debugfs status :1067, SMC gate :1534, profile gate :1540,
    notifier gate :1544, profile name :1553. clpc->hw->low_power_khz is read only at :1519 (the fallback) and in KUnit
    :1924-1925, which checks table values. git grep low_power_khz on the head finds no other user in the tree outside
    tools/asahi/clpc-gpu-demand-tests.py. That script models the new field at :115 and :289.
    • apple_clpc_policy_notify (:1237) does not read the ceiling. It can be registered early by the ANE path (:1416), but that is harmless.
    • hw->low_power_mw stays a table value (:866-874). On a DT-only Mac it is 0, so the profile there is ceiling-only, which is intended.
  • Probe ordering. clpc->low_power_khz is set at :1516-1519, before the SMC parse (:1534), the notifier (:1544),
    platform_profile_register (:1553) and the first apple_clpc_queue() (:1562). The work items are INIT'd earlier but not
    queued until :1562.
    • The debugfs status file exists from :1489, so a read during probe sees 0 and skips the profile line. This is benign.
  • Units. MHz are multiplied by 1000 into kHz (:1517).
    • Absent or malformed property: of_property_read_u32 fails and the table value is used (T6041 and T6050 keep 2808000, every other SoC keeps 0).
    • Zero: the DT 0 overrides the table, so there is no profile. The aura writer never emits 0 (aura src/kboot.c !mhz return).
    • Above the max OPP: top_khz falls back to cpuinfo.max_freq (:892), so the profile registers but caps nothing.
  • The resolution is complete. git range-diff against soc: apple: clpc: Take the Low Power mode ceiling from the DT #1906 0cbf68d differs only in context from soc: apple: clpc: take High Power mode from the device tree #2784, the [Ryan: ...]
    note, the six hw-to-clpc read swaps (profile/SMC gates, notifier, name, idle sampling) and one wrapped line. The binding commit
    is unchanged apart from context. The J616s row in issuecomment-7081158205 used 62688a9c and e8b6cccc. Their
    git patch-id --stable matches e641792 and 4e03359 exactly, so the row is on identical patches.
  • The loader path is live, not dead code. aura#358 (merged 2026-11-19, aura origin/main de9244cd src/kboot.c:10929-10960,
    called at :12733) copies ADT /arm-io/pmgr/clpc cpu-low-power-frequency-max (when non-zero) as a u32 into the first enabled
    apple,*-clpc node. Whether it reaches each Mac depends on that Mac's Stage 2 carrying aura#358.
  • Other Macs. The driver binds only to t6041(-max)/t6050/t8132/t8140/t8142/t8152-clpc (:2160-2166). M1, M1 Pro, M2 and
    J615 T8122 have no clpc node, so nothing changes there. J616s T6040 is covered by the "apple,t6041-clpc" -> hw_t6040 row.
  • Rules.
    • No new chip gates or tables. The SoC-table fallback (T6041, T6050 low_power_khz = 2808000) is pre-existing, and the
      high_power_machine "apple,j714s" fallback is pre-existing from soc: apple: clpc: take High Power mode from the device tree #2784.
    • No new module or cmdline parameters. The ceiling comes from the machine (ADT -> DT).
    • Binding: apple,low-power-frequency-max-mhz with no $ref follows the dtschema unit-suffix convention (same as
      capacity-dmips-mhz and adi,lpf-margin-mhz in tree), and the dt-checks CI is SUCCESS.
  • Provenance. Only ADT property and path names (pmgr/clpc cpu-low-power-frequency-max) and the existing SMC key names
    appear. No kext classes or methods, and no internal register names.
  • Hygiene.
    • Author is Nick on both commits; committer is Ryan Murray.
    • Signed-off-by: Nick on both. The driver commit adds the [Ryan: ...] conflict note and Ryan's Signed-off-by.
    • No Co-Authored-By, Assisted-by or agent trailers in either commit. Assisted-by appears only in the PR body.

Blockers

None.

Nits

  1. Wrong SoC in the commit message. The 4e03359 message (Nick's text, carried verbatim) says "so the T6041 and T8140 profiles stay as
    they are". The second table with a ceiling is T6050 (clpc.c:2150, apple_clpc_hw_t6050). apple_clpc_hw_t8140 has no
    low_power_khz. It should read "T6041 and T6050".
  2. Name of a function that does not exist. The PR body mentions apple_clpc_profile_ceilings(), which exists in neither the head nor soc: apple: clpc: Take the Low Power mode ceiling from the DT #1906 0cbf68d.
    The PR body links aurora-platform#38 while the approving review links soc: apple: sep: log every refused SBIO request with its raw status #35. Make sure the userspace PR that is linked is the one that ships.
  3. Possible overflow. clpc.c:1517 mhz * 1000 wraps for mhz > 4294967. This is unreachable from a real ADT. A bound or
    if (mhz > UINT_MAX / 1000) fallback would make it robust. This was already raised in review.
  4. Binding range. The binding could state maxItems: 1 or a minimum: 1 / maximum: range. A unit-suffix property is a
    uint32-array in dtschema, and the driver reads only cell 0.
  5. Behaviour on a DT value of 0. clpc.c:1516-1519: a DT value of 0 overrides a non-zero table value and removes the profile on T6041 and T6050.
    The aura writer never emits 0, but the binding text does not say that 0 is invalid or means "none".
  6. No KUnit coverage of the DT path. The host test sets c.low_power_khz directly, but nothing exercises
    probe's DT-over-table precedence.

Missing rows (DT path unproven; proven only on J616s T6040, 2808 MHz -> 2868 MHz P cap, 8.80 W)

  • J713 (T8132, ADT 2088 MHz). The low-power profile is new on this fanless Air. The ceiling is applied to every cluster
    (:886-892), so the E cluster is capped as well if its max is above 2088 MHz. Whether macOS caps E is unverified.
  • J700 Neo (T8140, ADT 3144 MHz). The profile is new. No row.
  • M5 J704/J813/J815 (T8142, 2220 MHz). Nick's J815 row used a built-in ceiling, not the DT read. The same E-cluster question applies. T8152 J873: no row.
  • J616c (T6041) and J714s (T6050). The DT value now overrides the table. Expected to be equal (2808), but no row
    confirms the ADT value or that low_power_mw still behaves the same on T6050.
  • Deployment. The DT path is live only on Macs whose Stage 2 includes aura#358. A Mac on an older Stage 2 keeps the
    table behaviour, so there is no regression there.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide merged commit 3710668 into integration/aurora Nov 22, 2026
8 checks passed
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.

3 participants