aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-01-30 05:01:38 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-03-29 23:52:55 -0400
commita5f6b5b1e89067d3de30ae04693f96189cc05aec (patch)
tree684912bfdf823793d88fbcf685ab759813b01a73
parente4f0fdcc9c95f415b6ac54d0d309021a17b9b2a8 (diff)
drm/amdgpu: add support for BO_VAs without BO v2
For PRT support we need mappings which aren't backed by any memory. v2: fix parameter checking Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index bd0d33125c18..f922e4356758 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1117,7 +1117,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
1117 struct dma_fence *exclusive; 1117 struct dma_fence *exclusive;
1118 int r; 1118 int r;
1119 1119
1120 if (clear) { 1120 if (clear || !bo_va->bo) {
1121 mem = NULL; 1121 mem = NULL;
1122 nodes = NULL; 1122 nodes = NULL;
1123 exclusive = NULL; 1123 exclusive = NULL;
@@ -1134,9 +1134,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
1134 exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv); 1134 exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
1135 } 1135 }
1136 1136
1137 flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem); 1137 if (bo_va->bo) {
1138 gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) && 1138 flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
1139 adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ? flags : 0; 1139 gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
1140 adev == amdgpu_ttm_adev(bo_va->bo->tbo.bdev)) ?
1141 flags : 0;
1142 } else {
1143 flags = 0x0;
1144 gtt_flags = ~0x0;
1145 }
1140 1146
1141 spin_lock(&vm->status_lock); 1147 spin_lock(&vm->status_lock);
1142 if (!list_empty(&bo_va->vm_status)) 1148 if (!list_empty(&bo_va->vm_status))
@@ -1271,7 +1277,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
1271 INIT_LIST_HEAD(&bo_va->invalids); 1277 INIT_LIST_HEAD(&bo_va->invalids);
1272 INIT_LIST_HEAD(&bo_va->vm_status); 1278 INIT_LIST_HEAD(&bo_va->vm_status);
1273 1279
1274 list_add_tail(&bo_va->bo_list, &bo->va); 1280 if (bo)
1281 list_add_tail(&bo_va->bo_list, &bo->va);
1275 1282
1276 return bo_va; 1283 return bo_va;
1277} 1284}
@@ -1309,7 +1316,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
1309 1316
1310 /* make sure object fit at this offset */ 1317 /* make sure object fit at this offset */
1311 eaddr = saddr + size - 1; 1318 eaddr = saddr + size - 1;
1312 if ((saddr >= eaddr) || (offset + size > amdgpu_bo_size(bo_va->bo))) 1319 if (saddr >= eaddr ||
1320 (bo_va->bo && offset + size > amdgpu_bo_size(bo_va->bo)))
1313 return -EINVAL; 1321 return -EINVAL;
1314 1322
1315 last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE; 1323 last_pfn = eaddr / AMDGPU_GPU_PAGE_SIZE;