diff options
| author | Shyam Sundar S K <Shyam-sundar.S-k@amd.com> | 2026-06-09 13:40:38 +0530 |
|---|---|---|
| committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2026-07-10 15:13:42 +0300 |
| commit | 98432eec31803ae8707a9fd593ba64cd2648aa74 (patch) | |
| tree | ea16763af03092384c80c2a90cb6095a8cbb087a /include/uapi/linux | |
| parent | 4aefd66ef7822cf7d3f53146dcee0b71021ed2b7 (diff) | |
platform/x86/amd/pmf: Add util layer and userspace character device interface
Add a util layer to AMD PMF that exposes a minimal userspace interface
via a character device for metrics monitoring and feature discovery.
This creates /dev/amdpmf_interface with basic ioctl support to retrieve
PMF metrics such as:
* Power source and power slider position
* Platform type, lid state, and user presence
* Skin temperature and ambient light
* BIOS input parameters (1-10)
* Graphics workload metrics
* CPU C-state residency (average and maximum)
* Socket power consumption
* Auto Mode: Automatic power profile switching based on system activity
* Static Power Slider: User-selectable power profiles
* Policy Builder (Smart PC): Action based policy management
* Dynamic Power Slider AC: Adaptive power profiles when on AC power
* Dynamic Power Slider DC: Adaptive power profiles when on battery
The interface enables smoother integration with userspace tools such as
AMD SystemDeck [1], which is widely used for monitoring and controlling
power and thermal behavior on AMD platforms. These tools help designers
keep major components within thermal limits to ensure proper operation
and enhance overall system stability and reliability.
The feature is gated behind the CONFIG_AMD_PMF_UTIL_SUPPORT Kconfig
option, allowing it to be disabled if not needed. The implementation
uses existing PMF infrastructure to populate data from the TA (Trusted
Application) shared memory buffer.
Link: https://docs.amd.com/v/u/en-US/68773_0.50 [1]
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://patch.msgid.link/20260609081044.2416731-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/amd-pmf.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/include/uapi/linux/amd-pmf.h b/include/uapi/linux/amd-pmf.h new file mode 100644 index 000000000000..bbbd39b2ce15 --- /dev/null +++ b/include/uapi/linux/amd-pmf.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */ +/* + * AMD Platform Management Framework (PMF) UAPI Header + * + * Copyright (c) 2026, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * This file defines the user-space API for interacting with the AMD PMF + * driver. It provides ioctl interfaces to query platform-specific metrics + * such as power source, slider position, platform type, laptop placement, + * and various BIOS input/output parameters. + */ + +#ifndef _UAPI_LINUX_AMD_PMF_H +#define _UAPI_LINUX_AMD_PMF_H + +#include <linux/bits.h> +#include <linux/ioctl.h> +#include <linux/types.h> + +/** + * AMD_PMF_IOC_MAGIC - Magic number for AMD PMF ioctl commands + * + * This magic number uniquely identifies AMD PMF ioctl operations. + */ +#define AMD_PMF_IOC_MAGIC 'p' + +/** + * IOCTL_AMD_PMF_POPULATE_DATA - ioctl command to retrieve PMF metrics data + * + * This ioctl command is used to populate the amd_pmf_info structure + * with the requested PMF metrics information. + */ +#define IOCTL_AMD_PMF_POPULATE_DATA _IOWR(AMD_PMF_IOC_MAGIC, 0x00, __u64) + +#define AMD_PMF_BIOS_PARAMS_MAX 10 + +/* AMD PMF feature flags - bitmask indicating supported features */ +#define AMD_PMF_FEAT_AUTO_MODE BIT(0) +#define AMD_PMF_FEAT_STATIC_POWER_SLIDER BIT(1) +#define AMD_PMF_FEAT_POLICY_BUILDER BIT(2) +#define AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_AC BIT(3) +#define AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_DC BIT(4) + +struct amd_pmf_info { + __u64 size; + + /* Feature info */ + __u32 features_supported; + + /* Power and state info */ + __u32 platform_type; + __u32 power_source; + __u32 laptop_placement; + __u32 lid_state; + __u32 user_presence; + __u32 slider_position; + + /* Thermal and power metrics */ + __s32 skin_temp; + __u32 gfx_busy; + __s32 ambient_light; + __u32 avg_c0_residency; + __u32 max_c0_residency; + __u32 socket_power; + + /* BIOS parameters */ + __u32 bios_input[AMD_PMF_BIOS_PARAMS_MAX]; +}; + +#endif /* _UAPI_LINUX_AMD_PMF_H */ |
