summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2019-09-24 13:29:27 +0200
committerAlex Deucher <alexander.deucher@amd.com>2019-10-03 09:11:03 -0500
commit4a246528677380befaea5c7de0ee0911d3ccf1d3 (patch)
tree57484fc35e2e2752cdae1c5a9d5eacbba90a7ee9 /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
parentd02a7061b3d9e2d0c17436f96e6de06165ebcabd (diff)
downloadlinux-stable-4a246528677380befaea5c7de0ee0911d3ccf1d3.tar.gz
linux-stable-4a246528677380befaea5c7de0ee0911d3ccf1d3.tar.bz2
linux-stable-4a246528677380befaea5c7de0ee0911d3ccf1d3.zip
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> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-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 12d2adcdf14e..f10b6175e20c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -369,7 +369,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;
@@ -377,12 +377,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)