Skip to content

soc: apple: clpc: fast GPU power target, CPU energy monitor and capacity-scaled LPM ceiling (J813/J815) - #3873

Open
m0d16l14n1 wants to merge 6 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/t8142-lpm-followups
Open

m0d16l14n1 wants to merge 6 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/t8142-lpm-followups

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What: Follow-up Low Power Mode series stacked on #3646: (1) drive the M5 GPU's fast status-config power target (+0x12c, ~12 ms firmware polling) from CLPC's low-power cap instead of sharing Region C +0x88 with the slower thermal governor, (2) read T8142 memory-mapped 64-bit CPU/cluster hardware energy accumulators + live GPU power for 100 ms burst limiting alongside the 1 Hz SMC PPSM floor, and (3) scale each CPU cluster's initial low-power ceiling by capacity-dmips-mhz when the package power limiter is active (leaving the E-cluster uncapped at 2964 MHz until package power crosses the target).
Tested: Booted and verified on J815 (7.3.0-aurora-j815-dev, exact 2870f8b47906 commits: 9/9 PASS, 0 errors — CPU energy 1097 -> 20311 mW, capacity ceiling 2220 / 2964 MHz, steady CPU hold 4838 mW with zero oscillation, GPU hold 4965 mW with cap 1250 mW and CPU ceilings untouched, mix 4933 mW). Local ARCH=arm64 LLVM=1 W=1 builds (clpc.o plain + KUnit, drivers/gpu/drm/asahi/, t8142-j813.dtb, t8142-j815.dtb), checkpatch.pl, and all clpc-*.py / g17-*.py host suites PASS.
Risk: Two-way door · opt-in via DT properties (apple,low-power-capacity-ceiling, apple,energy-monitor) on J813/J815 (t8142); M5 status-config power target affects M5 GPUs only when CLPC reports a non-zero low-power cap and falls back to Region C if unavailable.
Not yet: Live m5_gpu_power_mw() reporting on M5 Pro/Max/Ultra (J714/J716c/J775D; J815 26B123 uses is_common26() where m5_gpu_power_mw() returns -EINVAL by design).

Details

Stacked on #3646 (fork:j815/t8142-lpm-limit, 6fe3caf3799b). Each topic is isolated in its own commit:

  1. dt-bindings (apple,pmc.yaml, apple,clpc.yaml, apple,acc-energy.yaml):
    • apple,low-power-capacity-ceiling: scales each CPU cluster's initial low-power frequency ceiling from apple,low-power-frequency-max-mhz by max(capacity-dmips-mhz) / cluster(capacity-dmips-mhz) when the package power limiter is active.
    • apple,energy-monitor / apple,acc-energy: describes memory-mapped 64-bit CPU/cluster energy accumulator pairs (+0x0 core/cluster logic, +0x8 SRAM) and apple,picojoules-per-tick.
  2. Capacity-scaled low-power CPU ceiling (drivers/soc/apple/clpc.c):
    • On T8142 (E = 671, P = 1024, low_power_khz = 2220 MHz), P caps at 2220 MHz while E's equivalent ceiling (3388 MHz) exceeds its 2964 MHz top OPP so E stays uncapped until total package power exceeds the target (matching macOS J815 traces).
    • Guarded by both apple,low-power-capacity-ceiling and apple_clpc_power_limited(clpc) so boards without a package power limiter keep the static raw-MHz ceiling.
  3. 100 ms hardware CPU energy accumulators + live GPU power (drivers/soc/apple/clpc.c, include/linux/soc/apple/clpc.h):
    • Torn-read-safe 64-bit accumulator sampling (hi/lo/hi) with exact integer pJ / ns = mW conversion plus apple_clpc_gpu_set_power_mw().
    • Hybrid step policy (apple_clpc_power_step()): acts on max(hw_mw, smc_mw) on fresh 1 Hz SMC readings, lets fresh 100 ms hardware bursts above target step down immediately without acting on stale SMC readings or stepping up prematurely, and falls back to bidirectional hw_mw control when SMC is absent.
    • Supports on-demand debugfs sampling in balanced and resets baselines cleanly on profile transitions, suspend/resume, or counter wrap.
  4. M5 fast GPU status-config power target (drivers/gpu/drm/asahi/g17/):
    • Writes the CLPC low-power GPU cap to the M5 status-config power target (+0x12c mW, +0x144 reason 0x31200003, +0x128 enable 1, relocated via M5StatusConfigMap) and restores the initial status-config maximum with reason 0x3000001d on uncap, idle, or shutdown.
    • Keeps Region C +0x88 strictly for the slow thermal budget governor (with automatic Region C fallback if status-config is unavailable), re-publishes if firmware initdata reloads after wake/recovery, retries failed writes, and reports live m5_gpu_power_mw() to CLPC.
  5. T8142 J813/J815 DTS (t8142-j813-j815.dtsi):
    • Wires the 12 T8142 ACC energy accumulator windows (6 E-cores, E-CPM, 4 P-cores, P-CPM at 25 pJ/tick) and opts &clpc into apple,energy-monitor and apple,low-power-capacity-ceiling.
Evidence
  • Local builds in aurora-kbuild (ARCH=arm64 LLVM=1 W=1): drivers/soc/apple/clpc.o (both plain and CONFIG_KUNIT=y), drivers/gpu/drm/asahi/, apple/t8142-j813.dtb, apple/t8142-j815.dtb: 0 errors, 0 new warnings.
  • Host tests: clpc-gpu-demand-tests.py, clpc-high-power-cleanup-tests.py (+ --old-ref 677be395), g17-m5-governor-stop-tests.py (incl. status-config power target + all 3 mutations killed), and all other tools/asahi/g17-*.py suites PASS.
  • Hardware row (J815, 2870f8b47906): 9/9 PASS (see comment #issuecomment-7343000266).

Describe two optional low-power properties on both CLPC bindings (apple,pmc.yaml and apple,clpc.yaml):
- apple,low-power-capacity-ceiling: scale each CPU cluster's initial low-power frequency ceiling by capacity-dmips-mhz relative to the fastest cluster when the package power limiter is active, matching macOS's performance-level ceiling (leaving efficiency clusters uncapped until the power loop steps them down).
- apple,energy-monitor: phandle to an apple,acc-energy node describing memory-mapped 64-bit CPU/cluster hardware energy accumulators and their picojoule-per-tick scale for 100 ms power limiting.

Signed-off-by: Nick <nekreshen@yandex.ru>
…-limited

Applying apple,low-power-frequency-max-mhz directly as a raw MHz ceiling on every cluster caps efficiency cores well below the single-thread throughput of performance cores at that frequency (on T8142, capping E at 2352 MHz while macOS leaves E uncapped up to 2964 MHz and lets the 5 W package limiter step it down under load).

When apple,low-power-capacity-ceiling is set and the package power limiter is active, scale each cluster's initial low-power ceiling from low_power_khz by max(capacity-dmips-mhz) / cluster(capacity-dmips-mhz) read from the CPU DT nodes. Boards without the property, without capacity-dmips-mhz, or without an active package power limiter keep the existing raw-frequency ceiling so static-ceiling-only boards do not regress power draw.

Adds a KUnit test covering T8142 E/P capacity scaling and missing-metadata fallback.

Signed-off-by: Nick <nekreshen@yandex.ru>
The SMC package power keys (PHPC/PPSM) update at ~1 Hz, so a low-power limiter driven by SMC alone can wait up to a second before reacting to sudden CPU or GPU bursts.

Add optional support for reading memory-mapped 64-bit hardware CPU/cluster energy accumulators described by apple,energy-monitor (with a torn-read-safe lo/hi/lo reader and exact integer pJ/ns -> mW conversion) together with live GPU power reported by the GPU driver via apple_clpc_gpu_set_power_mw(). In the low-power loop, combine the 100 ms hardware reading with the 1 Hz SMC reading (taking max(hw_mw, smc_mw) when both exist) so CPU/GPU bursts step down within 100 ms while SMC still covers unmeasured SoC rails.

Resets the energy baseline cleanly on suspend/resume, leaving low-power mode, or counter wrap, exposes energy_mw and gpu power in debugfs, and adds KUnit tests for delta math, wrap handling, and power combination.

Signed-off-by: Nick <nekreshen@yandex.ru>
The M5 firmware exposes a fast host power target in the status-config block (+0x128 enable, +0x12c target mW, +0x144 policy reason, all inside the unshifted 0x000..0x1dc band and relocated via M5StatusConfigMap) that the firmware polls continuously (~12 ms), separate from Region C +0x88's slower (~1 s) thermal budget word.

Drive the status-config power target directly from CLPC's low-power GPU cap (writing reason 0x31200003 while capped and restoring the initial status-config maximum with reason 0x3000001d when uncapped, idle, or shutting down), keeping Region C +0x88 strictly for the thermal budget governor while retaining a Region C fallback if the status-config target is unavailable. Re-publishes automatically if firmware initdata is re-initialized after wake or recovery, and retries failed writes.

Also reports live M5 GPU power (m5_gpu_power_mw()) to CLPC via apple_clpc_gpu_set_power_mw() for the 100 ms low-power loop, and extends g17-m5-governor-stop-tests.py to cover the status-config power target path.

Signed-off-by: Nick <nekreshen@yandex.ru>
…capacity ceiling

Describe the T8142 per-core and cluster hardware energy accumulators (6 E-cores + E-CPM + 4 P-cores + P-CPM, 25 pJ/tick) and wire them with apple,low-power-capacity-ceiling on the J813/J815 CLPC node so the low-power profile reacts to CPU/GPU bursts at 100 ms and leaves the E-cluster uncapped up to its top OPP until total package power crosses the target.

Signed-off-by: Nick <nekreshen@yandex.ru>
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

Tested on J815 (MacBook Pro 14" M5, T8142, 26B123 GPU firmware) on 7.3.0-aurora-j815-dev (j815/nightly12-lpm 66c55f0d3c02, carrying the exact 2870f8b47906 #3873 commits on top of #3646 6fe3caf3799b + #3868 90300394b3d3; Stage 2 aura#580 setting apple,low-power-mw = <5000> and apple,low-power-frequency-max-mhz = <2220>).

Test Result Notes
env / ppd PASS apple-clpc platform profile (low-power / balanced / performance) wired through power-profiles-daemon (platform_profile); power key PPSM target 5000 mW; energy monitor 12 windows, 25 pJ/tick
reading PASS Power Saver idle 3352 mW, 10 fresh SMC readings in 10 s; Balanced idle 3865 mW -> all-core load 24305 mW
energy PASS 12 T8142 ACC energy accumulator windows live in balanced (on-demand) and low-power: CPU energy idle 1097 mW -> all-core load 20311 mW; 0 SErrors. Power Saver idle ceilings: policy0 2220000 / 4464000 kHz (P-cluster), policy1 2964000 / 2964000 kHz (E-cluster capacity-scaled)
cpu (40 s all-core yes) PASS PPSM median 4838 mW (target 5000 mW) vs Balanced 23835 mW; settled smoothly in 6 s and locked steady for 34 consecutive seconds at cpu0 1608000 kHz, cpu1 1584000 kHz (4812..4941 mW, zero oscillation)
gpu (40 s vkcube) PASS PPSM median 4965 mW (target 5000 mW); M5 status-config +0x12c target capped GPU cleanly down to 1250 mW, CPU ceilings untouched (cpu0 2220000, cpu1 2964000), 0 GPU faults
mix (40 s CPU + GPU) PASS PPSM median 4933 mW (target 5000 mW) vs Balanced 23255 mW; GPU cap 1250 mW, ceilings cpu0 1308000 kHz, cpu1 972000 kHz
regress PASS 9 PASS, 0 FAIL, 0 CHECK; 0 new kernel errors, 0 failed systemd units, 0 suspend failures

Note on gpu power in debugfs on J815: J815 26B123 uses RootProfile::J873G18G26B123 (is_common26() == true), where m5_gpu_power_mw() intentionally returns -EINVAL (the POLICY_GPU_POWER = 0xad4 offset is M5 Pro/Max/Ultra only), so gpu power reports 0 mW on J815 as expected while the status-config +0x12c power target and 12-window CPU energy monitor run live.

Local verification on 2870f8b47906: checkpatch.pl 0 errors / 0 warnings on all 5 commits, clpc-gpu-demand-tests.py, clpc-high-power-cleanup-tests.py (including --old-ref 677be395), and all g17-*.py host tests PASS; ARCH=arm64 LLVM=1 W=1 builds of clpc.o (CONFIG_KUNIT=y and =n), drivers/gpu/drm/asahi/, t8142-j813.dtb, and t8142-j815.dtb all clean.

@m0d16l14n1
m0d16l14n1 marked this pull request as ready for review December 2, 2026 10:48
@m0d16l14n1
m0d16l14n1 requested review from a team and DjDeveloperr as code owners December 2, 2026 10:48
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at 1566d169: not ready yet

Check Detail
CI at head ok no CI for this change (the hardware row is the gate)
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 1566d169, a Mac and a result in the PR body or a comment
Conflicts ok not computed yet
PR text ok Risk: two-way · opt-in via DT properties (apple,low-power-capacity-ceiling, apple,energy-monitor) on J813/J815 (t8142); M5 status-config power target affects M5 GPUs only when CLPC reports a non-zero low-power cap and falls back to Region C if unavailable.

Areas: area:bringup, area:gpu, area:platform

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

satchlj
satchlj previously approved these changes Dec 2, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verdict: MERGE at 2870f8b479063aaf960c89ae9d99ec81b237648c
Blockers: none (note: this branch targets main while carrying the 4 commits from still-open #3646 at 6fe3caf379, which is already approved — merge #3646 first or land #3873 as the superset)
Checked: no Apple material, DT-property opt-in (no model gating), default command-line compatibility, apple,pmc.yaml / apple,clpc.yaml / apple,acc-energy.yaml, t8142-j813-j815.dtsi, clpc.c accumulator math / hybrid step policy / capacity ceiling / suspend & stop cleanup, g17 M5 status-config power target and cache-line cleaning, KUnit & host test coverage, J815 9/9 hardware receipt, PR text

Evidence
  • Documentation/devicetree/bindings/ & arch/arm64/boot/dts/apple/t8142-j813-j815.dtsi: all new behavior is opt-in via DT properties (apple,power-key-id, apple,low-power-gpu-cap, apple,low-power-capacity-ceiling, apple,energy-monitor / apple,acc-energy with 12 T8142 windows at 25 pJ/tick).
  • drivers/soc/apple/clpc.c & include/linux/soc/apple/clpc.h:
    • apple_clpc_read_acc64() uses a hi/lo/hi2 loop safe against 32-bit rollovers; apple_clpc_energy_delta_mw() guards zero windows, wraps, and multiplication overflow before div64_u64(delta * pj_per_tick, delta_ns).
    • apple_clpc_power_step() acts on max(hw_mw, smc_mw) on fresh 1 Hz SMC samples, allows immediate 100 ms step-down on hardware bursts above target without oscillating on stale SMC values, and falls back cleanly to bidirectional hardware control if SMC is absent.
    • apple_clpc_cluster_low_power_khz() scales cleanly by capacity-dmips-mhz with fallback when metadata is absent; apple_clpc_stop() drops gpu->cap_mw and apple_clpc_resume() resets baselines and caps cleanly.
  • drivers/gpu/drm/asahi/g17/ (initdata/m5.rs, thermal.rs, mod.rs): verified status_config is 64-byte aligned (next_packed_allocation(..., 0x40)), so +0x128 (enable) and +0x12c (target) share a 64-byte cache line while +0x144 (reason) is cleaned on the adjacent line. PowerTarget cleanly decouples fast CLPC capping from the slow Region C thermal governor with Region C fallback, initdata-reload re-publish, failed-write retry, and shutdown restore. (Non-blocking nit: cleaning reason_line before target_line in publish_m5_power_target() guarantees reason reaches PoC ahead of the shared enable/target line.)
  • Tests & hardware row at exact head 2870f8b47906: pr-readiness green (MERGEABLE, zero conflicts; note hosted apple-build/dt-checks/host-tests/KUnit were skipped on this fork PR while local W=1 arm64 LLVM builds of clpc.o, drivers/gpu/drm/asahi/, and J813/J815 DTBs, checkpatch.pl, clpc-*.py, and g17-*.py suites all passed) and J815 hardware row (#issuecomment-7343000266) passed 9/9 across CPU, GPU, and mixed loads with 0 SErrors and 0 GPU faults.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@m0d16l14n1
m0d16l14n1 dismissed satchlj’s stale review December 2, 2026 16:46

The merge-base changed after approval.

@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.

Not approving at 2870f8b4 yet. The code looks right, but this PR's own "Not yet" row is still open, and the branch will conflict once #3868 lands.

What I checked: the five commits on top of #3646: the bindings; in clpc.c, the capacity ceiling, the energy monitor and the step policy; the g17 status-config power target; and the J813/J815 DT.

  • The CLPC side only runs where the DT opts in. Without apple,energy-monitor and apple,low-power-capacity-ceiling, apple_clpc_power_limited() and the ceilings work as before.
  • governor_tick() now reads GPU power only while the GPU is busy. This doesn't change the thermal governor: Governor::tick() and cpu_advice() already ignore power when there was no recent activity.

Missing before merge:

  1. A J714s (M5 Pro) row at head. Owner: the M5 lead.

    • The g17 change runs on every M5 GPU. Each governor step reads status-config +0x12c, and if that word changes under the driver, it writes +0x128, +0x12c and +0x144 back.
    • J714s has no apple,low-power-gpu-cap, so it should never write. This row also stands in for the PR's "Not yet" line about M5 Pro/Max/Ultra.
    • The row: boot the exact head, then run a GPU load (GPUBench rt.scene or GTA V) in balanced and in performance, before and after one mem sleep. Check:
      • no GPU faults and no new firmware clamps;
      • FPS within noise of main;
      • if you have a status-config reader, +0x128, +0x12c and +0x144 still at their boot values.
  2. Conflicts after #3868. Owner: m0d16l14n1.

    • Once #3868 merges, this branch conflicts in apple,pmc.yaml and apple,clpc.yaml, where both PRs add properties after apple,low-power-gpu-cap. Keep both.
    • It also conflicts in t8142-j813-j815.dtsi. Keep apple,low-power-smc-notice; and your two new lines.
    • clpc.c, g17/mod.rs and the test scripts merge cleanly. I checked with a local merge-tree of this head onto main + #3868.
    • Your J815 kernel already carried all three PRs, so the merged content is what you tested. Please merge main, without a force push, after #3868 lands.

Before merge, on our side:

  • Hosted CI skipped apple-build, dt-checks, host-tests and KUnit on this fork PR. I'll run the local equivalents on the merge tree:
    • W=1 builds of clpc.o (plain and KUnit) and drivers/gpu/drm/asahi/;
    • the J813/J815 DTBs;
    • dt_binding_check for the new apple,acc-energy.yaml;
    • the clpc and g17 host tests.
  • clpc-gpu-demand-tests.py currently fails on main itself, at t6041_from_dt after #3965's T6041 DT change. That failure isn't from this PR.

Small fix (not blocking), same as the earlier nit: publish_m5_power_target() in g17/initdata/m5.rs cleans the enable/target line before the reason line, and issues dsb sy only after both. So the firmware can see the new enable and target before the new reason. To close that window: store the reason, dc cvac its line and dsb, then store target and enable and clean that line.

Conflicts with aurora-silicon#3868 and aurora-silicon#3992, resolved to keep both sides:

- apple,pmc.yaml and apple,clpc.yaml: apple,low-power-smc-notice, then
  apple,low-power-capacity-ceiling and apple,energy-monitor.
- t8142-j813-j815.dtsi: the notice, then the ceiling and the energy
  monitor on the CLPC node.
- clpc.c: KUnit only. Keep the T6050 GPU fabric case and the capacity
  ceiling and energy power cases.

The other files merge cleanly.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

#3868 is in main, so I merged main (48fc75eaffa6) into this branch as a normal merge commit, 1566d1695739. Your commits are unchanged, and in all 17 files the lines this PR adds and removes are the same as at 2870f8b47906.

How the conflicts were resolved, keeping both sides:

Local checks on the merge (clang 23, arm64):

  • W=1 clpc.o: 0 warnings, also with KUnit on (25 cases compiled, not run).
  • W=1 drivers/gpu/drm/asahi/: builds; no warning is in a file this PR touches.
  • run-host-tests.py: clpc 9/9, g17- 333/333.
  • dt_binding_check on apple,pmc.yaml, apple,clpc.yaml and apple,acc-energy.yaml: clean.
  • J813, J815, J704 and J714s DTBs build; only J813 and J815 have the new properties.

Still owed before merge:

  • A J714s (M5 Pro) row at this head, ours (M5 lead): the one described in the 18:00 review.
  • A short J700 boot and GPU row at this head, ours: apply_effort() and governor_restore() in g17/mod.rs also run there.
  • A review at this head. I only did the merge and didn't review it.

Your J815 row at 2870f8b47906 ran these same lines with #3646 and #3868 in the kernel, so I don't see a new J815 row as needed; the reviewer should confirm that.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 3, 2026

@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: MERGE at 1566d16

Checked: The new energy node and both CLPC binding variants pass dt-doc-validate. I ran the exact-head GPU demand and profile cleanup suites. The hardware energy loop rejects invalid deltas, samples independently of the slower SMC floor, and uses the opt-in capacity scaling only on boards that declare it. The merge retains the mainline SMC notice, with the new flags and accumulator phandle alongside it.

Follow-ups: Please keep the independent fast GPU target and CPU energy changes in separate reviewable PRs in future series.

@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.

Approving at 1566d16957397a103cc4f83a4dcf6b47e57104e5. I read the whole diff against current main and found nothing that has to change. Two rows at this head still come first (below), so please don't merge on this alone. The last push is also ours (the merge of main).

What I checked

  • Energy and power units: pJ / ns = mW is right, the multiplication is guarded, a counter that goes back drops the window, and the result is clamped before it meets the int compare. The first sample after a profile change or a resume only sets the baseline.
  • Locking and lifetime: the accumulators are read only under sample_lock and not once stopped is set, so not across suspend. The GPU power is a single word in the refcounted input and is cleared on put. The power target only changes under the device lock.
  • Boards without the new properties: apple_clpc_power_limited(), the ceilings and the power step take the same decisions as main. This includes T6050, which has a 15 W target and an SMC but no energy monitor. On the J700 the power target returns at once and the governor never arms, so what's left is one extra read per submission.
  • Rules: opt-in by DT property, no new parameter, no board or SoC test.
  • The earlier note about the order of the two cache cleans is withdrawn. The status config is mapped write-combined, and its enable word is already 1 from boot, so there's nothing to reorder.

The J815 row still counts. From the head it ran on to this one, the PR's functions and the g17 files around them are the same, except g17/mod.rs, where main changed only calibration code that T8142 doesn't run. The J815 device tree gained only #3868's line, which that kernel already had. The rest is main's own CLPC work. I couldn't read that kernel's commit (66c55f0d3c02 isn't published), so this takes your description of it as given. If a built line of the PR changes, the J815 needs to run again.

Before merge, both ours:

  1. An M5 Pro row: balanced, performance, low power and one deep sleep, with a probe on the write of the three status-config words. It has to stay at zero hits.
  2. A short Neo row on a kernel that also has other work: GPU load, idle, reboot.

Not blocking

  1. The Risk line says the status-config target matters only with a non-zero cap. The code goes further: with no cap, if the firmware ever changes +0x12c, set_maximum() and apply() in thermal.rs write the boot value back, with enable and a reason. Nobody has watched that word on an M5 Pro or Max yet, and 24240 mW would be low there. That is what row 1 looks for. If it sees one write, the fix is to leave the words alone until a cap has been published.
  2. governor_tick() returns early when the firmware has stopped or crashed, before set_power_mw(). The last GPU power then stays in CLPC, and the 100 ms loop would keep adding it. No board can hit this today (J813/J815 report 0), but it needs a 0 there before an M5 Pro or Max gets apple,energy-monitor.
  3. With m5_thermal_governor=0 the governor never runs. The cap is then published from apply_effort(), but leaving low power under a steady GPU load keeps the old cap until the GPU idles, because a cap of 0 is skipped there.
  4. apple_clpc_init_energy_monitor() uses devm_ioremap(), which ignores the bus's nonposted-mmio. These are reads and the J815 saw no SError, but devm_ioremap_resource() handles it.
  5. The 100 ms loop sees only CPU bursts on J813/J815, since GPU power reads 0 there. The commit message and the binding say CPU and GPU. One sentence in the PR on how 25 pJ, the register windows and 0x31200003 were found would help the next reader.

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:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants