diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-12-18 22:17:00 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-06-26 16:11:45 -0400 |
commit | 44fa346f7ac0e23a53ae0a5587d14ef1c3f86647 (patch) | |
tree | e743022fa024c50060c4a94b9e79ac2ebe7378fe /drivers/gpu/drm/radeon/cik.c | |
parent | 64f759cc6acf702d61cfb4bf0ce4a76aa6fe3be7 (diff) | |
download | lwn-44fa346f7ac0e23a53ae0a5587d14ef1c3f86647.tar.gz lwn-44fa346f7ac0e23a53ae0a5587d14ef1c3f86647.zip |
drm/radeon: add get_gpu_clock_counter() callback for cik
Used for GPU clock counter snapshots.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/cik.c')
-rw-r--r-- | drivers/gpu/drm/radeon/cik.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index f17e4912eb6a..7aae670080d3 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -5554,3 +5554,24 @@ void dce8_bandwidth_update(struct radeon_device *rdev) dce8_program_watermarks(rdev, rdev->mode_info.crtcs[i], lb_size, num_heads); } } + +/** + * cik_get_gpu_clock_counter - return GPU clock counter snapshot + * + * @rdev: radeon_device pointer + * + * Fetches a GPU clock counter snapshot (SI). + * Returns the 64 bit clock counter snapshot. + */ +uint64_t cik_get_gpu_clock_counter(struct radeon_device *rdev) +{ + uint64_t clock; + + mutex_lock(&rdev->gpu_clock_mutex); + WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1); + clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) | + ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL); + mutex_unlock(&rdev->gpu_clock_mutex); + return clock; +} + |