RE: [PATCH] drm/amdgpu/powerplay: unify smu send message function

2019-12-02 Thread Quan, Evan


> -Original Message-
> From: amd-gfx  On Behalf Of Likun
> Gao
> Sent: Monday, December 2, 2019 6:04 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Gao, Likun ; Wang, Kevin(Yang)
> ; Feng, Kenneth 
> Subject: [PATCH] drm/amdgpu/powerplay: unify smu send message function
> 
> From: Likun Gao 
> 
> Drop smu_send_smc_msg function from ASIC specify structure.
> Reuse smu_send_smc_msg_with_param function for smu_send_smc_msg.
> Set paramer to 0 for smu_send_msg function, otherwise it will send
> with previous paramer value (Not a certain value).
> 
> Signed-off-by: Likun Gao 
> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  8 
>  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c   |  1 -
>  drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h |  3 ++-
>  drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h  |  2 --
>  drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h  |  2 --
>  drivers/gpu/drm/amd/powerplay/navi10_ppt.c |  1 -
>  drivers/gpu/drm/amd/powerplay/renoir_ppt.c |  1 -
>  drivers/gpu/drm/amd/powerplay/smu_internal.h   |  2 --
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c  | 26 
> --
>  drivers/gpu/drm/amd/powerplay/smu_v12_0.c  | 25 -
>  drivers/gpu/drm/amd/powerplay/vega20_ppt.c |  1 -
>  11 files changed, 10 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 36001a4..e039904 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -2567,3 +2567,11 @@ uint32_t smu_get_pptable_power_limit(struct
> smu_context *smu)
> 
>   return ret;
>  }
> +
> +int smu_send_smc_msg(struct smu_context *smu, uint16_t msg)
> +{
> + int ret;
> +
> + ret = smu->ppt_funcs->send_smc_msg_with_param(smu, msg, 0);
> + return ret;
> +}
[Quan, Evan] Better to still keep the smu_send_smc_msg definition in 
smu_internal.h as it's used internally.
Other than this, the patch is reviewed-by: Evan Quan 
> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> index 68107de..3f13986 100644
> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> @@ -2137,7 +2137,6 @@ static const struct pptable_funcs arcturus_ppt_funcs
> = {
>   .set_tool_table_location = smu_v11_0_set_tool_table_location,
>   .notify_memory_pool_location =
> smu_v11_0_notify_memory_pool_location,
>   .system_features_control = smu_v11_0_system_features_control,
> - .send_smc_msg = smu_v11_0_send_msg,
>   .send_smc_msg_with_param = smu_v11_0_send_msg_with_param,
>   .read_smc_arg = smu_v11_0_read_arg,
>   .init_display_count = smu_v11_0_init_display_count,
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> index ada4a8d..fae1026 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> @@ -500,7 +500,6 @@ struct pptable_funcs {
>   int (*notify_memory_pool_location)(struct smu_context *smu);
>   int (*set_last_dcef_min_deep_sleep_clk)(struct smu_context *smu);
>   int (*system_features_control)(struct smu_context *smu, bool en);
> - int (*send_smc_msg)(struct smu_context *smu, uint16_t msg);
>   int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t
> msg, uint32_t param);
>   int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);
>   int (*init_display_count)(struct smu_context *smu, uint32_t count);
> @@ -725,4 +724,6 @@ int smu_get_dpm_clock_table(struct smu_context
> *smu,
> 
>  uint32_t smu_get_pptable_power_limit(struct smu_context *smu);
> 
> +int smu_send_smc_msg(struct smu_context *smu, uint16_t msg);
> +
>  #endif
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
> b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
> index 5a27713..80b1d20 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
> @@ -177,8 +177,6 @@ int smu_v11_0_notify_memory_pool_location(struct
> smu_context *smu);
>  int smu_v11_0_system_features_control(struct smu_context *smu,
>bool en);
> 
> -int smu_v11_0_send_msg(struct smu_context *smu, uint16_t msg);
> -
>  int
>  smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
> uint32_t param);
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
> b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
> index 44c65dd..f709f6e 100644
>

Re: [PATCH] drm/amdgpu/powerplay: unify smu send message function

2019-12-02 Thread Wang, Kevin(Yang)
[AMD Official Use Only - Internal Distribution Only]



From: Gao, Likun 
Sent: Monday, December 2, 2019 6:03 PM
To: amd-gfx@lists.freedesktop.org 
Cc: Wang, Kevin(Yang) ; Feng, Kenneth 
; Gao, Likun 
Subject: [PATCH] drm/amdgpu/powerplay: unify smu send message function

From: Likun Gao 

Drop smu_send_smc_msg function from ASIC specify structure.
Reuse smu_send_smc_msg_with_param function for smu_send_smc_msg.
Set paramer to 0 for smu_send_msg function, otherwise it will send
with previous paramer value (Not a certain value).

Signed-off-by: Likun Gao 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  8 
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c   |  1 -
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h |  3 ++-
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h  |  2 --
 drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h  |  2 --
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c |  1 -
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c |  1 -
 drivers/gpu/drm/amd/powerplay/smu_internal.h   |  2 --
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c  | 26 --
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c  | 25 -
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c |  1 -
 11 files changed, 10 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 36001a4..e039904 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -2567,3 +2567,11 @@ uint32_t smu_get_pptable_power_limit(struct smu_context 
*smu)

 return ret;
 }
+
+int smu_send_smc_msg(struct smu_context *smu, uint16_t msg)
[kevin]:
please use "enum smu_message_type" replace "uint16_t" type.
+{
+   int ret;
+
+   ret = smu->ppt_funcs->send_smc_msg_with_param(smu, msg, 0);
[kevin]:
i think use function smu_send_smc_msg_with_param() replace it is better.
after fixed,
Reviewed-by: Kevin Wang 
+   return ret;
+}
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index 68107de..3f13986 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2137,7 +2137,6 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
 .set_tool_table_location = smu_v11_0_set_tool_table_location,
 .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
 .system_features_control = smu_v11_0_system_features_control,
-   .send_smc_msg = smu_v11_0_send_msg,
 .send_smc_msg_with_param = smu_v11_0_send_msg_with_param,
 .read_smc_arg = smu_v11_0_read_arg,
 .init_display_count = smu_v11_0_init_display_count,
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h 
b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index ada4a8d..fae1026 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -500,7 +500,6 @@ struct pptable_funcs {
 int (*notify_memory_pool_location)(struct smu_context *smu);
 int (*set_last_dcef_min_deep_sleep_clk)(struct smu_context *smu);
 int (*system_features_control)(struct smu_context *smu, bool en);
-   int (*send_smc_msg)(struct smu_context *smu, uint16_t msg);
 int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t msg, 
uint32_t param);
 int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);
 int (*init_display_count)(struct smu_context *smu, uint32_t count);
@@ -725,4 +724,6 @@ int smu_get_dpm_clock_table(struct smu_context *smu,

 uint32_t smu_get_pptable_power_limit(struct smu_context *smu);

+int smu_send_smc_msg(struct smu_context *smu, uint16_t msg);
+
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h 
b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
index 5a27713..80b1d20 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
@@ -177,8 +177,6 @@ int smu_v11_0_notify_memory_pool_location(struct 
smu_context *smu);
 int smu_v11_0_system_features_control(struct smu_context *smu,
  bool en);

-int smu_v11_0_send_msg(struct smu_context *smu, uint16_t msg);
-
 int
 smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
   uint32_t param);
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h 
b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
index 44c65dd..f709f6e 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
@@ -44,8 +44,6 @@ int smu_v12_0_read_arg(struct smu_context *smu, uint32_t 
*arg);

 int smu_v12_0_wait_for_response(struct smu_context *smu);

-int smu_v12_0_send_msg(struct smu_context *smu, uint16_t msg);
-
 int
 smu_v12_0_send_msg_with_param(struct smu_

[PATCH] drm/amdgpu/powerplay: unify smu send message function

2019-12-02 Thread Likun Gao
From: Likun Gao 

Drop smu_send_smc_msg function from ASIC specify structure.
Reuse smu_send_smc_msg_with_param function for smu_send_smc_msg.
Set paramer to 0 for smu_send_msg function, otherwise it will send
with previous paramer value (Not a certain value).

Signed-off-by: Likun Gao 
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  8 
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c   |  1 -
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h |  3 ++-
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h  |  2 --
 drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h  |  2 --
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c |  1 -
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c |  1 -
 drivers/gpu/drm/amd/powerplay/smu_internal.h   |  2 --
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c  | 26 --
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c  | 25 -
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c |  1 -
 11 files changed, 10 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 36001a4..e039904 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -2567,3 +2567,11 @@ uint32_t smu_get_pptable_power_limit(struct smu_context 
*smu)
 
return ret;
 }
+
+int smu_send_smc_msg(struct smu_context *smu, uint16_t msg)
+{
+   int ret;
+
+   ret = smu->ppt_funcs->send_smc_msg_with_param(smu, msg, 0);
+   return ret;
+}
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index 68107de..3f13986 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2137,7 +2137,6 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
.set_tool_table_location = smu_v11_0_set_tool_table_location,
.notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
.system_features_control = smu_v11_0_system_features_control,
-   .send_smc_msg = smu_v11_0_send_msg,
.send_smc_msg_with_param = smu_v11_0_send_msg_with_param,
.read_smc_arg = smu_v11_0_read_arg,
.init_display_count = smu_v11_0_init_display_count,
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h 
b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index ada4a8d..fae1026 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -500,7 +500,6 @@ struct pptable_funcs {
int (*notify_memory_pool_location)(struct smu_context *smu);
int (*set_last_dcef_min_deep_sleep_clk)(struct smu_context *smu);
int (*system_features_control)(struct smu_context *smu, bool en);
-   int (*send_smc_msg)(struct smu_context *smu, uint16_t msg);
int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t msg, 
uint32_t param);
int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);
int (*init_display_count)(struct smu_context *smu, uint32_t count);
@@ -725,4 +724,6 @@ int smu_get_dpm_clock_table(struct smu_context *smu,
 
 uint32_t smu_get_pptable_power_limit(struct smu_context *smu);
 
+int smu_send_smc_msg(struct smu_context *smu, uint16_t msg);
+
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h 
b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
index 5a27713..80b1d20 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
@@ -177,8 +177,6 @@ int smu_v11_0_notify_memory_pool_location(struct 
smu_context *smu);
 int smu_v11_0_system_features_control(struct smu_context *smu,
 bool en);
 
-int smu_v11_0_send_msg(struct smu_context *smu, uint16_t msg);
-
 int
 smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
  uint32_t param);
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h 
b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
index 44c65dd..f709f6e 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h
@@ -44,8 +44,6 @@ int smu_v12_0_read_arg(struct smu_context *smu, uint32_t 
*arg);
 
 int smu_v12_0_wait_for_response(struct smu_context *smu);
 
-int smu_v12_0_send_msg(struct smu_context *smu, uint16_t msg);
-
 int
 smu_v12_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
  uint32_t param);
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c 
b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index f842246..15403b7 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -2083,7 +2083,6 @@ static const struct pptable_funcs navi10_ppt_funcs = {
.set_tool_table_location = smu_v11_0_set_tool_table_location,
.notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,