diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 28c33d711bab..5fcb3488a595 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "amdgpu.h" | 46 | #include "amdgpu.h" |
47 | #include "amdgpu_object.h" | 47 | #include "amdgpu_object.h" |
48 | #include "amdgpu_trace.h" | 48 | #include "amdgpu_trace.h" |
49 | #include "amdgpu_amdkfd.h" | ||
49 | #include "bif/bif_4_1_d.h" | 50 | #include "bif/bif_4_1_d.h" |
50 | 51 | ||
51 | #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) | 52 | #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) |
@@ -1171,6 +1172,23 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, | |||
1171 | { | 1172 | { |
1172 | unsigned long num_pages = bo->mem.num_pages; | 1173 | unsigned long num_pages = bo->mem.num_pages; |
1173 | struct drm_mm_node *node = bo->mem.mm_node; | 1174 | struct drm_mm_node *node = bo->mem.mm_node; |
1175 | struct reservation_object_list *flist; | ||
1176 | struct dma_fence *f; | ||
1177 | int i; | ||
1178 | |||
1179 | /* If bo is a KFD BO, check if the bo belongs to the current process. | ||
1180 | * If true, then return false as any KFD process needs all its BOs to | ||
1181 | * be resident to run successfully | ||
1182 | */ | ||
1183 | flist = reservation_object_get_list(bo->resv); | ||
1184 | if (flist) { | ||
1185 | for (i = 0; i < flist->shared_count; ++i) { | ||
1186 | f = rcu_dereference_protected(flist->shared[i], | ||
1187 | reservation_object_held(bo->resv)); | ||
1188 | if (amdkfd_fence_check_mm(f, current->mm)) | ||
1189 | return false; | ||
1190 | } | ||
1191 | } | ||
1174 | 1192 | ||
1175 | switch (bo->mem.mem_type) { | 1193 | switch (bo->mem.mem_type) { |
1176 | case TTM_PL_TT: | 1194 | case TTM_PL_TT: |