diff options
Diffstat (limited to 'meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1519-drm-amdgpu-Add-eviction_valuable-TTM-callback.patch')
-rw-r--r-- | meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1519-drm-amdgpu-Add-eviction_valuable-TTM-callback.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1519-drm-amdgpu-Add-eviction_valuable-TTM-callback.patch b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1519-drm-amdgpu-Add-eviction_valuable-TTM-callback.patch new file mode 100644 index 00000000..cbe22735 --- /dev/null +++ b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1519-drm-amdgpu-Add-eviction_valuable-TTM-callback.patch @@ -0,0 +1,76 @@ +From 837456ef48244bedacc4137ff7c62d0fdb58becf Mon Sep 17 00:00:00 2001 +From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> +Date: Fri, 2 Sep 2016 16:56:26 -0400 +Subject: [PATCH 1519/4131] drm/amdgpu: Add eviction_valuable TTM callback + +Change-Id: I6255ebffb7efa70fa4a1a17ff77e71e79145c502 +Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> + + Conflicts: + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 34 ++++++++++++++++++++++++++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +index 512207e..b028f23 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +@@ -46,6 +46,7 @@ + #include "amdgpu.h" + #include "amdgpu_trace.h" + #include "bif/bif_4_1_d.h" ++#include "amdgpu_amdkfd.h" + + #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) + +@@ -208,6 +209,37 @@ 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) + { +@@ -1292,7 +1324,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_ttm_bo_eviction_valuable, ++ .eviction_valuable = amdgpu_bo_eviction_valuable, + .evict_flags = &amdgpu_evict_flags, + .move = &amdgpu_bo_move, + .verify_access = &amdgpu_verify_access, +-- +2.7.4 + |