Skip to contentSkip to conversation

Make platform profiles firmware independent

PATCH In review Daniel Lezcano 5 participants 15 messages Oct 24 – Nov 17 1 message not in the archive

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

v3 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, and initialization fails when ACPI is disabled, preventing non-ACPI providers from using the existing firmware-independent class interface.

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.

CONFIG_PLATFORM_PROFILE_LEGACY controls the backwards-compatible aggregate sysfs interface. It defaults to enabled to preserve existing userspace. Disabling it omits the legacy sysfs callbacks and ACPI adapter while retaining class devices and kernel profile cycling. New userspace should discover and control individual class devices instead.
The interface is deprecated, with removal intended after the 2028 LTS kernel once userspace migration is complete. A shared pr_notice_once() warns on legacy attribute access rather than on merely loading the core. The default remains enabled while userspace adopts released class-device support; this series does not claim that ecosystem migration is complete.

The existing firmware-independent interface remains:

/sys/class/platform-profile/platform-profile-X/name /sys/class/platform-profile/platform-profile-X/choices /sys/class/platform-profile/platform-profile-X/profile

Non-ACPI userspace controls providers individually through these class devices. Aggregate selection remains available through the legacy ACPI attributes, and aggregate profile cycling remains available to kernel callers. No new sysfs directory or userspace ABI is introduced.

The original first patch, "Separate handler locking from sysfs lifetime", fixing the handler access race and sysfs teardown locking issue, has been sent separately as a standalone v3 fix. It is not included in this series. The base tree used here already contains that fix.

Patch 1 extracts the core and initializes it before built-in consumers. Patch 2 completes class-device notifications and registration cleanup. Patch 3 documents firmware-independent profile selection through class devices. Patch 4 makes the legacy ACPI aggregate sysfs interface optional and documents its deprecation.

Validation performed during development (before this rebase):

- 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. Both CONFIG_PLATFORM_PROFILE_LEGACY=y and =n are covered.
- 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 and POLLPRI on the class and legacy ACPI interfaces. With acpi=off, class get/set, notifications and kernel cycling are exercised. Both runs check that no new aggregate sysfs directory is created.
- 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.
- QEMU with active ACPI and CONFIG_PLATFORM_PROFILE_LEGACY=n: verify the legacy attributes are absent, class get/set and notifications work, and kernel cycling and registration/removal stress pass.

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.

Changes in v3:
- Send the original first patch fixing the handler access race and sysfs lifetime locking separately as a standalone v3 fix, including the requested profile_lock protection comment and Fixes tag.
- Reduce this series to the four remaining patches and renumber them.
- Rebase the remaining changes onto the current base, which already contains the separately submitted locking fix.

Changes in v2:
- Add the Fixes tag to patch 1 and explain how the mutex-guard conversion reintroduced the teardown deadlock previously fixed in 041142d7d252, and how class-device support subsequently extended the affected paths.
- Drop the proposed /sys/kernel/platform_profile/ aggregate interface and its ABI documentation. Use the existing firmware-independent /sys/class/platform-profile/platform-profile-X/ devices instead.
- Preserve aggregate selection through the legacy ACPI attributes and retain internal aggregation for kernel profile cycling.
- Refocus patch 3 on class-device notifications for direct writes and restoring aggregate visibility after failed registration.
- Update the Kconfig help and documentation to describe the existing class interface and distinguish it from ACPI aggregate selection.
- Revalidate class controls and notifications with acpi=off, legacy aggregation with ACPI active, and the absence of a new aggregate ABI.
- Add CONFIG_PLATFORM_PROFILE_LEGACY (default y) to make legacy aggregate sysfs code optional, independently of class devices and kernel cycling.
- Mark the legacy ABI deprecated and describe removal after the 2028 LTS kernel, conditional on userspace migration. Emit one shared notice on legacy attribute access; retain the enabled default during migration.
- Move the legacy ACPI ABI documentation from testing/ to obsolete/, document the replacement class attributes and update MAINTAINERS.

Changes in v1:
- Initial series extracting the core from ACPI, separating handler locking from sysfs lifetime operations and retaining the legacy ABI.
- Proposed a firmware-neutral aggregate sysfs interface alongside the existing per-provider class devices (removed in v2).

Daniel Lezcano (4):
platform profile: Extract the core from ACPI
platform profile: Complete class notifications and registration
cleanup
platform profile: Document firmware-independent profile selection platform profile: Make legacy ACPI aggregate interface optional

 .../sysfs-platform_profile                    |  12 ++
 .../ABI/testing/sysfs-class-platform-profile  |   2 +-
 .../userspace-api/sysfs-platform_profile.rst  |  55 ++++++--
 MAINTAINERS                                   |   5 +
 drivers/acpi/Kconfig                          |   3 -
 drivers/acpi/Makefile                         |   1 -
 drivers/cpufreq/Kconfig.x86                   |   2 +-
 drivers/platform/Kconfig                      |  35 +++++
 drivers/platform/Makefile                     |   2 +
 drivers/platform/profile/Makefile             |   5 +
 drivers/platform/profile/acpi.c               |  15 +++
 .../profile/core.c}                           | 122 ++++++++++++++----
 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 +
 21 files changed, 255 insertions(+), 56 deletions(-)
 rename Documentation/ABI/{testing => obsolete}/sysfs-platform_profile (70%)
 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} (88%)
 create mode 100644 drivers/platform/profile/profile.h

base-commit: 8244dc8f69f0e73cb1789355260b7d68bf5494e7

Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 1/4 platform profile: Extract the core from ACPI

Platform 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.h
drivers/acpi/Kconfig +0 -3
index f165d14cf61a..dd00312217de 100644
@@ -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
index d1b0affb844f..f8af27341805 100644
@@ -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
index d6190b8dde4b..9e1e3391a084 100644
@@ -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
index 312788f249c9..395b75f2edf0 100644
@@ -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 under /sys/class/platform-profile/.
+	  A provider driver must register before profile attributes become
+	  available. ACPI is not required; on ACPI systems the legacy system-wide
+	  interface under /sys/firmware/acpi/ 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
index fa322e7f8716..b6732f2f3c85 100644
@@ -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
new file mode 100644
index 000000000000..ae95ba09383c
@@ -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
new file mode 100644
index 000000000000..ff925dedacaf
@@ -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
new file mode 100644
index 000000000000..910c9f7da6a0
@@ -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
index f775c6ca1ec1..08f15f72f8ed 100644
@@ -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
index 4851bf45157d..b560982d2378 100644
@@ -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
@@ -905,7 +905,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
index ad4faf18de47..31e13d6d7e75 100644
@@ -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
index 9f0016056d7e..f6acf1cc2a2f 100644
@@ -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
index dd51491b9bcd..81a52194ff42 100644
@@ -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
index 516594993073..2291e1d48d13 100644
@@ -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
@@ -77,7 +77,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
@@ -264,7 +264,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
index 4ced7bdcd62c..3026a0a8d073 100644
@@ -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
#2 lore raw

Re: [PATCH v3 1/4] platform profile: Extract the core from ACPI

Hi Daniel,

Quoted 13 lines · Daniel Lezcano

Platform 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.

Quoted 5 lines

Use subsys_initcall_sync so the class is ready before built-in thermal and CPUFreq providers, but after ACPI has initialized its compatibility kobject.

Thanks for your patch, which is now commit 699041135f75b13a ("platform profile: Extract the core from ACPI") in pm/linux-next/

drivers/platform/Kconfig line 3

Quoted 6 lines
drivers/platform/Kconfig +2 -0
@@ -1,4 +1,20 @@
 # SPDX-License-Identifier: GPL-2.0-only
+config PLATFORM_PROFILE
+       tristate "Platform profile support"

I guess this can be invisible (perhaps "... if COMPILE_TEST"?), as you have updated all provider selectors?

If not, I guess this needs a "depend on X86 || COMPILE_TEST", so people configuring kernels for different architectures do not see this option?

Quoted 7 lines
drivers/platform/Kconfig +7 -0
+       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 under /sys/class/platform-profile/.

drivers/platform/Kconfig line 20

Quoted 10 lines
drivers/platform/Kconfig +7 -0
+         A provider driver must register before profile attributes become
+         available. ACPI is not required; on ACPI systems the legacy system-wide
+         interface under /sys/firmware/acpi/ 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"

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#3 lore raw

Re: [PATCH v3 1/4] platform profile: Extract the core from ACPI

Hi Geert,

Quoted 36 lines · Geert Uytterhoeven

Hi Daniel,

Quoted 13 lines · Daniel Lezcano

Platform 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.

Quoted 5 lines

Use subsys_initcall_sync so the class is ready before built-in thermal and CPUFreq providers, but after ACPI has initialized its compatibility kobject.

Thanks for your patch, which is now commit 699041135f75b13a ("platform profile: Extract the core from ACPI") in pm/linux-next/

drivers/platform/Kconfig line 3

Quoted 6 lines
drivers/platform/Kconfig +2 -0
@@ -1,4 +1,20 @@
  # SPDX-License-Identifier: GPL-2.0-only
+config PLATFORM_PROFILE
+       tristate "Platform profile support"

I guess this can be invisible (perhaps "... if COMPILE_TEST"?), as you have updated all provider selectors?

Quoted 2 lines

If not, I guess this needs a "depend on X86 || COMPILE_TEST", so people configuring kernels for different architectures do not see this option?

The goal of this series is to make the platform profile firmware agnostic so it is available for all architectures

#4 lore raw

Re: [PATCH v3 1/4] platform profile: Extract the core from ACPI

Hi Daniel,

Quoted 35 lines · Daniel Lezcano
Quoted 34 lines · Geert Uytterhoeven
Quoted 13 lines · Daniel Lezcano

Platform 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.

Quoted 5 lines

Use subsys_initcall_sync so the class is ready before built-in thermal and CPUFreq providers, but after ACPI has initialized its compatibility kobject.

Thanks for your patch, which is now commit 699041135f75b13a ("platform profile: Extract the core from ACPI") in pm/linux-next/

drivers/platform/Kconfig line 3

Quoted 6 lines
drivers/platform/Kconfig +2 -0
@@ -1,4 +1,20 @@
  # SPDX-License-Identifier: GPL-2.0-only
+config PLATFORM_PROFILE
+       tristate "Platform profile support"

I guess this can be invisible (perhaps "... if COMPILE_TEST"?), as you have updated all provider selectors?

Quoted 5 lines
Quoted 2 lines

If not, I guess this needs a "depend on X86 || COMPILE_TEST", so people configuring kernels for different architectures do not see this option?

The goal of this series is to make the platform profile firmware agnostic so it is available for all architectures

Sure... Are there any users of it on these architectures?

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

A message that is not in the archive (sent off-list or not yet received): CAB9z6xC4c=o1DwVARBek7ozDxaCON9rpwTmJ810sDGyP0XYQDA@mail.gmail.com

#6 lore raw

Re: [PATCH v3 1/4] platform profile: Extract the core from ACPI

Quoted 47 lines · Daniel Lezcano
Quoted 43 lines · Geert Uytterhoeven

Hi Daniel,

Quoted 38 lines · Daniel Lezcano
Quoted 36 lines · Geert Uytterhoeven
Quoted 13 lines · Daniel Lezcano

Platform 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.

Quoted 5 lines

Use subsys_initcall_sync so the class is ready before built-in thermal and CPUFreq providers, but after ACPI has initialized its compatibility kobject.

Thanks for your patch, which is now commit 699041135f75b13a ("platform profile: Extract the core from ACPI") in pm/linux-next/

drivers/platform/Kconfig line 3

Quoted 6 lines
drivers/platform/Kconfig +2 -0
@@ -1,4 +1,20 @@
  # SPDX-License-Identifier: GPL-2.0-only
+config PLATFORM_PROFILE
+       tristate "Platform profile support"

I guess this can be invisible (perhaps "... if COMPILE_TEST"?), as you have updated all provider selectors?

If not, I guess this needs a "depend on X86 || COMPILE_TEST", so people configuring kernels for different architectures do not see this option?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The goal of this series is to make the platform profile firmware agnostic so it is available for all architectures

Sure... Are there any users of it on these architectures?

ARM64 is about to (patches are cooked)

Geert has a point though. There are arches that don't need to see this at all.

You can add ARM64 to the list while adding support for this to it.

Quoted 1 line

Others IDK

Well, exactly.

#7 lore raw

Re: [PATCH v3 1/4] platform profile: Extract the core from ACPI

Quoted 2 lines · Rafael J. Wysocki (Intel)

On Tue, Nov 17, 2026 at 7:27 PM Daniel Lezcano
<[email protected]> wrote:

[ ... ]

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Sure... Are there any users of it on these architectures?

ARM64 is about to (patches are cooked)

Quoted 7 lines

Geert has a point though. There are arches that don't need to see this at all.

You can add ARM64 to the list while adding support for this to it.

Quoted 1 line

Others IDK

Well, exactly.

Ok, I will send a patch to depend on x86 and COMPILE_TESt

#8 lore raw

PATCH v3 2/4 platform profile: Complete class notifications and registration cleanup

In reply to Daniel Lezcano

The class profile attribute documents POLLPRI notifications for changes made through userspace writes as well as changes reported by providers. However, a direct write currently notifies only the legacy ACPI aggregate attribute, leaving listeners on the provider's own profile attribute unaware of the change.

Notify the class device after a successful direct write, using the same helper as aggregate writes and provider-originated notifications. This also makes notifications available when ACPI is absent or disabled.

Restore aggregate attribute visibility after unlinking a handler whose registration failed during a sysfs group update. Keep aggregation exposed only through the existing ACPI interface; the existing class devices provide firmware-independent userspace access.

---
 drivers/platform/profile/core.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/platform/profile/core.c +8 -6
index 57c3dad2732b..a850942131cd 100644
@@ -256,6 +256,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();
@@ -330,7 +331,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
@@ -366,7 +367,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
  *
@@ -391,7 +392,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
  *
@@ -409,7 +410,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
@@ -437,7 +438,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
@@ -508,7 +509,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)
@@ -650,6 +651,7 @@ struct device *platform_profile_register(struct device *dev, const char *name,
 	scoped_guard(mutex, &profile_lock)
 		list_del(&to_pprof_handler(ppdev)->node);
 
+	profile_update();
 	device_unregister(ppdev);
 
 cleanup_ida:
Signature · 1 line
2.43.0
#9 lore raw

PATCH v3 3/4 platform profile: Document firmware-independent profile selection

In reply to Daniel Lezcano

Describe the existing per-provider class devices as the firmware-neutral userspace interface. Explain that providers can use any firmware transport or implement profiles in software, without an ACPI companion or firmware node on their parent device.

Retain the ACPI paths as compatibility interfaces for aggregate selection. Clarify that non-ACPI userspace selects individual providers and document the sequential application of aggregate writes and their partial-failure behavior. No new userspace ABI is introduced.

Correct the per-provider choices attribute reference and extend existing ACPI maintainer coverage to the extracted core and its interfaces.

---
 .../ABI/testing/sysfs-class-platform-profile  |  2 +-
 .../userspace-api/sysfs-platform_profile.rst  | 46 ++++++++++++++-----
 MAINTAINERS                                   |  5 ++
 include/linux/platform_profile.h              |  3 ++
 4 files changed, 43 insertions(+), 13 deletions(-)
Documentation/ABI/testing/sysfs-class-platform-profile +1 -1
index fcab26894ec3..75e0f6e2c128 100644
@@ -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/userspace-api/sysfs-platform_profile.rst +34 -12

69 lines not on this page · raw message

MAINTAINERS +5 -0
index 0e9fe9c2a39b..ecb3bf5fdafc 100644
@@ -285,10 +285,14 @@ 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-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 +300,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/kernel/acpi.rs
 F:	tools/power/acpi/
include/linux/platform_profile.h +3 -0
index 855b28340e95..f23f9827eac6 100644
@@ -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
#10 lore raw

PATCH v3 4/4 platform profile: Make legacy ACPI aggregate interface optional

In reply to Daniel Lezcano

The aggregate attributes under /sys/firmware/acpi/ are retained for backwards compatibility. Firmware-independent userspace can already discover providers through /sys/class/platform-profile/ and control each provider using its choices and profile attributes.

Add PLATFORM_PROFILE_LEGACY, a boolean depending on PLATFORM_PROFILE and ACPI, to control the legacy aggregate sysfs interface. Default it to y so existing userspace continues to work when updating its configuration.

Compile the ACPI adapter and legacy sysfs callbacks only when the option is enabled. Keep common aggregation helpers in the core because kernel hotkey users still need platform_profile_cycle(). Class devices and their notifications remain available regardless of the legacy option.

Document the compatibility option and recommend individual class devices for new userspace. No daemon changes are included in this kernel series. Move the legacy ABI documentation to obsolete/, retain its original creation dates and attribute descriptions, identify the replacement class attributes, and update its MAINTAINERS entry.

Mark the legacy ABI deprecated and document removal after the 2028 LTS kernel, conditional on userspace migration. Keep the enabled default until class-device support has been released and deployed in userspace. Emit one shared pr_notice_once() when either legacy attribute is read or the profile is written, identifying actual legacy use rather than warning merely because the compatibility code was loaded.

Validate ARM64 without ACPI and x86 module builds with the option enabled and disabled. With ACPI active and the option disabled, QEMU tests confirm that the legacy attributes are absent while class controls, notifications, kernel cycling and concurrent registration/removal continue to work.

---
 .../sysfs-platform_profile                    | 12 ++++
 .../userspace-api/sysfs-platform_profile.rst  | 17 +++--
 MAINTAINERS                                   |  2 +-
 drivers/platform/Kconfig                      | 23 +++++-
 drivers/platform/profile/Makefile             |  2 +-
 drivers/platform/profile/core.c               | 72 +++++++++++++++----
 drivers/platform/profile/profile.h            |  2 +-
 7 files changed, 109 insertions(+), 21 deletions(-)
 rename Documentation/ABI/{testing => obsolete}/sysfs-platform_profile (70%)
Documentation/ABI/obsolete/sysfs-platform_profile renamed from Documentation/ABI/testing/sysfs-platform_profile +12 -0
similarity index 70%
rename from Documentation/ABI/testing/sysfs-platform_profile
rename to Documentation/ABI/obsolete/sysfs-platform_profile
index 125324ab53a9..c001c8641a3a 100644
@@ -2,6 +2,12 @@ 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.
+		Available with CONFIG_PLATFORM_PROFILE_LEGACY on active ACPI
+		systems for backwards compatibility. New userspace should use
+		/sys/class/platform-profile/platform-profile-X/choices instead.
+		This interface is deprecated, with removal intended after the
+		2028 LTS kernel once userspace migration is complete. Accessing
+		either legacy attribute emits a one-time deprecation notice.
 
 		Drivers must use the following standard profile-names:
 
@@ -27,6 +33,12 @@ 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.
 
+		This legacy interface requires CONFIG_PLATFORM_PROFILE_LEGACY.
+		Individual class devices remain available without that option.
+		Use /sys/class/platform-profile/platform-profile-X/profile
+		instead. This interface is deprecated, with removal intended
+		after the 2028 LTS kernel once userspace migration is complete.
+
 		This file can be monitored for changes by polling for POLLPRI,
 		POLLPRI will be signalled on any changes, independent of those
 		changes coming from a userspace write; or coming from another
Documentation/userspace-api/sysfs-platform_profile.rst +13 -4
index a85ede3fb8e5..a3fc1ee20832 100644
@@ -26,11 +26,20 @@ The firmware-independent userspace interface is available under
 ``/sys/class/platform-profile/platform-profile-X/``, with ``name``,
 ``choices`` and ``profile`` attributes for each registered provider.
 
-On ACPI systems, ``/sys/firmware/acpi/platform_profile_choices`` and
+On ACPI systems with ``CONFIG_PLATFORM_PROFILE_LEGACY`` enabled,
+``/sys/firmware/acpi/platform_profile_choices`` and
 ``/sys/firmware/acpi/platform_profile`` remain available as compatibility
 interfaces for aggregate profile selection across registered providers.
-On non-ACPI systems, userspace selects profiles through the individual
-provider class devices.
+New userspace should select profiles through the individual provider class
+devices. These remain available when the legacy interface is disabled and
+on non-ACPI systems. Kernel profile cycling also remains available without
+the legacy interface.
+
+The legacy aggregate interface is deprecated. Removal is intended after the
+2028 LTS kernel, once userspace has migrated to released software using the
+class devices. Compatibility remains enabled by default during the migration;
+the date alone does not trigger removal. Accessing either legacy attribute
+emits a one-time kernel notice directing userspace to the class interface.
 
 Note that this API is only for selecting the platform profile, it is
 NOT a goal of this API to allow monitoring the resulting performance
@@ -70,7 +79,7 @@ Multiple driver support
 When multiple drivers on a system advertise a platform profile handler, the
 platform profile handler core will only advertise the profiles that are
 common between all drivers to the ``/sys/firmware/acpi`` interfaces, when
-ACPI is active.
+ACPI is active and ``CONFIG_PLATFORM_PROFILE_LEGACY`` is enabled.
 
 This is to ensure there is no ambiguity on what the profile names mean when
 all handlers don't support a profile.
MAINTAINERS +1 -1
index ecb3bf5fdafc..33fafd213a31 100644
@@ -283,10 +283,10 @@ S:	Supported
 Q:	https://patchwork.kernel.org/project/linux-acpi/list/
 B:	https://bugzilla.kernel.org
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
+F:	Documentation/ABI/obsolete/sysfs-platform_profile
 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-platform_profile
 F:	Documentation/firmware-guide/acpi/
 F:	Documentation/userspace-api/sysfs-platform_profile.rst
 F:	arch/x86/kernel/acpi/
drivers/platform/Kconfig +21 -2
index 395b75f2edf0..7270f24a3b6e 100644
@@ -9,12 +9,31 @@ config PLATFORM_PROFILE
 
 	  The core exposes per-provider controls under /sys/class/platform-profile/.
 	  A provider driver must register before profile attributes become
-	  available. ACPI is not required; on ACPI systems the legacy system-wide
-	  interface under /sys/firmware/acpi/ is also provided.
+	  available. ACPI is not required. The legacy system-wide interface under
+	  /sys/firmware/acpi/ can be enabled separately for existing userspace.
 
 	  To compile this as a module, choose M here: the module will be called
 	  platform_profile.
 
+config PLATFORM_PROFILE_LEGACY
+	bool "Legacy ACPI platform profile sysfs interface (DEPRECATED)"
+	depends on PLATFORM_PROFILE && ACPI
+	default y
+	help
+	  Expose platform_profile and platform_profile_choices under
+	  /sys/firmware/acpi/ for compatibility with existing userspace. These
+	  attributes aggregate the profiles of all registered providers.
+
+	  This interface is deprecated and is intended for removal after the
+	  2028 LTS kernel, once userspace has migrated to the class interface.
+	  It remains enabled by default until replacement userspace releases
+	  are available and have had time to reach users.
+
+	  New userspace should use the individual devices under
+	  /sys/class/platform-profile/ instead. Disabling this option removes
+	  the legacy sysfs interface but retains class devices and kernel
+	  profile cycling. If unsure, say Y to preserve compatibility.
+
 source "drivers/platform/mips/Kconfig"
 
 source "drivers/platform/loongarch/Kconfig"
drivers/platform/profile/Makefile +1 -1
index ae95ba09383c..787fc9bc961a 100644
@@ -2,4 +2,4 @@
 obj-$(CONFIG_PLATFORM_PROFILE) += platform_profile.o
 
 platform_profile-y := core.o
-platform_profile-$(CONFIG_ACPI) += acpi.o
+platform_profile-$(CONFIG_PLATFORM_PROFILE_LEGACY) += acpi.o
drivers/platform/profile/core.c +60 -12

138 lines not on this page · raw message

drivers/platform/profile/profile.h +1 -1
index 910c9f7da6a0..362eb8cc4592 100644
@@ -5,7 +5,7 @@
 #include <linux/kconfig.h>
 #include <linux/kobject.h>
 
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_PLATFORM_PROFILE_LEGACY
 struct kobject *platform_profile_compat_kobj(void);
 #else
 static inline struct kobject *platform_profile_compat_kobj(void)
Signature · 1 line
2.43.0
#11 lore raw
In reply to Daniel Lezcano

Hi,

sashiko validated this series

Is there any other comments for these changes I should take care of ?

Quoted 152 lines · Daniel Lezcano

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, and initialization fails when ACPI is disabled, preventing non-ACPI providers from using the existing firmware-independent class interface.

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.

CONFIG_PLATFORM_PROFILE_LEGACY controls the backwards-compatible aggregate sysfs interface. It defaults to enabled to preserve existing userspace. Disabling it omits the legacy sysfs callbacks and ACPI adapter while retaining class devices and kernel profile cycling. New userspace should discover and control individual class devices instead.
The interface is deprecated, with removal intended after the 2028 LTS kernel once userspace migration is complete. A shared pr_notice_once() warns on legacy attribute access rather than on merely loading the core. The default remains enabled while userspace adopts released class-device support; this series does not claim that ecosystem migration is complete.

The existing firmware-independent interface remains:

/sys/class/platform-profile/platform-profile-X/name /sys/class/platform-profile/platform-profile-X/choices /sys/class/platform-profile/platform-profile-X/profile

Non-ACPI userspace controls providers individually through these class devices. Aggregate selection remains available through the legacy ACPI attributes, and aggregate profile cycling remains available to kernel callers. No new sysfs directory or userspace ABI is introduced.

The original first patch, "Separate handler locking from sysfs lifetime", fixing the handler access race and sysfs teardown locking issue, has been sent separately as a standalone v3 fix. It is not included in this series. The base tree used here already contains that fix.

Patch 1 extracts the core and initializes it before built-in consumers. Patch 2 completes class-device notifications and registration cleanup. Patch 3 documents firmware-independent profile selection through class devices. Patch 4 makes the legacy ACPI aggregate sysfs interface optional and documents its deprecation.

Validation performed during development (before this rebase):

- 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. Both CONFIG_PLATFORM_PROFILE_LEGACY=y and =n are covered.
- 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 and POLLPRI on the class and legacy ACPI interfaces. With acpi=off, class get/set, notifications and kernel cycling are exercised. Both runs check that no new aggregate sysfs directory is created.
- 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.
- QEMU with active ACPI and CONFIG_PLATFORM_PROFILE_LEGACY=n: verify the legacy attributes are absent, class get/set and notifications work, and kernel cycling and registration/removal stress pass.

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.

Changes in v3:
- Send the original first patch fixing the handler access race and sysfs lifetime locking separately as a standalone v3 fix, including the requested profile_lock protection comment and Fixes tag.
- Reduce this series to the four remaining patches and renumber them.
- Rebase the remaining changes onto the current base, which already contains the separately submitted locking fix.

Changes in v2:
- Add the Fixes tag to patch 1 and explain how the mutex-guard conversion reintroduced the teardown deadlock previously fixed in 041142d7d252, and how class-device support subsequently extended the affected paths.
- Drop the proposed /sys/kernel/platform_profile/ aggregate interface and its ABI documentation. Use the existing firmware-independent /sys/class/platform-profile/platform-profile-X/ devices instead.
- Preserve aggregate selection through the legacy ACPI attributes and retain internal aggregation for kernel profile cycling.
- Refocus patch 3 on class-device notifications for direct writes and restoring aggregate visibility after failed registration.
- Update the Kconfig help and documentation to describe the existing class interface and distinguish it from ACPI aggregate selection.
- Revalidate class controls and notifications with acpi=off, legacy aggregation with ACPI active, and the absence of a new aggregate ABI.
- Add CONFIG_PLATFORM_PROFILE_LEGACY (default y) to make legacy aggregate sysfs code optional, independently of class devices and kernel cycling.
- Mark the legacy ABI deprecated and describe removal after the 2028 LTS kernel, conditional on userspace migration. Emit one shared notice on legacy attribute access; retain the enabled default during migration.
- Move the legacy ACPI ABI documentation from testing/ to obsolete/, document the replacement class attributes and update MAINTAINERS.

Changes in v1:
- Initial series extracting the core from ACPI, separating handler locking from sysfs lifetime operations and retaining the legacy ABI.
- Proposed a firmware-neutral aggregate sysfs interface alongside the existing per-provider class devices (removed in v2).

Daniel Lezcano (4):
platform profile: Extract the core from ACPI
platform profile: Complete class notifications and registration
cleanup
platform profile: Document firmware-independent profile selection platform profile: Make legacy ACPI aggregate interface optional

  .../sysfs-platform_profile                    |  12 ++
  .../ABI/testing/sysfs-class-platform-profile  |   2 +-
  .../userspace-api/sysfs-platform_profile.rst  |  55 ++++++--
  MAINTAINERS                                   |   5 +
  drivers/acpi/Kconfig                          |   3 -
  drivers/acpi/Makefile                         |   1 -
  drivers/cpufreq/Kconfig.x86                   |   2 +-
  drivers/platform/Kconfig                      |  35 +++++
  drivers/platform/Makefile                     |   2 +
  drivers/platform/profile/Makefile             |   5 +
  drivers/platform/profile/acpi.c               |  15 +++
  .../profile/core.c}                           | 122 ++++++++++++++----
  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 +
  21 files changed, 255 insertions(+), 56 deletions(-)

rename Documentation/ABI/{testing => obsolete}/sysfs-platform_profile (70%) 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} (88%) create mode 100644 drivers/platform/profile/profile.h

base-commit: 8244dc8f69f0e73cb1789355260b7d68bf5494e7

#12 lore raw
Quoted 7 lines · Daniel Lezcano

Hi,

sashiko validated this series

Is there any other comments for these changes I should take care of ?

I'd love to see some feedback from someone having a vested interest in this interface. Mario? Mark?

Quoted 154 lines · Daniel Lezcano
Quoted 152 lines

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, and initialization fails when ACPI is disabled, preventing non-ACPI providers from using the existing firmware-independent class interface.

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.

CONFIG_PLATFORM_PROFILE_LEGACY controls the backwards-compatible aggregate sysfs interface. It defaults to enabled to preserve existing userspace. Disabling it omits the legacy sysfs callbacks and ACPI adapter while retaining class devices and kernel profile cycling. New userspace should discover and control individual class devices instead.
The interface is deprecated, with removal intended after the 2028 LTS kernel once userspace migration is complete. A shared pr_notice_once() warns on legacy attribute access rather than on merely loading the core. The default remains enabled while userspace adopts released class-device support; this series does not claim that ecosystem migration is complete.

The existing firmware-independent interface remains:

/sys/class/platform-profile/platform-profile-X/name /sys/class/platform-profile/platform-profile-X/choices /sys/class/platform-profile/platform-profile-X/profile

Non-ACPI userspace controls providers individually through these class devices. Aggregate selection remains available through the legacy ACPI attributes, and aggregate profile cycling remains available to kernel callers. No new sysfs directory or userspace ABI is introduced.

The original first patch, "Separate handler locking from sysfs lifetime", fixing the handler access race and sysfs teardown locking issue, has been sent separately as a standalone v3 fix. It is not included in this series. The base tree used here already contains that fix.

Patch 1 extracts the core and initializes it before built-in consumers. Patch 2 completes class-device notifications and registration cleanup. Patch 3 documents firmware-independent profile selection through class devices. Patch 4 makes the legacy ACPI aggregate sysfs interface optional and documents its deprecation.

Validation performed during development (before this rebase):

- 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. Both CONFIG_PLATFORM_PROFILE_LEGACY=y and =n are covered.
- 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 and POLLPRI on the class and legacy ACPI interfaces. With acpi=off, class get/set, notifications and kernel cycling are exercised. Both runs check that no new aggregate sysfs directory is created.
- 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.
- QEMU with active ACPI and CONFIG_PLATFORM_PROFILE_LEGACY=n: verify the legacy attributes are absent, class get/set and notifications work, and kernel cycling and registration/removal stress pass.

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.

Changes in v3:
- Send the original first patch fixing the handler access race and sysfs lifetime locking separately as a standalone v3 fix, including the requested profile_lock protection comment and Fixes tag.
- Reduce this series to the four remaining patches and renumber them.
- Rebase the remaining changes onto the current base, which already contains the separately submitted locking fix.

Changes in v2:
- Add the Fixes tag to patch 1 and explain how the mutex-guard conversion reintroduced the teardown deadlock previously fixed in 041142d7d252, and how class-device support subsequently extended the affected paths.
- Drop the proposed /sys/kernel/platform_profile/ aggregate interface and its ABI documentation. Use the existing firmware-independent /sys/class/platform-profile/platform-profile-X/ devices instead.
- Preserve aggregate selection through the legacy ACPI attributes and retain internal aggregation for kernel profile cycling.
- Refocus patch 3 on class-device notifications for direct writes and restoring aggregate visibility after failed registration.
- Update the Kconfig help and documentation to describe the existing class interface and distinguish it from ACPI aggregate selection.
- Revalidate class controls and notifications with acpi=off, legacy aggregation with ACPI active, and the absence of a new aggregate ABI.
- Add CONFIG_PLATFORM_PROFILE_LEGACY (default y) to make legacy aggregate sysfs code optional, independently of class devices and kernel cycling.
- Mark the legacy ABI deprecated and describe removal after the 2028 LTS kernel, conditional on userspace migration. Emit one shared notice on legacy attribute access; retain the enabled default during migration.
- Move the legacy ACPI ABI documentation from testing/ to obsolete/, document the replacement class attributes and update MAINTAINERS.

Changes in v1:
- Initial series extracting the core from ACPI, separating handler locking from sysfs lifetime operations and retaining the legacy ABI.
- Proposed a firmware-neutral aggregate sysfs interface alongside the existing per-provider class devices (removed in v2).

Daniel Lezcano (4):
platform profile: Extract the core from ACPI
platform profile: Complete class notifications and registration
cleanup
platform profile: Document firmware-independent profile selection platform profile: Make legacy ACPI aggregate interface optional

  .../sysfs-platform_profile                    |  12 ++
  .../ABI/testing/sysfs-class-platform-profile  |   2 +-
  .../userspace-api/sysfs-platform_profile.rst  |  55 ++++++--
  MAINTAINERS                                   |   5 +
  drivers/acpi/Kconfig                          |   3 -
  drivers/acpi/Makefile                         |   1 -
  drivers/cpufreq/Kconfig.x86                   |   2 +-
  drivers/platform/Kconfig                      |  35 +++++
  drivers/platform/Makefile                     |   2 +
  drivers/platform/profile/Makefile             |   5 +
  drivers/platform/profile/acpi.c               |  15 +++
  .../profile/core.c}                           | 122 ++++++++++++++----
  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 +
  21 files changed, 255 insertions(+), 56 deletions(-)

rename Documentation/ABI/{testing => obsolete}/sysfs-platform_profile (70%) 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} (88%) create mode 100644 drivers/platform/profile/profile.h

base-commit: 8244dc8f69f0e73cb1789355260b7d68bf5494e7

Reviewed-by
#13 lore raw
Quoted 4 lines · Rafael J. Wysocki (Intel)
Quoted 2 lines · Daniel Lezcano
Quoted 9 lines
Quoted 5 lines

Hi,

sashiko validated this series

Is there any other comments for these changes I should take care of ?

I'd love to see some feedback from someone having a vested interest in this interface. Mario? Mark?

I am onboard with the new approach.

#14 lore raw
Quoted 10 lines · Mario Limonciello
Quoted 8 lines · Rafael J. Wysocki (Intel)
Quoted 6 lines · Daniel Lezcano

Hi,

sashiko validated this series

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Is there any other comments for these changes I should take care of ?

I'd love to see some feedback from someone having a vested interest in this interface. Mario? Mark?

I am onboard with the new approach.

All right then, applied as 7.5 material, thanks!

maintainer Reviewed-by
#15 lore raw
In reply to Mario Limonciello
Quoted 9 lines · Mario Limonciello
Quoted 8 lines · Rafael J. Wysocki (Intel)
Quoted 6 lines · Daniel Lezcano

Hi,

sashiko validated this series

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Is there any other comments for these changes I should take care of ?

I'd love to see some feedback from someone having a vested interest in this interface. Mario? Mark?

I am onboard with the new approach.

Ditto. Apologies - I thought I had added my tag already, but if I haven't:

Mark