aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4164-drm-amdgpu-CMA-Validate-BOs-before-use.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4164-drm-amdgpu-CMA-Validate-BOs-before-use.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4164-drm-amdgpu-CMA-Validate-BOs-before-use.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4164-drm-amdgpu-CMA-Validate-BOs-before-use.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4164-drm-amdgpu-CMA-Validate-BOs-before-use.patch
new file mode 100644
index 00000000..9b2bada5
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4164-drm-amdgpu-CMA-Validate-BOs-before-use.patch
@@ -0,0 +1,53 @@
+From 7d3142e579c36a3d54034bee2d0f4ad1e52e06cd Mon Sep 17 00:00:00 2001
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Date: Mon, 26 Feb 2018 18:20:23 -0500
+Subject: [PATCH 4164/5725] drm/amdgpu: CMA: Validate BOs before use
+
+The CMA copy is submitted in Kernel mode. Before submitting the command
+ensure that the BOs are validated.
+
+Change-Id: I1ca03934486eac32d0947654e727439d13f20b8e
+Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index 83ed761..90e98c9 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -2439,6 +2439,23 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
+ return r;
+ }
+
++ /* The process to which the Source and Dest BOs belong to could be
++ * evicted and the BOs invalidated. So validate BOs before use
++ */
++ r = amdgpu_amdkfd_bo_validate(src_mem->bo, src_mem->domain, false);
++ if (r) {
++ pr_err("CMA fail: SRC BO validate failed %d\n", r);
++ goto validate_fail;
++ }
++
++
++ r = amdgpu_amdkfd_bo_validate(dst_mem->bo, dst_mem->domain, false);
++ if (r) {
++ pr_err("CMA fail: DST BO validate failed %d\n", r);
++ goto validate_fail;
++ }
++
++
+ r = amdgpu_ttm_copy_mem_to_mem(adev, &src, &dst, size, NULL,
+ &fence);
+ if (r)
+@@ -2453,6 +2470,7 @@ int amdgpu_amdkfd_copy_mem_to_mem(struct kgd_dev *kgd, struct kgd_mem *src_mem,
+ *f = dma_fence_get(fence);
+ dma_fence_put(fence);
+
++validate_fail:
+ ttm_eu_backoff_reservation(&ticket, &list);
+ return r;
+ }
+--
+2.7.4
+