aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1289-Change-fence-references-to-dma_fence.patch
blob: c1dc92c678b6ae54eaabdfc7ec89de79e0dc33a1 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
From a1e210185b518c3894a5b0a6ab95796aabb33429 Mon Sep 17 00:00:00 2001
From: Kent Russell <kent.russell@amd.com>
Date: Tue, 25 Apr 2017 13:00:47 -0400
Subject: [PATCH 1289/4131] Change fence references to dma_fence

Required now that we're based on drm-next
[4.11]

Change-Id: I43d3ac96525d231fb2771c964969c787bc091449

 Conflicts:
	drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
	drivers/gpu/drm/amd/include/kgd_kfd_interface.h
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 12 ++++++------
 drivers/gpu/drm/amd/amdkfd/kfd_device.c  | 14 +++++++-------
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h    |  4 ++--
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 6a41746..97a8070 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1765,7 +1765,7 @@ static int kfd_ioctl_cross_memory_copy(struct file *filep,
 	struct task_struct *remote_task;
 	struct mm_struct *remote_mm;
 	struct pid *remote_pid;
-	struct fence *fence = NULL, *lfence = NULL;
+	struct dma_fence *fence = NULL, *lfence = NULL;
 	uint64_t dst_va_addr;
 	uint64_t copied, total_copied = 0;
 	uint64_t src_offset, dst_offset;
@@ -1931,7 +1931,7 @@ static int kfd_ioctl_cross_memory_copy(struct file *filep,
 
 			/* Later fence available. Release old fence */
 			if (fence && lfence) {
-				fence_put(lfence);
+				dma_fence_put(lfence);
 				lfence = NULL;
 			}
 
@@ -1971,14 +1971,14 @@ static int kfd_ioctl_cross_memory_copy(struct file *filep,
 
 	/* Wait for the last fence irrespective of error condition */
 	if (fence) {
-		if (fence_wait_timeout(fence, false, msecs_to_jiffies(1000))
+		if (dma_fence_wait_timeout(fence, false, msecs_to_jiffies(1000))
 			< 0)
 			pr_err("Cross mem copy failed. BO timed out\n");
-		fence_put(fence);
+		dma_fence_put(fence);
 	} else if (lfence) {
 		pr_debug("GPU copy fail. But wait for prev DMA to finish\n");
-		fence_wait_timeout(lfence, true, msecs_to_jiffies(1000));
-		fence_put(lfence);
+		dma_fence_wait_timeout(lfence, true, msecs_to_jiffies(1000));
+		dma_fence_put(lfence);
 	}
 
 kfd_process_fail:
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 45a234d..43ccf18 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -26,7 +26,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/highmem.h>
-#include <linux/fence.h>
+#include <linux/dma-fence.h>
 #include "kfd_priv.h"
 #include "kfd_device_queue_manager.h"
 #include "kfd_pm4_headers_vi.h"
@@ -905,7 +905,7 @@ void kfd_restore_bo_worker(struct work_struct *work)
  *
  */
 int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
-					       struct fence *fence)
+					       struct dma_fence *fence)
 {
 	struct kfd_process *p;
 	unsigned long active_time;
@@ -914,7 +914,7 @@ int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
 	if (!fence)
 		return -EINVAL;
 
-	if (fence_is_signaled(fence))
+	if (dma_fence_is_signaled(fence))
 		return 0;
 
 	p = kfd_lookup_process_by_mm(mm);
@@ -931,11 +931,11 @@ int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
 		else {
 			WARN(1, "Starting new evict with previous evict is not completed\n");
 			if (cancel_delayed_work_sync(&p->eviction_work.dwork))
-				fence_put(p->eviction_work.quiesce_fence);
+				dma_fence_put(p->eviction_work.quiesce_fence);
 		}
 	}
 
-	p->eviction_work.quiesce_fence = fence_get(fence);
+	p->eviction_work.quiesce_fence = dma_fence_get(fence);
 
 	/* Avoid KFD process starvation. Wait for at least
 	 * PROCESS_ACTIVE_TIME_MS before evicting the process again
@@ -982,13 +982,13 @@ void kfd_evict_bo_worker(struct work_struct *work)
 	pr_info("Started evicting process of pasid %d\n", p->pasid);
 	ret = quiesce_process_mm(p);
 	if (!ret) {
-		fence_signal(eviction_work->quiesce_fence);
+		dma_fence_signal(eviction_work->quiesce_fence);
 		schedule_delayed_work(&p->restore_work,
 					PROCESS_RESTORE_TIME_MS);
 	} else
 		pr_err("Failed to quiesce user queues. Cannot evict BOs\n");
 
-	fence_put(eviction_work->quiesce_fence);
+	dma_fence_put(eviction_work->quiesce_fence);
 
 	pr_info("Finished evicting process of pasid %d\n", p->pasid);
 
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index fc5ba66..5174a2a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -588,7 +588,7 @@ struct qcm_process_device {
 /* KFD Memory Eviction */
 struct kfd_eviction_work {
 	struct delayed_work dwork;
-	struct fence *quiesce_fence;
+	struct dma_fence *quiesce_fence;
 };
 
 /* Approx. wait time before attempting to restore evicted BOs */
@@ -601,7 +601,7 @@ struct kfd_eviction_work {
 void kfd_evict_bo_worker(struct work_struct *work);
 void kfd_restore_bo_worker(struct work_struct *work);
 int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
-					       struct fence *fence);
+					       struct dma_fence *fence);
 
 
 /* 8 byte handle containing GPU ID in the most significant 4 bytes and
-- 
2.7.4