diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c index df65c66dc956..b8d3b87fd43e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <drm/drmP.h> | 31 | #include <drm/drmP.h> |
32 | #include "amdgpu.h" | 32 | #include "amdgpu.h" |
33 | #include "amdgpu_trace.h" | 33 | #include "amdgpu_trace.h" |
34 | #include "amdgpu_amdkfd.h" | ||
34 | 35 | ||
35 | struct amdgpu_sync_entry { | 36 | struct amdgpu_sync_entry { |
36 | struct hlist_node node; | 37 | struct hlist_node node; |
@@ -85,11 +86,20 @@ static bool amdgpu_sync_same_dev(struct amdgpu_device *adev, | |||
85 | */ | 86 | */ |
86 | static void *amdgpu_sync_get_owner(struct dma_fence *f) | 87 | static void *amdgpu_sync_get_owner(struct dma_fence *f) |
87 | { | 88 | { |
88 | struct drm_sched_fence *s_fence = to_drm_sched_fence(f); | 89 | struct drm_sched_fence *s_fence; |
90 | struct amdgpu_amdkfd_fence *kfd_fence; | ||
91 | |||
92 | if (!f) | ||
93 | return AMDGPU_FENCE_OWNER_UNDEFINED; | ||
89 | 94 | ||
95 | s_fence = to_drm_sched_fence(f); | ||
90 | if (s_fence) | 96 | if (s_fence) |
91 | return s_fence->owner; | 97 | return s_fence->owner; |
92 | 98 | ||
99 | kfd_fence = to_amdgpu_amdkfd_fence(f); | ||
100 | if (kfd_fence) | ||
101 | return AMDGPU_FENCE_OWNER_KFD; | ||
102 | |||
93 | return AMDGPU_FENCE_OWNER_UNDEFINED; | 103 | return AMDGPU_FENCE_OWNER_UNDEFINED; |
94 | } | 104 | } |
95 | 105 | ||
@@ -204,11 +214,18 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, | |||
204 | for (i = 0; i < flist->shared_count; ++i) { | 214 | for (i = 0; i < flist->shared_count; ++i) { |
205 | f = rcu_dereference_protected(flist->shared[i], | 215 | f = rcu_dereference_protected(flist->shared[i], |
206 | reservation_object_held(resv)); | 216 | reservation_object_held(resv)); |
217 | /* We only want to trigger KFD eviction fences on | ||
218 | * evict or move jobs. Skip KFD fences otherwise. | ||
219 | */ | ||
220 | fence_owner = amdgpu_sync_get_owner(f); | ||
221 | if (fence_owner == AMDGPU_FENCE_OWNER_KFD && | ||
222 | owner != AMDGPU_FENCE_OWNER_UNDEFINED) | ||
223 | continue; | ||
224 | |||
207 | if (amdgpu_sync_same_dev(adev, f)) { | 225 | if (amdgpu_sync_same_dev(adev, f)) { |
208 | /* VM updates are only interesting | 226 | /* VM updates are only interesting |
209 | * for other VM updates and moves. | 227 | * for other VM updates and moves. |
210 | */ | 228 | */ |
211 | fence_owner = amdgpu_sync_get_owner(f); | ||
212 | if ((owner != AMDGPU_FENCE_OWNER_UNDEFINED) && | 229 | if ((owner != AMDGPU_FENCE_OWNER_UNDEFINED) && |
213 | (fence_owner != AMDGPU_FENCE_OWNER_UNDEFINED) && | 230 | (fence_owner != AMDGPU_FENCE_OWNER_UNDEFINED) && |
214 | ((owner == AMDGPU_FENCE_OWNER_VM) != | 231 | ((owner == AMDGPU_FENCE_OWNER_VM) != |