X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,  mario.limonciello@amd.com,
	Sanket.Goswami@amd.com
Subject: Re: [PATCH v7 0/7] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface
Date: Fri, 10 Jul 2026 15:37:20 +0300 (EEST)	[thread overview]
Message-ID: <eaffb334-9077-6d77-bd4f-6078615d1e1d@linux.intel.com> (raw)
In-Reply-To: <20260609081044.2416731-1-Shyam-sundar.S-k@amd.com>

On Tue, 9 Jun 2026, Shyam Sundar S K wrote:

> 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.
> 
> v7:
>  - Merge patch 3/8 into patch 1/8
>  - Use _IOWR(..., __u64) to keep ioctl number stable across extensions
>  - Clamp copy size with min_t() instead of -EINVAL for forward compatible
>  - Drop IS_ALIGNED() check and features_from_user read-back block

Hi,

I've now applied this to the review-ilpo-next branch.

I had to make two minor corrections while applying (one header added and 
a spacing change).

-- 
 i.

> 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 (7):
>   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: 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           | 152 +++++++++++++
>  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, 690 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
> 
> 

      parent reply	other threads:[~2026-07-10 12:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  8:10 [PATCH v7 0/7] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface Shyam Sundar S K
2026-06-09  8:10 ` [PATCH v7 1/7] platform/x86/amd/pmf: Add util layer and userspace character device interface Shyam Sundar S K
2026-06-09 13:24   ` Mario Limonciello
2026-06-09 14:43     ` Shyam Sundar S K
2026-06-09  8:10 ` [PATCH v7 2/7] platform/x86/amd/pmf: store BIOS output values for user-space metrics via util IOCTL Shyam Sundar S K
2026-06-09  8:10 ` [PATCH v7 3/7] platform/x86/amd/pmf: Store commonly used enums in the header file Shyam Sundar S K
2026-06-09  8:10 ` [PATCH v7 4/7] platform/x86/amd/pmf: Move debug helper functions to UAPI header Shyam Sundar S K
2026-06-09  8:10 ` [PATCH v7 5/7] platform/x86/amd/pmf: Implement util layer ioctl handler Shyam Sundar S K
2026-06-09  8:10 ` [PATCH v7 6/7] platform/x86/amd/pmf: Introduce AMD PMF testing tool for driver metrics and features Shyam Sundar S K
2026-06-09  8:10 ` [PATCH v7 7/7] Documentation/ABI: add testing entry for AMD PMF character device interface Shyam Sundar S K
2026-07-10 12:37 ` Ilpo Järvinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eaffb334-9077-6d77-bd4f-6078615d1e1d@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Sanket.Goswami@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=hansg@kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox