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 <hdegoede@redhat.com>,
	platform-driver-x86@vger.kernel.org,  Patil.Reddy@amd.com,
	mario.limonciello@amd.com, Yijun.Shen@dell.com
Subject: Re: [PATCH 01/10] platform/x86/amd/pmf: Add support for adjusting PMF PPT and PPT APU thresholds
Date: Tue, 10 Jun 2025 19:12:48 +0300 (EEST)	[thread overview]
Message-ID: <5f5ab951-b948-e9d0-6ae2-d8269e4d82e1@linux.intel.com> (raw)
In-Reply-To: <20250509072654.713629-2-Shyam-sundar.S-k@amd.com>

[-- Attachment #1: Type: text/plain, Size: 2952 bytes --]

On Fri, 9 May 2025, Shyam Sundar S K wrote:

> The most recent PMF Trusted Application includes enhanced features that
> allow for modifications to PMF thermal parameters such as PPT and PPT APU.
> 
> This update introduces the necessary driver support to utilize these
> capabilities.
> 
> Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
> Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
>  drivers/platform/x86/amd/pmf/pmf.h    |  4 ++++
>  drivers/platform/x86/amd/pmf/tee-if.c | 16 ++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
> index e6bdee68ccf3..4665e68e5c07 100644
> --- a/drivers/platform/x86/amd/pmf/pmf.h
> +++ b/drivers/platform/x86/amd/pmf/pmf.h
> @@ -93,6 +93,8 @@ struct cookie_header {
>  #define PMF_POLICY_BIOS_OUTPUT_1				10
>  #define PMF_POLICY_BIOS_OUTPUT_2				11
>  #define PMF_POLICY_P3T						38
> +#define PMF_POLICY_PMF_PPT					54
> +#define PMF_POLICY_PMF_PPT_APU_ONLY				55
>  #define PMF_POLICY_BIOS_OUTPUT_3				57
>  #define PMF_POLICY_BIOS_OUTPUT_4				58
>  #define PMF_POLICY_BIOS_OUTPUT_5				59
> @@ -677,6 +679,8 @@ struct pmf_action_table {
>  	u32 stt_skintemp_apu;	/* in C */
>  	u32 stt_skintemp_hs2;	/* in C */
>  	u32 p3t_limit;		/* in mW */
> +	u32 pmf_ppt;		/* in mW */
> +	u32 pmf_ppt_apu_only;	/* in mW */
>  };
>  
>  /* Input conditions */
> diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
> index a1e43873a07b..679c5bf5faca 100644
> --- a/drivers/platform/x86/amd/pmf/tee-if.c
> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
> @@ -145,6 +145,22 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
>  			}
>  			break;
>  
> +		case PMF_POLICY_PMF_PPT:
> +			if (dev->prev_data->pmf_ppt != val) {
> +				amd_pmf_send_cmd(dev, SET_PMF_PPT, false, val, NULL);
> +				dev_dbg(dev->dev, "update PMF PPT: %u\n", val);
> +				dev->prev_data->pmf_ppt = val;
> +			}
> +			break;
> +
> +		case PMF_POLICY_PMF_PPT_APU_ONLY:
> +			if (dev->prev_data->pmf_ppt_apu_only != val) {
> +				amd_pmf_send_cmd(dev, SET_PMF_PPT_APU_ONLY, false, val, NULL);
> +				dev_dbg(dev->dev, "update PMF PPT APU ONLY: %u\n", val);
> +				dev->prev_data->pmf_ppt_apu_only = val;
> +			}
> +			break;
> +

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

...But with the caveat that you should start to consider something more 
clever here as most of these cases are essentially just copy-paste code 
with very minor variations in a single parameters and offset in 
dev->prev_data so it would be nice if the similar cases could be handled 
with once generic code fragment (I don't count dev_dbg variations).

>  		case PMF_POLICY_SYSTEM_STATE:
>  			switch (val) {
>  			case 0:
> 

-- 
 i.

  reply	other threads:[~2025-06-10 16:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-09  7:26 [PATCH 00/10] Enhancements to PMF Driver for Improved Custom BIOS Input Handling Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 01/10] platform/x86/amd/pmf: Add support for adjusting PMF PPT and PPT APU thresholds Shyam Sundar S K
2025-06-10 16:12   ` Ilpo Järvinen [this message]
2025-06-17  7:15     ` Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 02/10] platform/x86/amd/pmf: Fix the custom bios input handling mechanism Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 03/10] platform/x86/amd/pmf: Extend custom BIOS inputs for more policies Shyam Sundar S K
2025-06-10 15:58   ` Ilpo Järvinen
2025-05-09  7:26 ` [PATCH 04/10] platform/x86/amd/pmf: Update ta_pmf_action structure member Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 05/10] platform/x86/amd/pmf: Add helper to verify BIOS input notifications are enable/disable Shyam Sundar S K
2025-06-10 16:01   ` Ilpo Järvinen
2025-05-09  7:26 ` [PATCH 06/10] platform/x86/amd/pmf: Add custom BIOS input support for AMD_CPU_ID_PS Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 07/10] platform/x86/amd/pmf: Use amd_pmf_update_bios_inputs() helper Shyam Sundar S K
2025-06-10 15:56   ` Ilpo Järvinen
2025-05-09  7:26 ` [PATCH 08/10] platform/x86/amd/pmf: Preserve custom BIOS inputs for evaluating the policies Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 09/10] platform/x86/amd/pmf: Call enact function sooner to process early pending requests Shyam Sundar S K
2025-06-10 16:19   ` Ilpo Järvinen
2025-05-09  7:26 ` [PATCH 10/10] platform/x86/amd/pmf: Add debug logs for pending requests and custom BIOS inputs Shyam Sundar S K
2025-05-12  8:13 ` [PATCH 00/10] Enhancements to PMF Driver for Improved Custom BIOS Input Handling Shen, Yijun
2025-05-12 17:26 ` Mario Limonciello

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=5f5ab951-b948-e9d0-6ae2-d8269e4d82e1@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Patil.Reddy@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=Yijun.Shen@dell.com \
    --cc=hdegoede@redhat.com \
    --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