Create shared array of power profile name strings
Subsystems (3)
cover Create shared array of power profile name strings
== Description ==
All the power profile modes use the same strings (or a subset of) Creating a public array of the strings will allow sharing rather than duplicating for each chip
First patch only implements change for navi10
Second patch extends the changes to all other implementations of pp_hwmgr_func->get_power_profile_mode (smu10, smu7, vega10, vega20)
and pptable_funcs->get_power_profile_mode (arcturus, sienna_cichlid, vangogh, renoir)
=== Test System ===
* DESKTOP(AMD FX-8350 + NAVI10(731F/ca), BIOS: F2)
+ ISO(Ubuntu 20.04.3 LTS)
+ Kernel(5.13.0-geabeb4f20a07-fdoagd5f)
=== Patch Summary ===
linux: ([email protected]:agd5f) origin/amd-staging-drm-next @ 1e7a606dca04
+ 482319edaabb amdgpu/pm: Create shared array of power profile name strings
+ 1e7a606dca04 amdgpu/pm: Modify implmentations of get_power_profile_mode to use amdgpu_pp_profile_name
=== Test ===
LOGFILE=pp_profile_strings.test.log
AMDGPU_PCI_ADDR=lspci -nn | grep "VGA\|Display" | cut -d " " -f 1 AMDGPU_HWMON=ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | awk '{print $9}' HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}
lspci -nn | grep "VGA\|Display" > $LOGFILE
FILES="pp_power_profile_mode "
for f in $FILES
do
echo === $f === >> $LOGFILE
cat $HWMON_DIR/device/$f >> $LOGFILE
done
cat $LOGFILE
Darren Powell (2):
amdgpu/pm: Create shared array of power profile name strings amdgpu/pm: Modify implmentations of get_power_profile_mode to use
amdgpu_pp_profile_name
drivers/gpu/drm/amd/include/kgd_pp_interface.h | 4 ++++ drivers/gpu/drm/amd/pm/amdgpu_pm.c | 10 ++++++++++ .../gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 9 +-------- .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 14 +++----------- .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 12 +++--------- .../gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 10 +--------- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 10 +--------- 11 files changed, 27 insertions(+), 82 deletions(-)
base-commit: eabeb4f20a0786188fba07a2dd1b0a614c4e15f6
Signature · 1 line
2.33.1
PATCH 1/2 amdgpu/pm: Create shared array of power profile name strings
== Description ==
All the power profile modes use the same strings (or a subset of) Creating a public array of the strings will allow sharing rather than duplicating for each chip
First patch only implements change for navi10, followup with other chips
== Changes ==
Create a declaration of the public array in kgd_pp_interface.h Define the public array in amdgpu_pm.c
Modify the implementaiton of navi10_get_power_profile_mode to use new array
== Test ==
LOGFILE=pp_profile_strings.test.log
AMDGPU_PCI_ADDR=lspci -nn | grep "VGA\|Display" | cut -d " " -f 1 AMDGPU_HWMON=ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | awk '{print $9}' HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}
lspci -nn | grep "VGA\|Display" > $LOGFILE
FILES="pp_power_profile_mode "
for f in $FILES
do
echo === $f === >> $LOGFILE
cat $HWMON_DIR/device/$f >> $LOGFILE
done
cat $LOGFILE
--- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 4 ++++ drivers/gpu/drm/amd/pm/amdgpu_pm.c | 10 ++++++++++ drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 10 +--------- 3 files changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +4 -0
@@ -153,6 +153,10 @@ enum PP_SMC_POWER_PROFILE { PP_SMC_POWER_PROFILE_COUNT, }; +extern const char *const amdgpu_pp_profile_name[PP_SMC_POWER_PROFILE_COUNT ]; + + +enum {PP_GROUP_UNKNOWN =0 ,PP_GROUP_GFX =1 ,
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10 -0
@@ -82,6 +82,16 @@ static const struct hwmon_temp_label { {PP_TEMP_MEM, "mem"}, }; +const char *const amdgpu_pp_profile_name[] = { +"BOOTUP_DEFAULT" , +"3D_FULL_SCREEN" , +"POWER_SAVING" , +"VIDEO" , +"VR" , +"COMPUTE" , +"CUSTOM" +}; +/** * DOC: power_dpm_state *
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -9
@@ -1710,14 +1710,6 @@ static int navi10_get_power_profile_mode(struct smu_context *smu, char *buf)DpmActivityMonitorCoeffInt_t activity_monitor;uint32_t i, size =0 ;int16_t workload_type =0 ; -static const char *profile_name[] = { -"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" };static const char *title[] = {"PROFILE_INDEX(NAME)" ,"CLOCK_TYPE(NAME)" ,
@@ -1756,7 +1748,7 @@ static int navi10_get_power_profile_mode(struct smu_context *smu, char *buf) } size +=sysfs_emit_at (buf, size,"%2d %14s%s:\n" , - i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + i, amdgpu_pp_profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); size += sysfs_emit_at(buf, size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", " ",
Signature · 1 line
2.33.1
PATCH 2/2 amdgpu/pm: Modify implmentations of get_power_profile_mode to use amdgpu_pp_profile_name
In reply to Darren Powell After modifying navi10 in previous commit, extend the changes so all implementations of pp_hwmgr_func->get_power_profile_mode and pptable_funcs->get_power_profile_mode use amdgpu_pp_profile_name
== Test ==
LOGFILE=pp_profile_strings.test.log
AMDGPU_PCI_ADDR=lspci -nn | grep "VGA\|Display" | cut -d " " -f 1 AMDGPU_HWMON=ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | awk '{print $9}' HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}
lspci -nn | grep "VGA\|Display" > $LOGFILE
FILES="pp_power_profile_mode "
for f in $FILES
do
echo === $f === >> $LOGFILE
cat $HWMON_DIR/device/$f >> $LOGFILE
done
cat $LOGFILE
--- .../gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 9 +-------- .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 14 +++----------- .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 12 +++--------- .../gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 10 +--------- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 10 +--------- 8 files changed, 12 insertions(+), 73 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +1 -8
@@ -1441,13 +1441,6 @@ static int smu10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) {70, 90, 0, 0,}, {30, 60, 0, 6,}, }; -static const char *profile_name[6 ] = { -"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" };static const char *title[6 ] = {"NUM" ,"MODE_NAME" , "BUSY_SET_POINT",
@@ -1465,7 +1458,7 @@ static int smu10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)for (i =0 ; i <=PP_SMC_POWER_PROFILE_COMPUTE ; i++) size +=sysfs_emit_at (buf, size,"%3d %14s%s: %14d %3d %10d %14d\n" , - i, profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , + i, amdgpu_pp_profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , profile_mode_setting[i][0 ], profile_mode_setting[i][1 ], profile_mode_setting[i][2 ], profile_mode_setting[i][3 ]);
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +3 -11
@@ -5500,14 +5500,6 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)uint32_t i, size =0 ;uint32_t len; -static const char *profile_name[7 ] = {"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" }; -static const char *title[8 ] = {"NUM" ,"MODE_NAME" ,"SCLK_UP_HYST" ,
@@ -5531,7 +5523,7 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)for (i =0 ; i < len; i++) {if (i == hwmgr->power_profile_mode) { size += sysfs_emit_at(buf, size, "%3d %14s %s: %8d %16d %16d %16d %16d %16d\n", - i, profile_name[i], "*", + i, amdgpu_pp_profile_name[i], "*", data->current_profile_setting.sclk_up_hyst, data->current_profile_setting.sclk_down_hyst, data->current_profile_setting.sclk_activity,
@@ -5542,12 +5534,12 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) }if (smu7_profiling[i].bupdate_sclk) size +=sysfs_emit_at (buf, size,"%3d %16s: %8d %16d %16d " , - i, profile_name[i], smu7_profiling[i].sclk_up_hyst, + i, amdgpu_pp_profile_name[i], smu7_profiling[i].sclk_up_hyst, smu7_profiling[i].sclk_down_hyst, smu7_profiling[i].sclk_activity);else size +=sysfs_emit_at (buf, size,"%3d %16s: %8s %16s %16s " , - i, profile_name[i],"-" ,"-" ,"-" ); + i, amdgpu_pp_profile_name[i],"-" ,"-" ,"-" );if (smu7_profiling[i].bupdate_mclk) size += sysfs_emit_at(buf, size, "%16d %16d %16d\n",
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +3 -9
@@ -5099,13 +5099,6 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) {70, 90, 0, 0,}, {30, 60, 0, 6,}, }; -static const char *profile_name[7 ] = {"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" };static const char *title[6 ] = {"NUM" ,"MODE_NAME" , "BUSY_SET_POINT",
@@ -5123,11 +5116,12 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)for (i =0 ; i <PP_SMC_POWER_PROFILE_CUSTOM ; i++) size +=sysfs_emit_at (buf, size,"%3d %14s%s: %14d %3d %10d %14d\n" , - i, profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , + i, amdgpu_pp_profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , profile_mode_setting[i][0 ], profile_mode_setting[i][1 ], profile_mode_setting[i][2 ], profile_mode_setting[i][3 ]); + size +=sysfs_emit_at (buf, size,"%3d %14s%s: %14d %3d %10d %14d\n" , i, - profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , + amdgpu_pp_profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " , data->custom_profile_mode[0 ], data->custom_profile_mode[1 ], data->custom_profile_mode[2 ], data->custom_profile_mode[3 ]);return size;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +1 -9
@@ -3982,14 +3982,6 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)DpmActivityMonitorCoeffInt_t activity_monitor;uint32_t i, size =0 ;uint16_t workload_type =0 ; -static const char *profile_name[] = { -"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" };static const char *title[] = {"PROFILE_INDEX(NAME)" ,"CLOCK_TYPE(NAME)" ,
@@ -4023,7 +4015,7 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) return result); size +=sysfs_emit_at (buf, size,"%2d %14s%s:\n" , - i, profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " ); + i, amdgpu_pp_profile_name[i], (i == hwmgr->power_profile_mode) ?"*" :" " ); size += sysfs_emit_at(buf, size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", " ",
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +1 -9
@@ -1389,14 +1389,6 @@ 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" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" };static const char *title[] = {"PROFILE_INDEX(NAME)" ,"CLOCK_TYPE(NAME)" ,
@@ -1453,7 +1445,7 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu, } size +=sysfs_emit_at (buf, size,"%2d %14s%s\n" , - i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + i, amdgpu_pp_profile_name[i], (i == smu->power_profile_mode) ?"*" :" " );if (smu_version >=0x360d00 ) { size += sysfs_emit_at(buf, size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n",
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -9
@@ -1342,14 +1342,6 @@ static int sienna_cichlid_get_power_profile_mode(struct smu_context *smu, char * &(activity_monitor_external.DpmActivityMonitorCoeffInt);uint32_t i, size =0 ;int16_t workload_type =0 ; -static const char *profile_name[] = { -"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" };static const char *title[] = {"PROFILE_INDEX(NAME)" ,"CLOCK_TYPE(NAME)" ,
@@ -1388,7 +1380,7 @@ static int sienna_cichlid_get_power_profile_mode(struct smu_context *smu, char * } size +=sysfs_emit_at (buf, size,"%2d %14s%s:\n" , - i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + i, amdgpu_pp_profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); size += sysfs_emit_at(buf, size, "%19s %d(%13s) %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", " ",
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -9
@@ -1013,14 +1013,6 @@ static int vangogh_get_dpm_ultimate_freq(struct smu_context *smu,static int vangogh_get_power_profile_mode (struct smu_context *smu,char *buf) { -static const char *profile_name[] = { -"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" };uint32_t i, size =0 ;int16_t workload_type =0 ;
@@ -1040,7 +1032,7 @@ static int vangogh_get_power_profile_mode(struct smu_context *smu,continue ; size +=sysfs_emit_at (buf, size,"%2d %14s%s\n" , - i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + i, amdgpu_pp_profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); }return size;
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +1 -9
@@ -1095,14 +1095,6 @@ static int renoir_set_watermarks_table(static int renoir_get_power_profile_mode (struct smu_context *smu,char *buf) { -static const char *profile_name[] = { -"BOOTUP_DEFAULT" , -"3D_FULL_SCREEN" , -"POWER_SAVING" , -"VIDEO" , -"VR" , -"COMPUTE" , -"CUSTOM" };uint32_t i, size =0 ;int16_t workload_type =0 ;
@@ -1121,7 +1113,7 @@ static int renoir_get_power_profile_mode(struct smu_context *smu,continue ; size +=sysfs_emit_at (buf, size,"%2d %14s%s\n" , - i, profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); + i, amdgpu_pp_profile_name[i], (i == smu->power_profile_mode) ?"*" :" " ); }return size;
Signature · 1 line
2.33.1
Quoted 35 lines · Darren Powell
== Description ==
All the power profile modes use the same strings (or a subset of) Creating a public array of the strings will allow sharing rather than duplicating for each chip
First patch only implements change for navi10
Second patch extends the changes to all other implementations ofpp_hwmgr_func->get_power_profile_mode(smu10, smu7, vega10, vega20)
andpptable_funcs->get_power_profile_mode(arcturus,sienna_cichlid, vangogh, renoir)=== Test System ===
*DESKTOP(AMD FX-8350 + NAVI10(731F/ca), BIOS: F2)
+ ISO(Ubuntu 20.04.3 LTS)
+ Kernel(5.13.0-geabeb4f20a07-fdoagd5f)=== Patch Summary ===
linux: ([email protected]:agd5f) origin/amd-staging-drm-next @1e7a606dca04
+482319edaabbamdgpu/pm: Create shared array of power profile name strings
+1e7a606dca04amdgpu/pm: Modify implmentations ofget_power_profile_modeto useamdgpu_pp_profile_name=== Test ===
LOGFILE=pp_profile_strings.test.log
AMDGPU_PCI_ADDR=lspci -nn | grep "VGA\|Display" | cut -d " " -f 1AMDGPU_HWMON=ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | awk '{print $9}'HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}lspci -nn | grep "VGA\|Display" > $LOGFILE
FILES="pp_power_profile_mode "for f in $FILES
do
echo === $f === >> $LOGFILE
cat $HWMON_DIR/device/$f >> $LOGFILE
done
cat $LOGFILE
Quoted 5 lines
Darren Powell (2):
amdgpu/pm: Create shared array of power profile name strings amdgpu/pm: Modify implmentations ofget_power_profile_modeto use
amdgpu_pp_profile_name
Series is -
Thanks,
Lijo
Quoted 16 lines
drivers/gpu/drm/amd/include/kgd_pp_interface.h | 4 ++++ drivers/gpu/drm/amd/pm/amdgpu_pm.c | 10 ++++++++++ .../gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 9 +-------- .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 14 +++----------- .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 12 +++--------- .../gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 10 +--------- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 10 +--------- drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 10 +--------- 11 files changed, 27 insertions(+), 82 deletions(-)base-commit:
eabeb4f20a0786188fba07a2dd1b0a614c4e15f6