Skip to content

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

Open
m0d16l14n1 wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/t8142-j815-thermal
Open

m0d16l14n1 wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/t8142-j815-thermal

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Infrastructure for a SoC die thermal zone on boards that discover their SMC temperatures. The J815's zone itself is left out until its limits come from the machine (below).

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

Change

  1. dt-bindings, hwmon (macsmc): when such a node is a thermal sensor provider, the hottest-die reading is sensor 1000. A zone on it gets the board's trips and cooling maps. Changed on this head (review): the tripless macsmc_soc_die zone is registered in every case, next to a device tree zone. The asahi GPU drivers' governors (g17 thermal.rs, m3 m3_thermal.rs) read the SoC hotspot from that zone by name, and a device tree zone can't take that name (no _ in a node name). So a board that adds a zone keeps the governors' input. The binding now says the DT zone comes in addition to the named one.
  2. Guard: discovered channels are not bounded at build time, so a static assert can't keep 1000 above them. A node with 1000 or more temperature channels keeps the tripless zone, with a warning.

Changed on this head (review): the J815 DTS commit (a zone with estimated sustainable power and trips) is dropped, and so are the numbers it quoted. A critical trip that is guessed can shut down a healthy Mac, or come too late. The J815 keeps the tripless macsmc_soc_die zone, and the PMP and SMC still enforce the hardware limits. The zone comes back once the boot loader publishes the package's sustainable power target and die limits from the machine. That is a separate aura change, not started. Rebased onto integration/aurora b241e35.

Checks on this head: macsmc-hwmon.c builds with W=1 and no warnings at both commits, dt_binding_check on apple,smc-hwmon.yaml and CHECK_DTBS on the J813/J815 DTBs are clean, and checkpatch --strict is clean.

Still owed (HW rows): J815, J813 and J704 (same driver, no zone) on this head, each with the tripless macsmc_soc_die zone still registered; 0 failed units, 0 new kernel errors.

Part of the J815 bring-up: board results are summarised in discussion #135.

Assisted-by: LLM (Claude:Opus 5.5)

@m0d16l14n1

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.

Assisted-by: Claude Opus 5.5

@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

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.

Assisted-by: LLM (Claude:Opus 5.5)

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

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 <nekreshen@yandex.ru>
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 tripless
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 the tripless 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 <nekreshen@yandex.ru>
@m0d16l14n1
m0d16l14n1 force-pushed the j815/t8142-j815-thermal branch from 8bb24d1 to dfdafea Compare November 22, 2026 03:21
@m0d16l14n1

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.

Assisted-by: LLM (Claude:Opus 5.5)

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

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