From: Evgeny Pinchuk <evgeny.pinchuk@xxxxxxx> Adding new function to the interface used by kfd. The new function retrieves the max engine clock speed. Signed-off-by: Evgeny Pinchuk <evgeny.pinchuk@xxxxxxx> Signed-off-by: Oded Gabbay <oded.gabbay@xxxxxxx> --- drivers/gpu/drm/radeon/radeon_kfd.c | 11 +++++++++++ include/linux/radeon_kfd.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c index 6dba170..8b6d497 100644 --- a/drivers/gpu/drm/radeon/radeon_kfd.c +++ b/drivers/gpu/drm/radeon/radeon_kfd.c @@ -50,6 +50,8 @@ static void unlock_srbm_gfx_cntl(struct kgd_dev *kgd); static void lock_grbm_gfx_idx(struct kgd_dev *kgd); static void unlock_grbm_gfx_idx(struct kgd_dev *kgd); +static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd); + static const struct kfd2kgd_calls kfd2kgd = { .allocate_mem = allocate_mem, @@ -64,6 +66,7 @@ static const struct kfd2kgd_calls kfd2kgd = { .unlock_srbm_gfx_cntl = unlock_srbm_gfx_cntl, .lock_grbm_gfx_idx = lock_grbm_gfx_idx, .unlock_grbm_gfx_idx = unlock_grbm_gfx_idx, + .get_max_engine_clock_in_mhz = get_max_engine_clock_in_mhz, }; static const struct kgd2kfd_calls *kgd2kfd; @@ -307,3 +310,11 @@ static uint64_t get_gpu_clock_counter(struct kgd_dev *kgd) return rdev->asic->get_gpu_clock_counter(rdev); } + +static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd) +{ + struct radeon_device *rdev = (struct radeon_device *)kgd; + + /* The sclk is in quantas of 10kHz */ + return rdev->pm.power_state->clock_info->sclk / 100; +} diff --git a/include/linux/radeon_kfd.h b/include/linux/radeon_kfd.h index 4c7e923..4114c8e 100644 --- a/include/linux/radeon_kfd.h +++ b/include/linux/radeon_kfd.h @@ -93,6 +93,8 @@ struct kfd2kgd_calls { /* GRBM_GFX_INDEX mutex */ void (*lock_grbm_gfx_idx)(struct kgd_dev *kgd); void (*unlock_grbm_gfx_idx)(struct kgd_dev *kgd); + + uint32_t (*get_max_engine_clock_in_mhz)(struct kgd_dev *kgd); }; bool kgd2kfd_init(unsigned interface_version, -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel