Re: [PATCH 07/15] platform/x86/amd/pmf: Add support update p3t limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 22 Sep 2023, Shyam Sundar S K wrote:

> P3T (Peak Package Power Limit) is a metric within the SMU controller
> that can influence the power limits. Add support from the driver
> to update P3T limits accordingly.
> 
> Reviewed-by: Mario Limonciello <mario.limonciello@xxxxxxx>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@xxxxxxx>
> ---
>  drivers/platform/x86/amd/pmf/pmf.h    | 3 +++
>  drivers/platform/x86/amd/pmf/tee-if.c | 8 ++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
> index e64b4d285624..897f61b75e2f 100644
> --- a/drivers/platform/x86/amd/pmf/pmf.h
> +++ b/drivers/platform/x86/amd/pmf/pmf.h
> @@ -46,6 +46,7 @@
>  #define GET_STT_MIN_LIMIT	0x1F
>  #define GET_STT_LIMIT_APU	0x20
>  #define GET_STT_LIMIT_HS2	0x21
> +#define SET_P3T				0x23 /* P3T: Peak Package Power Limit */
>  
>  /* OS slider update notification */
>  #define DC_BEST_PERF		0
> @@ -69,6 +70,7 @@
>  #define PMF_POLICY_STT_MIN					6
>  #define PMF_POLICY_STT_SKINTEMP_APU				7
>  #define PMF_POLICY_STT_SKINTEMP_HS2				8
> +#define PMF_POLICY_P3T						38
>  
>  /* TA macros */
>  #define PMF_TA_IF_VERSION__MAJOR				1
> @@ -472,6 +474,7 @@ struct pmf_action_table {
>  	unsigned long stt_minlimit; /* in mW */
>  	unsigned long stt_skintemp_apu; /* in C */
>  	unsigned long stt_skintemp_hs2; /* in C */
> +	unsigned long p3t_limit; /* 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 eb25d5ce3a9a..883dd143375a 100644
> --- a/drivers/platform/x86/amd/pmf/tee-if.c
> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
> @@ -105,6 +105,14 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
>  				dev->prev_data->stt_skintemp_hs2 = val;
>  			}
>  			break;
> +
> +		case PMF_POLICY_P3T:
> +			if (dev->prev_data->p3t_limit != val) {
> +				amd_pmf_send_cmd(dev, SET_P3T, false, val, NULL);
> +				dev_dbg(dev->dev, "update P3T : %d\n", val);

%d vs u32

> +				dev->prev_data->p3t_limit = val;

unsigned long vs u32 ? (as in the other patch)


-- 
 i.




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux