Make platform profiles firmware independent
Subsystems (8)
cover Make platform profiles firmware independent
Make platform profile selection independent of ACPI firmware.
The provider API already uses struct device, profile enums and callbacks; it does not require an ACPI handle or firmware node. However, the core is built under drivers/acpi/, its Kconfig symbol depends implicitly on ACPI, initialization fails when ACPI is disabled, and the system-wide profile interface is only exposed under /sys/firmware/acpi/.
This series moves the core to drivers/platform/profile/ and introduces CONFIG_PLATFORM_PROFILE, updating all existing provider selectors. It retains the tristate configuration and platform_profile module name. Firmware-specific discovery and profile operations remain with providers. The core can also be selected directly through its Kconfig prompt.
An optional ACPI adapter obtains the legacy sysfs kobject and is linked into the same module. The generic core contains no ACPI types or symbols and initializes without ACPI support or with ACPI disabled at boot. The existing /sys/firmware/acpi/platform_profile and /sys/firmware/acpi/platform_profile_choices attributes remain available on active ACPI systems.
The new system-wide interface is:
/sys/kernel/platform_profile/choices
/sys/kernel/platform_profile/profile
Both aggregate frontends use the same callbacks, handler set and profile semantics. The per-provider /sys/class/platform-profile/ interface is preserved. Notifications cover both aggregate frontends and direct per-provider writes. The new sysfs location is proposed ABI.
The first patch fixes the lock/lifetime boundary before adding another
frontend: sysfs teardown must not drain callbacks while holding the mutex those callbacks need. A separate registration mutex serializes lifecycle changes, while a profile-lock-protected handler list determines aggregate membership independently of the class device's teardown state.
The second patch extracts the core and uses subsys_initcall_sync() so it initializes after ACPI and before built-in thermal and CPUFreq consumers. The third adds the generic aggregate interface, and the fourth documents the interfaces and extends maintainer coverage.
Validation:
- ARM64 built-in core with CONFIG_ACPI=n: W=1 build and sparse.
- x86 modular core with CONFIG_ACPI=y: W=1 object build and sparse.
- Full x86 kernel link and QEMU boot with lockdep and list debugging, with active ACPI and with acpi=off.
- Firmware-less providers exercising common and hidden choices, profile reads/writes, invalid input, mixed profiles, cycling, partial callback failures, POLLPRI and legacy/generic shared state.
- Concurrent sysfs I/O with two persistent providers while a third provider is registered and removed 200 times, last-provider attribute removal and repeated provider module reloads.
The provider API and profile names are unchanged. Aggregate writes retain their sequential, non-transactional behavior: a failing callback does not roll back providers already updated.
Daniel Lezcano (4):
platform profile: Separate handler locking from sysfs lifetime platform profile: Extract the core from ACPI
platform profile: Add firmware-neutral aggregate sysfs interface platform profile: Document firmware-independent profile selection
.../ABI/testing/sysfs-class-platform-profile | 2 +-
.../ABI/testing/sysfs-kernel-platform_profile | 30 +++
.../ABI/testing/sysfs-platform_profile | 7 +-
.../userspace-api/sysfs-platform_profile.rst | 41 +++-
MAINTAINERS | 6 +
drivers/acpi/Kconfig | 3 -
drivers/acpi/Makefile | 1 -
drivers/cpufreq/Kconfig.x86 | 2 +-
drivers/platform/Kconfig | 16 ++
drivers/platform/Makefile | 2 +
drivers/platform/profile/Makefile | 5 +
drivers/platform/profile/acpi.c | 15 ++
.../profile/core.c} | 195 +++++++++++++-----
drivers/platform/profile/profile.h | 17 ++
drivers/platform/surface/Kconfig | 6 +-
drivers/platform/x86/Kconfig | 10 +-
drivers/platform/x86/amd/pmf/Kconfig | 2 +-
drivers/platform/x86/dell/Kconfig | 4 +-
drivers/platform/x86/hp/Kconfig | 2 +-
drivers/platform/x86/lenovo/Kconfig | 6 +-
drivers/thermal/intel/int340x_thermal/Kconfig | 2 +-
include/linux/platform_profile.h | 3 +
22 files changed, 288 insertions(+), 89 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-kernel-platform_profile
create mode 100644 drivers/platform/profile/Makefile
create mode 100644 drivers/platform/profile/acpi.c
rename drivers/{acpi/platform_profile.c => platform/profile/core.c} (79%)
create mode 100644 drivers/platform/profile/profile.hbase-commit: d0cd1e850e1602729dd60dc3c5fd96f80e0cdc5d
Signature · 1 line
2.43.0
PATCH 1/4 platform profile: Separate handler locking from sysfs lifetime
Registration and removal currently hold profile_lock across device_unregister() and sysfs_update_group(). These operations can remove sysfs attributes and wait for their active callbacks to finish. The profile read and write callbacks acquire profile_lock themselves, so a concurrent access can deadlock:
Removal/update path Active sysfs callback ------------------- --------------------- acquire profile_lock hold kernfs active reference
remove a sysfs attribute wait for profile_lock
wait for its active references
The removal path cannot finish until the callback returns, and the callback cannot return until the removal path releases profile_lock. This applies both to per-provider device teardown and to updates of the legacy aggregate attribute group.
Simply dropping profile_lock around these operations is insufficient. Aggregate operations currently discover providers through the class device list. A provider being unregistered could therefore still be selected for an aggregate read, write or cycle while its sysfs files are being torn down. Concurrent registrations and removals would also race when updating aggregate attribute visibility.
Introduce profile_registration_lock to serialize registration, removal and aggregate sysfs updates. Sysfs callbacks never acquire this mutex. Retain profile_lock for profile operations and use it to protect an explicit list of handlers participating in the aggregate interface.
Add a handler to that list only after device_register() succeeds. On removal, unlink it under profile_lock before calling device_unregister(). Acquiring profile_lock first waits for any aggregate operation already using the handler to complete; unlinking prevents later aggregate operations from finding it. Release profile_lock before draining sysfs callbacks, allowing active per-provider callbacks to complete before the device is released. Apply the same unlink-before-unregister ordering to registration error cleanup.
Walk this list for aggregate reads, writes and profile cycling, and use its emptiness to determine aggregate attribute visibility. The class devices remain the per-provider userspace interface.
There can now be an interval between removing the last handler from the list and removing the aggregate attributes. Explicitly reject choices reads and writes during that interval: the intersection bitmap starts with every bit set, so an empty traversal must not advertise all profiles or report a successful write without updating a provider.
This also establishes the locking and lifetime boundary needed to expose the aggregate operations through a second, firmware-independent sysfs interface later in the series.
--- drivers/acpi/platform_profile.c | 75 ++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 33 deletions(-)
drivers/acpi/platform_profile.c +42 -33
@@ -8,6 +8,7 @@#include <linux/bits.h> #include <linux/cleanup.h> #include <linux/init.h> +#include <linux/list.h> #include <linux/mutex.h> #include <linux/platform_profile.h> #include <linux/sysfs.h>
@@ -15,8 +16,12 @@#define to_pprof_handler (d) (container_of(d, struct platform_profile_handler, dev))static DEFINE_MUTEX (profile_lock); +/* Serialize registration and sysfs updates without blocking sysfs callbacks. */ +static DEFINE_MUTEX (profile_registration_lock); +static LIST_HEAD (profile_handlers);struct platform_profile_handler { +struct list_head node;const char *name;struct device dev;int minor;
@@ -44,6 +49,22 @@ static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST);static DEFINE_IDA (platform_profile_ida); +static int profile_walk_handlers (void *data, +int (*fn)(struct device *dev,void *data)) +{ +struct platform_profile_handler *handler; +int ret; + +lockdep_assert_held (&profile_lock); +list_for_each_entry (handler, &profile_handlers, node) { + ret =fn (&handler->dev, data); +if (ret) +return ret; + } + +return 0 ; +} +/** * _commmon_choices_show - Show the available profile choices * @choices: The available profile choices
@@ -306,20 +327,18 @@ static ssize_t platform_profile_choices_show(struct kobject *kobj,int err; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - err =class_for_each_device (&platform_profile_class,NULL , - &data, _aggregate_choices); + err =profile_walk_handlers (&data, _aggregate_choices);if (err)return err;if (data.count ==1 ) { - err =class_for_each_device (&platform_profile_class,NULL , - &data, _remove_hidden_choices); + err =profile_walk_handlers (&data, _remove_hidden_choices);if (err)return err; } }/* no profile handler registered any more */ -if (bitmap_empty (data.aggregate,PLATFORM_PROFILE_LAST )) +if (!data.count ||bitmap_empty (data.aggregate,PLATFORM_PROFILE_LAST ))return -EINVAL ;return _commmon_choices_show (data.aggregate, buf);
@@ -384,8 +403,7 @@ static ssize_t platform_profile_show(struct kobject *kobj,int err; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - err =class_for_each_device (&platform_profile_class,NULL , - &profile, _aggregate_profiles); + err =profile_walk_handlers (&profile, _aggregate_profiles);if (err)return err; }
@@ -423,15 +441,13 @@ static ssize_t platform_profile_store(struct kobject *kobj,return -EINVAL ; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - ret =class_for_each_device (&platform_profile_class,NULL , - &data, _aggregate_choices); + ret =profile_walk_handlers (&data, _aggregate_choices);if (ret)return ret; -if (!test_bit (i, data.aggregate)) +if (!data.count || !test_bit (i, data.aggregate))return -EOPNOTSUPP ; - ret =class_for_each_device (&platform_profile_class,NULL , &i, - _store_and_notify); + ret =profile_walk_handlers (&i, _store_and_notify);if (ret)return ret; }
@@ -450,22 +466,11 @@ static struct attribute *platform_profile_attrs[] = {NULL }; -static int profile_class_registered (struct device *dev,const void *data) -{ -return 1 ; -} -static umode_t profile_class_is_visible (struct kobject *kobj,struct attribute *attr,int idx) { -struct device *dev; - - dev =class_find_device (&platform_profile_class,NULL ,NULL , profile_class_registered); -if (!dev) -return 0 ; - -put_device (dev); +guard (mutex)(&profile_lock); -return attr->mode; +return list_empty (&profile_handlers) ?0 : attr->mode; }static const struct attribute_group platform_profile_group = {
@@ -502,8 +507,7 @@ int platform_profile_cycle(void)int err; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - err =class_for_each_device (&platform_profile_class,NULL , - &profile, _aggregate_profiles); + err =profile_walk_handlers (&profile, _aggregate_profiles);if (err)return err;
@@ -512,8 +516,7 @@ int platform_profile_cycle(void) profile == PLATFORM_PROFILE_LAST)return -EINVAL ; - err =class_for_each_device (&platform_profile_class,NULL , - &data, _aggregate_choices); + err =profile_walk_handlers (&data, _aggregate_choices);if (err)return err;
@@ -525,8 +528,7 @@ int platform_profile_cycle(void)PLATFORM_PROFILE_LAST , profile + 1); - err =class_for_each_device (&platform_profile_class,NULL , &next, - _store_and_notify); + err =profile_walk_handlers (&next, _store_and_notify);if (err)return err;
@@ -583,7 +585,7 @@ struct device *platform_profile_register(struct device *dev, const char *name, } } -guard (mutex)(&profile_lock); +guard (mutex)(&profile_registration_lock);/* create class interface for individual handler */ minor =ida_alloc (&platform_profile_ida,GFP_KERNEL );
@@ -604,6 +606,8 @@ struct device *platform_profile_register(struct device *dev, const char *name,put_device (ppdev); goto cleanup_ida; } + scoped_guard(mutex, &profile_lock) +list_add_tail (&to_pprof_handler (ppdev)->node, &profile_handlers);sysfs_notify (acpi_kobj,NULL ,"platform_profile" );
@@ -614,6 +618,8 @@ struct device *platform_profile_register(struct device *dev, const char *name,return ppdev; cleanup_cur: + scoped_guard(mutex, &profile_lock) +list_del (&to_pprof_handler (ppdev)->node);device_unregister (ppdev); cleanup_ida:
@@ -636,7 +642,10 @@ void platform_profile_remove(struct device *dev) pprof =to_pprof_handler (dev); -guard (mutex)(&profile_lock); +guard (mutex)(&profile_registration_lock); + + scoped_guard(mutex, &profile_lock) +list_del (&pprof->node);ida_free (&platform_profile_ida, pprof->minor);device_unregister (&pprof->dev);
Signature · 1 line
2.43.0
PATCH 2/4 platform profile: Extract the core from ACPI
In reply to Daniel LezcanoPlatform profile providers already use device-based callbacks and do not need ACPI types. The core is nevertheless confined to the ACPI build and refuses to initialize when ACPI is disabled.
Move the implementation to drivers/platform/profile and introduce the firmware-independent PLATFORM_PROFILE symbol. Update all provider selectors. Keep provider-specific ACPI dependencies and the platform_profile module name.
Isolate access to the legacy ACPI kobject in an optional compatibility object linked into the same module. Retain the legacy ABI on active ACPI systems, and initialize the class even when ACPI is absent or disabled.
Use subsys_initcall_sync so the class is ready before built-in thermal and CPUFreq providers, but after ACPI has initialized its compatibility kobject.
---
drivers/acpi/Kconfig | 3 -
drivers/acpi/Makefile | 1 -
drivers/cpufreq/Kconfig.x86 | 2 +-
drivers/platform/Kconfig | 16 +++++
drivers/platform/Makefile | 2 +
drivers/platform/profile/Makefile | 5 ++
drivers/platform/profile/acpi.c | 15 +++++
.../profile/core.c} | 64 +++++++++++++------
drivers/platform/profile/profile.h | 17 +++++
drivers/platform/surface/Kconfig | 6 +-
drivers/platform/x86/Kconfig | 10 +--
drivers/platform/x86/amd/pmf/Kconfig | 2 +-
drivers/platform/x86/dell/Kconfig | 4 +-
drivers/platform/x86/hp/Kconfig | 2 +-
drivers/platform/x86/lenovo/Kconfig | 6 +-
drivers/thermal/intel/int340x_thermal/Kconfig | 2 +-
16 files changed, 118 insertions(+), 39 deletions(-)
create mode 100644 drivers/platform/profile/Makefile
create mode 100644 drivers/platform/profile/acpi.c
rename drivers/{acpi/platform_profile.c => platform/profile/core.c} (94%)
create mode 100644 drivers/platform/profile/profile.hdrivers/acpi/Kconfig +0 -3
@@ -351,9 +351,6 @@ config ACPI_THERMAL To compile this driver as a module, choose M here: the module will be called thermal. -config ACPI_PLATFORM_PROFILE - tristate - config ACPI_CUSTOM_DSDT_FILE string "Custom DSDT Table file to include" default ""
drivers/acpi/Makefile +0 -1
@@ -91,7 +91,6 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o obj-$(CONFIG_ACPI) += container.o obj-$(CONFIG_ACPI_THERMAL_LIB) += thermal_lib.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o -obj-$(CONFIG_ACPI_PLATFORM_PROFILE) += platform_profile.o obj-$(CONFIG_ACPI_NFIT) += nfit/ obj-$(CONFIG_ACPI_NHLT) += nhlt.o obj-$(CONFIG_ACPI_NUMA) += numa/
drivers/cpufreq/Kconfig.x86 +1 -1
@@ -39,7 +39,7 @@ config X86_AMD_PSTATE select ACPI_PROCESSOR select ACPI_CPPC_LIB if X86_64 select CPU_FREQ_GOV_SCHEDUTIL if SMP - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select POWER_SUPPLY help This driver adds a CPUFreq driver which utilizes a fine grain
drivers/platform/Kconfig +16 -0
@@ -1,4 +1,20 @@ # SPDX-License-Identifier: GPL-2.0-only +config PLATFORM_PROFILE + tristate "Platform profile support" + help + Provide a common sysfs interface for selecting platform power, + performance and cooling profiles. Platform-specific provider drivers + map their operating modes onto standard profile names, independently + of the firmware interface they use. + + The core exposes per-provider controls and a system-wide interface + for profiles supported by all registered providers. A provider driver + must register before profile attributes become available. ACPI is not + required; on ACPI systems the legacy sysfs interface is also provided. + + To compile this as a module, choose M here: the module will be called + platform_profile. + source "drivers/platform/mips/Kconfig" source "drivers/platform/loongarch/Kconfig"
drivers/platform/Makefile +2 -0
@@ -3,6 +3,8 @@ # Makefile for linux/drivers/platform # +obj-$(CONFIG_PLATFORM_PROFILE) += profile/ + obj-$(CONFIG_X86) += x86/ obj-$(CONFIG_LOONGARCH) += loongarch/ obj-$(CONFIG_MELLANOX_PLATFORM) += mellanox/
drivers/platform/profile/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_PLATFORM_PROFILE) += platform_profile.o + +platform_profile-y := core.o +platform_profile-$(CONFIG_ACPI) += acpi.o
drivers/platform/profile/acpi.c new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Compatibility with the original ACPI platform profile sysfs ABI. */ + +#include <linux/acpi.h> +#include <linux/kobject.h> + +#include "profile.h" + +struct kobject *platform_profile_compat_kobj (void ) +{ +if (acpi_disabled) +return NULL ; + +return kobject_get (acpi_kobj); +}
drivers/platform/profile/core.c renamed from drivers/acpi/platform_profile.c +46 -18
146 lines not on this page · raw message
drivers/platform/profile/profile.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _PLATFORM_PROFILE_INTERNAL_H +#define _PLATFORM_PROFILE_INTERNAL_H + +#include <linux/kconfig.h> +#include <linux/kobject.h> + +#ifdef CONFIG_ACPI +struct kobject *platform_profile_compat_kobj (void ); +#else +static inline struct kobject *platform_profile_compat_kobj (void ) +{ +return NULL ; +} +#endif + +#endif
drivers/platform/surface/Kconfig +3 -3
@@ -203,12 +203,12 @@ config SURFACE_PLATFORM_PROFILE tristate "Surface Platform Profile Driver" depends on ACPI depends on SURFACE_AGGREGATOR_REGISTRY - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help - Provides support for the ACPI platform profile on 5th- and later + Provides support for platform profiles on 5th- and later generation Microsoft Surface devices. - More specifically, this driver provides ACPI platform profile support + More specifically, this driver provides platform profile support on Microsoft Surface devices with a Surface System Aggregator Module (SSAM) connected via the Surface Serial Hub (SSH / SAM-over-SSH). In other words, this driver provides platform profile support on the
drivers/platform/x86/Kconfig +5 -5
@@ -120,7 +120,7 @@ config BITLAND_MIFS_WMI depends on INPUT depends on LEDS_CLASS depends on POWER_SUPPLY - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select INPUT_SPARSEKMAP help This is a driver for Bitland MiInterface based laptops.
@@ -180,7 +180,7 @@ config ACER_WMI select INPUT_SPARSEKMAP select LEDS_CLASS select NEW_LEDS - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help This is a driver for newer Acer (and Wistron) laptops. It adds wireless radio and bluetooth control, and on some laptops,
@@ -279,7 +279,7 @@ config ASUS_WMI select INPUT_SPARSEKMAP select LEDS_CLASS select NEW_LEDS - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help Say Y here if you have a WMI aware Asus laptop (like Eee PCs or new Asus Notebooks).
@@ -646,7 +646,7 @@ config SAMSUNG_GALAXYBOOK depends on INPUT depends on LEDS_CLASS depends on SERIO_I8042 - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select FW_ATTR_CLASS help This is a driver for Samsung Galaxy Book series notebooks. It adds
@@ -906,7 +906,7 @@ config TOUCHSCREEN_DMI config INSPUR_PLATFORM_PROFILE tristate "Inspur WMI platform profile driver" depends on ACPI_WMI - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help This will allow users to determine and control the platform modes between low-power, balanced and performance modes.
drivers/platform/x86/amd/pmf/Kconfig +1 -1
@@ -8,7 +8,7 @@ config AMD_PMF depends on ACPI && PCI depends on POWER_SUPPLY depends on AMD_NODE - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE depends on TEE && AMDTEE depends on AMD_SFH_HID depends on HAS_IOMEM
drivers/platform/x86/dell/Kconfig +2 -2
@@ -44,7 +44,7 @@ config ALIENWARE_WMI_WMAX bool "Alienware WMAX WMI device driver" default y depends on ALIENWARE_WMI - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help Alienware WMI driver with AlienFX LED, HDMI, amplifier, deep sleep and AWCC thermal control capabilities.
@@ -120,7 +120,7 @@ config DELL_PC depends on ACPI depends on DMI depends on DELL_SMBIOS - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help This driver adds support for controlling the fan modes via platform_profile on supported Dell systems regardless of formfactor.
drivers/platform/x86/hp/Kconfig +1 -1
@@ -43,7 +43,7 @@ config HP_WMI depends on RFKILL || RFKILL = n select POWER_SUPPLY select INPUT_SPARSEKMAP - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select HWMON help Say Y here if you want to support WMI-based hotkeys on HP laptops and
drivers/platform/x86/lenovo/Kconfig +3 -3
@@ -12,7 +12,7 @@ config IDEAPAD_LAPTOP depends on BACKLIGHT_CLASS_DEVICE depends on ACPI_VIDEO || ACPI_VIDEO = n depends on ACPI_WMI || ACPI_WMI = n - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select INPUT_SPARSEKMAP select NEW_LEDS select LEDS_CLASS
@@ -63,7 +63,7 @@ config THINKPAD_ACPI depends on BACKLIGHT_CLASS_DEVICE depends on I2C depends on DRM - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select DRM_PRIVACY_SCREEN select HWMON select NVRAM
@@ -250,7 +250,7 @@ config LENOVO_WMI_GAMEZONE tristate "Lenovo GameZone WMI Driver" depends on ACPI_WMI depends on DMI - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select LENOVO_WMI_EVENTS select LENOVO_WMI_HELPERS help
drivers/thermal/intel/int340x_thermal/Kconfig +1 -1
@@ -12,7 +12,7 @@ config INT340X_THERMAL select ACPI_THERMAL_LIB select INTEL_SOC_DTS_IOSF_CORE select INTEL_TCC - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select PROC_THERMAL_MMIO_RAPL if POWERCAP help Newer laptops and tablets that use ACPI may have thermal sensors and
Signature · 1 line
2.43.0
PATCH 3/4 platform profile: Add firmware-neutral aggregate sysfs interface
In reply to Daniel LezcanoThe per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under /sys/firmware/acpi.
Add /sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
--- drivers/platform/profile/core.c | 60 +++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 7 deletions(-)
drivers/platform/profile/core.c +53 -7
@@ -26,9 +26,11 @@ static DEFINE_MUTEX(profile_lock);static DEFINE_MUTEX (profile_registration_lock);static LIST_HEAD (profile_handlers);static struct kobject *compat_kobj; +static struct kobject *profile_kobj;static void profile_notify (void ) { +sysfs_notify (profile_kobj,NULL ,"profile" );if (compat_kobj)sysfs_notify (compat_kobj,NULL ,"platform_profile" ); }
@@ -250,6 +252,7 @@ static ssize_t profile_store(struct device *dev, ret =_store_class_profile (dev, &index);if (ret)return ret; +_notify_class_profile (dev,NULL ); }profile_notify ();
@@ -324,7 +327,7 @@ static int _remove_hidden_choices(struct device *dev, void *arg) }/** -* platform_profile_choices_show - Show the available profile choices for legacy sysfs interface +* platform_profile_choices_show - Show the aggregate profile choices * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to
@@ -360,7 +363,7 @@ static ssize_t platform_profile_choices_show(struct kobject *kobj, }/** -* _aggregate_profiles - Aggregate the profiles for legacy sysfs interface +* _aggregate_profiles - Aggregate the profiles across providers * @dev: The device * @data: The profile to return *
@@ -385,7 +388,7 @@ static int _aggregate_profiles(struct device *dev, void *data) }/** -* _store_and_notify - Store and notify a class from legacy sysfs interface +* _store_and_notify - Store and notify a provider from an aggregate write * @dev: The device * @data: The profile to return *
@@ -403,7 +406,7 @@ static int _store_and_notify(struct device *dev, void *data) }/** -* platform_profile_show - Show the current profile for legacy sysfs interface +* platform_profile_show - Show the current aggregate profile * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to
@@ -431,7 +434,7 @@ static ssize_t platform_profile_show(struct kobject *kobj, }/** -* platform_profile_store - Set the profile for legacy sysfs interface +* platform_profile_store - Set the profile across all providers * @kobj: The kobject * @attr: The attribute * @buf: The buffer to read from
@@ -493,8 +496,30 @@ static const struct attribute_group platform_profile_group = { .is_visible = profile_class_is_visible, }; +static struct kobj_attribute aggregate_choices = +__ATTR (choices,0444 , platform_profile_choices_show,NULL ); +static struct kobj_attribute aggregate_profile = +__ATTR (profile,0644 , platform_profile_show, platform_profile_store); + +static struct attribute *aggregate_attrs[] = { + &aggregate_choices.attr, + &aggregate_profile.attr, +NULL +}; + +static const struct attribute_group aggregate_group = { + .attrs = aggregate_attrs, + .is_visible = profile_class_is_visible, +}; +static int profile_update (void ) { +int err; + + err =sysfs_update_group (profile_kobj, &aggregate_group); +if (err) +return err; +if (compat_kobj)return sysfs_update_group (compat_kobj, &platform_profile_group);
@@ -502,7 +527,7 @@ static int profile_update(void) }/** -* platform_profile_notify - Notify class device and legacy sysfs interface +* platform_profile_notify - Notify the provider and aggregate sysfs interfaces * @dev: The class device */ void platform_profile_notify (struct device *dev)
@@ -643,6 +668,7 @@ struct device *platform_profile_register(struct device *dev, const char *name, cleanup_cur: scoped_guard(mutex, &profile_lock)list_del (&to_pprof_handler (ppdev)->node); +profile_update ();device_unregister (ppdev); cleanup_ida:
@@ -726,15 +752,33 @@ static int __init platform_profile_init(void)if (err)return err; + profile_kobj =kobject_create_and_add ("platform_profile" , kernel_kobj); +if (!profile_kobj) { + err = -ENOMEM ; + goto unregister_class; + } + + err =sysfs_create_group (profile_kobj, &aggregate_group); +if (err) + goto put_kobj; + compat_kobj =platform_profile_compat_kobj ();if (compat_kobj) { err =sysfs_create_group (compat_kobj, &platform_profile_group);if (err) {kobject_put (compat_kobj); -class_unregister (&platform_profile_class); + goto remove_group; } } +return 0 ; + +remove_group: +sysfs_remove_group (profile_kobj, &aggregate_group); +put_kobj: +kobject_put (profile_kobj); +unregister_class: +class_unregister (&platform_profile_class);return err; }
@@ -744,6 +788,8 @@ static void __exit platform_profile_exit(void)sysfs_remove_group (compat_kobj, &platform_profile_group);kobject_put (compat_kobj); } +sysfs_remove_group (profile_kobj, &aggregate_group); +kobject_put (profile_kobj);class_unregister (&platform_profile_class); }subsys_initcall_sync (platform_profile_init);
Signature · 1 line
2.43.0
PATCH 4/4 platform profile: Document firmware-independent profile selection
In reply to Daniel LezcanoDescribe the firmware-neutral aggregate interface, retained ACPI compatibility paths and unchanged device-based provider API. Document hidden choices, mixed profiles and the sequential application of aggregate writes.
Correct the per-provider attribute reference and extend existing ACPI maintainer coverage to the extracted core and its interfaces.
--- .../ABI/testing/sysfs-class-platform-profile | 2 +- .../ABI/testing/sysfs-kernel-platform_profile | 30 ++++++++++++++ .../ABI/testing/sysfs-platform_profile | 7 +++- .../userspace-api/sysfs-platform_profile.rst | 41 ++++++++++++++----- MAINTAINERS | 6 +++ include/linux/platform_profile.h | 3 ++ 6 files changed, 77 insertions(+), 12 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-kernel-platform_profile
Documentation/ABI/testing/sysfs-class-platform-profile +1 -1
@@ -35,7 +35,7 @@ Date: March 2025 KernelVersion: 6.14 Description: Reading this file gives the current selected profile for this device. Writing this file with one of the strings from - platform_profile_choices changes the profile to the new value. + choices changes the profile to the new value. This file can be monitored for changes by polling for POLLPRI, POLLPRI will be signaled on any changes, independent of those
Documentation/ABI/testing/sysfs-kernel-platform_profile new file +30 -0
@@ -0,0 +1,30 @@ +What: /sys/kernel/platform_profile/choices +Date: October 2026 +Description: Space-separated list of standard profiles supported across all + registered platform profile providers. Profile names have the + meanings documented in sysfs-class-platform-profile. + + The file is read-only and is present while at least one provider + is registered. Reading fails with EINVAL when providers have no + common choices. Hidden choices may contribute to the common + choices when multiple providers are registered; with a single + provider only its visible choices are listed. + +What: /sys/kernel/platform_profile/profile +Date: October 2026 +Description: Reading returns the current profile when all providers agree, + or "custom" when they have different profiles or a provider + reports a custom configuration. + + Writing a profile listed in choices applies it to all providers. + "custom" cannot be written. Changes are applied sequentially; + an error does not roll back providers already updated. + + The file is read-write and is present while at least one provider + is registered. It can be monitored with poll() for POLLPRI. + Notifications cover successful userspace writes and changes + reported by providers, for example after a firmware hotkey event. + + On ACPI systems this interface shares its state with the legacy + /sys/firmware/acpi/platform_profile interface. The interface is + also available without ACPI support or with ACPI disabled.
Documentation/ABI/testing/sysfs-platform_profile +6 -1
@@ -2,6 +2,8 @@ What: /sys/firmware/acpi/platform_profile_choices Date: October 2020 Contact: Hans de Goede <[email protected]> Description: This file contains a space-separated list of profiles supported for this device. + This is the ACPI compatibility interface for the system-wide + /sys/kernel/platform_profile/choices attribute. Drivers must use the following standard profile-names:
@@ -23,7 +25,10 @@ Description: This file contains a space-separated list of profiles supported for What: /sys/firmware/acpi/platform_profile Date: October 2020 Contact: Hans de Goede <[email protected]> -Description: Reading this file gives the current selected profile for this +Description: This interface shares its state with + /sys/kernel/platform_profile/profile. + + Reading this file gives the current selected profile for this device. Writing this file with one of the strings from platform_profile_choices changes the profile to the new value.
Documentation/userspace-api/sysfs-platform_profile.rst +31 -10
63 lines not on this page · raw message
MAINTAINERS +6 -0
@@ -285,10 +285,15 @@ B: https://bugzilla.kernel.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm F: Documentation/ABI/testing/configfs-acpi F: Documentation/ABI/testing/sysfs-bus-acpi +F: Documentation/ABI/testing/sysfs-class-platform-profile +F: Documentation/ABI/testing/sysfs-kernel-platform_profile +F: Documentation/ABI/testing/sysfs-platform_profile F: Documentation/firmware-guide/acpi/ +F: Documentation/userspace-api/sysfs-platform_profile.rst F: arch/x86/kernel/acpi/ F: arch/x86/pci/acpi.c F: drivers/acpi/ +F: drivers/platform/profile/ F: drivers/pci/*/*acpi* F: drivers/pci/*acpi* F: drivers/pnp/pnpacpi/
@@ -296,6 +301,7 @@ F: include/acpi/ F: include/linux/acpi.h F: include/linux/fwnode.h F: include/linux/fw_table.h +F: include/linux/platform_profile.h F: lib/fw_table.c F: rust/helpers/acpi.c F: rust/kernel/acpi.rs
include/linux/platform_profile.h +3 -0
@@ -2,6 +2,9 @@/* * Platform profile sysfs interface * +* Providers may use any firmware interface or implement profiles in software. +* The parent device does not need an ACPI companion or a firmware node. +* * See Documentation/userspace-api/sysfs-platform_profile.rst for more * information. */
Signature · 1 line
2.43.0
Re: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
In reply to Daniel LezcanoAm 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 11 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
Thanks,
Armin Wolf
Quoted 167 lines
Assisted-by OpenCode:gpt-6.1-solSigned-off-by Daniel Lezcano <[email protected]>--- drivers/platform/profile/core.c | 60 +++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 7 deletions(-)drivers/platform/profile/core.c +53
-7@@ -26,9 +26,11 @@ static DEFINE_MUTEX(profile_lock);static DEFINE_MUTEX (profile_registration_lock);static LIST_HEAD (profile_handlers);static struct kobject *compat_kobj; +static struct kobject *profile_kobj;static void profile_notify (void ) { +sysfs_notify (profile_kobj,NULL ,"profile" );if (compat_kobj)sysfs_notify (compat_kobj,NULL ,"platform_profile" ); }@@ -250,6 +252,7 @@ static ssize_t profile_store(struct device *dev, ret =_store_class_profile (dev, &index);if (ret)return ret; +_notify_class_profile (dev,NULL ); }profile_notify ();@@ -324,7 +327,7 @@ static int _remove_hidden_choices(struct device *dev, void *arg) }/** -* platform_profile_choices_show - Show the available profile choices for legacy sysfs interface +* platform_profile_choices_show - Show the aggregate profile choices * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to @@ -360,7 +363,7 @@ static ssize_t platform_profile_choices_show(struct kobject *kobj, }/** -* _aggregate_profiles - Aggregate the profiles for legacy sysfs interface +* _aggregate_profiles - Aggregate the profiles across providers * @dev: The device * @data: The profile to return * @@ -385,7 +388,7 @@ static int _aggregate_profiles(struct device *dev, void *data) }/** -* _store_and_notify - Store and notify a class from legacy sysfs interface +* _store_and_notify - Store and notify a provider from an aggregate write * @dev: The device * @data: The profile to return * @@ -403,7 +406,7 @@ static int _store_and_notify(struct device *dev, void *data) }/** -* platform_profile_show - Show the current profile for legacy sysfs interface +* platform_profile_show - Show the current aggregate profile * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to @@ -431,7 +434,7 @@ static ssize_t platform_profile_show(struct kobject *kobj, }/** -* platform_profile_store - Set the profile for legacy sysfs interface +* platform_profile_store - Set the profile across all providers * @kobj: The kobject * @attr: The attribute * @buf: The buffer to read from @@ -493,8 +496,30 @@ static const struct attribute_group platform_profile_group = { .is_visible = profile_class_is_visible, }; +static struct kobj_attribute aggregate_choices = +__ATTR (choices,0444 , platform_profile_choices_show,NULL ); +static struct kobj_attribute aggregate_profile = +__ATTR (profile,0644 , platform_profile_show, platform_profile_store); + +static struct attribute *aggregate_attrs[] = { + &aggregate_choices.attr, + &aggregate_profile.attr, +NULL +}; + +static const struct attribute_group aggregate_group = { + .attrs = aggregate_attrs, + .is_visible = profile_class_is_visible, +}; +static int profile_update (void ) { +int err; + + err =sysfs_update_group (profile_kobj, &aggregate_group); +if (err) +return err; +if (compat_kobj)return sysfs_update_group (compat_kobj, &platform_profile_group);@@ -502,7 +527,7 @@ static int profile_update(void) }/** -* platform_profile_notify - Notify class device and legacy sysfs interface +* platform_profile_notify - Notify the provider and aggregate sysfs interfaces * @dev: The class device */ void platform_profile_notify (struct device *dev)@@ -643,6 +668,7 @@ struct device *platform_profile_register(struct device *dev, const char *name, cleanup_cur: scoped_guard(mutex, &profile_lock)list_del (&to_pprof_handler (ppdev)->node); +profile_update ();device_unregister (ppdev); cleanup_ida:@@ -726,15 +752,33 @@ static int __init platform_profile_init(void)if (err)return err; + profile_kobj =kobject_create_and_add ("platform_profile" , kernel_kobj); +if (!profile_kobj) { + err = -ENOMEM ; + goto unregister_class; + } + + err =sysfs_create_group (profile_kobj, &aggregate_group); +if (err) + goto put_kobj; + compat_kobj =platform_profile_compat_kobj ();if (compat_kobj) { err =sysfs_create_group (compat_kobj, &platform_profile_group);if (err) {kobject_put (compat_kobj); -class_unregister (&platform_profile_class); + goto remove_group; } } +return 0 ; + +remove_group: +sysfs_remove_group (profile_kobj, &aggregate_group); +put_kobj: +kobject_put (profile_kobj); +unregister_class: +class_unregister (&platform_profile_class);return err; }@@ -744,6 +788,8 @@ static void __exit platform_profile_exit(void)sysfs_remove_group (compat_kobj, &platform_profile_group);kobject_put (compat_kobj); } +sysfs_remove_group (profile_kobj, &aggregate_group); +kobject_put (profile_kobj);class_unregister (&platform_profile_class); }subsys_initcall_sync (platform_profile_init);
Rafael J. Wysocki (Intel)
maintainerRe: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
Quoted 11 lines · Armin Wolf
Am 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 8 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.
Quoted 8 lines
Quoted 3 lines
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
It is not just a matter of opinion AFAICS, the aggregate interface has been regarded as legacy for quite a while (see commit 778b94d7ac17 "ACPI: platform_profile: Add support for hidden choices" for example) and it was retained exactly for backwards compatibility reasons IIRC.
I'm with Armin on this.
Thanks!
Mark Pearson
maintainerRe: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
Quoted 21 lines · Rafael J. Wysocki (Intel)
Quoted 11 lines · Armin Wolf
Am 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 8 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.Quoted 8 lines
Quoted 3 lines
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
Quoted 8 lines
It is not just a matter of opinion AFAICS, the aggregate interface has been regarded as legacy for quite a while (see commit
778b94d7ac17"ACPI:platform_profile: Add support for hidden choices" for example) and it was retained exactly for backwards compatibility reasons IIRC.I'm with Armin on this.
Thanks!
I don't think we can get rid of the legacy aggregate interface - which I think is what you and Armin are asking for? What does making it optional mean?
Reading through the patch series it seemed quite reasonable to me to move it out from under ACPI but still have the old interface working. What are the alternatives?
User space (and users) are still using the aggregate interface in my experience
Mark
Re: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
Quoted 32 lines · Mark Pearson
Quoted 21 lines · Rafael J. Wysocki (Intel)
Quoted 11 lines · Armin Wolf
Am 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 8 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.Quoted 8 lines
Quoted 3 lines
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
Quoted 8 lines
It is not just a matter of opinion AFAICS, the aggregate interface has been regarded as legacy for quite a while (see commit
778b94d7ac17"ACPI:platform_profile: Add support for hidden choices" for example) and it was retained exactly for backwards compatibility reasons IIRC.I'm with Armin on this.
Thanks!
Quoted 7 lines
I don't think we can get rid of the legacy aggregate interface - which I think is what you and Armin are asking for? What does making it optional mean?
Reading through the patch series it seemed quite reasonable to me to move it out from under ACPI but still have the old interface working. What are the alternatives?
User space (and users) are still using the aggregate interface in my experience
Mark
If we want to get rid of the legacy interface eventually I think this is how you can do it:
1) Wrap it with a boolean Kconfig. Default to enabled.
2) Add some messaging in this Kconfig that it's being removed after the LTS kernel from 2028.
3) Emit a pr_notice_once() or similar that it's deprecated and will be removed in the future.
4) Modify all (known) userspace software to stop using it.
5) Wait for userspace software to tag new releases.
6) Change default to disabled.
7) Wait some time.
7) Next LTS is declared.
7) Drop kconfig and legacy code.
Rafael J. Wysocki (Intel)
maintainerRe: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
In reply to Mark PearsonQuoted 29 lines · Mark Pearson
Quoted 26 lines · Rafael J. Wysocki (Intel)
Quoted 11 lines · Armin Wolf
Am 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 8 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.Quoted 8 lines
Quoted 3 lines
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
It is not just a matter of opinion AFAICS, the aggregate interface has been regarded as legacy for quite a while (see commit
778b94d7ac17"ACPI:platform_profile: Add support for hidden choices" for example) and it was retained exactly for backwards compatibility reasons IIRC.
Quoted 6 lines
Quoted 3 lines
I'm with Armin on this.
Thanks!
I don't think we can get rid of the legacy aggregate interface - which I think is what you and Armin are asking for? What does making it optional mean?
"Optional" means "not required to be present" AFAIAC. Which means making it possible to have a system without that interface and still exposing the class device platform profile interface. For example, when ACPI is disabled.
Quoted 1 line
Reading through the patch series it seemed quite reasonable to me to move it out from under ACPI but still have the old interface working.
This just means moving things around without a particular gain IMV.
Quoted 1 line
What are the alternatives?
As per the above, retain it as is for systems where ACPI is enabled and do not expose it at all otherwise.
Quoted 1 line
User space (and users) are still using the aggregate interface in my experience
They do use the legacy aggregate interface, but they would need to be taught to use the new aggregate interface located elsewhere. However, they may as well be taught to use the class device platform profile interface directly, may they not?
IMV, adding a new aggregate interface with all of the problems that the legacy aggregate interface has would be a mistake.
Rafael J. Wysocki (Intel)
maintainerRe: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
In reply to Mario LimoncielloQuoted 45 lines · Mario Limonciello
Quoted 32 lines · Mark Pearson
Quoted 21 lines · Rafael J. Wysocki (Intel)
Quoted 11 lines · Armin Wolf
Am 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 8 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.Quoted 8 lines
Quoted 3 lines
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
Quoted 8 lines
It is not just a matter of opinion AFAICS, the aggregate interface has been regarded as legacy for quite a while (see commit
778b94d7ac17"ACPI:platform_profile: Add support for hidden choices" for example) and it was retained exactly for backwards compatibility reasons IIRC.I'm with Armin on this.
Thanks!
Quoted 7 lines
I don't think we can get rid of the legacy aggregate interface - which I think is what you and Armin are asking for? What does making it optional mean?
Reading through the patch series it seemed quite reasonable to me to move it out from under ACPI but still have the old interface working. What are the alternatives?
User space (and users) are still using the aggregate interface in my experience
Mark
If we want to get rid of the legacy interface eventually I think this is how you can do it:
Quoted 11 lines
1) Wrap it with a boolean
Kconfig. Default to enabled.
2) Add some messaging in thisKconfigthat it's being removed after the LTS kernel from 2028.
3) Emit apr_notice_once()or similar that it's deprecated and will be removed in the future.
4) Modify all (known) userspace software to stop using it.
5) Wait for userspace software to tag new releases.
6) Change default to disabled.
7) Wait some time.
7) Next LTS is declared.
7) Drop kconfig and legacy code.
That should work, but my point is rather to avoid adding another aggregate interface to replace the old one and instead switch over the ecosystem to the existing (and documented) class device platform profile interface.
The legacy aggregate one may simply be removed when everybody stops using it (which may take a while and it may be moved to staging at one point).
Re: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
Quoted 58 lines · Rafael J. Wysocki (Intel)
Quoted 45 lines · Mario Limonciello
Quoted 32 lines · Mark Pearson
Quoted 21 lines · Rafael J. Wysocki (Intel)
Quoted 11 lines · Armin Wolf
Am 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 8 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.Quoted 8 lines
Quoted 3 lines
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
Quoted 8 lines
It is not just a matter of opinion AFAICS, the aggregate interface has been regarded as legacy for quite a while (see commit
778b94d7ac17"ACPI:platform_profile: Add support for hidden choices" for example) and it was retained exactly for backwards compatibility reasons IIRC.I'm with Armin on this.
Thanks!
Quoted 7 lines
I don't think we can get rid of the legacy aggregate interface - which I think is what you and Armin are asking for? What does making it optional mean?
Reading through the patch series it seemed quite reasonable to me to move it out from under ACPI but still have the old interface working. What are the alternatives?
User space (and users) are still using the aggregate interface in my experience
Mark
If we want to get rid of the legacy interface eventually I think this is how you can do it:
Quoted 11 lines
1) Wrap it with a boolean
Kconfig. Default to enabled.
2) Add some messaging in thisKconfigthat it's being removed after the LTS kernel from 2028.
3) Emit apr_notice_once()or similar that it's deprecated and will be removed in the future.
4) Modify all (known) userspace software to stop using it.
5) Wait for userspace software to tag new releases.
6) Change default to disabled.
7) Wait some time.
7) Next LTS is declared.
7) Drop kconfig and legacy code.
Quoted 8 lines
That should work, but my point is rather to avoid adding another aggregate interface to replace the old one and instead switch over the ecosystem to the existing (and documented) class device platform profile interface.
The legacy aggregate one may simply be removed when everybody stops using it (which may take a while and it may be moved to staging at one point).
Right totally agreed. I was meaning userspace software should switch to class interfaces not add a new aggregate one.
Mark Pearson
maintainerRe: [PATCH v1 3/4] platform profile: Add firmware-neutral aggregate sysfs interface
Quoted 64 lines · Mario Limonciello
Quoted 63 lines · Rafael J. Wysocki (Intel)
Quoted 45 lines · Mario Limonciello
Quoted 32 lines · Mark Pearson
Quoted 21 lines · Rafael J. Wysocki (Intel)
Quoted 11 lines · Armin Wolf
Am 14.10.26 um 15:24 schrieb Daniel Lezcano:
Quoted 8 lines
The per-provider class interface is firmware-independent, but system- wide profile selection is only exposed under
/sys/firmware/acpi.Add
/sys/kernel/platform_profile/{choices,profile}, sharing the existing aggregate callbacks and semantics with the legacy interface. Keep attributes hidden until a provider is registered and remove them after the last provider.Quoted 8 lines
Quoted 3 lines
Notify both aggregate frontends on profile changes. Also notify the provider class device on a direct profile write, matching its documented POLLPRI ABI. Restore aggregate visibility after a failed registration.
IMHO the aggregate sysfs interface only exists for backwards-compatibility, so i would be very happy if you could just make the associated code optional and instead teach platform-profiles-daemon to use the individual class devices instead.
Quoted 8 lines
It is not just a matter of opinion AFAICS, the aggregate interface has been regarded as legacy for quite a while (see commit
778b94d7ac17"ACPI:platform_profile: Add support for hidden choices" for example) and it was retained exactly for backwards compatibility reasons IIRC.I'm with Armin on this.
Thanks!
Quoted 7 lines
I don't think we can get rid of the legacy aggregate interface - which I think is what you and Armin are asking for? What does making it optional mean?
Reading through the patch series it seemed quite reasonable to me to move it out from under ACPI but still have the old interface working. What are the alternatives?
User space (and users) are still using the aggregate interface in my experience
Mark
If we want to get rid of the legacy interface eventually I think this is how you can do it:
Quoted 11 lines
1) Wrap it with a boolean
Kconfig. Default to enabled.
2) Add some messaging in thisKconfigthat it's being removed after the LTS kernel from 2028.
3) Emit apr_notice_once()or similar that it's deprecated and will be removed in the future.
4) Modify all (known) userspace software to stop using it.
5) Wait for userspace software to tag new releases.
6) Change default to disabled.
7) Wait some time.
7) Next LTS is declared.
7) Drop kconfig and legacy code.That should work, but my point is rather to avoid adding another aggregate interface to replace the old one and instead switch over the ecosystem to the existing (and documented) class device platform profile interface.
Quoted 6 lines
Quoted 3 lines
The legacy aggregate one may simply be removed when everybody stops using it (which may take a while and it may be moved to staging at one point).
Right totally agreed. I was meaning userspace software should switch to class interfaces not add a new aggregate one.
OK - I'm in a minority. I will gracefully retreat back under my rock :)
I guess if PPD and tuneD are migrated that will cover 99% of the use cases anyway.
Mark