<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
I also think about this problem.<br>
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.<br>
<br>
The logic seems weird, As we supply many sysfs for adjust clock range.<br>
<br>
We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.<br>
<br>
But another think,if user change back the clk range through pp dpm clk.<br>
<br>
we are in manual mode, and user set auto mode, in fact, driver change nothing.<br>
<br>
Comparatively speaking, better set manual mode after user call pp dpm clk.<br>
Thanks very much.<br>
<br>
Best Regards<br>
Rex<br>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Kuehling, Felix<br>
<b>Sent:</b> Friday, January 26, 2018 12:55:19 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org; Zhu, Rex<br>
<b>Subject:</b> Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This patch breaks unforcing of clocks, which is currently done by<br>
switching back from "manual" to "auto". By removing "manual" mode, you<br>
remove the ability to unset forced clocks.<br>
<br>
Regards,<br>
  Felix<br>
<br>
<br>
On 2018-01-25 06:26 AM, Rex Zhu wrote:<br>
> Driver do not maintain manual mode for dpm_force_performance_level,<br>
> User can set sclk/mclk/pcie range through pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie<br>
> directly.<br>
><br>
> In order to not break currently tools,<br>
> when set "manual" to power_dpm_force_performance_level<br>
> driver will do nothing and just return successful.<br>
><br>
> Change-Id: Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b<br>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--<br>
>  drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----<br>
>  drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15 +++++++--------<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------<br>
>  7 files changed, 8 insertions(+), 32 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
> index 1812009..66b4df0 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
> @@ -152,7 +152,6 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,<br>
>                        (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :<br>
>                        (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :<br>
>                        (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :<br>
> -                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" :<br>
>                        (level == AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :<br>
>                        (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :<br>
>                        (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :<br>
> @@ -186,7 +185,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,<br>
>        } else if (strncmp("auto", buf, strlen("auto")) == 0) {<br>
>                level = AMD_DPM_FORCED_LEVEL_AUTO;<br>
>        } else if (strncmp("manual", buf, strlen("manual")) == 0) {<br>
> -             level = AMD_DPM_FORCED_LEVEL_MANUAL;<br>
> +             pr_info("No need to set manual mode, Just go ahead\n");<br>
>        } else if (strncmp("profile_exit", buf, strlen("profile_exit")) == 0) {<br>
>                level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;<br>
>        } else if (strncmp("profile_standard", buf, strlen("profile_standard")) == 0) {<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c<br>
> index ab45232..8ddc978 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c<br>
> @@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void *handle,<br>
>        struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
>        struct ci_power_info *pi = ci_get_pi(adev);<br>
>  <br>
> -     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |<br>
> -                             AMD_DPM_FORCED_LEVEL_LOW |<br>
> -                             AMD_DPM_FORCED_LEVEL_HIGH))<br>
> -             return -EINVAL;<br>
> -<br>
>        switch (type) {<br>
>        case PP_SCLK:<br>
>                if (!pi->sclk_dpm_key_disabled)<br>
> diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
> index b9aa9f4..3fab686 100644<br>
> --- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
> +++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
> @@ -41,14 +41,13 @@ struct amd_vce_state {<br>
>  <br>
>  enum amd_dpm_forced_level {<br>
>        AMD_DPM_FORCED_LEVEL_AUTO = 0x1,<br>
> -     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,<br>
> -     AMD_DPM_FORCED_LEVEL_LOW = 0x4,<br>
> -     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,<br>
> -     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,<br>
> -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,<br>
> -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,<br>
> -     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,<br>
> -     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,<br>
> +     AMD_DPM_FORCED_LEVEL_LOW = 0x2,<br>
> +     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,<br>
> +     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,<br>
> +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,<br>
> +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,<br>
> +     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,<br>
> +     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,<br>
>  };<br>
>  <br>
>  enum amd_pm_state_type {<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c<br>
> index dec8dd9..60d280c 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c<br>
> @@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,<br>
>        case AMD_DPM_FORCED_LEVEL_AUTO:<br>
>                ret = cz_phm_unforce_dpm_levels(hwmgr);<br>
>                break;<br>
> -     case AMD_DPM_FORCED_LEVEL_MANUAL:<br>
>        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:<br>
>        default:<br>
>                break;<br>
> @@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct pp_hwmgr *hwmgr,<br>
>  static int cz_force_clock_level(struct pp_hwmgr *hwmgr,<br>
>                enum pp_clock_type type, uint32_t mask)<br>
>  {<br>
> -     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)<br>
> -             return -EINVAL;<br>
> -<br>
>        switch (type) {<br>
>        case PP_SCLK:<br>
>                smum_send_msg_to_smc_with_parameter(hwmgr,<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c<br>
> index 409a56b..eddcbcd 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c<br>
> @@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,<br>
>                                                PPSMC_MSG_SetSoftMaxFclkByFreq,<br>
>                                                RAVEN_UMD_PSTATE_MIN_FCLK);<br>
>                break;<br>
> -     case AMD_DPM_FORCED_LEVEL_MANUAL:<br>
>        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:<br>
>        default:<br>
>                break;<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> index 13db75c..e3a8374 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> @@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,<br>
>                smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);<br>
>                smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);<br>
>                break;<br>
> -     case AMD_DPM_FORCED_LEVEL_MANUAL:<br>
>        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:<br>
>        default:<br>
>                break;<br>
> @@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,<br>
>  {<br>
>        struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);<br>
>  <br>
> -     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |<br>
> -                                     AMD_DPM_FORCED_LEVEL_LOW |<br>
> -                                     AMD_DPM_FORCED_LEVEL_HIGH))<br>
> -             return -EINVAL;<br>
> -<br>
>        switch (type) {<br>
>        case PP_SCLK:<br>
>                if (!data->sclk_dpm_key_disabled)<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> index 6b28896..828677e 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> @@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,<br>
>                vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);<br>
>                vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);<br>
>                break;<br>
> -     case AMD_DPM_FORCED_LEVEL_MANUAL:<br>
>        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:<br>
>        default:<br>
>                break;<br>
> @@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr,<br>
>  {<br>
>        struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);<br>
>  <br>
> -     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |<br>
> -                             AMD_DPM_FORCED_LEVEL_LOW |<br>
> -                             AMD_DPM_FORCED_LEVEL_HIGH))<br>
> -             return -EINVAL;<br>
> -<br>
>        switch (type) {<br>
>        case PP_SCLK:<br>
>                data->smc_state_table.gfx_boot_level = mask ? (ffs(mask) - 1) : 0;<br>
<br>
</div>
</span></font></div>
</body>
</html>