diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-01-17 00:18:47 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-19 14:17:57 -0500 |
commit | 60bbade2a63de363a7acdb5e3b0f166a883fe3be (patch) | |
tree | 904ef0ca6508bc6d2b3d2e85f842500f36c70a56 | |
parent | 156a81be3f3a3e4a37b6d31efeb5abefdbf51e73 (diff) |
drm/amdgpu: Expose more GPU sensor queries
Add sub-queries for stable pstate shader/memory clock.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 18 | ||||
-rw-r--r-- | include/uapi/drm/amdgpu_drm.h | 4 |
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 9f189ab07cdd..b929986dd3d7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -758,6 +758,24 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
758 | return -EINVAL; | 758 | return -EINVAL; |
759 | } | 759 | } |
760 | break; | 760 | break; |
761 | case AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK: | ||
762 | /* get stable pstate sclk in Mhz */ | ||
763 | if (amdgpu_dpm_read_sensor(adev, | ||
764 | AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK, | ||
765 | (void *)&ui32, &ui32_size)) { | ||
766 | return -EINVAL; | ||
767 | } | ||
768 | ui32 /= 100; | ||
769 | break; | ||
770 | case AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK: | ||
771 | /* get stable pstate mclk in Mhz */ | ||
772 | if (amdgpu_dpm_read_sensor(adev, | ||
773 | AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK, | ||
774 | (void *)&ui32, &ui32_size)) { | ||
775 | return -EINVAL; | ||
776 | } | ||
777 | ui32 /= 100; | ||
778 | break; | ||
761 | default: | 779 | default: |
762 | DRM_DEBUG_KMS("Invalid request %d\n", | 780 | DRM_DEBUG_KMS("Invalid request %d\n", |
763 | info->sensor_info.type); | 781 | info->sensor_info.type); |
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 4d21191aaed0..1816bd8200d1 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h | |||
@@ -664,6 +664,10 @@ struct drm_amdgpu_cs_chunk_data { | |||
664 | #define AMDGPU_INFO_SENSOR_VDDNB 0x6 | 664 | #define AMDGPU_INFO_SENSOR_VDDNB 0x6 |
665 | /* Subquery id: Query graphics voltage */ | 665 | /* Subquery id: Query graphics voltage */ |
666 | #define AMDGPU_INFO_SENSOR_VDDGFX 0x7 | 666 | #define AMDGPU_INFO_SENSOR_VDDGFX 0x7 |
667 | /* Subquery id: Query GPU stable pstate shader clock */ | ||
668 | #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8 | ||
669 | /* Subquery id: Query GPU stable pstate memory clock */ | ||
670 | #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9 | ||
667 | /* Number of VRAM page faults on CPU access. */ | 671 | /* Number of VRAM page faults on CPU access. */ |
668 | #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E | 672 | #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E |
669 | #define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F | 673 | #define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F |