<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:ËÎÌå;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:΢ÈíÑźÚ;
        panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
        {font-family:"\@΢ÈíÑźÚ";
        panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
        {font-family:"\@ËÎÌå";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.emailquote, li.emailquote, div.emailquote
        {mso-style-name:emailquote;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:1.0pt;
        border:none;
        padding:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Rex,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Yes, per discussed, we may need another patch to consider how to set the PHM_PlatformCaps_UMDPState flag.<o:p></o:p></p>
<p class="MsoNormal">But for now, I will keep the patch as it is.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Evan<o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Zhu, Rex <br>
<b>Sent:</b> Tuesday, June 19, 2018 11:43 PM<br>
<b>To:</b> Quan, Evan <Evan.Quan@amd.com>; Alex Deucher <alexdeucher@gmail.com><br>
<b>Cc:</b> amd-gfx list <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH 10/13] drm/amd/powerplay: apply clocks adjust rules on power state change<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Arial",sans-serif;color:black">Hi Evan,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Arial",sans-serif;color:black">did we need to check the following flags on vega12</span><span lang="ZH-CN" style="font-family:"΢ÈíÑźÚ",sans-serif;color:black">£¿</span><span style="font-family:"Arial",sans-serif;color:black">will
 driver set those flags when user select the umd_pstate?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Arial",sans-serif;color:black">PHM_PlatformCaps_UMDPState/PHM_PlatformCaps_PState.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black">Best Regards<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Arial",sans-serif;color:black">Rex<br>
<br>
<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="ZH-CN" style="font-family:"΢ÈíÑźÚ",sans-serif;color:black">»ñÈ¡</span><span lang="ZH-CN" style="font-family:"Arial",sans-serif;color:black">
</span><span style="font-family:"Arial",sans-serif;color:black"><a href="https://aka.ms/ghei36">Outlook for Android</a><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Alex Deucher <<a href="mailto:alexdeucher@gmail.com">alexdeucher@gmail.com</a>><br>
<b>Sent:</b> Tuesday, June 19, 2018 11:16:44 PM<br>
<b>To:</b> Quan, Evan<br>
<b>Cc:</b> amd-gfx list<br>
<b>Subject:</b> Re: [PATCH 10/13] drm/amd/powerplay: apply clocks adjust rules on power state change</span><o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal">On Tue, Jun 19, 2018 at 3:39 AM, Evan Quan <<a href="mailto:evan.quan@amd.com">evan.quan@amd.com</a>> wrote:<br>
> The clocks hard/soft min/max clock levels will be adjusted<br>
> correspondingly.<br>
<br>
<br>
Also note that this add the apply_clocks_adjust_rules callback which<br>
is used to validate the clock settings on a power state change.  One<br>
other comment below.<br>
<br>
><br>
> Change-Id: I2c4b6cd6756d40a28933f0c26b9e1a3d5078bab8<br>
> Signed-off-by: Evan Quan <<a href="mailto:evan.quan@amd.com">evan.quan@amd.com</a>><br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 162 +++++++++++++++++++++<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h |   2 +<br>
>  2 files changed, 164 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
> index a227ace..26bdfff 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
> @@ -1950,6 +1950,166 @@ static int vega12_print_clock_levels(struct pp_hwmgr *hwmgr,<br>
>         return size;<br>
>  }<br>
><br>
> +static int vega12_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)<br>
> +{<br>
> +       struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
> +       struct vega12_single_dpm_table *dpm_table;<br>
> +       bool vblank_too_short = false;<br>
> +       bool disable_mclk_switching;<br>
> +       uint32_t i, latency;<br>
> +<br>
> +       disable_mclk_switching = ((1 < hwmgr->display_config->num_display) &&<br>
> +                                 !hwmgr->display_config->multi_monitor_in_sync) ||<br>
> +                                 vblank_too_short;<br>
> +       latency = hwmgr->display_config->dce_tolerable_mclk_in_active_latency;<br>
> +<br>
> +       /* gfxclk */<br>
> +       dpm_table = &(data->dpm_table.gfx_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_GFXCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_GFXCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_GFXCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[0].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* memclk */<br>
> +       dpm_table = &(data->dpm_table.mem_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_MCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_MCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_MCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[0].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* honour DAL's UCLK Hardmin */<br>
> +       if (dpm_table->dpm_state.hard_min_level < (hwmgr->display_config->min_mem_set_clock / 100))<br>
> +               dpm_table->dpm_state.hard_min_level = hwmgr->display_config->min_mem_set_clock / 100;<br>
> +<br>
<br>
Didn't you just remove the uclk hard min setting in a previous patch?<br>
<br>
<br>
<br>
> +       /* Hardmin is dependent on displayconfig */<br>
> +       if (disable_mclk_switching) {<br>
> +               dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               for (i = 0; i < data->mclk_latency_table.count - 1; i++) {<br>
> +                       if (data->mclk_latency_table.entries[i].latency <= latency) {<br>
> +                               if (dpm_table->dpm_levels[i].value >= (hwmgr->display_config->min_mem_set_clock / 100)) {<br>
> +                                       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[i].value;<br>
> +                                       break;<br>
> +                               }<br>
> +                       }<br>
> +               }<br>
> +       }<br>
> +<br>
> +       if (hwmgr->display_config->nb_pstate_switch_disable)<br>
> +               dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       /* vclk */<br>
> +       dpm_table = &(data->dpm_table.vclk_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_UVDCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* dclk */<br>
> +       dpm_table = &(data->dpm_table.dclk_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_UVDCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* socclk */<br>
> +       dpm_table = &(data->dpm_table.soc_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_SOCCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_SOCCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_SOCCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* eclk */<br>
> +       dpm_table = &(data->dpm_table.eclk_table);<br>
> +       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +       dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;<br>
> +       dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +<br>
> +       if (PP_CAP(PHM_PlatformCaps_UMDPState)) {<br>
> +               if (VEGA12_UMD_PSTATE_VCEMCLK_LEVEL < dpm_table->count) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_VCEMCLK_LEVEL].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[VEGA12_UMD_PSTATE_VCEMCLK_LEVEL].value;<br>
> +               }<br>
> +<br>
> +               if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> +                       dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +                       dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count - 1].value;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       return 0;<br>
> +}<br>
> +<br>
>  static int vega12_display_configuration_changed_task(struct pp_hwmgr *hwmgr)<br>
>  {<br>
>         struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
> @@ -2196,6 +2356,8 @@ static const struct pp_hwmgr_func vega12_hwmgr_funcs = {<br>
>         .display_clock_voltage_request = vega12_display_clock_voltage_request,<br>
>         .force_clock_level = vega12_force_clock_level,<br>
>         .print_clock_levels = vega12_print_clock_levels,<br>
> +       .apply_clocks_adjust_rules =<br>
> +               vega12_apply_clocks_adjust_rules,<br>
>         .display_config_changed = vega12_display_configuration_changed_task,<br>
>         .powergate_uvd = vega12_power_gate_uvd,<br>
>         .powergate_vce = vega12_power_gate_vce,<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
> index e18c083..e17237c 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
> @@ -443,6 +443,8 @@ struct vega12_hwmgr {<br>
>  #define VEGA12_UMD_PSTATE_GFXCLK_LEVEL         0x3<br>
>  #define VEGA12_UMD_PSTATE_SOCCLK_LEVEL         0x3<br>
>  #define VEGA12_UMD_PSTATE_MCLK_LEVEL           0x2<br>
> +#define VEGA12_UMD_PSTATE_UVDCLK_LEVEL         0x3<br>
> +#define VEGA12_UMD_PSTATE_VCEMCLK_LEVEL        0x3<br>
><br>
>  int vega12_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable);<br>
><br>
> --<br>
> 2.7.4<br>
><br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>