Re: [PATCH 8/8] drm/amdgpu/mes12: fix suspend issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 7, 2024 at 5:39 AM Jack Xiao <Jack.Xiao@xxxxxxx> wrote:
>
> Use mes pipe to unmap kcq and kgq.
>
> Signed-off-by: Jack Xiao <Jack.Xiao@xxxxxxx>

Series is:
Acked-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 22 ++++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c  | 27 +------------------------
>  2 files changed, 23 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index f165b9d49e29..c770cb201e64 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -509,6 +509,16 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id)
>         int i, r = 0;
>         int j;
>
> +       if (adev->enable_mes) {
> +               for (i = 0; i < adev->gfx.num_compute_rings; i++) {
> +                       j = i + xcc_id * adev->gfx.num_compute_rings;
> +                       amdgpu_mes_unmap_legacy_queue(adev,
> +                                                  &adev->gfx.compute_ring[j],
> +                                                  RESET_QUEUES, 0, 0);
> +               }
> +               return 0;
> +       }
> +
>         if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
>                 return -EINVAL;
>
> @@ -551,6 +561,18 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id)
>         int i, r = 0;
>         int j;
>
> +       if (adev->enable_mes) {
> +               if (amdgpu_gfx_is_master_xcc(adev, xcc_id)) {
> +                       for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
> +                               j = i + xcc_id * adev->gfx.num_gfx_rings;
> +                               amdgpu_mes_unmap_legacy_queue(adev,
> +                                                     &adev->gfx.gfx_ring[j],
> +                                                     PREEMPT_QUEUES, 0, 0);
> +                       }
> +               }
> +               return 0;
> +       }
> +
>         if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
>                 return -EINVAL;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
> index f384be0d1800..c77c66155d8e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
> @@ -3519,33 +3519,9 @@ static int gfx_v12_0_hw_init(void *handle)
>         return r;
>  }
>
> -static int gfx_v12_0_kiq_disable_kgq(struct amdgpu_device *adev)
> -{
> -       struct amdgpu_kiq *kiq = &adev->gfx.kiq[0];
> -       struct amdgpu_ring *kiq_ring = &kiq->ring;
> -       int i, r = 0;
> -
> -       if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
> -               return -EINVAL;
> -
> -       if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size *
> -                                       adev->gfx.num_gfx_rings))
> -               return -ENOMEM;
> -
> -       for (i = 0; i < adev->gfx.num_gfx_rings; i++)
> -               kiq->pmf->kiq_unmap_queues(kiq_ring, &adev->gfx.gfx_ring[i],
> -                                          PREEMPT_QUEUES, 0, 0);
> -
> -       if (adev->gfx.kiq[0].ring.sched.ready)
> -               r = amdgpu_ring_test_helper(kiq_ring);
> -
> -       return r;
> -}
> -
>  static int gfx_v12_0_hw_fini(void *handle)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> -       int r;
>         uint32_t tmp;
>
>         amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0);
> @@ -3553,8 +3529,7 @@ static int gfx_v12_0_hw_fini(void *handle)
>
>         if (!adev->no_hw_access) {
>                 if (amdgpu_async_gfx_ring) {
> -                       r = gfx_v12_0_kiq_disable_kgq(adev);
> -                       if (r)
> +                       if (amdgpu_gfx_disable_kgq(adev, 0))
>                                 DRM_ERROR("KGQ disable failed\n");
>                 }
>
> --
> 2.41.0
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux