[PATCH] drm/amdgpu: check CG flag before querying CG status

Alex Deucher alexdeucher at gmail.com
Mon Aug 2 16:32:38 UTC 2021


On Mon, Aug 2, 2021 at 5:31 AM Lang Yu <lang.yu at amd.com> wrote:
>
> For ASICs which don't supoort clock gating, querying CG status
> may cause a hardware hang issue. So add a CG flag check to exit
> directly in such a case.
>
> Signed-off-by: Lang Yu <lang.yu at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index b1d2dc39e8be..a7afcdc50ca8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1671,6 +1671,11 @@ void amdgpu_device_ip_get_clockgating_state(struct amdgpu_device *adev,
>  {
>         int i;
>
> +       if (!adev->cg_flags) {
> +               *flags = 0;
> +               return;
> +       }

This is fine if someone has disabled all CG flags, but maybe it would
be better to check each flag individually within the
get_clockgating_state() callback for each IP.  Do we need a similar
check for PG flags?

Alex

> +
>         for (i = 0; i < adev->num_ip_blocks; i++) {
>                 if (!adev->ip_blocks[i].status.valid)
>                         continue;
> --
> 2.25.1
>


More information about the amd-gfx mailing list