All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/8] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface
@ 2026-05-27 14:01 Shyam Sundar S K
  2026-05-27 14:01 ` [PATCH v6 1/8] platform/x86/amd/pmf: Add util layer and userspace character device interface Shyam Sundar S K
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Shyam Sundar S K @ 2026-05-27 14:01 UTC (permalink / raw)
  To: hansg, ilpo.jarvinen
  Cc: platform-driver-x86, mario.limonciello, Sanket.Goswami,
	Shyam Sundar S K

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/20251111071010.4179492-1-
    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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-06-09  7:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-27 14:01 [PATCH v6 0/8] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface Shyam Sundar S K
2026-05-27 14:01 ` [PATCH v6 1/8] platform/x86/amd/pmf: Add util layer and userspace character device interface Shyam Sundar S K
2026-06-08  9:36   ` Hans de Goede
2026-05-27 14:01 ` [PATCH v6 2/8] platform/x86/amd/pmf: store BIOS output values for user-space metrics via util IOCTL Shyam Sundar S K
2026-05-27 14:02 ` [PATCH v6 3/8] platform/x86/amd/pmf: Add feature discovery support to util interface Shyam Sundar S K
2026-06-08  9:24   ` Hans de Goede
2026-06-08 13:13     ` Ilpo Järvinen
2026-06-09  7:46       ` Shyam Sundar S K
2026-05-27 14:02 ` [PATCH v6 4/8] platform/x86/amd/pmf: Store commonly used enums in the header file Shyam Sundar S K
2026-05-27 14:02 ` [PATCH v6 5/8] platform/x86/amd/pmf: Move debug helper functions to UAPI header Shyam Sundar S K
2026-05-27 14:02 ` [PATCH v6 6/8] platform/x86/amd/pmf: Implement util layer ioctl handler Shyam Sundar S K
2026-06-08  9:32   ` Hans de Goede
2026-06-08 14:33     ` Ilpo Järvinen
2026-06-08 16:08       ` Hans de Goede
2026-06-09  7:48       ` Shyam Sundar S K
2026-05-27 14:02 ` [PATCH v6 7/8] platform/x86/amd/pmf: Introduce AMD PMF testing tool for driver metrics and features Shyam Sundar S K
2026-05-27 14:02 ` [PATCH v6 8/8] Documentation/ABI: add testing entry for AMD PMF character device interface Shyam Sundar S K

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.