drm/amd/powerplay: support custom power profile setting
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: support custom power profile setting
Support custom power profile mode settings on Arcturus.
--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 132 +++++++++++++++++- .../powerplay/inc/smu11_driver_if_arcturus.h | 6 +- 2 files changed, 128 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +126 -6
@@ -179,6 +179,7 @@ static struct smu_11_0_cmn2aisc_mapping arcturus_table_map[SMU_TABLE_COUNT] = {TAB_MAP (DRIVER_SMU_CONFIG ),TAB_MAP (OVERDRIVE ),TAB_MAP (I2C_COMMANDS ), + TAB_MAP(ACTIVITY_MONITOR_COEFF), };static struct smu_11_0_cmn2aisc_mapping arcturus_pwr_src_map[SMU_POWER_SOURCE_COUNT ] = {
@@ -302,6 +303,10 @@ static int arcturus_tables_init(struct smu_context *smu, struct smu_table *tableSMU_TABLE_INIT (tables,SMU_TABLE_I2C_COMMANDS ,sizeof (SwI2cRequest_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_ACTIVITY_MONITOR_COEFF , +sizeof (DpmActivityMonitorCoeffInt_t),PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM ); + smu_table->metrics_table =kzalloc (sizeof (SmuMetrics_t),GFP_KERNEL );if (!smu_table->metrics_table)return -ENOMEM ;
@@ -1314,6 +1319,7 @@ static int arcturus_get_power_limit(struct smu_context *smu,static int arcturus_get_power_profile_mode (struct smu_context *smu,char *buf) { +DpmActivityMonitorCoeffInt_t activity_monitor;static const char *profile_name[] = {"BOOTUP_DEFAULT" ,"3D_FULL_SCREEN" ,
@@ -1323,14 +1329,35 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,"COMPUTE" , "CUSTOM"};static const char *title[] = { -"PROFILE_INDEX(NAME)" }; +"PROFILE_INDEX(NAME)" , +"CLOCK_TYPE(NAME)" , +"FPS" , +"UseRlcBusy" , +"MinActiveFreqType" , +"MinActiveFreq" , +"BoosterFreqType" , +"BoosterFreq" , +"PD_Data_limit_c" , +"PD_Data_error_coeff" , +"PD_Data_error_rate_coeff" };uint32_t i, size =0 ;int16_t workload_type =0 ; +int result =0 ; +uint32_t smu_version; -if (!smu->pm_enabled || !buf) +if (!buf)return -EINVAL ; - size +=sprintf (buf + size,"%16s\n" , + result =smu_get_smc_version (smu,NULL , &smu_version); +if (result) +return result; + +if (smu_version >=0x360d00 ) + size +=sprintf (buf + size,"%16s %s %s %s %s %s %s %s %s %s %s\n" , + title[0 ], title[1 ], title[2 ], title[3 ], title[4 ], title[5 ], + title[6 ], title[7 ], title[8 ], title[9 ], title[10 ]); +else + size +=sprintf (buf + size,"%16s\n" , title[0 ]);for (i =0 ; i <=PP_SMC_POWER_PROFILE_CUSTOM ; i++) {
@@ -1342,8 +1369,50 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,if (workload_type <0 )continue ; +if (smu_version >=0x360d00 ) { + result =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , + workload_type, + (void *)(&activity_monitor), + false); +if (result) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return result; + } + } + size +=sprintf (buf + size,"%2d %14s%s\n" , i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + +if (smu_version >=0x360d00 ) { + size +=sprintf (buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n" , +" " , +0 , +"GFXCLK" , + activity_monitor.Gfx_FPS, + activity_monitor.Gfx_UseRlcBusy, + activity_monitor.Gfx_MinActiveFreqType, + activity_monitor.Gfx_MinActiveFreq, + activity_monitor.Gfx_BoosterFreqType, + activity_monitor.Gfx_BoosterFreq, + activity_monitor.Gfx_PD_Data_limit_c, + activity_monitor.Gfx_PD_Data_error_coeff, + activity_monitor.Gfx_PD_Data_error_rate_coeff); + + size +=sprintf (buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n" , +" " , +1 , +"UCLK" , + activity_monitor.Mem_FPS, + activity_monitor.Mem_UseRlcBusy, + activity_monitor.Mem_MinActiveFreqType, + activity_monitor.Mem_MinActiveFreq, + activity_monitor.Mem_BoosterFreqType, + activity_monitor.Mem_BoosterFreq, + activity_monitor.Mem_PD_Data_limit_c, + activity_monitor.Mem_PD_Data_error_coeff, + activity_monitor.Mem_PD_Data_error_rate_coeff); + } }return size;
@@ -1353,18 +1422,69 @@ static int arcturus_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size) { +DpmActivityMonitorCoeffInt_t activity_monitor;int workload_type =0 ;uint32_t profile_mode = input[size];int ret =0 ; - -if (!smu->pm_enabled) -return -EINVAL ; +uint32_t smu_version;if (profile_mode >PP_SMC_POWER_PROFILE_CUSTOM ) {pr_err ("Invalid power profile mode %d\n" , profile_mode);return -EINVAL ; } + ret =smu_get_smc_version (smu,NULL , &smu_version); +if (ret) +return ret; + +if ((profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) && + (smu_version >=0x360d00 )) { + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , +WORKLOAD_PPLIB_CUSTOM_BIT , + (void *)(&activity_monitor), + false); +if (ret) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return ret; + } + +switch (input[0 ]) { +case 0 :/* Gfxclk */ + activity_monitor.Gfx_FPS = input[1 ]; + activity_monitor.Gfx_UseRlcBusy = input[2 ]; + activity_monitor.Gfx_MinActiveFreqType = input[3 ]; + activity_monitor.Gfx_MinActiveFreq = input[4 ]; + activity_monitor.Gfx_BoosterFreqType = input[5 ]; + activity_monitor.Gfx_BoosterFreq = input[6 ]; + activity_monitor.Gfx_PD_Data_limit_c = input[7 ]; + activity_monitor.Gfx_PD_Data_error_coeff = input[8 ]; + activity_monitor.Gfx_PD_Data_error_rate_coeff = input[9 ]; +break ; +case 1 :/* Uclk */ + activity_monitor.Mem_FPS = input[1 ]; + activity_monitor.Mem_UseRlcBusy = input[2 ]; + activity_monitor.Mem_MinActiveFreqType = input[3 ]; + activity_monitor.Mem_MinActiveFreq = input[4 ]; + activity_monitor.Mem_BoosterFreqType = input[5 ]; + activity_monitor.Mem_BoosterFreq = input[6 ]; + activity_monitor.Mem_PD_Data_limit_c = input[7 ]; + activity_monitor.Mem_PD_Data_error_coeff = input[8 ]; + activity_monitor.Mem_PD_Data_error_rate_coeff = input[9 ]; +break ; + } + + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , +WORKLOAD_PPLIB_CUSTOM_BIT , + (void *)(&activity_monitor), + true); +if (ret) { +pr_err ("[%s] Failed to set activity monitor!" , __func__); +return ret; + } + } +/* * Conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT * Not all profile modes are supported on arcturus.
drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_arcturus.h +2 -4
@@ -823,7 +823,6 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } AvfsFuseOverride_t; -/* NOT CURRENTLY USED typedef struct { uint8_t Gfx_ActiveHystLimit; uint8_t Gfx_IdleHystLimit;
@@ -866,7 +865,6 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } DpmActivityMonitorCoeffInt_t; -*/ // These defines are used with the following messages: // SMC_MSG_TransferTableDram2Smu
@@ -878,11 +876,11 @@ typedef struct {#define TABLE_PMSTATUSLOG 4#define TABLE_SMU_METRICS 5#define TABLE_DRIVER_SMU_CONFIG 6 -//#define TABLE_ACTIVITY_MONITOR_COEFF 7 #define TABLE_OVERDRIVE 7#define TABLE_WAFL_XGMI_TOPOLOGY 8#define TABLE_I2C_COMMANDS 9 -#define TABLE_COUNT 10 +#define TABLE_ACTIVITY_MONITOR_COEFF 10 +#define TABLE_COUNT 11// These defines are used with the SMC_MSG_SetUclkFastSwitch message. typedef enum {
Signature · 6 lines
2.24.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 23 lines · Evan Quan
Support custom power profile mode settings on Arcturus.
Change-Id Id14f9a1cced41433b7487f447c452f8852964891Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 132 +++++++++++++++++- .../powerplay/inc/smu11_driver_if_arcturus.h | 6 +- 2 files changed, 128 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1
-0@@ -179,6 +179,7 @@ static struct smu_11_0_cmn2aisc_mapping arcturus_table_map[SMU_TABLE_COUNT] = {TAB_MAP (DRIVER_SMU_CONFIG ),TAB_MAP (OVERDRIVE ),TAB_MAP (I2C_COMMANDS ), + TAB_MAP(ACTIVITY_MONITOR_COEFF), };static struct smu_11_0_cmn2aisc_mapping arcturus_pwr_src_map[SMU_POWER_SOURCE_COUNT ] = {
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c static int arcturus_tables_init(struct smu_context *smu, struct smu_table *table · line 309
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +4
-0@@ -302,6 +303,10 @@ static int arcturus_tables_init(struct smu_context *smu, struct smu_table *tableSMU_TABLE_INIT (tables,SMU_TABLE_I2C_COMMANDS ,sizeof (SwI2cRequest_t),PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM ); +SMU_TABLE_INIT (tables,SMU_TABLE_ACTIVITY_MONITOR_COEFF , +sizeof (DpmActivityMonitorCoeffInt_t),PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM ); +
Is freeing this handled properly? Assuming that is ok, the patch is:
Quoted 211 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +121
-6smu_table->metrics_table =kzalloc (sizeof (SmuMetrics_t),GFP_KERNEL );if (!smu_table->metrics_table)return -ENOMEM ;@@ -1314,6 +1319,7 @@ static int arcturus_get_power_limit(struct smu_context *smu,static int arcturus_get_power_profile_mode (struct smu_context *smu,char *buf) { +DpmActivityMonitorCoeffInt_t activity_monitor;static const char *profile_name[] = {"BOOTUP_DEFAULT" ,"3D_FULL_SCREEN" ,@@ -1323,14 +1329,35 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,"COMPUTE" , "CUSTOM"};static const char *title[] = { -"PROFILE_INDEX(NAME)" }; +"PROFILE_INDEX(NAME)" , +"CLOCK_TYPE(NAME)" , +"FPS" , +"UseRlcBusy" , +"MinActiveFreqType" , +"MinActiveFreq" , +"BoosterFreqType" , +"BoosterFreq" , +"PD_Data_limit_c" , +"PD_Data_error_coeff" , +"PD_Data_error_rate_coeff" };uint32_t i, size =0 ;int16_t workload_type =0 ; +int result =0 ; +uint32_t smu_version; -if (!smu->pm_enabled || !buf) +if (!buf)return -EINVAL ; - size +=sprintf (buf + size,"%16s\n" , + result =smu_get_smc_version (smu,NULL , &smu_version); +if (result) +return result; + +if (smu_version >=0x360d00 ) + size +=sprintf (buf + size,"%16s %s %s %s %s %s %s %s %s %s %s\n" , + title[0 ], title[1 ], title[2 ], title[3 ], title[4 ], title[5 ], + title[6 ], title[7 ], title[8 ], title[9 ], title[10 ]); +else + size +=sprintf (buf + size,"%16s\n" , title[0 ]);for (i =0 ; i <=PP_SMC_POWER_PROFILE_CUSTOM ; i++) {@@ -1342,8 +1369,50 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,if (workload_type <0 )continue ; +if (smu_version >=0x360d00 ) { + result =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , + workload_type, + (void *)(&activity_monitor), + false); +if (result) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return result; + } + } + size +=sprintf (buf + size,"%2d %14s%s\n" , i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + +if (smu_version >=0x360d00 ) { + size +=sprintf (buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n" , +" " , +0 , +"GFXCLK" , + activity_monitor.Gfx_FPS, + activity_monitor.Gfx_UseRlcBusy, + activity_monitor.Gfx_MinActiveFreqType, + activity_monitor.Gfx_MinActiveFreq, + activity_monitor.Gfx_BoosterFreqType, + activity_monitor.Gfx_BoosterFreq, + activity_monitor.Gfx_PD_Data_limit_c, + activity_monitor.Gfx_PD_Data_error_coeff, + activity_monitor.Gfx_PD_Data_error_rate_coeff); + + size +=sprintf (buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n" , +" " , +1 , +"UCLK" , + activity_monitor.Mem_FPS, + activity_monitor.Mem_UseRlcBusy, + activity_monitor.Mem_MinActiveFreqType, + activity_monitor.Mem_MinActiveFreq, + activity_monitor.Mem_BoosterFreqType, + activity_monitor.Mem_BoosterFreq, + activity_monitor.Mem_PD_Data_limit_c, + activity_monitor.Mem_PD_Data_error_coeff, + activity_monitor.Mem_PD_Data_error_rate_coeff); + } }return size;@@ -1353,18 +1422,69 @@ static int arcturus_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size) { +DpmActivityMonitorCoeffInt_t activity_monitor;int workload_type =0 ;uint32_t profile_mode = input[size];int ret =0 ; - -if (!smu->pm_enabled) -return -EINVAL ; +uint32_t smu_version;if (profile_mode >PP_SMC_POWER_PROFILE_CUSTOM ) {pr_err ("Invalid power profile mode %d\n" , profile_mode);return -EINVAL ; } + ret =smu_get_smc_version (smu,NULL , &smu_version); +if (ret) +return ret; + +if ((profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) && + (smu_version >=0x360d00 )) { + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , +WORKLOAD_PPLIB_CUSTOM_BIT , + (void *)(&activity_monitor), + false); +if (ret) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return ret; + } + +switch (input[0 ]) { +case 0 :/* Gfxclk */ + activity_monitor.Gfx_FPS = input[1 ]; + activity_monitor.Gfx_UseRlcBusy = input[2 ]; + activity_monitor.Gfx_MinActiveFreqType = input[3 ]; + activity_monitor.Gfx_MinActiveFreq = input[4 ]; + activity_monitor.Gfx_BoosterFreqType = input[5 ]; + activity_monitor.Gfx_BoosterFreq = input[6 ]; + activity_monitor.Gfx_PD_Data_limit_c = input[7 ]; + activity_monitor.Gfx_PD_Data_error_coeff = input[8 ]; + activity_monitor.Gfx_PD_Data_error_rate_coeff = input[9 ]; +break ; +case 1 :/* Uclk */ + activity_monitor.Mem_FPS = input[1 ]; + activity_monitor.Mem_UseRlcBusy = input[2 ]; + activity_monitor.Mem_MinActiveFreqType = input[3 ]; + activity_monitor.Mem_MinActiveFreq = input[4 ]; + activity_monitor.Mem_BoosterFreqType = input[5 ]; + activity_monitor.Mem_BoosterFreq = input[6 ]; + activity_monitor.Mem_PD_Data_limit_c = input[7 ]; + activity_monitor.Mem_PD_Data_error_coeff = input[8 ]; + activity_monitor.Mem_PD_Data_error_rate_coeff = input[9 ]; +break ; + } + + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , +WORKLOAD_PPLIB_CUSTOM_BIT , + (void *)(&activity_monitor), + true); +if (ret) { +pr_err ("[%s] Failed to set activity monitor!" , __func__); +return ret; + } + } +/* * Conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT * Not all profile modes are supported on arcturus. drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_arcturus.h +2
-5@@ -823,7 +823,6 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } AvfsFuseOverride_t; -/* NOT CURRENTLY USED typedef struct { uint8_t Gfx_ActiveHystLimit; uint8_t Gfx_IdleHystLimit;@@ -866,7 +865,6 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } DpmActivityMonitorCoeffInt_t; -*/ // These defines are used with the following messages: // SMC_MSG_TransferTableDram2Smu @@ -878,11 +876,11 @@ typedef struct {#define TABLE_PMSTATUSLOG 4#define TABLE_SMU_METRICS 5#define TABLE_DRIVER_SMU_CONFIG 6 -//#define TABLE_ACTIVITY_MONITOR_COEFF 7 #define TABLE_OVERDRIVE 7#define TABLE_WAFL_XGMI_TOPOLOGY 8#define TABLE_I2C_COMMANDS 9 -#define TABLE_COUNT 10 +#define TABLE_ACTIVITY_MONITOR_COEFF 10 +#define TABLE_COUNT 11// These defines are used with the SMC_MSG_SetUclkFastSwitch message. typedef enum { --2.24.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
Quoted 43 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, December 24, 2019 3:35 AM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: support custom power profile settingQuoted 7 lines · Evan Quan
Support custom power profile mode settings on Arcturus.
Change-Id Id14f9a1cced41433b7487f447c452f8852964891Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 132+++++++++++++++++-
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c static struct smu_11_0_cmn2aisc_mapping
Quoted 9 lines
.../powerplay/inc/smu11_driver_if_arcturus.h | 6 +- 2 files changed, 128 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0
-0@@ -179,6 +179,7 @@ static struct smu_11_0_cmn2aisc_mappingarcturus_table_map[SMU_TABLE_COUNT] = {
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1
-0TAB_MAP (DRIVER_SMU_CONFIG ),TAB_MAP (OVERDRIVE ),TAB_MAP (I2C_COMMANDS ), + TAB_MAP(ACTIVITY_MONITOR_COEFF), }; static struct smu_11_0_cmn2aisc_mappingarcturus_pwr_src_map[SMU_POWER_SOURCE_COUNT] = { @@ -302,6
+303,10 @@ static int arcturus_tables_init(struct
smu_context*smu, structsmu_table*tableQuoted 1 line
SMU_TABLE_INIT(tables,
SMU_TABLE_I2C_COMMANDS,
sizeof(SwI2cRequest_t),Quoted 2 lines
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c static int arcturus_tables_init(struct smu_context *smu, struct smu_table *table · line 309
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +4
-0+SMU_TABLE_INIT (tables,SMU_TABLE_ACTIVITY_MONITOR_COEFF , +sizeof (DpmActivityMonitorCoeffInt_t),PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM ); +Is freeing this handled properly? Assuming that is ok, the patch is:
Reviewed-by Alex Deucher <[email protected]>
[Quan, Evan] Yes, that is well handled. smu_fini_fb_allocations() is responsible for reclaiming all the tables.
Quoted 226 lines
Quoted 6 lines
smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t), GFP_KERNEL); if (!smu_table->metrics_table) return -ENOMEM;drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0
-0@@ -1314,6 +1319,7 @@ static int arcturus_get_power_limit(struct
smu_context*smu, static int arcturus_get_power_profile_mode(struct
smu_context*smu,Quoted 6 lines
char *buf) { + DpmActivityMonitorCoeffInt_t activity_monitor; static const char *profile_name[] = { "BOOTUP_DEFAULT", "3D_FULL_SCREEN", @@ -1323,14+1329,35 @@ static int arcturus_get_power_profile_mode(struct
smu_context*smu,Quoted 29 lines
"COMPUTE", "CUSTOM"}; static const char *title[] = {drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +18
-3- "PROFILE_INDEX(NAME)"}; +"PROFILE_INDEX(NAME)" , +"CLOCK_TYPE(NAME)" , +"FPS" , +"UseRlcBusy" , +"MinActiveFreqType" , +"MinActiveFreq" , +"BoosterFreqType" , +"BoosterFreq" , +"PD_Data_limit_c" , +"PD_Data_error_coeff" , + "PD_Data_error_rate_coeff"};uint32_t i, size =0 ;int16_t workload_type =0 ; +int result =0 ; +uint32_t smu_version; -if (!smu->pm_enabled || !buf) +if (!buf)return -EINVAL ; - size += sprintf(buf + size, "%16s\n", + result =smu_get_smc_version (smu,NULL , &smu_version); +if (result) +return result; +drivers/gpu/drm/amd/powerplay/arcturus_ppt.c static int arcturus_get_power_profile_mode(struct smu_context *smu,
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +6
-1+if (smu_version >=0x360d00 ) + size +=sprintf (buf + size,"%16s %s %s %s %s %s %s %s %s %s %s\n" , + title[0 ], title[1 ], title[2 ], title[3 ], title[4 ], title[5 ], + title[6 ], title[7 ], title[8 ], title[9 ], title[10 ]); +else + size +=sprintf (buf + size,"%16s\n" , title[0 ]); for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) { @@ -1342,8 +1369,50 @@ static int arcturus_get_power_profile_mode(struct
smu_context*smu,Quoted 18 lines
if (
workload_type< 0)
continue;drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +12
-0+if (smu_version >=0x360d00 ) { + result =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , + workload_type, + (void *)(&activity_monitor), + false); +if (result) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return result; + } + } + size += sprintf(buf + size, "%2d %14s%s\n", i, profile_name[i], (i ==
smu->power_profile_mode) ? "*" : " ");drivers/gpu/drm/amd/powerplay/arcturus_ppt.c static int arcturus_get_power_profile_mode(struct smu_context *smu,
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +3
-0+ +if (smu_version >=0x360d00 ) { + size += sprintf(buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n",
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +5
-0+" " , +0 , +"GFXCLK" , + activity_monitor.Gfx_FPS, + activity_monitor.Gfx_UseRlcBusy,drivers/gpu/drm/amd/powerplay/arcturus_ppt.c static int arcturus_get_power_profile_mode(struct smu_context *smu,
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +10
-0+ activity_monitor.Gfx_MinActiveFreqType, + activity_monitor.Gfx_MinActiveFreq, + activity_monitor.Gfx_BoosterFreqType, + activity_monitor.Gfx_BoosterFreq, + activity_monitor.Gfx_PD_Data_limit_c, + activity_monitor.Gfx_PD_Data_error_coeff, + + activity_monitor.Gfx_PD_Data_error_rate_coeff); + + size += sprintf(buf + size,"%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n",
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c static int
Quoted 17 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +13
-0+" " , +1 , +"UCLK" , + activity_monitor.Mem_FPS, + activity_monitor.Mem_UseRlcBusy, + activity_monitor.Mem_MinActiveFreqType, + activity_monitor.Mem_MinActiveFreq, + activity_monitor.Mem_BoosterFreqType, + activity_monitor.Mem_BoosterFreq, + activity_monitor.Mem_PD_Data_limit_c, + activity_monitor.Mem_PD_Data_error_coeff, + activity_monitor.Mem_PD_Data_error_rate_coeff); + } }return size;@@ -1353,18 +1422,69 @@ static intarcturus_set_power_profile_mode(struct
smu_context*smu,Quoted 109 lines
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +54
-3long *input, uint32_t size) { +DpmActivityMonitorCoeffInt_t activity_monitor;int workload_type =0 ;uint32_t profile_mode = input[size];int ret =0 ; - -if (!smu->pm_enabled) -return -EINVAL ; +uint32_t smu_version;if (profile_mode >PP_SMC_POWER_PROFILE_CUSTOM ) {pr_err ("Invalid power profile mode %d\n" , profile_mode);return -EINVAL ; } + ret =smu_get_smc_version (smu,NULL , &smu_version); +if (ret) +return ret; + +if ((profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) && + (smu_version >=0x360d00 )) { + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , +WORKLOAD_PPLIB_CUSTOM_BIT , + (void *)(&activity_monitor), + false); +if (ret) { +pr_err ("[%s] Failed to get activity monitor!" , __func__); +return ret; + } + +switch (input[0 ]) { +case 0 :/* Gfxclk */ + activity_monitor.Gfx_FPS = input[1 ]; + activity_monitor.Gfx_UseRlcBusy = input[2 ]; + activity_monitor.Gfx_MinActiveFreqType = input[3 ]; + activity_monitor.Gfx_MinActiveFreq = input[4 ]; + activity_monitor.Gfx_BoosterFreqType = input[5 ]; + activity_monitor.Gfx_BoosterFreq = input[6 ]; + activity_monitor.Gfx_PD_Data_limit_c = input[7 ]; + activity_monitor.Gfx_PD_Data_error_coeff = input[8 ]; + activity_monitor.Gfx_PD_Data_error_rate_coeff = input[9 ]; +break ; +case 1 :/* Uclk */ + activity_monitor.Mem_FPS = input[1 ]; + activity_monitor.Mem_UseRlcBusy = input[2 ]; + activity_monitor.Mem_MinActiveFreqType = input[3 ]; + activity_monitor.Mem_MinActiveFreq = input[4 ]; + activity_monitor.Mem_BoosterFreqType = input[5 ]; + activity_monitor.Mem_BoosterFreq = input[6 ]; + activity_monitor.Mem_PD_Data_limit_c = input[7 ]; + activity_monitor.Mem_PD_Data_error_coeff = input[8 ]; + activity_monitor.Mem_PD_Data_error_rate_coeff = input[9 ]; +break ; + } + + ret =smu_update_table (smu, +SMU_TABLE_ACTIVITY_MONITOR_COEFF , +WORKLOAD_PPLIB_CUSTOM_BIT , + (void *)(&activity_monitor), + true); +if (ret) { +pr_err ("[%s] Failed to set activity monitor!" , __func__); +return ret; + } + } +/* * Conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT * Not all profile modes are supported on arcturus. diff --git
a/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_arcturus.hb/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_arcturus.hindexa886f0644d24..910226ec512e100644drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_arcturus.h +0
-1@@ -823,7 +823,6 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use } AvfsFuseOverride_t; -/* NOT CURRENTLY USED typedef struct { uint8_t Gfx_ActiveHystLimit; uint8_t Gfx_IdleHystLimit;@@ -866,7 +865,6 @@ typedef struct {uint32_t MmHubPadding[8 ];// SMU internal use }
DpmActivityMonitorCoeffInt_t; -*/// These defines are used with the following messages:
//SMC_MSG_TransferTableDram2Smudrivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_arcturus.h +2
-3@@ -878,11 +876,11 @@ typedef struct {#define TABLE_PMSTATUSLOG 4#define TABLE_SMU_METRICS 5#define TABLE_DRIVER_SMU_CONFIG 6 -//#define TABLE_ACTIVITY_MONITOR_COEFF 7 #define TABLE_OVERDRIVE 7#define TABLE_WAFL_XGMI_TOPOLOGY 8#define TABLE_I2C_COMMANDS 9 -#define TABLE_COUNT 10 +#define TABLE_ACTIVITY_MONITOR_COEFF 10 +#define TABLE_COUNT 11// These defines are used with the SMC_MSG_SetUclkFastSwitch message. typedef enum { --2.24.0
Quoted 5 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cev
Quoted 1 line
Quoted 6 lines
an.quan%40amd.com%7Cc291ae2fc8ad4b4c095208d787df37bb%7C3dd8961fe 4884e6
Quoted 1 line
08e11a82d994e183d%7C0%7C0%7C637127265093035498&sdata=hqgAJP %2F9vIG
Quoted 1 line
H8%2F2D6XgpyqtVXkMDeXpeK44aN8k9Xw4%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx