drm/amdgpu: Allow switching to CUSTOM profile on Vega10 v2
Subsystems (2)
PATCH 1/2 drm/amdgpu: Allow switching to CUSTOM profile on Vega10 v2
Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU. But ensure that we zero out the copy stored in adev to ensure that a valid profile has been submitted at some point first
v2: Fix comment that wasn't updated from previous patch
--- .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +22 -1
@@ -1427,6 +1427,15 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)vega10_setup_default_pcie_table (hwmgr); +/* Zero out the saved copy of the CUSTOM profile +* This will be checked when trying to set the profile +* and will require that new values be passed in +*/ + data->custom_profile_mode[0 ] =0 ; + data->custom_profile_mode[1 ] =0 ; + data->custom_profile_mode[2 ] =0 ; + data->custom_profile_mode[3 ] =0 ; +/* save a copy of the default DPM table */ memcpy (&(data->golden_dpm_table), &(data->dpm_table),sizeof (struct vega10_dpm_table ));
@@ -4910,9 +4919,20 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui 1 << power_profile_mode);if (power_profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) { -if (size ==0 || size >4 ) +if (size !=0 && size !=4 )return -EINVAL ; +/* If size = 0 and the CUSTOM profile has been set already +* then just apply the profile. The copy stored in the hwmgr +* is zeroed out on init +*/ +if (size ==0 ) { +if (data->custom_profile_mode[0 ] !=0 ) + goto out; +else +return -EINVAL ; + } + data->custom_profile_mode[0 ] = busy_set_point = input[0 ]; data->custom_profile_mode[1 ] =FPS = input[1 ]; data->custom_profile_mode[2 ] = use_rlc_busy = input[2 ];
@@ -4923,6 +4943,7 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui use_rlc_busy << 16 | min_active_level<<24); } +out: hwmgr->power_profile_mode = power_profile_mode;return 0 ;
Signature · 6 lines
2.17.1 _______________________________________________ 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]
PATCH 2/2 drm/amdgpu: Allow switching to CUSTOM profile on Vega20
Vega20 stores a CUSTOM profile on the GPU, but it may not be valid. Add a bool to vega20_hwmgr to determine whether or not a valid CUSTOM profile has been set, and use that to check when a user requests switching to the CUSTOM profile without passing in any arguments. Then if the CUSTOM profile has been set already, we can switch to it without providing the parameters again
--- .../gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 16 +++++++++++++++- .../gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +15 -1
@@ -434,6 +434,7 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr) hwmgr->platform_descriptor.clockStep.memoryClock =500 ; data->total_active_cus = adev->gfx.cu_info.number; + data->is_custom_profile_set = false;return 0 ; }
@@ -3843,7 +3844,11 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui }if (power_profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) { -if (size <10 ) +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +if (size ==0 && !data->is_custom_profile_set) +return -EINVAL ; +if (size <10 && size !=0 )return -EINVAL ; result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3858,13 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui"[SetPowerProfile] Failed to get activity monitor!" , return result); +/* If size==0, then we want to apply the already-configured +* CUSTOM profile again. Just apply it, since we checked its +* validity above +*/ +if (size ==0 ) + goto out; +switch (input[0 ]) {case 0 :/* Gfxclk */ activity_monitor.Gfx_FPS = input[1 ];
@@ -3903,11 +3915,13 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui result =vega20_set_activity_monitor_coeff (hwmgr, (uint8_t *)(&activity_monitor),WORKLOAD_PPLIB_CUSTOM_BIT ); + data->is_custom_profile_set = true;PP_ASSERT_WITH_CODE (!result,"[SetPowerProfile] Failed to set activity monitor!" , return result); } +out:/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ workload_type =conv_power_profile_to_pplib_workload (power_profile_mode);
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2 -0
@@ -531,6 +531,8 @@ struct vega20_hwmgr {bool pcie_parameters_override;uint32_t pcie_gen_level1;uint32_t pcie_width_level1; + +bool is_custom_profile_set; };#define VEGA20_DPM2_NEAR_TDP_DEC 10
Signature · 6 lines
2.17.1 _______________________________________________ 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]
RE: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega20
Thanks. Reviewed-by: Evan Quan <[email protected]>
Quoted 102 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: 2019年4月1日 19:27
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega20Vega20 stores a CUSTOM profile on the GPU, but it may not be valid. Add a bool to
vega20_hwmgrto determine whether or not a valid CUSTOM profile has been set, and use that to check when a user requests switching to the CUSTOM profile without passing in any arguments. Then if the CUSTOM profile has been set already, we can switch to it without providing the parameters againChange-Id If3e55ec8e5aa6921d4f3f1098f5778036cd69990Signed-off-by Kent Russell <[email protected]>--- .../gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 16 +++++++++++++++- .../gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0@@ -434,6 +434,7 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr) hwmgr->platform_descriptor.clockStep.memoryClock = 500; data->total_active_cus = adev->gfx.cu_info.number; + data->is_custom_profile_set = false;return 0 ;}
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0
-0@@ -3843,7 +3844,11 @@ static int vega20_set_power_profile_mode(struct
pp_hwmgr*hwmgr, long *input, uidrivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5
-1}if (power_profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) { -if (size <10 ) +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend); +if (size ==0 && !data->is_custom_profile_set) +return -EINVAL ; +if (size <10 && size !=0 )return -EINVAL ; result = vega20_get_activity_monitor_coeff(hwmgr,@@ -3853,6 +3858,13 @@ static int vega20_set_power_profile_mode(struct
pp_hwmgr*hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity
monitor!",drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +8
-0return result); +/* If size==0, then we want to apply the already-configured +* CUSTOM profile again. Just apply it, since we checked its +* validity above +*/ +if (size ==0 ) + goto out; +switch (input[0 ]) {case 0 :/* Gfxclk */ activity_monitor.Gfx_FPS = input[1]; @@ -3903,11 +3915,13 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr*hwmgr, long *input, ui
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0result =vega20_set_activity_monitor_coeff (hwmgr, (uint8_t *)(&activity_monitor),WORKLOAD_PPLIB_CUSTOM_BIT ); + data->is_custom_profile_set = true; PP_ASSERT_WITH_CODE(!result, "[SetPowerProfile] Failed to set activitymonitor!",
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-0return result); } +out:/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ workload_type =conv_power_profile_to_pplib_workload(power_profile_mode);drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2
-1@@ -531,6 +531,8 @@ struct vega20_hwmgr {bool pcie_parameters_override;uint32_t pcie_gen_level1;uint32_t pcie_width_level1; + +bool is_custom_profile_set; };#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.17.1
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
Can you confirm that the save custom profile settings are not lost after resume? With that confirmed, the patch is Reviewed-by: Evan Quan <[email protected]>
Quoted 80 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: 2019年4月1日 19:27
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10 v2Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU. But ensure that we zero out the copy stored in adev to ensure that a valid profile has been submitted at some point first
v2: Fix comment that wasn't updated from previous patch
Change-Id Iafa5994e89ce00d3a124285b3435b581ec0e5d3bSigned-off-by Kent Russell <[email protected]>--- .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +9
-0@@ -1427,6 +1427,15 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)vega10_setup_default_pcie_table (hwmgr); +/* Zero out the saved copy of the CUSTOM profile +* This will be checked when trying to set the profile +* and will require that new values be passed in +*/ + data->custom_profile_mode[0 ] =0 ; + data->custom_profile_mode[1 ] =0 ; + data->custom_profile_mode[2 ] =0 ; + data->custom_profile_mode[3 ] =0 ; +/* save a copy of the default DPM table */ memcpy(&(data->golden_dpm_table), &(data->dpm_table),drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0sizeof(struct vega10_dpm_table));@@ -4910,9 +4919,20 @@ static int vega10_set_power_profile_mode(struct
pp_hwmgr*hwmgr, long *input, uidrivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12
-11 << power_profile_mode);if (power_profile_mode ==PP_SMC_POWER_PROFILE_CUSTOM ) { -if (size ==0 || size >4 ) +if (size !=0 && size !=4 )return -EINVAL ; +/* If size = 0 and the CUSTOM profile has been set already +* then just apply the profile. The copy stored in the hwmgr +* is zeroed out on init +*/ +if (size ==0 ) { +if (data->custom_profile_mode[0 ] !=0 ) + goto out; +else +return -EINVAL ; + } + data->custom_profile_mode[0 ] = busy_set_point = input[0 ]; data->custom_profile_mode[1 ] =FPS = input[1 ]; data->custom_profile_mode[2 ] = use_rlc_busy = input[2 ];@@ -4923,6 +4943,7 @@ static int vega10_set_power_profile_mode(struct
pp_hwmgr*hwmgr, long *input, ui
use_rlc_busy<< 16 |
min_active_level<<24);drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-1} +out: hwmgr->power_profile_mode = power_profile_mode;return 0 ; --2.17.1
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
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB33440A254AF4FC93173CDD6EE4560-rweVpJHSKToDMgCC8P//[email protected]
I can confirm it. I switched back and forth a few times and the custom values persisted until reboot. Thanks Evan!
Kent
KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122
________________________________
From: Quan, Evan
Sent: Monday, April 1, 2019 10:19:33 PM
To: Russell, Kent; [email protected]
Cc: Russell, Kent
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10 v2
Can you confirm that the save custom profile settings are not lost after resume? With that confirmed, the patch is Reviewed-by: Evan Quan <[email protected]>
Quoted 77 lines
-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Russell, Kent
Sent: 2019年4月1日 19:27
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on
Vega10 v2Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU. But ensure that we zero out the copy stored in adev to ensure that a valid profile has been submitted at some point first
v2: Fix comment that wasn't updated from previous patch
Change-Id Iafa5994e89ce00d3a124285b3435b581ec0e5d3bSigned-off-by Kent Russell <[email protected]>--- .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +9
-0@@ -1427,6 +1427,15 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)vega10_setup_default_pcie_table (hwmgr); +/* Zero out the saved copy of the CUSTOM profile +* This will be checked when trying to set the profile +* and will require that new values be passed in +*/ + data->custom_profile_mode[0 ] =0 ; + data->custom_profile_mode[1 ] =0 ; + data->custom_profile_mode[2 ] =0 ; + data->custom_profile_mode[3 ] =0 ; +/* save a copy of the default DPM table */ memcpy(&(data->golden_dpm_table), &(data->dpm_table),sizeof(struct vega10_dpm_table));drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -4910,9 +4919,20 @@ static int vega10_set_power_profile_mode(struct
pp_hwmgr*hwmgr, long *input, ui1 << power_profile_mode); if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12
-1-if (size ==0 || size >4 ) +if (size !=0 && size !=4 )return -EINVAL ; +/* If size = 0 and the CUSTOM profile has been set already +* then just apply the profile. The copy stored in the hwmgr +* is zeroed out on init +*/ +if (size ==0 ) { +if (data->custom_profile_mode[0 ] !=0 ) + goto out; +else +return -EINVAL ; + } + data->custom_profile_mode[0 ] = busy_set_point = input[0 ]; data->custom_profile_mode[1 ] =FPS = input[1 ]; data->custom_profile_mode[2 ] = use_rlc_busy = input[2 ];@@ -4923,6 +4943,7 @@ static int vega10_set_power_profile_mode(struct
pp_hwmgr*hwmgr, long *input, uiuse_rlc_busy << 16 | min_active_level<<24); }+out:
hwmgr->power_profile_mode = power_profile_mode; return 0;
Quoted 7 lines
--
2.17.1_______________________________________________
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