aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/2339-drm-amdgpu-gfx10-remove-unnecessary-waiting-on-gfx-i.patch
blob: 5694f0bfa5f2d884091ce3ec31c3b7d7c4c6af17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 48f522db19d10bf931d52a112434495e54fc9912 Mon Sep 17 00:00:00 2001
From: Jack Xiao <Jack.Xiao@amd.com>
Date: Mon, 6 May 2019 16:40:48 +0800
Subject: [PATCH 2339/2940] drm/amdgpu/gfx10: remove unnecessary waiting on gfx
 inactive

The following KIQ ring test could guarantee the previous unmap
has been done.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 35 ++++----------------------
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 262c4004939f..fc6b95fe6879 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -3564,9 +3564,8 @@ static int gfx_v10_0_hw_init(void *handle)
 static int gfx_v10_0_kiq_disable_kgq(struct amdgpu_device *adev)
 {
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq;
-	struct amdgpu_ring *ring, *kiq_ring = &kiq->ring;
-	struct v10_gfx_mqd *mqd;
-	int r, i, j;
+	struct amdgpu_ring *kiq_ring = &kiq->ring;
+	int i;
 
 	if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
 		return -EINVAL;
@@ -3575,33 +3574,9 @@ static int gfx_v10_0_kiq_disable_kgq(struct amdgpu_device *adev)
 					adev->gfx.num_gfx_rings))
 		return -ENOMEM;
 
-	for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
-		ring = &adev->gfx.gfx_ring[i];
-
-		r = amdgpu_bo_reserve(ring->mqd_obj, false);
-		if (unlikely(r != 0))
-			return r;
-
-		r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
-		if (!r) {
-			kiq->pmf->kiq_unmap_queues(kiq_ring, ring,
-						   PREEMPT_QUEUES, 0, 0);
-			mqd = ring->mqd_ptr;
-
-			for (j = 0; j < adev->usec_timeout; j++) {
-				if (!mqd->cp_gfx_hqd_active)
-					break;
-				udelay(1);
-			}
-
-			if (j == adev->usec_timeout)
-				DRM_ERROR("failed to wait for gfx inactive\n");
-
-			amdgpu_bo_kunmap(ring->mqd_obj);
-			ring->mqd_ptr = NULL;
-		}
-		amdgpu_bo_unreserve(ring->mqd_obj);
-	}
+	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);
 
 	return amdgpu_ring_test_ring(kiq_ring);
 }
-- 
2.17.1