<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:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Darren Powell <darren.powell@amd.com><br>
<b>Sent:</b> Saturday, December 19, 2020 8:48 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Powell, Darren <Darren.Powell@amd.com><br>
<b>Subject:</b> [PATCH 1/8] amdgpu/pm: Powerplay API for smu , added get_performance_level</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Modified Functions<br>
smu_get_performance_level() - modifed arg0 to match Powerplay API get_performance_level<br>
<br>
Other Changes<br>
added a new structure swsmu_dpm_funcs to hold smu functions for Powerplay API<br>
removed special smu handling from amdgpu_get_power_dpm_force_performance_level<br>
<br>
Signed-off-by: Darren Powell <darren.powell@amd.com><br>
---<br>
drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 +---<br>
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 2 +-<br>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 +++++++++++-<br>
3 files changed, 13 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
index 7b6ef05a1d35..0008bbe971d6 100644<br>
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
@@ -280,9 +280,7 @@ static ssize_t amdgpu_get_power_dpm_force_performance_level(struct device *dev,<br>
return ret;<br>
}<br>
<br>
- if (is_support_sw_smu(adev))<br>
- level = smu_get_performance_level(&adev->smu);<br>
- else if (adev->powerplay.pp_funcs->get_performance_level)<br>
+ if (adev->powerplay.pp_funcs->get_performance_level)<br>
level = amdgpu_dpm_get_performance_level(adev);<br>
else<br>
level = adev->pm.dpm.forced_level;<br>
diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
index 89be49a43500..10914f3438ac 100644<br>
--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
@@ -743,7 +743,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,<br>
uint32_t *min, uint32_t *max);<br>
int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,<br>
uint32_t min, uint32_t max);<br>
-enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);<br>
+enum amd_dpm_forced_level smu_get_performance_level(void *handle);<br>
int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);<br>
int smu_set_display_count(struct smu_context *smu, uint32_t count);<br>
int smu_set_ac_dc(struct smu_context *smu);<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
index cf999b7a2164..36d18668ec99 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
@@ -46,6 +46,8 @@<br>
#undef pr_info<br>
#undef pr_debug<br>
<br>
+static const struct amd_pm_funcs swsmu_dpm_funcs;<br>
+<br>
size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)<br>
{<br>
size_t size = 0;<br>
@@ -428,6 +430,9 @@ static int smu_early_init(void *handle)<br>
smu->smu_baco.state = SMU_BACO_STATE_EXIT;<br>
smu->smu_baco.platform_support = false;<br>
<br>
+ adev->powerplay.pp_handle = smu;<br>
+ adev->powerplay.pp_funcs = &swsmu_dpm_funcs;<br>
+<br>
return smu_set_funcs(adev);<br>
}<br>
<br>
@@ -1569,8 +1574,9 @@ int smu_switch_power_profile(struct smu_context *smu,<br>
return 0;<br>
}<br>
<br>
-enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu)<br>
+enum amd_dpm_forced_level smu_get_performance_level(void *handle)<br>
{<br>
+ struct smu_context *smu = handle;<br>
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);<br>
enum amd_dpm_forced_level level;<br>
<br>
@@ -2549,3 +2555,7 @@ int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state)<br>
<br>
return ret;<br>
}<br>
+<br>
+static const struct amd_pm_funcs swsmu_dpm_funcs = {<br>
+ .get_performance_level = smu_get_performance_level,<br>
+};</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">could you change this name to "smu_pm_funcs" or others, <br>
</div>
<div class="PlainText">not of all fields is DPM related functions <span style="color: rgb(0, 0, 0);">in data structure of 'amd_pm_funcs' </span><br>
</div>
<div class="PlainText"><span style="color: rgb(0, 0, 0);">it will make some confused for developers.</span></div>
<div class="PlainText"><span style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span><br>
</span></span></div>
<div class="PlainText">-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CKevin1.Wang%40amd.com%7Ce82fe9048c4d43857c9908d8a3b7e561%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637439357533667974%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vGF8e0xTEWyAqKusXbH23Ez4k5Lzz6RmORQXN6unJz8%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CKevin1.Wang%40amd.com%7Ce82fe9048c4d43857c9908d8a3b7e561%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637439357533667974%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vGF8e0xTEWyAqKusXbH23Ez4k5Lzz6RmORQXN6unJz8%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>