diff options
author | Hawking Zhang <Hawking.Zhang@amd.com> | 2024-03-17 19:26:07 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2024-05-02 16:18:12 -0400 |
commit | a2211e475cc0641cd49d019f9c70b1f69fd30e1c (patch) | |
tree | 0d0abcf49f506ea459dda016a17e4d38bbae9199 /drivers/gpu/drm/amd/amdgpu | |
parent | e781af666341ccbc099bd3154f920eca6f74fb16 (diff) |
drm/amdgpu: Switch to smuio func to get gpu clk counter
Switch to smuio callback to query gpu clock counter
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c index 33fe519e617d..8147990ebefc 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c @@ -36,8 +36,6 @@ #include "gc/gc_12_0_0_offset.h" #include "gc/gc_12_0_0_sh_mask.h" -#include "smuio/smuio_14_0_2_offset.h" -#include "smuio/smuio_14_0_2_sh_mask.h" #include "soc24_enum.h" #include "ivsrcid/gfx/irqsrcs_gfx_11_0_0.h" @@ -3467,14 +3465,14 @@ static int gfx_v12_0_wait_for_idle(void *handle) static uint64_t gfx_v12_0_get_gpu_clock_counter(struct amdgpu_device *adev) { - uint64_t clock; + uint64_t clock = 0; + + if (adev->smuio.funcs && + adev->smuio.funcs->get_gpu_clock_counter) + clock = adev->smuio.funcs->get_gpu_clock_counter(adev); + else + dev_warn(adev->dev, "query gpu clock counter is not supported\n"); - amdgpu_gfx_off_ctrl(adev, false); - mutex_lock(&adev->gfx.gpu_clock_mutex); - clock = (uint64_t)RREG32_SOC15(SMUIO, 0, regGOLDEN_TSC_COUNT_LOWER) | - ((uint64_t)RREG32_SOC15(SMUIO, 0, regGOLDEN_TSC_COUNT_UPPER) << 32ULL); - mutex_unlock(&adev->gfx.gpu_clock_mutex); - amdgpu_gfx_off_ctrl(adev, true); return clock; } |