Repository navigation
soc: apple: clpc: link without the SMC driver (r2) - #2846
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. 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: |
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)