<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">ok, it is fine for me,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">and some code blocks need to have a blank line to match kernel coding style.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">with that fixes,
</span><span style="background-color: rgba(0, 0, 0, 0); color: rgb(50, 49, 48); font-family: calibri, sans-serif; font-size: 11pt;">Series is </span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="background-color: rgba(0, 0, 0, 0); color: rgb(50, 49, 48); font-family: calibri, sans-serif; font-size: 11pt;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="background-color: rgba(0, 0, 0, 0); color: rgb(50, 49, 48); font-family: calibri, sans-serif; font-size: 11pt;">Reviewed-by: Kevin Wang <kevin1.wang@amd.com></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">Best Regards,</span><br>
<span style="font-family: calibri, sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">Kevin</span></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Lazar, Lijo <Lijo.Lazar@amd.com><br>
<b>Sent:</b> Monday, May 17, 2021 5:04 PM<br>
<b>To:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhang, Hawking <Hawking.Zhang@amd.com>; Chen, Guchun <Guchun.Chen@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> RE: [PATCH v2 2/3] drm/amd/pm: Fix showing incorrect frequencies on aldebaran</font>
<div> </div>
</div>
<div lang="EN-US" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_msipheader251902e5" style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif;margin:0in">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
Hi Kevin,</p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
This case is for determinism mode - there it uses the max frequency passed and min_clk is the default min clock.</p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
Thanks,</p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
Lijo</p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<b>From:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com> <br>
<b>Sent:</b> Monday, May 17, 2021 2:32 PM<br>
<b>To:</b> Lazar, Lijo <Lijo.Lazar@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhang, Hawking <Hawking.Zhang@amd.com>; Chen, Guchun <Guchun.Chen@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> Re: [PATCH v2 2/3] drm/amd/pm: Fix showing incorrect frequencies on aldebaran</p>
</div>
</div>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p style="margin:15.0pt"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<div>
<div>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black">Hi Lijo,</span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black"> </span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black">+ pstate_table->gfxclk_pstate.curr.min = min_clk;</span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black">+ pstate_table->gfxclk_pstate.curr.max = max;</span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black"> </span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black">min_clk and max,</span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black">it seems it is coding error, is right?</span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black"> </span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black">Best Regards,</span></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;background:white">
<span style="color:black">Kevin</span></p>
</div>
<div class="x_MsoNormal" align="center" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<b><span style="color:black">From:</span></b><span style="color:black"> Lazar, Lijo <<a href="mailto:Lijo.Lazar@amd.com">Lijo.Lazar@amd.com</a>><br>
<b>Sent:</b> Monday, May 17, 2021 4:39 PM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Cc:</b> Zhang, Hawking <<a href="mailto:Hawking.Zhang@amd.com">Hawking.Zhang@amd.com</a>>; Wang, Kevin(Yang) <<a href="mailto:Kevin1.Wang@amd.com">Kevin1.Wang@amd.com</a>>; Chen, Guchun <<a href="mailto:Guchun.Chen@amd.com">Guchun.Chen@amd.com</a>>; Feng,
Kenneth <<a href="mailto:Kenneth.Feng@amd.com">Kenneth.Feng@amd.com</a>><br>
<b>Subject:</b> [PATCH v2 2/3] drm/amd/pm: Fix showing incorrect frequencies on aldebaran</span>
</p>
<div>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
</div>
</div>
<div>
<p class="x_xmsipheader251902e5" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<div>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
v1: Use the current and custom pstate frequencies to track the current and</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
user-set min/max values in manual and determinism mode. Previously, only</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
actual_* value was used to track the currrent and user requested value.</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
The value will get reassigned whenever user requests a new value with</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
pp_od_clk_voltage node. Hence it will show incorrect values when user</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
requests an invalid value or tries a partial request without committing</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
the values. Separating out to custom and current variable fixes such</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
issues.</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
v2: Remove redundant if-else check</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
Signed-off-by: Lijo Lazar <a href="mailto:lijo.lazar@amd.com">lijo.lazar@amd.com</a></p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
---</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
.../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 65 ++++++++++++-------</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 6 ++</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
2 files changed, 46 insertions(+), 25 deletions(-)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
index 5d04a1dfdfd8..d27ed2954705 100644</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -78,8 +78,6 @@</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
#define smnPCIE_ESM_CTRL 0x111003D0</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
-#define CLOCK_VALID (1 << 31)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
-</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
static const struct cmn2asic_msg_mapping aldebaran_message_map[SMU_MSG_MAX_COUNT] = {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 0),</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion, 1),</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -455,12 +453,18 @@ static int aldebaran_populate_umd_state_clk(struct smu_context *smu)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
pstate_table->gfxclk_pstate.min = gfx_table->min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
pstate_table->gfxclk_pstate.peak = gfx_table->max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.min = gfx_table->min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.max = gfx_table->max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
pstate_table->uclk_pstate.min = mem_table->min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
pstate_table->uclk_pstate.peak = mem_table->max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->uclk_pstate.curr.min = mem_table->min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->uclk_pstate.curr.max = mem_table->max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
pstate_table->socclk_pstate.min = soc_table->min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
pstate_table->socclk_pstate.peak = soc_table->max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->socclk_pstate.curr.min = soc_table->min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->socclk_pstate.curr.max = soc_table->max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (gfx_table->count > ALDEBARAN_UMD_PSTATE_GFXCLK_LEVEL &&</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
mem_table->count > ALDEBARAN_UMD_PSTATE_MCLK_LEVEL &&</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -669,6 +673,7 @@ static int aldebaran_print_clk_levels(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
{</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
int i, now, size = 0;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
int ret = 0;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ struct smu_umd_pstate_table *pstate_table = &smu->pstate_table;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct pp_clock_levels_with_latency clocks;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct smu_13_0_dpm_table *single_dpm_table;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct smu_dpm_context *smu_dpm = &smu->smu_dpm;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -703,12 +708,8 @@ static int aldebaran_print_clk_levels(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
display_levels = clocks.num_levels;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- min_clk = smu->gfx_actual_hard_min_freq & CLOCK_VALID ?</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_hard_min_freq & ~CLOCK_VALID :</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- single_dpm_table->dpm_levels[0].value;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- max_clk = smu->gfx_actual_soft_max_freq & CLOCK_VALID ?</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_soft_max_freq & ~CLOCK_VALID :</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- single_dpm_table->dpm_levels[1].value;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ min_clk = pstate_table->gfxclk_pstate.curr.min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ max_clk = pstate_table->gfxclk_pstate.curr.max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
freq_values[0] = min_clk;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
freq_values[1] = max_clk;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1134,9 +1135,6 @@ static int aldebaran_set_performance_level(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
&& (level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM))</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
smu_cmn_send_smc_msg(smu, SMU_MSG_DisableDeterminism, NULL);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- /* Reset user min/max gfx clock */</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_hard_min_freq = 0;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_soft_max_freq = 0;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
switch (level) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1163,6 +1161,7 @@ static int aldebaran_set_soft_freq_limited_range(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
{</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct smu_dpm_context *smu_dpm = &(smu->smu_dpm);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct smu_13_0_dpm_context *dpm_context = smu_dpm->dpm_context;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ struct smu_umd_pstate_table *pstate_table = &smu->pstate_table;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct amdgpu_device *adev = smu->adev;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
uint32_t min_clk;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
uint32_t max_clk;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1176,14 +1175,20 @@ static int aldebaran_set_soft_freq_limited_range(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return -EINVAL;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (smu_dpm->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- min_clk = max(min, dpm_context->dpm_tables.gfx_table.min);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- max_clk = min(max, dpm_context->dpm_tables.gfx_table.max);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- ret = smu_v13_0_set_soft_freq_limited_range(smu, SMU_GFXCLK,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- min_clk, max_clk);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ if (min >= max) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ dev_err(smu->adev->dev,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ "Minimum GFX clk should be less than the maximum allowed clock\n");</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ return -EINVAL;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ }</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ if ((min == pstate_table->gfxclk_pstate.curr.min) &&</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ (max == pstate_table->gfxclk_pstate.curr.max))</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ return 0;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ ret = smu_v13_0_set_soft_freq_limited_range(smu, SMU_GFXCLK,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ min, max);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (!ret) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_hard_min_freq = min_clk | CLOCK_VALID;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_soft_max_freq = max_clk | CLOCK_VALID;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.min = min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.max = max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return ret;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1209,10 +1214,8 @@ static int aldebaran_set_soft_freq_limited_range(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
dev_err(adev->dev,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
"Failed to enable determinism at GFX clock %d MHz\n", max);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
} else {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_hard_min_freq =</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- min_clk | CLOCK_VALID;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_soft_max_freq =</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- max | CLOCK_VALID;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.min = min_clk;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.max = max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1225,6 +1228,7 @@ static int aldebaran_usr_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
{</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct smu_dpm_context *smu_dpm = &(smu->smu_dpm);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
struct smu_13_0_dpm_context *dpm_context = smu_dpm->dpm_context;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ struct smu_umd_pstate_table *pstate_table = &smu->pstate_table;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
uint32_t min_clk;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
uint32_t max_clk;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
int ret = 0;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1245,16 +1249,20 @@ static int aldebaran_usr_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (input[1] < dpm_context->dpm_tables.gfx_table.min) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
dev_warn(smu->adev->dev, "Minimum GFX clk (%ld) MHz specified is less than the minimum allowed (%d) MHz\n",</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
input[1], dpm_context->dpm_tables.gfx_table.min);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.custom.min =</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return -EINVAL;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_hard_min_freq = input[1];</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.custom.min = input[1];</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
} else if (input[0] == 1) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (input[1] > dpm_context->dpm_tables.gfx_table.max) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
dev_warn(smu->adev->dev, "Maximum GFX clk (%ld) MHz specified is greater than the maximum allowed (%d) MHz\n",</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
input[1], dpm_context->dpm_tables.gfx_table.max);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.custom.max =</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return -EINVAL;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- smu->gfx_actual_soft_max_freq = input[1];</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.custom.max = input[1];</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
} else {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return -EINVAL;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1276,8 +1284,15 @@ static int aldebaran_usr_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
dev_err(smu->adev->dev, "Input parameter number not correct\n");</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return -EINVAL;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
} else {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- min_clk = smu->gfx_actual_hard_min_freq;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
- max_clk = smu->gfx_actual_soft_max_freq;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ if (!pstate_table->gfxclk_pstate.custom.min)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.custom.min =</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ if (!pstate_table->gfxclk_pstate.custom.max)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.custom.max =</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ min_clk = pstate_table->gfxclk_pstate.custom.min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ max_clk = pstate_table->gfxclk_pstate.custom.max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return aldebaran_set_soft_freq_limited_range(smu, SMU_GFXCLK, min_clk, max_clk);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
break;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
index 0864083e7435..6b3374432e1d 100644</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1626,6 +1626,8 @@ int smu_v13_0_set_performance_level(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
sclk_max);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (ret)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return ret;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.min = sclk_min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->gfxclk_pstate.curr.max = sclk_max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (mclk_min && mclk_max) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1635,6 +1637,8 @@ int smu_v13_0_set_performance_level(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
mclk_max);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (ret)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return ret;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->uclk_pstate.curr.min = mclk_min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->uclk_pstate.curr.max = mclk_max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (socclk_min && socclk_max) {</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
@@ -1644,6 +1648,8 @@ int smu_v13_0_set_performance_level(struct smu_context *smu,</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
socclk_max);</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
if (ret)</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return ret;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->socclk_pstate.curr.min = socclk_min;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
+ pstate_table->socclk_pstate.curr.max = socclk_max;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
}</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
return ret;</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
-- </p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
2.17.1</p>
<p class="x_xmsonormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>