aboutsummaryrefslogtreecommitdiffstats
path: root/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1614-drm-amdgpu-Consolidate-2-eviction_valuable-calls.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1614-drm-amdgpu-Consolidate-2-eviction_valuable-calls.patch')
-rw-r--r--meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1614-drm-amdgpu-Consolidate-2-eviction_valuable-calls.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1614-drm-amdgpu-Consolidate-2-eviction_valuable-calls.patch b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1614-drm-amdgpu-Consolidate-2-eviction_valuable-calls.patch
new file mode 100644
index 00000000..17ac84ac
--- /dev/null
+++ b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1614-drm-amdgpu-Consolidate-2-eviction_valuable-calls.patch
@@ -0,0 +1,99 @@
+From 4b6d7d4d5acd955ef045417556608c13a1ce784a Mon Sep 17 00:00:00 2001
+From: Kent Russell <kent.russell@amd.com>
+Date: Mon, 6 Mar 2017 08:09:41 -0500
+Subject: [PATCH 1614/4131] drm/amdgpu: Consolidate 2 eviction_valuable calls
+
+There were two differing eviction_valuable functions. Consolidate them
+by moving the kfd-based one into the original function. This also
+addresses an unused-function warning.
+
+Change-Id: I42e369813ad8f2b7d4bd018b7fcc913581297361
+Signed-off-by: Kent Russell <kent.russell@amd.com>
+
+ Conflicts:
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 50 ++++++++++++---------------------
+ 1 file changed, 18 insertions(+), 32 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+index 48e74d3..c4b1c9d 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+@@ -209,37 +209,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
+ return 0;
+ }
+
+-static bool amdgpu_bo_eviction_valuable(struct ttm_buffer_object *bo,
+- const struct ttm_place *place)
+-{
+- struct reservation_object_list *flist;
+- struct fence *f;
+- int i;
+-
+- /* Don't evict this BO if it's outside of the
+- * requested placement range
+- */
+- if (!ttm_bo_eviction_valuable(bo, place))
+- return false;
+-
+- /* If bo is a KFD BO, check if the bo belongs to the current process.
+- * If true, then return false as any KFD process needs all its BOs to
+- * be resident to run successfully
+- */
+- flist = reservation_object_get_list(bo->resv);
+- if (!flist)
+- return true;
+-
+- for (i = 0; i < flist->shared_count; ++i) {
+- f = rcu_dereference_protected(flist->shared[i],
+- reservation_object_held(bo->resv));
+- if (amd_kfd_fence_check_mm(f, current->mm))
+- return false;
+- }
+-
+- return true;
+-}
+-
+ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
+ struct ttm_placement *placement)
+ {
+@@ -1235,9 +1204,26 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
+ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
+ const struct ttm_place *place)
+ {
++ struct reservation_object_list *flist;
++ struct fence *f;
++ int i;
+ unsigned long num_pages = bo->mem.num_pages;
+ struct drm_mm_node *node = bo->mem.mm_node;
+
++ /* If bo is a KFD BO, check if the bo belongs to the current process.
++ * If true, then return false as any KFD process needs all its BOs to
++ * be resident to run successfully
++ */
++ flist = reservation_object_get_list(bo->resv);
++ if (flist) {
++ for (i = 0; i < flist->shared_count; ++i) {
++ f = rcu_dereference_protected(flist->shared[i],
++ reservation_object_held(bo->resv));
++ if (amd_kfd_fence_check_mm(f, current->mm))
++ return false;
++ }
++ }
++
+ if (bo->mem.start != AMDGPU_BO_INVALID_OFFSET)
+ return ttm_bo_eviction_valuable(bo, place);
+
+@@ -1331,7 +1317,7 @@ static struct ttm_bo_driver amdgpu_bo_driver = {
+ .ttm_tt_unpopulate = &amdgpu_ttm_tt_unpopulate,
+ .invalidate_caches = &amdgpu_invalidate_caches,
+ .init_mem_type = &amdgpu_init_mem_type,
+- .eviction_valuable = amdgpu_bo_eviction_valuable,
++ .eviction_valuable = amdgpu_ttm_bo_eviction_valuable,
+ .evict_flags = &amdgpu_evict_flags,
+ .move = &amdgpu_bo_move,
+ .verify_access = &amdgpu_verify_access,
+--
+2.7.4
+