Repository navigation
soc: apple: clpc: link without the SMC driver - #2693
RyanTheTide wants to merge 2 commits into
Conversation
APPLE_CLPC treats the SMC as optional ("depends on MFD_MACSMC ||
!MFD_MACSMC"), but the PHPC package-power read and the zETM High Power
mode record call apple_smc_read()/apple_smc_write(), which have no
stubs. A kernel with APPLE_CLPC=y and MFD_MACSMC unset fails to link:
clpc.c: undefined reference to `apple_smc_write'
clpc.c: undefined reference to `apple_smc_read'
That includes the driver's own clpc.kunitconfig, which does not enable
the SMC.
Test IS_ENABLED(CONFIG_MFD_MACSMC) before looking the SMC up, so both
paths return -ENODEV and the calls drop out at compile time. The low-power
profile then has only its frequency ceiling, as it already does when the
node has no apple,smc phandle. Kernels with the SMC driver are unchanged.
Fixes: bdd3bc3 ("soc: apple: clpc: T6050 platform profiles after macOS's power modes")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
apple_clpc_send_high_power() now tests IS_ENABLED(CONFIG_MFD_MACSMC) before it talks to the SMC. The host test compiles the extracted function against its own prelude, which had neither macro, so it stopped building. Define both, with the SMC driver built in, so the test keeps exercising the SMC path it checks. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
No blockers. Checked at da9e3bb: Kconfig
HW row: not needed for the Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist review at da9e3bbcab83ebb807e2be4ba797c4c98f57113e (REQUEST_CHANGES).
Checklist Summary
- §1 (No model gating): Pass — guards on
IS_ENABLED(CONFIG_MFD_MACSMC)for the optional Kconfig dependency. - §2 (No hacks / default cmdline): Pass.
- §3 (Kconfig link safety & correctness): Kconfig link safety passes (
depends on MFD_MACSMC || !MFD_MACSMCindrivers/soc/apple/Kconfig:320disallowsAPPLE_CLPC=ywithMFD_MACSMC=m, soIS_ENABLED(CONFIG_MFD_MACSMC)covers every valid build combination, and bothapple_smc_read_u32()/:824andapple_smc_write()/:1305are behind it). However, there is a real behavioral bug in the!CONFIG_MFD_MACSMCpath (see Blocker below). - §4 (Clean-room & attribution): Pass — both commits (
6fb5d1ca,da9e3bbc) have human author/committer (Ryan Murray <ryan@aurorasilicon.org>) andSigned-off-by:only; PR body includesAssisted-by:. - §5 (Evidence): KUnit (arm64 qemu with and without SMC) and host tests (
tools/asahi/clpc-high-power-cleanup-tests.py,clpc-gpu-demand-tests) pass. - §6 (Naming): Pass.
- CI: 7/7 checks PASS (
host-tests,source,rust-build,kunit,DWC3/ATC builtin-no-atc,DWC3/ATC modular-no-atc,DWC3/ATC builtin-modular-atc).
Blocker
performanceprofile permanently fails with-ENODEVwhenCONFIG_MFD_MACSMC=non ahigh_power_machinewithapple,smcin DT (drivers/soc/apple/clpc.c:1508-1510,:1337-1344):- In
apple_clpc_probe()(clpc.c:1508-1510),clpc->smc_npis still parsed andclpc->high_poweris still set totrueeven when!IS_ENABLED(CONFIG_MFD_MACSMC). apple_clpc_profile_probe()(clpc.c:1318) advertisesPLATFORM_PROFILE_PERFORMANCE, so writingperformanceentersapple_clpc_profile_set()(clpc.c:1337-1344), callsapple_clpc_send_high_power(clpc, true), receives-ENODEV, and returns early without updatingclpc->profileor clearingclpc->low_power(leaving low-power ceilings active when switchinglow-power -> performance, and debugfsstatusat:1071reportingsmc high power: off (0 records sent)despite SMC support being compiled out).- This breaks the advertised
performanceprofile in the exact!CONFIG_MFD_MACSMCbuild this PR enables, and contradicts the commit message / PR description ("as it already does when the node has noapple,smcphandle", whereclpc->high_powerisfalseandperformancesucceeds). - Fix: Gate
clpc->smc_npparsing and/orclpc->high_poweratclpc.c:1508-1510withIS_ENABLED(CONFIG_MFD_MACSMC)(while keeping theIS_ENABLED(CONFIG_MFD_MACSMC)guards inapple_clpc_read_power()andapple_clpc_send_high_power()so theapple_smc_*()calls still drop out at compile time).
- In
Non-blocking Nits
- Commit
6fb5d1ca826ccarriesFixes: bdd3bc3f17b4, butapple_smc_write()was introduced byf04da7cf87ff("soc: apple: clpc: J714s: tell the SMC about High Power mode"); please add a secondFixes:tag forf04da7cf87ff. - For §5 completeness on fleet configs (
MFD_MACSMC=y), anobjdump -d drivers/soc/apple/clpc.obefore/after comparison on the fleet config would directly prove unchanged code generation without needing a hardware boot.
Assisted-by: LLM (Gemini 4 Neon)
|
Superseded by #2846: the same two commits rebased on integration/aurora f5fae3c, plus the review fix (probe takes the |
Problem. APPLE_CLPC treats the SMC as optional (
depends on MFD_MACSMC || !MFD_MACSMC), but the PHPC package-power read and the zETM High Power mode record callapple_smc_read()/apple_smc_write(), which have no stubs. Any kernel withAPPLE_CLPC=yandMFD_MACSMCunset fails to link. That includes the driver's owndrivers/soc/apple/clpc.kunitconfig, so the CLPC KUnit suite does not build on integration/aurora today.Change. Test
IS_ENABLED(CONFIG_MFD_MACSMC)before the SMC lookup in both callers, so they return-ENODEVand the calls drop out at compile time. Without the SMC driver, the low-power profile has only its frequency ceiling, which is what already happens when the node has noapple,smcphandle. Kernels with the SMC driver (all our distro and fleet configs) are unchanged.Testing (KUnit, arm64 qemu,
kunit.py run --kunitconfig drivers/soc/apple/clpc.kunitconfig --arch=arm64):apple_smc_write,apple_smc_read)APPLE_MAILBOX/APPLE_RTKIT/MFD_MACSMC=y: 13 pass, 1 skippedcheckpatch --strictcleanStill to run. Nothing on hardware: with the SMC driver built in, the object code paths are the same.
Reviewer detail
tools/asahi/clpc-high-power-cleanup-tests.pycompiles the extracted function against its own prelude, which lackedIS_ENABLED/CONFIG_MFD_MACSMC. It now defines both, with the SMC driver built in, so the test keeps covering the SMC path. That test passes with gcc 16.1 and clang 22, its--old-ref 677be395variant still fails the pre-fix source as intended, and clpc-gpu-demand-tests passes.traces/kernel/20261121-cts-viewmask-clpc/(kunit-integ-cc145705-nosmc.log, kunit-fix-nosmc.log, kunit-fix-smc.log).Assisted-by: LLM (Claude:Opus 5.5)