Repository navigation
soc: apple: clpc: offer platform profiles in kernels without ACPI - #3995
Conversation
Distribution kernels build without ACPI. ACPI_PLATFORM_PROFILE sat under `if ACPI` and was built only inside drivers/acpi/, so APPLE_CLPC's `select ACPI_PLATFORM_PROFILE if ACPI` did nothing there and the driver skipped devm_platform_profile_register(): no /sys/class/platform-profile on the M5 Pro. The class needs nothing from ACPI. Define the symbol outside `if ACPI`, build platform_profile.o without ACPI too, select it unconditionally, and request it in asahi.config so a distribution build fails loudly if it is ever dropped again. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Reviewed 4369a64 against its base and verified the full tree matches #2549. Arm64 sources the ACPI Kconfig with ACPI disabled, Kbuild selects exactly one platform-profile object in either configuration, and the no-ACPI code has no reference to acpi_kobj. The carried J714s and K114s rows cover profile registration and switching on this tree.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 4369a64622c2 once a no-regression boot on a second generation (J773g or J700) passes at this head and CI finishes. No blocking findings.
Checked
git rev-parse 4369a646^{tree}is601aaff45196d4409734bc5ed6e15d8283cad892, the same as #2549's4dfa5b66^{tree}, and both have the same merge basee0ee46a1. So the J714s row (#2549, comment 7066988691) and the K114s row (comment 7259129712) ran this exact tree, and both passed.- The one commit is authored and signed off by Diljit Singh. There is no Co-Authored-By, Assisted-by or "Generated with" line in the commit or the body.
- No constants from reverse engineering: the change is Kconfig, Makefile and a
CONFIG_ACPIguard aroundacpi_kobj. - With ACPI off,
drivers/Makefilebuildsacpi/platform_profile.o. With ACPI on,drivers/acpi/Makefilebuilds it as before, and theifndef CONFIG_ACPIkeeps it from being listed twice. Without ACPI,platform_profile_legacy_kobj()returns NULL, so the legacy/sys/firmware/acpifiles are never created and the class interface works as before. - Since
e0ee46a1,mainhas changedasahi.configanddrivers/soc/apple/Kconfig(Bluetooth and DRM config lines, the panel-notch symbols). None of it touches the CLPC or platform-profile lines, and GitHub's merge ref is clean.
Local checks (pc, arm64, LLVM, this head)
- asahi config (ACPI on, as the lab kernel):
make W=1 drivers/acpi/platform_profile.o drivers/soc/apple/clpc.obuilds with 0 warnings. - The same config with ACPI off (as the distribution kernels):
CONFIG_ACPI_PLATFORM_PROFILE=ycomes fromAPPLE_CLPC=y, and both objects build with W=1 and 0 warnings.make -n drivers/builds onlyplatform_profile.ofromdrivers/acpi/and links it intodrivers/built-in.a. checkpatch.plon 4369a64: 0 errors, 0 warnings.- Host tests (the
host-tests.ymlcontainer,run-host-tests.py): 437/437 passed. - Hosted
apple-build,host-testsandKUnit planare still queued.
Still owed: a boot of this head on J773g or J700 (they register no profile) showing the empty /sys/class/platform-profile and no regression: 0 failed units, 0 AVC denials, 0 new kernel errors.
|
J773g (M4 mini, T8132, 27.2) |
What: Build
ACPI_PLATFORM_PROFILEwhen ACPI is off, so apple-clpc registers its platform profiles on the distribution kernels (Fedora, alarm and NixOS all build with# CONFIG_ACPI is not set). This replaces #2549 with the same tree. Only the commit message changes: it drops an AI co-author trailer.Tested: #2549's rows ran this exact tree (
601aaff4): the 14-inch M5 Pro J714s passed with powerprofilesctl switching profiles, and so did a K114s (T6050) with the same config as Fedora's kernel. Kconfig resolution over the alarm, Fedora and NixOS configs: exactly one line differs in each, the newCONFIG_ACPI_PLATFORM_PROFILE=y.Risk: two-way door · kernels built without ACPI. Every Mac whose CLPC has a low-power ceiling (from the driver's table or the boot loader's
apple,low-power-frequency-max-mhz) or High Power mode gains power profiles: T6050, T6041, T8132 and others. The rest get an empty platform-profile class directory.Not yet: none. The second generation is the M4 mini (J773g, T8132) at
4369a646: it does register a profile, and it switched through all three (#3995 (comment)).Details
The M5 Pro (J714s) release gate found no
/sys/class/platform-profileon Aurora Edge (kernel-aurora 7.3.0-43, e0ee46a). The lab kernel has the class. Without it, powerprofilesctl and the GNOME and KDE power-mode controls have nothing to switch.Root cause. The distribution configs (Fedora, alarm and NixOS) all build with
# CONFIG_ACPI is not set.ACPI_PLATFORM_PROFILEwas defined insideif ACPIindrivers/acpi/Kconfig, and its object was built only fromdrivers/acpi/, whichdrivers/Makefileenters only withCONFIG_ACPI. So APPLE_CLPC'sselect ACPI_PLATFORM_PROFILE if ACPIdid nothing there.IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)inapple_clpc_probe()was then false, and the driver silently skippeddevm_platform_profile_register(). The lab kernel starts from defconfig, which hasCONFIG_ACPI=y. Since 1d9f65e the class also registers on a device tree boot, so the lab kernel has profiles. A distro config line could not have fixed this, because Kconfig drops the symbol while ACPI is off.Change
ACPI_PLATFORM_PROFILEsymbol (promptless, select-only) now sits outsideif ACPI.drivers/Makefilebuildsacpi/platform_profile.owhen ACPI is off, the same waydrivers/rasbuildsamd/fmpm.o. With ACPI on, nothing changes.platform_profile.creadsacpi_kobjonly withCONFIG_ACPI. Without it there is no legacy/sys/firmware/acpiinterface, and the class interface works as before.IS_REACHABLEstays in place for COMPILE_TEST architectures that do not sourcedrivers/acpi/Kconfig.asahi.configrequestsCONFIG_ACPI_PLATFORM_PROFILE=y. Each distro'svalidate-config.pythen fails the build if Kconfig ever drops it again.Checks
olddefconfigwith LLVM=1 over alarm's committed config, Fedora'sconfig+fedora.config, and NixOS'skernel/config+nixos.config. Before this change:# CONFIG_ACPI is not setand noACPI_PLATFORM_PROFILEin any of the three. After it: exactly one line differs in each resolved config, the newCONFIG_ACPI_PLATFORM_PROFILE=y. alarm and Fedoravalidate-config.pypass with the new asahi.config line.Other registrants. The other platform-profile drivers in the tree are amd-pstate, surface_platform_profile, int340x soc_slider and the x86 platform drivers (acer-wmi, amd-pmf, asus-wmi, bitland-mifs-wmi, alienware-wmi-wmax, dell-pc, hp-wmi, inspur, ideapad-laptop, thinkpad_acpi, lenovo wmi-gamezone, samsung-galaxybook). All of them depend on X86 or ACPI, so none can build in these arm64 configs. Within apple-clpc, only T6050 (any machine) and T6041 (M4 Max) set
low_power_khz. T8140 (the Neo), T8132, T8142 and T8152 register no profile. On those machines the change adds an empty class directory and nothing else.Base. The branch is e0ee46a, the Edge kernel, plus this one commit. A 7.3.0-44 Edge rebuild can pin this head and differ from the CTS-qualified 7.3.0-43 only by this change. The touched files are unchanged between e0ee46a and the integration/aurora tip, so it merges cleanly.
Distro drafts.
Fedora needs one more piece before profiles are useful there. tuned-ppd's acpi plugin writes only
/sys/firmware/acpi/platform_profile, and aurora-power-budget stands aside onceapple-clpcregisters. So Fedora needs a bridge to the class device first (details in #451).