drm/amd/powerplay: simplify the code of [get|set]_activity_monitor_coeff
Subsystems (2)
PATCH v2 1/1 drm/amd/powerplay: simplify the code of [get|set]_activity_monitor_coeff
use smu_update_table_with_arg to replace old code logic
--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 -- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 75 ++----------------- 2 files changed, 7 insertions(+), 74 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -6
@@ -524,12 +524,6 @@ struct smu_funcs struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges);int (*set_od8_default_settings)(struct smu_context *smu,bool initialize); -int (*get_activity_monitor_coeff)(struct smu_context *smu, -uint8_t *table, -uint16_t workload_type); -int (*set_activity_monitor_coeff)(struct smu_context *smu, -uint8_t *table, -uint16_t workload_type);int (*conv_power_profile_to_pplib_workload)(int power_profile);int (*get_power_profile_mode)(struct smu_context *smu,char *buf);int (*set_power_profile_mode)(struct smu_context *smu,long *input,uint32_t size);
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +7 -68
111 lines not on this page · raw message
Signature · 6 lines
2.21.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quan, Evan
Reviewed-by Evan QuanQuoted 211 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: Tuesday, April 09, 2019 10:09 AM
To: [email protected]
Cc: Quan, Evan <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH v2] drm/amd/powerplay: simplify the code of [get|set]_activity_monitor_coeffuse
smu_update_table_with_argto replace old code logicSigned-off-by Kevin Wang <[email protected]>--- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 6 -- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 75 ++----------------- 2 files changed, 7 insertions(+), 74 deletions(-)drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0
-6@@ -524,12 +524,6 @@ struct smu_funcsstruct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges);int (*set_od8_default_settings)(struct smu_context *smu,bool initialize); -int (*get_activity_monitor_coeff)(struct smu_context *smu, -uint8_t *table, -uint16_t workload_type); -int (*set_activity_monitor_coeff)(struct smu_context *smu, -uint8_t *table, -uint16_t workload_type);int (*conv_power_profile_to_pplib_workload)(int power_profile); int (*get_power_profile_mode)(struct smu_context *smu, char*buf);
int (*set_power_profile_mode)(structsmu_context*smu, long
*input,uint32_tsize); diff --gita/drivers/gpu/drm/amd/powerplay/smu_v11_0.cb/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index0e4b4b88af24..d2e2a4e2d0eb100644drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-7@@ -1460,62 +1460,6 @@ static int smu_v11_0_set_od8_default_settings(struct smu_context *smu, return 0; } -static int smu_v11_0_set_activity_monitor_coeff (struct smu_context *smu, -uint8_t *table,uint16_t workload_type) -{ -int ret =0 ; -memcpy (smu- >smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].cpu_addr, - table, smu- >smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].size); - ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_SetDriverDramAddrHigh,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-1- upper_32_bits(smu-Quoted 1 line
smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address));
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2-if (ret) { - pr_err("[%s] Attempt to Set Dram Addr High Failed!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-3-return ret; - } - ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_SetDriverDramAddrLow,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-1- lower_32_bits(smu-Quoted 1 line
smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address));
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2-if (ret) { - pr_err("[%s] Attempt to Set Dram Addr Low Failed!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-3-return ret; - } - ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_TransferTableSmu2Dram,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-1-TABLE_ACTIVITY_MONITOR_COEFF | (
workload_type<< 16));drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2-if (ret) { - pr_err("[%s] Attempt to Transfer Table From SMU Failed!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-11-return ret; - } - -return ret; -} - -static int smu_v11_0_get_activity_monitor_coeff (struct smu_context *smu, -uint8_t *table,uint16_t workload_type) -{ -int ret =0 ; - ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_SetDriverDramAddrHigh,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-1- upper_32_bits(smu-Quoted 1 line
smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address));
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2-if (ret) { - pr_err("[%s] Attempt to Set Dram Addr High Failed!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-4-return ret; - } - - ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_SetDriverDramAddrLow,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-1- lower_32_bits(smu-Quoted 1 line
smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address));
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2-if (ret) { - pr_err("[%s] Attempt to Set Dram Addr Low Failed!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-4-return ret; - } - - ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_TransferTableSmu2Dram,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-1-TABLE_ACTIVITY_MONITOR_COEFF | (
workload_type<< 16));drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2-if (ret) { - pr_err("[%s] Attempt to Transfer Table From SMU Failed!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-6-return ret; - } - -return ret; -} - static int smu_v11_0_conv_power_profile_to_pplib_workload(int
power_profile) {drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0int pplib_workload =0 ;@@ -1584,9 +1528,8 @@ static int smu_v11_0_get_power_profile_mode(struct smu_context *smu, char *buf) for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) {/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
workload_type=smu_v11_0_conv_power_profile_to_pplib_workload(i);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2- result = smu_v11_0_get_activity_monitor_coeff(smu, - (uint8_t*)(&activity_monitor),
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-1- workload_type); + result = smu_update_table_with_arg(smu,
TABLE_ACTIVITY_MONITOR_COEFF,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-0+ workload_type,
&activity_monitor, false);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0if (result) { pr_err("[%s] Failed to get activity monitor!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-1return result;@@ -1658,7 +1601,7 @@ static int smu_v11_0_get_power_profile_mode(struct smu_context *smu, char *buf) static int smu_v11_0_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size) { DpmActivityMonitorCoeffInt_t activity_monitor; -int workload_type, ret =0 ; +int workload_type =0 , ret =0 ; smu->power_profile_mode = input[size];@@ -1668,9 +1611,8 @@ static intsmu_v11_0_set_power_profile_mode(struct
smu_context*smu, long *inputdrivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0} if (smu->power_profile_mode ==
PP_SMC_POWER_PROFILE_CUSTOM) {drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2- ret = smu_v11_0_get_activity_monitor_coeff(smu, - (uint8_t*)(&activity_monitor),
-WORKLOAD_PPLIB_CUSTOM_BIT);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-0+ ret = smu_update_table_with_arg(smu,
TABLE_ACTIVITY_MONITOR_COEFF,
+WORKLOAD_PPLIB_CUSTOM_BIT, &activity_monitor, false);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0if (ret) { pr_err("[%s] Failed to get activity monitor!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0return ret;@@ -1723,9 +1665,8 @@ static intsmu_v11_0_set_power_profile_mode(struct
smu_context*smu, long *inputdrivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2break ; } - ret = smu_v11_0_set_activity_monitor_coeff(smu, - (uint8_t*)(&activity_monitor),
-WORKLOAD_PPLIB_CUSTOM_BIT);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-0+ ret = smu_update_table_with_arg(smu,
TABLE_ACTIVITY_MONITOR_COEFF,
+WORKLOAD_PPLIB_COMPUTE_BIT, &activity_monitor, true);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0if (ret) { pr_err("[%s] Failed to set activity monitor!",
__func__);drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-2return ret;@@ -1994,8 +1935,6 @@ static const struct smu_funcs smu_v11_0_funcs = { .get_sclk = smu_v11_0_dpm_get_sclk, .get_mclk = smu_v11_0_dpm_get_mclk, .set_od8_default_settings = smu_v11_0_set_od8_default_settings, - .get_activity_monitor_coeff = smu_v11_0_get_activity_monitor_coeff, - .set_activity_monitor_coeff = smu_v11_0_set_activity_monitor_coeff, .conv_power_profile_to_pplib_workload =
smu_v11_0_conv_power_profile_to_pplib_workload,drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-1.get_power_profile_mode = smu_v11_0_get_power_profile_mode, .set_power_profile_mode = smu_v11_0_set_power_profile_mode, --2.21.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx