Repository navigation
soc: apple: clpc: link without the SMC driver (r2) - #2846
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. Probe does
not take the apple,smc phandle either in such a kernel, so High Power
mode stays off and the performance profile switches like any other
(without that, a machine with apple,high-power-mode would fail every
write of "performance" with -ENODEV). 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: f04da7c ("soc: apple: clpc: J714s: tell the SMC about High Power mode")
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>
|
Review at 69bc2c3. Right fix. With Not this PR: |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist review (§1–§6) at 69bc2c322912755ce6d54dbd3437fe702cbba139 (APPROVE).
Checklist Summary
- §1 (No model gating): Pass — guards strictly on
IS_ENABLED(CONFIG_MFD_MACSMC)for the optional Kconfig dependency. - §2 (Production-ready / default cmdline): Pass — no cmdline parameters, hacks, or workarounds.
- §3 (Safety & Kconfig link correctness): Pass — verified every SMC touchpoint in
drivers/soc/apple/clpc.c:drivers/soc/apple/Kconfig:320(depends on MFD_MACSMC || !MFD_MACSMC) forbidsAPPLE_CLPC=ywithMFD_MACSMC=m, soIS_ENABLED(CONFIG_MFD_MACSMC)matches every valid build configuration.- Both
apple_smc_*()call sites (apple_smc_read_u32()atclpc.c:828andapple_smc_write()atclpc.c:1315) sit behind!IS_ENABLED(CONFIG_MFD_MACSMC)and fold out at compile time whenMFD_MACSMC=n, whileapple_clpc_smc()remains referenced (no unused-function warning) and uses only OF/driver-core APIs. - The
#2693blocker is cleanly fixed inapple_clpc_probe()(clpc.c:1545-1547): gatingof_parse_phandle(dev->of_node, "apple,smc", 0)onIS_ENABLED(CONFIG_MFD_MACSMC)keepsclpc->smc_np = NULLandclpc->high_power = falsewhenMFD_MACSMC=n, so High-Power-only machines skip registering"apple-smc", machines withlow_power_khzswitchperformancewithout-ENODEV, debugfs omits the SMC High Power line, andapple_clpc_stop()skips the SMC write (of_node_put(NULL)is a safe no-op). tools/asahi/clpc-high-power-cleanup-tests.pydefinesCONFIG_MFD_MACSMCandIS_ENABLED()so the host test continues exercising the SMC path.
- §4 (Clean-room & attribution): Pass — both commits (
a4c4da52403e,69bc2c322912) carry human author/committer and humanSigned-off-by:only, include bothFixes:tags (f04da7cf87ff,bdd3bc3f17b4), and supersede#2693on a fresh branch without force-pushing; PR body includesAssisted-by:. - §5 (Evidence): Pass — KUnit passes with stock
clpc.kunitconfig(unblocking#2821) and withMFD_MACSMC=y, fleet-configobjdump -dshows identical codegen whenMFD_MACSMC=y(no hardware row owed), and all 7 CI checks (host-tests,source,rust-build,kunit, and all 3DWC3/ATCbuild matrices) are green. - §6 (Naming): Pass — touches only existing in-tree paths.
Clean replacement for #2693; ready to unblock #2821 and queue for merge.
Assisted-by: LLM (Gemini 4 Neon)
|
Merge-train adversarial review (MERGETRAIN-LINUX4) at 69bc2c3: no blockers. Merges clean on integration/aurora 000ab96. Full reviewVERDICT: NO BLOCKERS Blockers: none. What I checked:
Nits:
Missing rows: none owed. Codegen is unchanged when SMC=y/m, which follows from the source. I did not re-run the author's objdump. The CI kunit job (stock clpc.kunitconfig, SMC=n) is green, and that covers the link case. Assisted-by: LLM (Claude:Opus 5.5) |
Problem.
APPLE_CLPCtreats 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. A 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 (it blocks #2821).Change. Same two commits as #2693, rebased on integration/aurora f5fae3c (279 commits on, incl. #2784 and #2816), plus Dj's review of #2693:
apple_clpc_read_power()andapple_clpc_send_high_power()testIS_ENABLED(CONFIG_MFD_MACSMC)first, so the SMC calls drop out at compile time.apple,smcphandle only when the SMC driver is built. Without itclpc->high_powerstays false, so writingperformanceswitches the profile like any other instead of failing with-ENODEVand leaving the low-power ceiling in place.Fixes:for f04da7c, which addedapple_smc_write().No new gate: the guard is the Kconfig symbol of the optional dependency. Kernels with the SMC driver (all our distro and fleet configs) are unchanged.
Testing.
clpc.kunitconfig(no SMC) links and passes 11/11; withMFD_MACSMC=y13 pass, 1 skip (needsUCLAMP_TASK).clpc.obuilt with the fleet config (RUST off for the one-object build): withMFD_MACSMC=y, tip and this head give the same normalizedobjdump -d(0 lines of diff, text 22025 bytes both). WithMFD_MACSMC=nandACPI_PLATFORM_PROFILE=y, tip has undefinedapple_smc_read/apple_smc_writeand still parsesapple,smc; this head has neither.tools/asahi/clpc-high-power-cleanup-tests.pyandclpc-gpu-demand-tests.pypass; checkpatch --strict clean.Still to run. Nothing on hardware: with the SMC driver the code is byte-for-byte the same.
Supersedes #2693 (fresh branch instead of a force push).
Review points from #2693 and where they went
performancefails with-ENODEVon a High Power machine whenMFD_MACSMC=n. Fixed inapple_clpc_probe():if (IS_ENABLED(CONFIG_MFD_MACSMC)) clpc->smc_np = of_parse_phandle(...), soclpc->high_power = clpc->smc_np && high_poweris false.apple_clpc_profile_set()then never callsapple_clpc_send_high_power(), updatesprofileand clearslow_power, and debugfs prints nosmc high powerline. The compile-time guards in both callers stay.Fixes: f04da7cf87ff ("soc: apple: clpc: J714s: tell the SMC about High Power mode")added.MFD_MACSMC=y: identical).Objects (sha256 prefix, text, undefined SMC symbols,
apple,smcstrings):(
smc-y-headdiffers fromsmc-y-tiponly in line-number data; the disassembly is the same.)Assisted-by: LLM (Claude:Opus 5.5)