[PATCH] drm/amdgpu: show gfx clock gating status to user
Deucher, Alexander
Alexander.Deucher at amd.com
Tue Jan 3 15:02:09 UTC 2017
> -----Original Message-----
> From: Huang Rui [mailto:ray.huang at amd.com]
> Sent: Tuesday, January 03, 2017 5:47 AM
> To: Deucher, Alexander; amd-gfx at lists.freedesktop.org
> Cc: Zhu, Rex; Mao, David; Fu, Ping; Huang, Ray
> Subject: [PATCH] drm/amdgpu: show gfx clock gating status to user
>
> Signed-off-by: Huang Rui <ray.huang at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 +++++
> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 ++
> drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 ++
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 3 +++
> 5 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 96eeea7..989d311 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1033,6 +1033,7 @@ struct amdgpu_gfx {
> struct amdgpu_irq_src priv_inst_irq;
> /* gfx status */
> uint32_t gfx_current_status;
> + bool cg_enabled;
> /* ce ram size*/
> unsigned ce_ram_size;
> struct amdgpu_cu_info cu_info;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index a7c7657..10f2eab 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -1543,6 +1543,11 @@ static int amdgpu_debugfs_pm_info(struct
> seq_file *m, void *data)
> struct amdgpu_device *adev = dev->dev_private;
> struct drm_device *ddev = adev->ddev;
>
> + if (adev->gfx.cg_enabled)
> + seq_printf(m, "GFX Clock Gating: Enabled\n");
> + else
> + seq_printf(m, "GFX Clock Gating: Disabled\n");
> +
I think it would be better to print the cg_flags and pg_flags (both as a mask and in human readable form) so we know exactly cg and pg features are enabled.
Alex
> if (!adev->pm.dpm_enabled) {
> seq_printf(m, "dpm not enabled\n");
> return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> index 45b3365..c59fac2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> @@ -3178,6 +3178,8 @@ static int gfx_v6_0_set_clockgating_state(void
> *handle,
> }
> gfx_v6_0_enable_gui_idle_interrupt(adev, true);
>
> + adev->gfx.cg_enabled = (state == AMD_CG_STATE_GATE) ? true :
> false;
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> index 0efb912..eb2ed44 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> @@ -5108,6 +5108,8 @@ static int gfx_v7_0_set_clockgating_state(void
> *handle,
> }
> gfx_v7_0_enable_gui_idle_interrupt(adev, true);
>
> + adev->gfx.cg_enabled = (state == AMD_CG_STATE_GATE) ? true :
> false;
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index c4afa8e..2b9618d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -6156,6 +6156,9 @@ static int gfx_v8_0_set_clockgating_state(void
> *handle,
> default:
> break;
> }
> +
> + adev->gfx.cg_enabled = (state == AMD_CG_STATE_GATE) ? true :
> false;
> +
> return 0;
> }
>
> --
> 2.7.4
More information about the amd-gfx
mailing list