Skip to content

hwmon: macsmc: offer the SoC die zone to a device tree thermal zone - #1908

Merged
DjDeveloperr merged 2 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/t8142-j815-thermal
Nov 26, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/t8142-j815-thermal

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What: macsmc-hwmon can be the thermal sensor of a device tree zone on boards that discover their SMC temperatures. The hottest-die reading is sensor 1000, and the named tripless macsmc_soc_die zone that the GPU governors read is kept in every case. No board gets a zone yet: J815 trips come later, from the machine.
Tested: J815 (MacBook Air 15" M5) at 1dfc0ffa27a9: macsmc_soc_die present (thermal_zone0, 40 °C), GPU governor hotspot reads with 0 failures. Regression at boot: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors.
Risk: two-way door. Thermal zone registration on macsmc boards with #thermal-sensor-cells; a board without a zone on sensor 1000 takes the -ENODEV path and is unchanged.
Not yet: a #thermal-sensor-cells board without sensor 1000 (M2/M3/M4 Pro) for the -ENODEV path; J813/J704 rows at this head.

Details

A node with apple,discover-temperatures (the M5 Airs) has no stable channel indices, so a device tree zone can't name one of its channels.

  1. dt-bindings, hwmon (macsmc): when such a node is a thermal sensor provider, the hottest-die reading is sensor 1000, and a zone on it gets the board's trips and cooling maps. The named zone is registered as well: the asahi GPU drivers' governors (g17 thermal.rs, m3 m3_thermal.rs) find the SoC hotspot by that name, and a device tree zone can't take it (no _ in a node name).
  2. Guard: discovered channels aren't bounded at build time. A node with 1000 or more temperature channels keeps only the named zone and logs a warning.

No J815 zone in this PR. A guessed critical trip can shut down a healthy Mac or come too late; the PMP and SMC keep enforcing the hardware limits. A J815 zone follows once the boot loader publishes the package's limits from the machine.

Changed on this head: rebased onto main; main's fan-assist trip on the named zone now sits next to the device tree zone. No AI attribution in the body or the commits.

Evidence

J815, macOS 27.2 stub, this head merged with the other J815 PRs into one test kernel on main 2943fff. Command line: default plus pcie_aspm=off and three opt-ins that don't touch hwmon.

  • /sys/class/thermal/thermal_zone0/type = macsmc_soc_die, 40 °C at idle.
  • GPU governor: 0 hotspot read failures over the suite (vkcube, es2gears, codec runs).

@m0d16l14n1

m0d16l14n1 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr out of draft, parent-first on #1532 (alias fix merged in). J815 soak: peak 99.4 °C, settles at about 99 °C with the P cluster held at 2508 MHz by the IPA governor; trips 60/100/115 °C. Please review.

@m0d16l14n1
m0d16l14n1 force-pushed the j815/t8142-j815-thermal branch from 83a0fe3 to 8d5e6d5 Compare November 19, 2026 07:27
@m0d16l14n1 m0d16l14n1 changed the title J815: slow the CPUs on the hottest SoC die reading (on #1532) J815: slow the CPUs on the hottest SoC die reading Nov 19, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 3.

The driver half is sound. When the node has #thermal-sensor-cells, devm_thermal_of_zone_register() on sensor 1000 is tried first. -ENODEV falls back to the tripless zone as before (macsmc-hwmon.c:1438-1450), and the per-channel zones that HWMON_C_REGISTER_TZ registers cannot reach index 1000.

  1. All three commits carry an Assisted-by: Claude Opus 5.5 trailer. Drop it from the commits and keep the disclosure as the last line of the PR body, in the form Assisted-by: LLM (<Vendor>:<Model>).
  2. arch/arm64/boot/dts/apple/t8142-j815.dts:67-85: sustainable-power = <9000> and the 100 °C and 115 °C trips are estimates, as the commit says. 115 °C is a critical trip, so it causes an orderly shutdown, and a guessed value there can either shut down a healthy Mac or come too late. These thermal limits need to come from the machine. The boot loader already reads the CLPC node, so it can publish the package's sustainable power target, and the die limits, into this zone (or into properties the driver reads). Until then, keep the tripless zone the driver already registers: the PMP and SMC still enforce the hardware limits, as the comment notes.
  3. t8142-j815.dts:52-61 and the commit message of 8d5e6d5 quote the machine's CLPC tuning values and macOS power figures in source and in public text. Remove those numbers from the DT comment, the commit message and the PR body. Once item 2 is done, the comment only needs to say where the value comes from.

Nit: the binding text gives the sensor-1000 rule, but the driver comment calls the value "above any temperature channel index". A static_assert against the largest channel count the driver can register would keep that true.

HW row: J815 with the trips taken from the machine: a 3-minute all-core soak with the die peak and the throttled P-cluster frequency reported, no critical trip, then 0 failed units, 0 SELinux denials and 0 new kernel errors on the default command line. Also boot J813 and J704 (same driver, no zone) with the tripless macsmc_soc_die zone still registered.

Assisted-by: LLM (Claude:Opus 5.5)

@m0d16l14n1
m0d16l14n1 force-pushed the j815/t8142-j815-thermal branch from 8d5e6d5 to 8bb24d1 Compare November 21, 2026 12:51
@m0d16l14n1 m0d16l14n1 changed the title J815: slow the CPUs on the hottest SoC die reading hwmon: macsmc: offer the SoC die zone to a device tree thermal zone Nov 21, 2026
@m0d16l14n1

m0d16l14n1 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

@RyanTheTide agreed on the trips.

  • The J815 DTS commit is dropped, and the quoted tuning and power figures go with it. The J815 keeps the tripless zone until the loader can publish the machine's limits.
  • The trailers are dropped.

On the nit: discovered channels have no build-time bound, so a static_assert can't express it. Probe now refuses the DT zone, with a warning, if temp.count reaches 1000.

The PR is now the binding + driver only.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 8bb24d1: Blockers: 1.

Earlier points: 1 (commit trailers) resolved: both commits carry only the human Signed-off-by. 2 and 3 (the J815 zone's estimated trips, and the figures quoted in the DT comment and commit message) resolved: the DTS commit and its numbers are gone. The nit is resolved another way: since discovered channels have no build-time bound, probe now keeps the tripless zone with a warning when temp.count reaches 1000 (drivers/hwmon/macsmc-hwmon.c:1452-1456). That works.

  1. drivers/hwmon/macsmc-hwmon.c:1457: a zone from devm_thermal_of_zone_register() takes its type from the DT zone node's name, not macsmc_soc_die. The in-kernel users of this zone look it up by that name: drivers/gpu/drm/asahi/g17/thermal.rs:48 and :198 read the SoC hotspot from macsmc_soc_die exactly on the discover-temperatures boards this PR is for (the comment at :46-47), and drivers/gpu/drm/asahi/m3/m3_thermal.rs:73 also uses the name. A DT node name can't contain _, so the first board that adds a zone here silently loses the GPU governor's hotspot input (it falls back to the J714 GPU-die names, which those boards don't register). The binding text ("replaces the macsmc_soc_die zone") makes that the contract. Either keep the consumers working in this series (export a helper from macsmc-hwmon that returns the die zone, whichever way it was registered, and use it in g17/m3 instead of the name lookup), or keep registering the named zone and leave the DT zone out until the consumers no longer depend on the name.

HW row: J815, J813 and J704 on this head with the default command line: macsmc_soc_die still registered (/sys/class/thermal/*/type), the GPU governor's hotspot reads on J815, 0 failed units, 0 new kernel errors. Once a board adds a zone: the same check with the DT zone, showing the governor still gets its input.

Assisted-by: LLM (Claude:Opus 5.5)

@m0d16l14n1
m0d16l14n1 force-pushed the j815/t8142-j815-thermal branch from 8bb24d1 to dfdafea Compare November 22, 2026 03:21
@m0d16l14n1

m0d16l14n1 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

@RyanTheTide fixed in dfdafea2, the second way: the named zone stays.

macsmc_hwmon_die_register() registers the tripless macsmc_soc_die zone in every case. A device tree zone on sensor 1000, when a board adds one, comes in addition to it. g17 thermal.rs and m3 m3_thermal.rs keep finding the hotspot by name, so a board with a DT zone doesn't lose the governor's input, and no consumer change is needed. Both read the same macsmc_hwmon_die_ops. The binding text now says the DT zone comes "in addition to the macsmc_soc_die zone, which is still registered for the users that look it up by name", and both commit messages say so.

I didn't take the helper route. It means a cross-module symbol from drm/asahi into macsmc-hwmon (or a symbol_get) in two Rust drivers, for a zone no board uses yet. Once a board needs the governor on the DT zone's trips, that can be done as its own change.

Checks:

  • macsmc-hwmon.c builds with W=1 and no warnings at both commits.
  • dt_binding_check on apple,smc-hwmon.yaml, and CHECK_DTBS J704/J813/J815 (no new warnings), pass.
  • checkpatch --strict is clean.
  • Rebased onto b241e35.

The rows (J815/J813/J704 with macsmc_soc_die registered and the governor's hotspot read) are still owed.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of dfdafea: no blockers.

The earlier point is resolved. macsmc_hwmon_die_register() now registers the device tree zone on sensor 1000 when a board has one, and the tripless macsmc_soc_die zone in every case (drivers/hwmon/macsmc-hwmon.c:1440-1465). So the g17 and m3 governors' lookup by name keeps working, and the binding text says the DT zone comes in addition to it. The channel-count guard and the human-only Signed-off-by lines are still in place, and the guessed J815 trips stay out.

One thing to know: the DT-zone attempt also runs on nodes without apple,discover-temperatures that have #thermal-sensor-cells (t8112.dtsi:1553, t604x.dtsi:1170, t600x-j314-j316.dtsi:1043). Without a zone on sensor 1000, devm_thermal_of_zone_register() returns -ENODEV silently and the driver goes on as before, so nothing changes there.

Rows: J815, J813 and J704 on dfdafea (owed by the author), each with macsmc_soc_die in /sys/class/thermal/*/type, 0 failed units and 0 new kernel errors. We'll boot our M2 (J413), M3 (J615) and M4 Pro (J616s) on this head to confirm the -ENODEV path leaves macsmc_soc_die and their existing zones unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

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

Formal §1–§6 pre-PR review at dfdafea293695de1715b45d92bf9335c48aee4d4 (against live integration/aurora 70a00e583b03): REQUEST_CHANGES.

Audit Summary (§1–§4, §6)

  • Code, DT bindings & lifetimes: 0 blockers.
    • Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml cleanly documents sensor 1000 for apple,discover-temperatures nodes in addition to macsmc_soc_die.
    • drivers/hwmon/macsmc-hwmon.c:1440-1465 checks hwmon->temp.count >= MACSMC_SOC_DIE_SENSOR_ID (1000) before calling devm_thermal_of_zone_register(), ignores -ENODEV silently on #thermal-sensor-cells boards without a sensor-1000 zone, and unconditionally keeps registering the named tripless macsmc_soc_die zone so g17/thermal.rs and m3/m3_thermal.rs retain their hotspot lookup.
  • §1–§4, §6 & CI: PASS — not superseded on integration/aurora, mergeable: clean, live CI green (host-tests, dt-checks), guessed J815 trips/tuning figures removed, both commits (31d02f9c611d, dfdafea29369) carry human author/committer + human Signed-off-by: only, PR body carries Assisted-by:, naming clean.

Blockers (§5 Evidence)

  1. Missing exact-head (dfdafea29369) hardware & regression evidence (explicitly noted as still owed in the PR body):
    • J815 / J813 / J704 (T8142) on dfdafea29369 (default command line): confirm macsmc_soc_die remains present in /sys/class/thermal/*/type, GPU governor hotspot read works, and full regression row (0 SELinux denials, 0 failed units, 0 new kernel errors).
    • At least one existing #thermal-sensor-cells board without sensor 1000 (e.g. M2/M3/M4 Pro): confirm the -ENODEV path leaves macsmc_soc_die and existing thermal zones unchanged with 0 new warnings/errors.

@github-actions github-actions Bot added area:power Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026
A node with apple,discover-temperatures has no stable channel indices, so
a thermal zone cannot name one of its temperature channels. Let such a
node be a thermal sensor provider for one sensor, 1000: the hottest of
its apple,soc-die-keys readings. A zone on it comes in addition to the
driver's tripless macsmc_soc_die zone, which in-kernel users look up by
name.

Signed-off-by: Nick <[email protected]>
A board that discovers its SMC temperatures (apple,discover-temperatures,
as the M5 Airs do) has no stable channel indices, so a device tree thermal
zone cannot name one of its temperature channels, and the hottest-die
zone is registered without trips. Such a board then has no thermal
policy of its own.

When the node is a thermal sensor provider, offer the hottest-die reading
as sensor 1000, above any channel index the hwmon core registers. A zone
on it gets the board's trips and cooling maps. The named
macsmc_soc_die zone is still registered in every case: the asahi GPU
drivers' governors (g17 and m3) read the SoC hotspot from that zone by
name, and a device tree zone's name cannot be macsmc_soc_die (no '_' in a
node name).
Discovered channels are not bounded at build time, so a node with 1000
or more of them keeps only the named zone, with a warning.

No board uses it yet: the J815 zone waits for limits the boot loader
reads from the machine.

Signed-off-by: Nick <[email protected]>
@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 25, 2026
@m0d16l14n1
m0d16l14n1 force-pushed the j815/t8142-j815-thermal branch from dfdafea to 1dfc0ff Compare November 25, 2026 03:45
@m0d16l14n1
m0d16l14n1 requested a review from a team as a code owner November 25, 2026 03:45
@m0d16l14n1
m0d16l14n1 requested a review from LiamRay11 November 25, 2026 03:45
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at 1dfc0ffa: ready to merge

Check Detail
CI at head ok 4 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 1dfc0ffa
Conflicts ok none
PR text ok Risk: two-way · . Thermal zone registration on macsmc boards with #thermal-sensor-cells; a board without a zone on sensor 1000 takes the -ENODEV path and is unchanged.

Areas: area:power
Merge: gh pr merge 1908 --merge (Owners and Core through the bypass: add --admin).

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

@github-actions github-actions Bot added door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 25, 2026
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr updated to 1dfc0ffa27a9: rebased onto main; main's fan-assist trip on the named zone now sits next to the device tree zone. The body is in the template, with no footer.

J815 row at this head (in the body): macsmc_soc_die present (thermal_zone0), GPU governor hotspot reads with 0 failures, regression at boot 0/0/0.

Still owed: a #thermal-sensor-cells board without sensor 1000 (M2/M3/M4 Pro) for the -ENODEV path, and J813/J704.

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

Code approved at 1dfc0ffa27a9. The J815 boot at this head kept the named die zone available to the GPU governor. Before merge, verify on a second generation that a thermal provider without sensor 1000 keeps its existing zones and reports no new errors.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 26, 2026 01:34

Superseded by the review at 1dfc0ff

@RyanTheTide

Copy link
Copy Markdown
Contributor

1dfc0ff J616s (T6040, M4 Pro, no sensor 1000) PASS: guarded one-shot combined batch (1c06fa69cde5 over main 8f99a85, 0 merge-tree diffs on 2 changed files, default cmdline, boot 1efdeb87-4c6d-44ed-9e5a-929ba5ed4c4f): 25 thermal zones registered with sane readings (0 errors; macsmc-battery 26.0 C, cpu-die-thermal 76.2 C, gpu0..6 41.2-44.8 C), hwmon3 macsmc_hwmon clean (0 macsmc-hwmon errors/warnings), 0 failed units, Enforcing, 0 new AVC, 0 GPU faults, 0 new kernel errors, Borealis VK api.smoke 8/8 pre/post 2/2 rtc1 s2idle, Wi-Fi 3/3 pre/post; stock 7.3.0-aurora-fleet89 restored.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
DjDeveloperr added a commit that referenced this pull request Nov 26, 2026
DjDeveloperr added a commit that referenced this pull request Nov 26, 2026
DjDeveloperr added a commit that referenced this pull request Nov 26, 2026
@DjDeveloperr
DjDeveloperr merged commit 2fe8e2a into aurora-silicon:main Nov 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:power Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants