summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2019-03-21 18:34:18 +0300
committerAlex Deucher <alexander.deucher@amd.com>2019-03-28 06:40:50 +0300
commitecf96b52bf98a22f14bd33c7deee0aad8eb6b569 (patch)
treed10af6d29f2407c86b97b4fd2118529b286a2b7e /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parentdf399b064118bf9a5b9a3faaa67feb1cbb34e9d4 (diff)
downloadlinux-ecf96b52bf98a22f14bd33c7deee0aad8eb6b569.tar.xz
drm/amdgpu: move VM table mapping into the backend as well
Clean that up further and also fix another case where the BO wasn't kmapped for CPU based updates. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index a5c6a1e5fe74..3ada094852c5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -659,17 +659,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
if (bo->tbo.type != ttm_bo_type_kernel) {
amdgpu_vm_bo_moved(bo_base);
} else {
- if (vm->use_cpu_for_update)
- r = amdgpu_bo_kmap(bo, NULL);
- else
- r = amdgpu_ttm_alloc_gart(&bo->tbo);
- if (r)
- break;
- if (bo->shadow) {
- r = amdgpu_ttm_alloc_gart(&bo->shadow->tbo);
- if (r)
- break;
- }
+ vm->update_funcs->map_table(bo);
amdgpu_vm_bo_relocated(bo_base);
}
}
@@ -751,22 +741,17 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
if (r)
return r;
- r = amdgpu_ttm_alloc_gart(&bo->tbo);
- if (r)
- return r;
-
if (bo->shadow) {
r = ttm_bo_validate(&bo->shadow->tbo, &bo->shadow->placement,
&ctx);
if (r)
return r;
-
- r = amdgpu_ttm_alloc_gart(&bo->shadow->tbo);
- if (r)
- return r;
-
}
+ r = vm->update_funcs->map_table(bo);
+ if (r)
+ return r;
+
memset(&params, 0, sizeof(params));
params.adev = adev;
params.vm = vm;
@@ -877,12 +862,6 @@ static int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
if (r)
return r;
- if (vm->use_cpu_for_update) {
- r = amdgpu_bo_kmap(pt, NULL);
- if (r)
- goto error_free_pt;
- }
-
/* Keep a reference to the root directory to avoid
* freeing them up in the wrong order.
*/