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 v4 3/7] platform/x86/amd/pmf: Add feature discovery support to util interface
Date: Tue, 19 May 2026 13:31:17 +0300 (EEST)	[thread overview]
Message-ID: <738ed51c-4ff3-8c65-da02-9f6a80db66a0@linux.intel.com> (raw)
In-Reply-To: <20260507144524.664001-4-Shyam-sundar.S-k@amd.com>

On Thu, 7 May 2026, Shyam Sundar S K wrote:

> Add feature discovery capability to the util layer interface, allowing
> userspace tools to query which PMF features are supported and enabled
> on the current platform.
> 
> The following features can now be queried through the
> /dev/amdpmf_interface ioctl:
> *  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
> 
> 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>
> ---
>  drivers/platform/x86/amd/pmf/util.c | 12 ++++++++++++
>  include/uapi/linux/amd-pmf.h        | 10 ++++++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd/pmf/util.c b/drivers/platform/x86/amd/pmf/util.c
> index 3a30fd4f063f..c96e6b3fef53 100644
> --- a/drivers/platform/x86/amd/pmf/util.c
> +++ b/drivers/platform/x86/amd/pmf/util.c
> @@ -34,6 +34,18 @@ static int amd_pmf_populate_data(struct amd_pmf_dev *pdev, struct amd_pmf_info *
>  	/* Set size and version */
>  	info->size = sizeof(struct amd_pmf_info);
>  
> +	/* PMF Feature support flags */
> +	if (is_apmf_func_supported(pdev, APMF_FUNC_AUTO_MODE))
> +		info->features_supported |= AMD_PMF_FEAT_AUTO_MODE;
> +	if (is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR))
> +		info->features_supported |= AMD_PMF_FEAT_STATIC_POWER_SLIDER;
> +	if (pdev->smart_pc_enabled)
> +		info->features_supported |= AMD_PMF_FEAT_POLICY_BUILDER;
> +	if (is_apmf_func_supported(pdev, APMF_FUNC_DYN_SLIDER_AC))
> +		info->features_supported |= AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_AC;
> +	if (is_apmf_func_supported(pdev, APMF_FUNC_DYN_SLIDER_DC))
> +		info->features_supported |= AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_DC;
> +
>  	/* Device States */
>  	info->platform_type = in->ev_info.platform_type;
>  	info->laptop_placement = in->ev_info.device_state;
> diff --git a/include/uapi/linux/amd-pmf.h b/include/uapi/linux/amd-pmf.h
> index 54b5cf08f3fb..0fe68e21ee5b 100644
> --- a/include/uapi/linux/amd-pmf.h
> +++ b/include/uapi/linux/amd-pmf.h
> @@ -34,6 +34,13 @@
>  
>  #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;
>  
> @@ -57,6 +64,9 @@ struct amd_pmf_info {
>  	__u32 bios_input[AMD_PMF_BIOS_PARAMS_MAX];
>  	__u32 bios_output[AMD_PMF_BIOS_PARAMS_MAX];
>  
> +	/* Feature info */
> +	__u32 features_supported;

Would it be better to place this right after the size?

I don't know if the features actually impact interpretation of any of the 
existing fields in this struct but I can envision it one day containing 
information how to interpret one of the fields (whether the field is valid 
or not). As such, it feel better to make sure it's always available 
regardless of the size kernel<->userspace transfers across.

-- 
 i.


  reply	other threads:[~2026-05-19 10:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 14:45 [PATCH v4 0/7] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface Shyam Sundar S K
2026-05-07 14:45 ` [PATCH v4 1/7] platform/x86/amd/pmf: Add util layer and userspace character device interface Shyam Sundar S K
2026-05-19 10:27   ` Ilpo Järvinen
2026-05-07 14:45 ` [PATCH v4 2/7] platform/x86/amd/pmf: store BIOS output values for user-space metrics via util IOCTL Shyam Sundar S K
2026-05-07 14:45 ` [PATCH v4 3/7] platform/x86/amd/pmf: Add feature discovery support to util interface Shyam Sundar S K
2026-05-19 10:31   ` Ilpo Järvinen [this message]
2026-05-07 14:45 ` [PATCH v4 4/7] platform/x86/amd/pmf: Store commonly used enums in the header file Shyam Sundar S K
2026-05-19 10:33   ` Ilpo Järvinen
2026-05-07 14:45 ` [PATCH v4 5/7] platform/x86/amd/pmf: Move debug helper functions to UAPI header Shyam Sundar S K
2026-05-07 14:45 ` [PATCH v4 6/7] platform/x86/amd/pmf: Introduce AMD PMF testing tool for driver metrics and features Shyam Sundar S K
2026-05-19 10:40   ` Ilpo Järvinen
2026-05-20 18:54     ` Shyam Sundar S K
2026-05-07 14:45 ` [PATCH v4 7/7] Documentation/ABI: add testing entry for AMD PMF character device interface Shyam Sundar S K

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=738ed51c-4ff3-8c65-da02-9f6a80db66a0@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