<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">
<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);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></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> Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Friday, April 3, 2020 3:03 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Russell, Kent <Kent.Russell@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Quan, Evan <Evan.Quan@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: error out on forcing clock setting not supported</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">For Arcturus, forcing clock to some specific level is not supported<br>
with 54.18 and onwards SMU firmware. As according to firmware team,<br>
they adopt new gfx dpm tuned parameters which can cover all the use<br>
case in a much smooth way. Thus setting through driver interface<br>
is not needed and maybe do a disservice.<br>
<br>
Change-Id: Ibffdb157639809707aa71049a935e53d1b4d06eb<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 47 +++++++++++++++++++-<br>
1 file changed, 46 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
index 5db8c56066ee..1ef0923f7190 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
@@ -794,8 +794,21 @@ static int arcturus_force_clk_levels(struct smu_context *smu,<br>
struct arcturus_dpm_table *dpm_table;<br>
struct arcturus_single_dpm_table *single_dpm_table;<br>
uint32_t soft_min_level, soft_max_level;<br>
+ uint32_t smu_version;<br>
int ret = 0;<br>
<br>
+ ret = smu_get_smc_version(smu, NULL, &smu_version);<br>
+ if (ret) {<br>
+ pr_err("Failed to get smu version!\n");<br>
+ return ret;<br>
+ }<br>
+<br>
+ if (smu_version >= 0x361200) {<br>
+ pr_err("Forcing clock level is not supported with "<br>
+ "54.18 and onwards SMU firmwares\n");<br>
+ return -EOPNOTSUPP;<br>
+ }<br>
+<br>
soft_min_level = mask ? (ffs(mask) - 1) : 0;<br>
soft_max_level = mask ? (fls(mask) - 1) : 0;<br>
<br>
@@ -1512,6 +1525,38 @@ static int arcturus_set_power_profile_mode(struct smu_context *smu,<br>
return 0;<br>
}<br>
<br>
+static int arcturus_set_performance_level(struct smu_context *smu,<br>
+ enum amd_dpm_forced_level level)<br>
+{<br>
+ uint32_t smu_version;<br>
+ int ret;<br>
+<br>
+ ret = smu_get_smc_version(smu, NULL, &smu_version);<br>
+ if (ret) {<br>
+ pr_err("Failed to get smu version!\n");<br>
+ return ret;<br>
+ }<br>
+<br>
+ switch (level) {<br>
+ case AMD_DPM_FORCED_LEVEL_HIGH:<br>
+ case AMD_DPM_FORCED_LEVEL_LOW:<br>
+ case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD:<br>
+ case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK:<br>
+ case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK:<br>
+ case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK:<br>
+ if (smu_version >= 0x361200) {<br>
+ pr_err("Forcing clock level is not supported with "<br>
+ "54.18 and onwards SMU firmwares\n");<br>
+ return -EOPNOTSUPP;<br>
+ }<br>
+ break;<br>
+ default:<br>
+ break;<br>
+ }<br>
+<br>
+ return smu_v11_0_set_performance_level(smu, level);<br>
+}<br>
+<br>
static void arcturus_dump_pptable(struct smu_context *smu)<br>
{<br>
struct smu_table_context *table_context = &smu->smu_table;<br>
@@ -2285,7 +2330,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {<br>
.get_profiling_clk_mask = arcturus_get_profiling_clk_mask,<br>
.get_power_profile_mode = arcturus_get_power_profile_mode,<br>
.set_power_profile_mode = arcturus_set_power_profile_mode,<br>
- .set_performance_level = smu_v11_0_set_performance_level,<br>
+ .set_performance_level = arcturus_set_performance_level,<br>
/* debug (internal used) */<br>
.dump_pptable = arcturus_dump_pptable,<br>
.get_power_limit = arcturus_get_power_limit,<br>
-- <br>
2.26.0<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>