]> www.infradead.org Git - users/jedix/linux-maple.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 17:17:36 +0000 (13:17 -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>
(cherry picked from commit f7fb9d677faf0460131bc2af15afd766d48a1f47)

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c

index f165b9d49e2927828482ad7084ba239a559ed3db..c770cb201e64bc82a7337eb57437b744d02f4ea3 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 506fa80033889f884e92e4cf8eefb16d1b7731ca..2c611b8577a7ec17cd9f908ce31456e290481787 100644 (file)
@@ -3546,33 +3546,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);
@@ -3580,8 +3556,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");
                }