aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1968-drm-amdgpu-Don-t-add-KFD-eviction-fence-to-DGMA-BOs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1968-drm-amdgpu-Don-t-add-KFD-eviction-fence-to-DGMA-BOs.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1968-drm-amdgpu-Don-t-add-KFD-eviction-fence-to-DGMA-BOs.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1968-drm-amdgpu-Don-t-add-KFD-eviction-fence-to-DGMA-BOs.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1968-drm-amdgpu-Don-t-add-KFD-eviction-fence-to-DGMA-BOs.patch
new file mode 100644
index 00000000..02eeeef2
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1968-drm-amdgpu-Don-t-add-KFD-eviction-fence-to-DGMA-BOs.patch
@@ -0,0 +1,64 @@
+From b88e18b5b246f789da1adeb3a74d5f66ad1371da Mon Sep 17 00:00:00 2001
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Date: Fri, 13 Oct 2017 17:12:56 -0500
+Subject: [PATCH 1968/4131] drm/amdgpu: Don't add KFD eviction fence to DGMA
+ BOs
+
+DGMA buffers are pinned at creation. No need to add KFD eviction fence
+to it instead just increment the pin count.
+
+Currently, when graphics does a CS on a shared (with KFD) DGMA BO it
+triggers an eviction of KFD process. This happens because DGMA BO has
+KFD eviction fence attached to it. This change will fix this issue.
+
+NOTE: This is a temporary workaround. A general solution is in the works
+that will avoid eviction fences being added to sync object based on
+fence owner.
+
+Change-Id: Ie8e4bf86ba808fb6ef35680637c0ffdf7ffb600e
+Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index ad419cf..427f7b3 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -1353,7 +1353,13 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
+ }
+ }
+
+- if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) == NULL)
++ if (mem->domain & AMDGPU_GEM_DOMAIN_DGMA) {
++ ret = amdgpu_bo_pin(bo, mem->domain, NULL);
++ if (ret != 0) {
++ pr_err("Unable to pin DGMA BO\n");
++ goto map_bo_to_gpuvm_failed;
++ }
++ } else if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) == NULL)
+ amdgpu_bo_fence(bo,
+ &kfd_vm->process_info->eviction_fence->base,
+ true);
+@@ -1619,11 +1625,14 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
+ /* If BO is unmapped from all VMs, unfence it. It can be evicted if
+ * required.
+ */
+- if (mem->mapped_to_gpu_memory == 0 &&
+- !amdgpu_ttm_tt_get_usermm(mem->bo->tbo.ttm))
+- amdgpu_amdkfd_remove_eviction_fence(mem->bo,
++ if (mem->mapped_to_gpu_memory == 0) {
++ if (mem->domain & AMDGPU_GEM_DOMAIN_DGMA)
++ amdgpu_bo_unpin(mem->bo);
++ else if (!amdgpu_ttm_tt_get_usermm(mem->bo->tbo.ttm))
++ amdgpu_amdkfd_remove_eviction_fence(mem->bo,
+ process_info->eviction_fence,
+- NULL, NULL);
++ NULL, NULL);
++ }
+
+ if (mapped_before == mem->mapped_to_gpu_memory) {
+ pr_debug("BO VA 0x%llx size 0x%lx is not mapped to vm %p\n",
+--
+2.7.4
+