aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3833-drm-amdkcl-fix-kfd-amdgpu_bo_create-func-para-change.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3833-drm-amdkcl-fix-kfd-amdgpu_bo_create-func-para-change.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3833-drm-amdkcl-fix-kfd-amdgpu_bo_create-func-para-change.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3833-drm-amdkcl-fix-kfd-amdgpu_bo_create-func-para-change.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3833-drm-amdkcl-fix-kfd-amdgpu_bo_create-func-para-change.patch
new file mode 100644
index 00000000..33e5e096
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3833-drm-amdkcl-fix-kfd-amdgpu_bo_create-func-para-change.patch
@@ -0,0 +1,88 @@
+From e5b8df6e6dc46138c3de8c23129a81bd5ec8f553 Mon Sep 17 00:00:00 2001
+From: Kevin Wang <Kevin1.Wang@amd.com>
+Date: Thu, 22 Mar 2018 17:58:36 +0800
+Subject: [PATCH 3833/4131] drm/amdkcl: fix kfd amdgpu_bo_create func para
+ changed error
+
+Change-Id: If26b36e6e51c3b28fd86463ffbde45304dda012f
+Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
+Reviewed-by: Le Ma <Le.Ma@amd.com>
+Signed-off-by: Kalyan Alle <kalyan.alle@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 26 +++++++++++++++++-------
+ 1 file changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index d133922..79be309 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -167,7 +167,8 @@ void amdgpu_amdkfd_unreserve_system_memory_limit(struct amdgpu_bo *bo)
+ if (bo->flags & AMDGPU_AMDKFD_USERPTR_BO) {
+ kfd_mem_limit.system_mem_used -= bo->tbo.acc_size;
+ kfd_mem_limit.userptr_mem_used -= amdgpu_bo_size(bo);
+- } else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT) {
++ } else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT &&
++ !bo->tbo.sg) {
+ kfd_mem_limit.system_mem_used -=
+ (bo->tbo.acc_size + amdgpu_bo_size(bo));
+ }
+@@ -1209,13 +1210,15 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
+ return -EINVAL;
+ user_addr = *offset;
+ } else if (flags & ALLOC_MEM_FLAGS_DOORBELL) {
+- domain = alloc_domain = AMDGPU_GEM_DOMAIN_GTT;
++ domain = AMDGPU_GEM_DOMAIN_GTT;
++ alloc_domain = AMDGPU_GEM_DOMAIN_CPU;
+ alloc_flags = 0;
+ if (size > UINT_MAX)
+ return -EINVAL;
+ sg = create_doorbell_sg(*offset, size);
+ if (!sg)
+ return -ENOMEM;
++ bo_type = ttm_bo_type_sg;
+ } else {
+ return -EINVAL;
+ }
+@@ -1256,10 +1259,13 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
+
+ amdgpu_sync_create(&(*mem)->sync);
+
+- ret = amdgpu_amdkfd_reserve_system_mem_limit(adev, size, alloc_domain);
+- if (ret) {
+- pr_debug("Insufficient system memory\n");
+- goto err_reserve_limit;
++ if (!sg) {
++ ret = amdgpu_amdkfd_reserve_system_mem_limit(adev, size,
++ alloc_domain);
++ if (ret) {
++ pr_debug("Insufficient system memory\n");
++ goto err_reserve_limit;
++ }
+ }
+
+ pr_debug("\tcreate BO VA 0x%llx size 0x%llx domain %s\n",
+@@ -1275,6 +1281,11 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
+ domain_string(alloc_domain), ret);
+ goto err_bo_create;
+ }
++
++ if (bo_type == ttm_bo_type_sg) {
++ bo->tbo.sg = sg;
++ bo->tbo.ttm->sg = sg;
++ }
+ bo->kfd_bo = *mem;
+ (*mem)->bo = bo;
+ if (user_addr)
+@@ -1304,7 +1315,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
+ allocate_init_user_pages_failed:
+ amdgpu_bo_unref(&bo);
+ err_bo_create:
+- unreserve_system_mem_limit(adev, size, alloc_domain);
++ if (!sg)
++ unreserve_system_mem_limit(adev, size, alloc_domain);
+ err_reserve_limit:
+ kfree(*mem);
+ err:
+--
+2.7.4
+