| From: |
| Shyam Sundar S K <Shyam-sundar.S-k-AT-amd.com> |
| To: |
| <hansg-AT-kernel.org>, <ilpo.jarvinen-AT-linux.intel.com> |
| Subject: |
| [PATCH v6 0/8] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface |
| Date: |
| Wed, 27 May 2026 19:31:57 +0530 |
| Message-ID: |
| <20260527140205.4073335-1-Shyam-sundar.S-k@amd.com> |
| Cc: |
| <platform-driver-x86-AT-vger.kernel.org>, <mario.limonciello-AT-amd.com>, <Sanket.Goswami-AT-amd.com>, Shyam Sundar S K <Shyam-sundar.S-k-AT-amd.com> |
| Archive-link: |
| Article |
This patch series introduces a new util layer for the AMD Platform
Management Framework (PMF) driver that exposes a minimal userspace
interface for metrics monitoring and feature discovery.
AMD PMF currently manages power and thermal policies internally through
Smart PC features, Auto Mode, Policy Builder, Static/Dynamic Power
Sliders. However, system designers and OEMs need visibility into PMF
metrics and feature status for validation, debugging, and integration
with monitoring tools.
This series addresses that need by adding a character device interface
that allows controlled access to PMF metrics data while maintaining
the driver's existing automated policy management.
The primary use case is integration with userspace tools like AMD
SystemDeck, which are widely used by system designers to:
- Monitor real-time power and thermal behavior
- Validate PMF feature operation during platform bring-up
- Debug thermal issues by tracking skin temperature, C-state residency,
and socket power metrics
- Verify BIOS input/output policy values during Smart PC operation
The util layer reads from the existing Trusted Application (TA) shared
memory buffer and cached BIOS output values, adding no new communication
overhead with the TA.
v6:
- Guard misc_deregister() with pmf_dev_handle NULL check
- Move amd_pmf_cdev_unregister() to top of amd_pmf_remove()
- Fix bios_idx type from u32 to int and add negative-value bounds check
- Add missing #include <linux/bits.h> to uapi/linux/amd-pmf.h
- Rename amd_pmf_get_pt/lp/sp() to descriptive full names
- Add missing enum entries in platform_type and slider_position helpers
- Export amd_pmf_get_ta_custom_bios_inputs() for util layer use
- Fix stale/incorrect entries in Documentation/ABI
v5:
- Add actual ioctl implementation after all struct fields are defined
- Move features_supported field just after size for early discovery
- Add 8-byte alignment check for user_size to prevent odd-byte copies
- Add AMD_PMF prefix to all UAPI enum names to avoid namespace collisions
- Use size_t for loop variable instead of int with cast
- Use ternary operator for checkbox output
- Add empty line before Linux kernel headers
- Refactor banner to const char * for cleaner formatting
v4:
- Implement single amd_pmf_info structure which can cover all members.
- Add amd_pmf prefix for enums/functions within the UAPI header.
- Keep test-pmf tool outside of selftests directory.
- Include necessary header files.
- Address review comments received from Ilpo on v3.
v3:
- Stop exporting battery information via util layer.
- Optimize the core logic for fetching BIOS outputs.
- Update the documentation patch to reflect the current util layer design.
- Consolidate amd-pmf-io.h changes into common UAPI header.
- Define a single unified uAPI structure and IOCTL.
- Address other v2 review remarks [1]
v2:
- address remarks from v1
- add a new tool that exercises the IOCTLs from PMF interface
[1] https://lore.kernel.org/platform-driver-x86/2025111107101...
Shyam-sundar.S-k@amd.com/
Shyam Sundar S K (8):
platform/x86/amd/pmf: Add util layer and userspace character device
interface
platform/x86/amd/pmf: store BIOS output values for user-space metrics
via util IOCTL
platform/x86/amd/pmf: Add feature discovery support to util interface
platform/x86/amd/pmf: Store commonly used enums in the header file
platform/x86/amd/pmf: Move debug helper functions to UAPI header
platform/x86/amd/pmf: Implement util layer ioctl handler
platform/x86/amd/pmf: Introduce AMD PMF testing tool for driver
metrics and features
Documentation/ABI: add testing entry for AMD PMF character device
interface
Documentation/ABI/testing/amdpmf-interface | 73 +++++++
MAINTAINERS | 1 +
.../amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 13 +-
drivers/platform/x86/amd/pmf/Kconfig | 10 +
drivers/platform/x86/amd/pmf/Makefile | 2 +
drivers/platform/x86/amd/pmf/core.c | 5 +
drivers/platform/x86/amd/pmf/pmf.h | 34 ++-
drivers/platform/x86/amd/pmf/spc.c | 72 +------
drivers/platform/x86/amd/pmf/tee-if.c | 13 +-
drivers/platform/x86/amd/pmf/util.c | 171 +++++++++++++++
include/linux/amd-pmf-io.h | 9 -
include/uapi/linux/amd-pmf.h | 204 ++++++++++++++++++
tools/platform/x86/amd/Makefile | 60 ++++++
tools/platform/x86/amd/test-pmf.c | 142 ++++++++++++
14 files changed, 709 insertions(+), 100 deletions(-)
create mode 100644 Documentation/ABI/testing/amdpmf-interface
create mode 100644 drivers/platform/x86/amd/pmf/util.c
create mode 100644 include/uapi/linux/amd-pmf.h
create mode 100644 tools/platform/x86/amd/Makefile
create mode 100644 tools/platform/x86/amd/test-pmf.c
--
2.34.1