<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:#0078D7;margin:15pt;" 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> Gao, Likun <Likun.Gao@amd.com><br>
<b>Sent:</b> Monday, December 2, 2019 6:03 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>; Gao, Likun <Likun.Gao@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu/powerplay: unify smu send message function</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">From: Likun Gao <Likun.Gao@amd.com><br>
<br>
Drop smu_send_smc_msg function from ASIC specify structure.<br>
Reuse smu_send_smc_msg_with_param function for smu_send_smc_msg.<br>
Set paramer to 0 for smu_send_msg function, otherwise it will send<br>
with previous paramer value (Not a certain value).<br>
<br>
Signed-off-by: Likun Gao <Likun.Gao@amd.com><br>
---<br>
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 ++++++++<br>
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 1 -<br>
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 ++-<br>
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 2 --<br>
drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h | 2 --<br>
drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 -<br>
drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 1 -<br>
drivers/gpu/drm/amd/powerplay/smu_internal.h | 2 --<br>
drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 26 --------------------------<br>
drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 25 -------------------------<br>
drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 1 -<br>
11 files changed, 10 insertions(+), 62 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
index 36001a4..e039904 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
@@ -2567,3 +2567,11 @@ uint32_t smu_get_pptable_power_limit(struct smu_context *smu)<br>
<br>
return ret;<br>
}<br>
+<br>
+int smu_send_smc_msg(struct smu_context *smu, uint16_t msg)</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">please use "enum smu_message_type" replace "uint16_t" type.<br>
+{<br>
+ int ret;<br>
+<br>
+ ret = smu->ppt_funcs->send_smc_msg_with_param(smu, msg, 0);</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">i think use function smu_send_smc_msg_with_param() replace it is better.</div>
<div class="PlainText">after fixed,</div>
<div class="PlainText">Reviewed-by: Kevin Wang <kevin1.wang@amd.com></div>
<div class="PlainText">+ return ret;<br>
+}<br>
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
index 68107de..3f13986 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
@@ -2137,7 +2137,6 @@ static const struct pptable_funcs arcturus_ppt_funcs = {<br>
.set_tool_table_location = smu_v11_0_set_tool_table_location,<br>
.notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,<br>
.system_features_control = smu_v11_0_system_features_control,<br>
- .send_smc_msg = smu_v11_0_send_msg,<br>
.send_smc_msg_with_param = smu_v11_0_send_msg_with_param,<br>
.read_smc_arg = smu_v11_0_read_arg,<br>
.init_display_count = smu_v11_0_init_display_count,<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
index ada4a8d..fae1026 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
@@ -500,7 +500,6 @@ struct pptable_funcs {<br>
int (*notify_memory_pool_location)(struct smu_context *smu);<br>
int (*set_last_dcef_min_deep_sleep_clk)(struct smu_context *smu);<br>
int (*system_features_control)(struct smu_context *smu, bool en);<br>
- int (*send_smc_msg)(struct smu_context *smu, uint16_t msg);<br>
int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t msg, uint32_t param);<br>
int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);<br>
int (*init_display_count)(struct smu_context *smu, uint32_t count);<br>
@@ -725,4 +724,6 @@ int smu_get_dpm_clock_table(struct smu_context *smu,<br>
<br>
uint32_t smu_get_pptable_power_limit(struct smu_context *smu);<br>
<br>
+int smu_send_smc_msg(struct smu_context *smu, uint16_t msg);<br>
+<br>
#endif<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h<br>
index 5a27713..80b1d20 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h<br>
@@ -177,8 +177,6 @@ int smu_v11_0_notify_memory_pool_location(struct smu_context *smu);<br>
int smu_v11_0_system_features_control(struct smu_context *smu,<br>
bool en);<br>
<br>
-int smu_v11_0_send_msg(struct smu_context *smu, uint16_t msg);<br>
-<br>
int<br>
smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,<br>
uint32_t param);<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h<br>
index 44c65dd..f709f6e 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h<br>
@@ -44,8 +44,6 @@ int smu_v12_0_read_arg(struct smu_context *smu, uint32_t *arg);<br>
<br>
int smu_v12_0_wait_for_response(struct smu_context *smu);<br>
<br>
-int smu_v12_0_send_msg(struct smu_context *smu, uint16_t msg);<br>
-<br>
int<br>
smu_v12_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,<br>
uint32_t param);<br>
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
index f842246..15403b7 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
@@ -2083,7 +2083,6 @@ static const struct pptable_funcs navi10_ppt_funcs = {<br>
.set_tool_table_location = smu_v11_0_set_tool_table_location,<br>
.notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,<br>
.system_features_control = smu_v11_0_system_features_control,<br>
- .send_smc_msg = smu_v11_0_send_msg,<br>
.send_smc_msg_with_param = smu_v11_0_send_msg_with_param,<br>
.read_smc_arg = smu_v11_0_read_arg,<br>
.init_display_count = smu_v11_0_init_display_count,<br>
diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
index b44ce14..b076589 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
@@ -800,7 +800,6 @@ static const struct pptable_funcs renoir_ppt_funcs = {<br>
.powergate_sdma = smu_v12_0_powergate_sdma,<br>
.powergate_vcn = smu_v12_0_powergate_vcn,<br>
.powergate_jpeg = smu_v12_0_powergate_jpeg,<br>
- .send_smc_msg = smu_v12_0_send_msg,<br>
.send_smc_msg_with_param = smu_v12_0_send_msg_with_param,<br>
.read_smc_arg = smu_v12_0_read_arg,<br>
.set_gfx_cgpg = smu_v12_0_set_gfx_cgpg,<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_internal.h b/drivers/gpu/drm/amd/powerplay/smu_internal.h<br>
index b2d81d3..dd3642d 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_internal.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_internal.h<br>
@@ -77,8 +77,6 @@<br>
#define smu_set_default_od_settings(smu, initialize) \<br>
((smu)->ppt_funcs->set_default_od_settings ? (smu)->ppt_funcs->set_default_od_settings((smu), (initialize)) : 0)<br>
<br>
-#define smu_send_smc_msg(smu, msg) \<br>
- ((smu)->ppt_funcs->send_smc_msg? (smu)->ppt_funcs->send_smc_msg((smu), (msg)) : 0)<br>
#define smu_send_smc_msg_with_param(smu, msg, param) \<br>
((smu)->ppt_funcs->send_smc_msg_with_param? (smu)->ppt_funcs->send_smc_msg_with_param((smu), (msg), (param)) : 0)<br>
#define smu_read_smc_arg(smu, arg) \<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
index b90eb81..acdbb8d 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
@@ -91,36 +91,10 @@ static int smu_v11_0_wait_for_response(struct smu_context *smu)<br>
return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90) == 0x1 ? 0 : -EIO;<br>
}<br>
<br>
-int smu_v11_0_send_msg(struct smu_context *smu, uint16_t msg)<br>
-{<br>
- struct amdgpu_device *adev = smu->adev;<br>
- int ret = 0, index = 0;<br>
-<br>
- index = smu_msg_get_index(smu, msg);<br>
- if (index < 0)<br>
- return index;<br>
-<br>
- smu_v11_0_wait_for_response(smu);<br>
-<br>
- WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);<br>
-<br>
- smu_v11_0_send_msg_without_waiting(smu, (uint16_t)index);<br>
-<br>
- ret = smu_v11_0_wait_for_response(smu);<br>
-<br>
- if (ret)<br>
- pr_err("failed send message: %10s (%d) response %#x\n",<br>
- smu_get_message_name(smu, msg), index, ret);<br>
-<br>
- return ret;<br>
-<br>
-}<br>
-<br>
int<br>
smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,<br>
uint32_t param)<br>
{<br>
-<br>
struct amdgpu_device *adev = smu->adev;<br>
int ret = 0, index = 0;<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
index 0451673..143650c 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
@@ -77,31 +77,6 @@ int smu_v12_0_wait_for_response(struct smu_context *smu)<br>
return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90) == 0x1 ? 0 : -EIO;<br>
}<br>
<br>
-int smu_v12_0_send_msg(struct smu_context *smu, uint16_t msg)<br>
-{<br>
- struct amdgpu_device *adev = smu->adev;<br>
- int ret = 0, index = 0;<br>
-<br>
- index = smu_msg_get_index(smu, msg);<br>
- if (index < 0)<br>
- return index;<br>
-<br>
- smu_v12_0_wait_for_response(smu);<br>
-<br>
- WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);<br>
-<br>
- smu_v12_0_send_msg_without_waiting(smu, (uint16_t)index);<br>
-<br>
- ret = smu_v12_0_wait_for_response(smu);<br>
-<br>
- if (ret)<br>
- pr_err("Failed to send message 0x%x, response 0x%x\n", index,<br>
- ret);<br>
-<br>
- return ret;<br>
-<br>
-}<br>
-<br>
int<br>
smu_v12_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,<br>
uint32_t param)<br>
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
index 02ede5c..12bcc3e 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
@@ -3231,7 +3231,6 @@ static const struct pptable_funcs vega20_ppt_funcs = {<br>
.set_tool_table_location = smu_v11_0_set_tool_table_location,<br>
.notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,<br>
.system_features_control = smu_v11_0_system_features_control,<br>
- .send_smc_msg = smu_v11_0_send_msg,<br>
.send_smc_msg_with_param = smu_v11_0_send_msg_with_param,<br>
.read_smc_arg = smu_v11_0_read_arg,<br>
.init_display_count = smu_v11_0_init_display_count,<br>
-- <br>
2.7.4<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>