]> www.infradead.org Git - linux.git/commitdiff
drm/amdgpu/mes12: fix suspend issue
authorJack Xiao <Jack.Xiao@amd.com>
Wed, 7 Aug 2024 04:03:11 +0000 (12:03 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Aug 2024 16:13:03 +0000 (12:13 -0400)
Use mes pipe to unmap kcq and kgq.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c

index 28bd2098a65e4e01c71a0305e937f934ae113879..9be8cafdcecc9bc1bbb07acd91bdb49c7b7f53e2 100644 (file)
@@ -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;
 
index df72fa125fd275a2e387effd0afa8317564d9740..f14e27f86e0eb4bd145f66e33e67a564af3e953b 100644 (file)
@@ -3595,33 +3595,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);
@@ -3630,8 +3606,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");
                }