[PATCH 6/6] amdgpu/pm: add kernel documentation for smu_get_power_limit

Quan, Evan Evan.Quan at amd.com
Tue Jun 1 08:12:07 UTC 2021


[AMD Official Use Only]

Series is reviewed-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Darren Powell
> Sent: Saturday, May 29, 2021 7:06 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Powell, Darren <Darren.Powell at amd.com>
> Subject: [PATCH 6/6] amdgpu/pm: add kernel documentation for
> smu_get_power_limit
> 
>  added doc tag "amdgpu_pp_power" with description
>  added tags for enums  pp_power_limit_level, pp_power_sample_window
>  added tag for function smu_get_power_limit
> 
> Test:
> * Temporary insertion into Documentation/gpu/amdgpu.rst
> ------------START------------
> Power Limit
> -----------
> .. kernel-doc:: drivers/gpu/drm/amd/include/kgd_pp_interface.h
>    :doc: amdgpu_pp_power
> 
> .. kernel-doc:: drivers/gpu/drm/amd/include/kgd_pp_interface.h
>    :identifiers: pp_power_limit_level
> 
> .. kernel-doc:: drivers/gpu/drm/amd/include/kgd_pp_interface.h
>    :identifiers: pp_power_sample_window
> 
> .. kernel-doc:: drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>    :identifiers: smu_get_power_limit
> -------------END-------------
> 
> Signed-off-by: Darren Powell <darren.powell at amd.com>
> ---
>  .../gpu/drm/amd/include/kgd_pp_interface.h    | 30
> ++++++++++++++++++-
>  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 10 +++++++
>  2 files changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
> b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
> index 369a72f03e92..46d2fc434e24 100644
> --- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
> +++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
> @@ -192,6 +192,26 @@ enum pp_df_cstate {
>  	DF_CSTATE_ALLOW,
>  };
> 
> +/**
> + * DOC: amdgpu_pp_power
> + *
> + * APU power is managed to system-level requirements through the PPT
> + * (package power tracking) feature. PPT is intended to limit power to the
> + * requirements of the power source and could be dynamically updated to
> + * maximize APU performance within the system power budget.
> + *
> + * Two windows of power measurement can be requested, where
> supported, with
> + * :c:type:`enum pp_power_sample_window
> <pp_power_sample_window>`.
> + */
> +
> +/**
> + * enum pp_power_limit_level - Used to query the power limits
> + *
> + * @PP_PWR_LIMIT_MIN: Minimum Power Limit
> + * @PP_PWR_LIMIT_CURRENT: Current Power Limit
> + * @PP_PWR_LIMIT_DEFAULT: Default Power Limit
> + * @PP_PWR_LIMIT_MAX: Maximum Power Limit
> + */
>  enum pp_power_limit_level
>  {
>  	PP_PWR_LIMIT_MIN = -1,
> @@ -200,7 +220,15 @@ enum pp_power_limit_level
>  	PP_PWR_LIMIT_MAX,
>  };
> 
> - enum pp_power_sample_window
> +/**
> + * enum pp_power_sample_window - Used to specify the window size of
> the requested power
> + *
> + * @PP_PWR_WINDOW_DEFAULT: manages the configurable, thermally
> significant
> + * moving average of APU power (default ~5000 ms).
> + * @PP_PWR_WINDOW_FAST: manages the ~10 ms moving average of
> APU power,
> + * where supported.
> + */
> +enum pp_power_sample_window
>  {
>  	PP_PWR_WINDOW_DEFAULT,
>  	PP_PWR_WINDOW_FAST,
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index 5671abd58bcf..b7a9037a2dbc 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -2166,6 +2166,16 @@ static int smu_set_fan_speed_rpm(void *handle,
> uint32_t speed)
>  	return ret;
>  }
> 
> +/**
> + * smu_get_power_limit - Request one of the SMU Power Limits
> + *
> + * @handle: pointer to smu context
> + * @limit: requested limit is written back to this variable
> + * @pp_limit_level: &pp_power_limit_level which power limit to return
> + * @sample_window: &pp_power_sample_window measurement window
> + * Return:  0 on success, <0 on error
> + *
> + */
>  int smu_get_power_limit(void *handle,
>  			uint32_t *limit,
>  			enum pp_power_limit_level pp_limit_level,
> --
> 2.25.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
> freedesktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&data=04%7C01%7Cevan.quan%40amd.com%7C171d1673dbaf4dad5
> dbd08d9222d473c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6
> 37578400133814296%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
> AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=
> 1L62QveKX%2B2UjfHPF9TUE8BREmMYbJkHUpQPlzmi324%3D&reserved
> =0


More information about the amd-gfx mailing list