Repository navigation
hwmon: macsmc: SMC key inventory and sensor key checks on every SoC - #2304
Conversation
Commit 2604bb0 ("hwmon: macsmc: expose read-only SMC key inventory on T6050") enabled the debugfs "keys" listing on T6050 next to the M3 SoCs. The listing only queries key metadata through the SMC's own key enumeration and reads readable 32-bit float T*/P* keys; it writes nothing, and it does its work only when root reads the file. None of that depends on the SoC, and the listing is how the keys a machine has are found for its device tree, on every SMC. Create it on every SoC. Fixes: 2604bb0 ("hwmon: macsmc: expose read-only SMC key inventory on T6050") Suggested-by: Satya Benson <satya@benson.earth> Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Commit c91c5f4 ("hwmon: macsmc: preserve the legacy sensor export policy") limited the key checks in macsmc_hwmon_create_sensor() to the M3 SoCs: a device tree sensor is set up only if the SMC reports its key as readable and as a 4-byte "flt " or an 8-byte "ioft". Elsewhere a sensor whose key fails those checks still got a channel. macsmc_hwmon_read_key() decodes only those two types and returns -EOPNOTSUPP for any other, so such a channel can only ever return an error, whatever the SoC. Apply the checks on every SoC and drop macsmc_hwmon_is_m3(), which has no other user. A temperature node of a thermal sensor provider (#thermal-sensor-cells) keeps its channel slot when it fails, as before, so thermal zones that refer to channels by index are not renumbered. Fixes: c91c5f4 ("hwmon: macsmc: preserve the legacy sensor export policy") Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Boot rows on hardware, M1 Pro and M2. These ran on combined test kernels that carry these two commits (
The M2 result fits the change, but not the commit message: it says such a channel "could only ever return an error", and on the M2 these three returned a fixed wrong value. It may be worth rewording that before merge, e.g. "returns an error or a meaningless value". Which check drops them (readable flag or size) is not confirmed yet. Assisted-by: LLM (Claude:Opus 5.5) |
|
Neo (J700) and 14" MacBook Pro M4 Pro (J616s), on combined test kernels carrying these commits: hwmon channel lists are identical to production (Neo 213, J616s 480 channels, same indices and labels), thermal zones are unchanged, 0 probe errors, s2idle 2/2 on each. The debugfs Assisted-by: LLM (Claude:Opus 5.5) |
Problem
Two macsmc-hwmon features were enabled by SoC list rather than by what the SMC reports:
keys) was created only on the M3 SoCs and T6050 (drivers/hwmon/macsmc-hwmon.c:1683, from 2604bb0). It enumerates keys, prints their type, size and flags, and reads readable float T*/P* keys. Nothing in it depends on the SoC, and it is how a machine's sensor keys are found for its device tree.flt4 bytes orioft8 bytes) ran only on the M3 SoCs (line 866, from c91c5f4). Elsewhere such a key still got a channel that could only ever return-EOPNOTSUPP, becausemacsmc_hwmon_read_key()decodes only those two types.Change
macsmc_hwmon_is_m3(), which has no other user. A temperature node on a thermal sensor provider (#thermal-sensor-cells, T8140) keeps its channel slot when it fails, as before, so thermal zones are not renumbered.Credit: Satya Benson wrote the inventory (2604bb0). Chris Kearney wrote the key checks (c91c5f4).
Testing
drivers/hwmon/macsmc-hwmon.o). See the build log below.Still to run
On Neo (J700), J616s, M1 Pro (J316s) and M2 (J413):
ls /sys/kernel/debug/ | grep macsmcandhead -3 /sys/kernel/debug/macsmc-hwmon*/keys; wc -l /sys/kernel/debug/macsmc-hwmon*/keys. Expected: the directory exists, and the file lists# N keysfollowed by N lines.sensors(orls /sys/class/hwmon/hwmon*/) compared against the base kernel. Expected: the same channels and labels. A channel that disappears was a key that always failed with-EOPNOTSUPP/-EACCES, and the kernel log names it. If one does, the second commit can be dropped on its own.Reach and safety
Both changes reach every SoC with an SMC hwmon node: T8103, T8112, T6000-T6002, T6020-T6022, T6030-T6034, T8122, T6040/T6041, T6050, T8132, T8140 and T8152. The inventory is passive until read. The key check only removes channels whose reads cannot succeed on any SoC, because the read path rejects every other type.
Build log
Compiled with the release config's kbuild flags plus the W=1 warning set (clang,
-fsyntax-only):The full kbuild object build in a clean O= tree is pending and will be added here.
Assisted-by: LLM (Claude:Opus 5.5)