<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">With your proposed changes patch is:</p>
<p style="margin-top:0;margin-bottom:0">Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Wednesday, June 20, 2018 2:17:57 AM<br>
<b>To:</b> Alex Deucher<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</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Alex,<br>
<br>
Comment inline.<br>
<br>
> -----Original Message-----<br>
> From: Alex Deucher [<a href="mailto:alexdeucher@gmail.com">mailto:alexdeucher@gmail.com</a>]<br>
> Sent: Tuesday, June 19, 2018 11:17 PM<br>
> To: Quan, Evan <Evan.Quan@amd.com><br>
> Cc: amd-gfx list <amd-gfx@lists.freedesktop.org><br>
> Subject: Re: [PATCH 10/13] drm/amd/powerplay: apply clocks adjust rules on<br>
> power state change<br>
> <br>
> On Tue, Jun 19, 2018 at 3:39 AM, Evan Quan <evan.quan@amd.com> 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 is used<br>
> to validate the clock settings on a power state change.  One other comment<br>
> below.<br>
Yes, this is for the apply_clocks_adjust_rules callback. I updated the patch description as below<br>
<br>
drm/amd/powerplay: apply clocks adjust rules on power state change<br>
<br>
This add the apply_clocks_adjust_rules callback which is used<br>
to validate the clock settings on a power state change.<br>
> ><br>
> > Change-Id: I2c4b6cd6756d40a28933f0c26b9e1a3d5078bab8<br>
> > Signed-off-by: Evan Quan <evan.quan@amd.com><br>
> > ---<br>
> >  drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 162<br>
> +++++++++++++++++++++<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<br>
> > 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<br>
> pp_hwmgr *hwmgr,<br>
> >         return size;<br>
> >  }<br>
> ><br>
> > +static int vega12_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr) {<br>
> > +       struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr-<br>
> >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>
> &&<br>
> > +                                 !hwmgr->display_config->multi_monitor_in_sync) ||<br>
> > +                                 vblank_too_short;<br>
> > +       latency =<br>
> > + 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-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +       dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.hard_max_level =<br>
> > + 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-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_GFXCLK_LEVEL].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_GFXCLK_LEVEL].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >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-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +       dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.hard_max_level =<br>
> > + 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-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_MCLK_LEVEL].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_MCLK_LEVEL].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >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-<br>
> >min_mem_set_clock / 100))<br>
> > +               dpm_table->dpm_state.hard_min_level =<br>
> > + 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>
Yes, it was moved here together with other clocks' min settings.<br>
> <br>
> > +       /* Hardmin is dependent on displayconfig */<br>
> > +       if (disable_mclk_switching) {<br>
> > +               dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >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-<br>
> >display_config->min_mem_set_clock / 100)) {<br>
> > +                                       dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >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 =<br>
> > + 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-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +       dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.hard_max_level =<br>
> > + 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-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >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-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +       dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.hard_max_level =<br>
> > + 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-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_UVDCLK_LEVEL].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >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-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +       dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.hard_max_level =<br>
> > + 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-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_SOCCLK_LEVEL].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_SOCCLK_LEVEL].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >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-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +       dpm_table->dpm_state.hard_min_level = dpm_table-<br>
> >dpm_levels[0].value;<br>
> > +       dpm_table->dpm_state.hard_max_level =<br>
> > + 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>
> {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_VCEMCLK_LEVEL].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >dpm_levels[VEGA12_UMD_PSTATE_VCEMCLK_LEVEL].value;<br>
> > +               }<br>
> > +<br>
> > +               if (hwmgr->dpm_level ==<br>
> AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {<br>
> > +                       dpm_table->dpm_state.soft_min_level = dpm_table-<br>
> >dpm_levels[dpm_table->count - 1].value;<br>
> > +                       dpm_table->dpm_state.soft_max_level = dpm_table-<br>
> >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<br>
> > *hwmgr)  {<br>
> >         struct vega12_hwmgr *data = (struct vega12_hwmgr<br>
> > *)(hwmgr->backend); @@ -2196,6 +2356,8 @@ static const struct<br>
> pp_hwmgr_func vega12_hwmgr_funcs = {<br>
> >         .display_clock_voltage_request =<br>
> 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 =<br>
> vega12_display_configuration_changed_task,<br>
> >         .powergate_uvd = vega12_power_gate_uvd,<br>
> >         .powergate_vce = vega12_power_gate_vce, diff --git<br>
> > a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
> > 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<br>
> > enable);<br>
> ><br>
> > --<br>
> > 2.7.4<br>
> ><br>
> > _______________________________________________<br>
> > amd-gfx mailing list<br>
> > amd-gfx@lists.freedesktop.org<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>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>