summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2019-09-24 13:29:27 +0200
committerXiaojie Yuan <xiaojie.yuan@amd.com>2019-10-14 19:50:30 +0800
commitf2964ce2e664a29d0b2cb23a7d4c2a004451dd1d (patch)
tree69eab708e8a829532156b83761c1653c7b08f8c7
parent4fa008f1ad4454ce8a16000366fdb79da12d0729 (diff)
drm/amdgpu: once more fix amdgpu_bo_create_kernel_at
When CPU access is needed we should tell that to amdgpu_bo_create_reserved() or otherwise the access is denied later on. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Emily Deng <Emily.Deng@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index db49737ab768..9c8e149c8491 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -392,7 +392,7 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
size = ALIGN(size, PAGE_SIZE);
r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain, bo_ptr,
- NULL, NULL);
+ NULL, cpu_addr);
if (r)
return r;
@@ -400,12 +400,15 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
* Remove the original mem node and create a new one at the request
* position.
*/
+ if (cpu_addr)
+ amdgpu_bo_kunmap(*bo_ptr);
+
+ ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
+
for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) {
(*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT;
(*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT;
}
-
- ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement,
&(*bo_ptr)->tbo.mem, &ctx);
if (r)