aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-08-03 13:24:06 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-08-17 15:46:06 -0400
commitec5207c9f1cf42be826b9e3b63fb9b7463ed7fab (patch)
tree1f89978be16a2c78df2c1f84a80303e7b554a8a8 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parent0f4b3c68626199cd5ce619e2a3105d44b81f2753 (diff)
drm/amdgpu: remove superflous amdgpu_bo_kmap in the VM
We now properly kmap all BOs after validation. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@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.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f35618e50005..420026bc2514 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1265,15 +1265,14 @@ void amdgpu_vm_get_entry(struct amdgpu_pte_update_params *p, uint64_t addr,
1265 * 1265 *
1266 * Check if we can update the PD with a huge page. 1266 * Check if we can update the PD with a huge page.
1267 */ 1267 */
1268static int amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, 1268static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,
1269 struct amdgpu_vm_pt *entry, 1269 struct amdgpu_vm_pt *entry,
1270 struct amdgpu_vm_pt *parent, 1270 struct amdgpu_vm_pt *parent,
1271 unsigned nptes, uint64_t dst, 1271 unsigned nptes, uint64_t dst,
1272 uint64_t flags) 1272 uint64_t flags)
1273{ 1273{
1274 bool use_cpu_update = (p->func == amdgpu_vm_cpu_set_ptes); 1274 bool use_cpu_update = (p->func == amdgpu_vm_cpu_set_ptes);
1275 uint64_t pd_addr, pde; 1275 uint64_t pd_addr, pde;
1276 int r;
1277 1276
1278 /* In the case of a mixed PT the PDE must point to it*/ 1277 /* In the case of a mixed PT the PDE must point to it*/
1279 if (p->adev->asic_type < CHIP_VEGA10 || 1278 if (p->adev->asic_type < CHIP_VEGA10 ||
@@ -1290,16 +1289,13 @@ static int amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,
1290 1289
1291 if (entry->addr == dst && 1290 if (entry->addr == dst &&
1292 entry->huge_page == !!(flags & AMDGPU_PDE_PTE)) 1291 entry->huge_page == !!(flags & AMDGPU_PDE_PTE))
1293 return 0; 1292 return;
1294 1293
1295 entry->addr = dst; 1294 entry->addr = dst;
1296 entry->huge_page = !!(flags & AMDGPU_PDE_PTE); 1295 entry->huge_page = !!(flags & AMDGPU_PDE_PTE);
1297 1296
1298 if (use_cpu_update) { 1297 if (use_cpu_update) {
1299 r = amdgpu_bo_kmap(parent->bo, (void *)&pd_addr); 1298 pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo);
1300 if (r)
1301 return r;
1302
1303 pde = pd_addr + (entry - parent->entries) * 8; 1299 pde = pd_addr + (entry - parent->entries) * 8;
1304 amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); 1300 amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags);
1305 } else { 1301 } else {
@@ -1312,8 +1308,6 @@ static int amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,
1312 pde = pd_addr + (entry - parent->entries) * 8; 1308 pde = pd_addr + (entry - parent->entries) * 8;
1313 amdgpu_vm_do_set_ptes(p, pde, dst, 1, 0, flags); 1309 amdgpu_vm_do_set_ptes(p, pde, dst, 1, 0, flags);
1314 } 1310 }
1315
1316 return 0;
1317} 1311}
1318 1312
1319/** 1313/**
@@ -1340,7 +1334,6 @@ static int amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
1340 struct amdgpu_bo *pt; 1334 struct amdgpu_bo *pt;
1341 unsigned nptes; 1335 unsigned nptes;
1342 bool use_cpu_update = (params->func == amdgpu_vm_cpu_set_ptes); 1336 bool use_cpu_update = (params->func == amdgpu_vm_cpu_set_ptes);
1343 int r;
1344 1337
1345 /* walk over the address space and update the page tables */ 1338 /* walk over the address space and update the page tables */
1346 for (addr = start; addr < end; addr += nptes, 1339 for (addr = start; addr < end; addr += nptes,
@@ -1356,11 +1349,8 @@ static int amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
1356 else 1349 else
1357 nptes = AMDGPU_VM_PTE_COUNT(adev) - (addr & mask); 1350 nptes = AMDGPU_VM_PTE_COUNT(adev) - (addr & mask);
1358 1351
1359 r = amdgpu_vm_handle_huge_pages(params, entry, parent, 1352 amdgpu_vm_handle_huge_pages(params, entry, parent,
1360 nptes, dst, flags); 1353 nptes, dst, flags);
1361 if (r)
1362 return r;
1363
1364 if (entry->huge_page) 1354 if (entry->huge_page)
1365 continue; 1355 continue;
1366 1356