drm/amdkfd: use correct method to get clock under SRIOV
Subsystems (3)
PATCH 1/1 drm/amdkfd: use correct method to get clock under SRIOV
[What]
Current SRIOV still using adev->clock.default_XX which gets from atomfirmware. But these fields are abandoned in atomfirmware long ago. Which may cause function to return a 0 value.
[How]
We don't need to check whether SR-IOV. For SR-IOV one-vf-mode, pm is enabled and VF is able to read dpm clock
from pmfw, so we can use dpm clock interface directly. For multi-VF mode, VF pm is disabled, so driver can just react as pm disabled. One-vf-mode is introduced from GFX9 so it shall not have any backward compatibility issue.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -6
@@ -442,9 +442,7 @@ void amdgpu_amdkfd_get_local_mem_info(struct amdgpu_device *adev, mem_info->local_mem_size_public, mem_info->local_mem_size_private); -if (amdgpu_sriov_vf (adev)) - mem_info->mem_clk_max = adev->clock.default_mclk /100 ; -else if (adev->pm.dpm_enabled) { +if (adev->pm.dpm_enabled) {if (amdgpu_emu_mode ==1 ) mem_info->mem_clk_max =0 ;else
@@ -463,9 +461,7 @@ uint64_t amdgpu_amdkfd_get_gpu_clock_counter(struct amdgpu_device *adev)uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz (struct amdgpu_device *adev) {/* the sclk is in quantas of 10kHz */ -if (amdgpu_sriov_vf (adev)) -return adev->clock.default_sclk /100 ; -else if (adev->pm.dpm_enabled) +if (adev->pm.dpm_enabled)return amdgpu_dpm_get_sclk (adev, false) /100 ;else return 100 ;
Signature · 1 line
2.34.1
Quoted 13 lines · Horace Chen
[What]
Current SRIOV still usingadev->clock.default_XXwhich gets from atomfirmware. But these fields are abandoned in atomfirmware long ago. Which may cause function to return a 0 value.[How]
We don't need to check whether SR-IOV. For SR-IOV one-vf-mode, pm is enabled and VF is able to read dpm clock
from pmfw, so we can use dpm clock interface directly. For multi-VF mode, VF pm is disabled, so driver can just react as pm disabled. One-vf-mode is introduced from GFX9 so it shall not have any backward compatibility issue.
Quoted 1 line
Signed-off-by Horace Chen <[email protected]>
Quoted 30 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-6@@ -442,9 +442,7 @@ void amdgpu_amdkfd_get_local_mem_info(struct amdgpu_device *adev, mem_info->local_mem_size_public, mem_info->local_mem_size_private); -if (amdgpu_sriov_vf (adev)) - mem_info->mem_clk_max = adev->clock.default_mclk /100 ; -else if (adev->pm.dpm_enabled) { +if (adev->pm.dpm_enabled) {if (amdgpu_emu_mode ==1 ) mem_info->mem_clk_max =0 ;else @@ -463,9 +461,7 @@ uint64_t amdgpu_amdkfd_get_gpu_clock_counter(struct amdgpu_device *adev)uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz (struct amdgpu_device *adev) {/* the sclk is in quantas of 10kHz */ -if (amdgpu_sriov_vf (adev)) -return adev->clock.default_sclk /100 ; -else if (adev->pm.dpm_enabled) +if (adev->pm.dpm_enabled)return amdgpu_dpm_get_sclk (adev, false) /100 ;else return 100 ;