Repository navigation
macsmc: Leave SMC policy to firmware and expose J616s/Neo thermal pressure - #670
Merged
Merged
Conversation
Keep the former cooling-device specifier valid for older device trees, but describe that fan policy stays with the SMC firmware. Manual target writes remain available through hwmon. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…trol The host thermal ladder assumed the SMC needed a manual request to run the fans. Sustained macOS measurements instead show firmware ramping the fans while the host makes no SMC key writes. Remove the autonomous fan cooling devices and resume work; retain explicit fanX_target control and release on suspend, shutdown and removal. Read the mode before requesting manual control. In system mode, unlock first and wait using reads instead of provoking a refused mode write. Firmware without an unlock key fails without issuing a known unsupported write. Exercise manual targets, zero refused writes, untouched lifecycle paths, suspend release, resume without reapplication, and unlock failures with the existing KUnit SMC model. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Probing a battery should not reset its persistent charge policy. Stop resetting the charging inhibitors and undocumented CH0K/CH0B keys merely because the driver bound. The earlier CHLS repair cleared a force-discharge bit left without a limit by old kernels. Warn about that state without changing it; an explicit charge_behaviour=auto request still clears it while preserving the limit byte. Keep the existing serialization and explicit charge controls. Update the KUnit coverage to verify read-only observation and explicit recovery. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Both firmware key inventories include the readable signed 32-bit mTPL key. Select it through the existing thermal-pressure property so the shared driver exposes its read-only level. On J616s macOS polls this key once per second; it is distinct from the temperature keys. Remove the J616s host active fan trips and maps. The SMC ramps the fans under sustained load without host key writes, so the earlier assumption behind the Linux fan ladder does not hold. Preserve every temperature channel, passive CPU/GPU cooling map, critical trip, and explicit manual fan control property. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The mode preflight should not introduce a read requirement for a legacy write-only mode key. Use the metadata to keep its existing direct write path, still solely under an explicit user target. Readable system-mode keys keep the unlock-before-write sequence. Cover this metadata case with the SMC model, asserting no mode read and no unlock operation for the legacy write-only path. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Keep ladder definitions and call sites stable while removing their fan trip/map instances in a final policy section. This makes independent CPU ladder updates apply cleanly in either aggregate PR landing order without restoring automatic fan writes. Drop the optional fan map on the passive trip as well, preserving the trip and its CPU cooling maps. The effective device tree retains firmware fan ownership, all existing sensor channels, and passive/critical protection. No GPU temperature producer, conversion or validity policy changes are included. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linux should leave the SMC's fan and charging policy alone until userspace asks to change it. This series removes automatic fan cooling requests and battery-policy resets at probe, avoids the deliberately refused manual-mode write, and exposes
mTPLthrough the existing DT-selected, read-onlythermal_pressure_levelattribute on J616s and J700 (Neo).For J616s, this PR supersedes the kernel-driven fan-ladder approach of #579. Its measured macOS 26.6.2 curve (fans off below about 100 C TCMz, then starting at minimum) describes the observed response; it does not establish that the host must implement that curve. The SMC starts in firmware mode 3, the measured macOS runtime windows contained zero host key writes, and Linux's refused manual-mode write correlated with an increased FOFC count. The policy here therefore leaves automatic fan control with firmware and permits host writes only for explicit user targets and their release. Firmware may itself change mode under load.
#579 is an independent outside-contributor PR against
integration/aurora. This PR neither depends on nor modifies it, and no comment was posted there. t-3618 (GPU SMC temperature production/validity) remains a separate task; no GPU temperature producer, conversion, validity filter or power-domain fix is included here.The macOS evidence has a defined scope: an AppleSMC write-path trace observed zero key writes during 30 seconds idle and 150 seconds across a load burst. A separate sustained-load observation showed the fans ramping without evidence of a missing Linux host handshake. Boot, suspend and shutdown were not traced. This supports removing the extra host policy; it does not establish that macOS never writes any SMC key throughout its lifecycle.
FOFCincreasing on a refused manual-mode write supports the counter interpretation, but its full semantics and reset conditions remain unproven.Changes:
fanX_targetis now the only entry to host manual fan control. Suspend, shutdown, removal, an explicit zero, and error recovery still release a fan previously taken over by a user request. Resume does not replay it.Ftst=1first and poll using reads until system mode ends, then write mode 1. Without an unlock key, return-EOPNOTSUPPwithout a known-refused write. Legacy mode 0 firmware keeps its direct manual/auto path. A write-only legacy mode key retains explicit direct control without acquiring a new read prerequisite; this metadata case has its own KUnit test.#cooling-cells. Keep the original ladder definitions and call sites intact as source input so independent ladder edits apply without conflict; the final section removes the resulting fan nodes, including an optional fan map on the passive trip. Every passive and critical trip, CPU cooling map, temperature channel and DT manual-control permission stays. The former binding property is deprecated so older DTs still validate. With an old DT, the new driver also cannot register autonomous fan cooling devices.charge_behaviour=autostill clears it while preserving the limit byte. Explicit charge behaviour and threshold controls remain serialized and available.apple,thermal-pressure-key = "mTPL"on both boards. Both key inventories contain it; the existing driver validates readable four-bytesi32data and hides the attribute if validation/read fails. It is an integer level, not a die temperature or percentage. J616s retains TCMz as its CPU die channel; no temperature channel is replaced or renumbered. hwmon: macsmc: Move SoC die and pressure key data into DT #642 had selected no pressure key for either board.The existing documented
fan_controlcompatibility override remains; there is no new module parameter. No machine-local override or private capture is included.SMC write audit
Audited against
aurora-wipbase8348f8244b208b5185b0764ebb21183a678e9e86: core, hwmon, power supply, reboot, RTC, input, and GPIO, including combined read/write requests. “Untraced” below means the macOS runtime trace cannot answer that lifecycle case; it does not mean macOS never does it.NTAP=1NTAP=0CHTE=0, elseCH0C=0CH0I=0auto.CH0K=0CH0B=0CHLS &= ~BIT(8)autostill clears it.CH0I=0/1auto/auto-dischargeorforce-dischargeCHTE=0/1, elseCH0C=0/1auto/auto-dischargeorinhibit-chargeCHLS(limit byte / discharge bit)auto/auto-dischargeCHWAflagF0Md/F1Md=1,F0Tg/F1Tg=clamped rpm,Ftst=1if lockedF0Md/F1Md=0,Ftst=0after the last manual fangP00..gP3f/gp00..gp3f,CMD_OUTPUT | levelpcIOeight-byte service payloadgP13template also stays, outside these boards.gPxx/gpxxcombined requests:CMD_PINMODE, fallbackCMD_IRQ_MODE,CMD_INPUT/OUTPUTMBSE=rest/offwMBSE=phra/off1There are no other direct SMC key writers in these drivers. Runtime battery/debug polling, input events and thermal pressure reads do not write keys. The scalar helpers only marshal the callers listed above.
FOFCandmTPLare never written.History reviewed before replacing the deliberate behavior:
33e0e46b6082: unlock was added because mode 3 refused manual writes; keep the qualified unlock/release, remove the initial deliberate refusal.93c3026d2e0eand478fc7de86c9: host fan cooling assumed slow/off fans meant Linux had to request cooling. The firmware-policy observations supersede that premise. arm64: dts: apple: t6040-j616s: Run the fans on the CPU die like macOS #579 tunes the host ladder removed here; this series supersedes that approach, while retaining the passive/critical backstops.0ebf821cf6c7: charging resets originated in the initial driver; they clear inherited policy on bind. Explicit charge controls already provide the appropriate policy-changing interface.ede99b3c1990: CHLS cleanup repaired a stale bit from older kernels. Preserve observation/warning and explicit recovery instead of silently changing it at probe.Validation
h-46234passed on3db457a10d5d2a5911732591570d707e06e264c9:W=1 -j8SMC/core/hwmon/power objects including KUnit code (0 warnings), binding check (0 warnings), and 33/33 arm64 QEMU KUnit tests across five suites.CHECK_DTBS=ypassed for J616s/Neo/M1 Pro/M2 usingDT_SCHEMA_FILES=hwmon/apple,smc-hwmon.yaml, with zero diagnostics from that schema. There are 57 DTC warnings; locally retained baselineh-46230logs reproduce all 57 exactly after normalizing source line numbers, with zero new warnings.h-46246confirmed the old remote run directory was absent; the original local collector logs, source proof and complete DTBs survived and were checked directly. No build was blindly replayed.mTPL. Only the 40 J616s fan cooling maps are removed, along with the active fan trips and cooling-device specifier; both DT manual fan permissions remain.h-46216also passed all then-existing 32 tests before the final write-only legacy-mode compatibility case. No target result is inferred from these models.fleet12identity, approved shared readh-46317obtained both fans at 0 rpm actual / 0 target, 1350 minimum / 5777 maximum. The running DT has no pressure-key property, hwmon has nothermal_pressure_level, and the SMC debugfs value reader is absent. FOFC, F0Md/F1Md and mTPL values were not obtainable through the existing interfaces. No module was loaded, no key written, no workload started, and fan mode is not inferred from zero tach. The candidate remains unbooted; the cold-boot/manual-target protocol below is still pending.Landing order and separate scope
The aggregate DT diff leaves every location edited by the current #579 patch untouched. The effective policy cleanup lives at the end of the board DTS and deletes fan trip/map instances by node name, including
map-fan6on the passive trip if present. It keeps that passive trip and its CPU cooling maps. There is no dependency on #579 and no copy of its new ladder in this PR.Both aggregate orders—#670 then #579, and #579 then #670—pass
git apply --check, apply without a textual conflict, and produce byte-identical source for all eight changed files. The check is pinned to #579's current head recorded in the local evidence. Published commits were preserved with a follow-up rather than a force push: these checks cover the aggregate PR diff used for landing, not individual replay of the superseded intermediate DT-removal commit. A commit-by-commit rebase should fold that intermediate removal into the final DT change first.Controller gate
h-46275passed on52cbd7f4041605e6afe8b969410baaf767f626a8: standalone and combined J616s/J616s-tether DTBs compile withW=1 CHECK_DTBS=y, with no selected hwmon-schema diagnostics, and are byte-identical with or without the current #579 patch. Both aggregate landing orders produce identical source. Both DTBs retain mTPL, 480 sensor nodes and all 40 CPU cooling maps, with zero fan cooling maps. Driver and Neo source is byte-for-byte unchanged from the 33/33-tested head3db457a10d5d2a5911732591570d707e06e264c9; all six commits pass strict checkpatch.Lead verification
First verify fresh J616s reference identity attestation in the controller. Boot the baseline kernel + matching DTB through the approved cold-boot workflow with bootguard fallback; capture the following immediately after boot and again after 60 seconds. Repeat after an approved cold boot of this series with its matching DTB, on the same firmware. Save both outputs; compare starting FOFC and its delta, rather than assuming a warm reboot resets it. This worker did not execute any of these target commands.
Read-only command body for
aurora-ctl hw request execute --device j616s --mode shared --task <task-id> --timeout 60s -- '<body>':Important measurement limit: stock in-tree
macsmc-hwmondebugfskeysis M3-gated and prints metadata, plus T/P floats; it cannot supply FOFC or fan-mode values on these boards. The existing research reader must match the running kernel and must be confirmed to return a fresh snapshot; a cached dump is not an after-test measurement. Provisioning such a reader, if absent, is a separate lead-approved step. Do not decode FOFC by assuming native endianness: retain its raw bytes and compare using the same interpretation as the baseline. Mode 3 is the expected idle firmware state, but firmware can itself change mode under load; a non-3 mode alone does not prove a host write.For Neo, use the same read-only hwmon loop with explicit controller device
neoand identityapple,j700: expect a read-onlythermal_pressure_levelif runtime key validation succeeds, and no fans.Only the lead, in a separately approved exclusive J616s request, should run the following manual test. It writes SMC keys through hwmon and is outside the worker's read-only hardware scope. Verify the candidate source identity, matching DTB and initial firmware ownership first. Record fresh FOFC/modes/Ftst immediately before and after it. Expected: no deliberately refused mode write, tach near the requested speed, and release to firmware. The SMC may ramp down slowly after release; do not require an immediate zero tach.
Rollback of manual control is an explicit zero to both targets; retain any failed-release output and use the approved recovery workflow if needed. Kernel/DT rollback uses the previous known-good pair through the controller with bootguard fallback. No persistent firmware policy, FOFC reset, or thermal-pressure write is part of this test.