aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorFelix Kuehling <Felix.Kuehling@amd.com>2017-08-17 16:37:49 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-08-29 15:27:37 -0400
commit38a8791aa7bfaa497e12e56b904a6b45986162d8 (patch)
tree0c538791215a773cd18c840fc9484b1ad1bc80f8 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parent7846b12fe0b5feab5446d892f41b5140c1419109 (diff)
drm/amdgpu: Fix huge page updates with CPU
Correctly detect system memory mappings when using CPU and don't use huge pages for them. Avoid incorrectly translating a physical page table GPU address when splitting a huge page while mapping system memory. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Christian König <christian.koenig@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.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 6b1343e5541d..ba475af99332 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1277,7 +1277,7 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,
1277 /* 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*/
1278 if (p->adev->asic_type < CHIP_VEGA10 || 1278 if (p->adev->asic_type < CHIP_VEGA10 ||
1279 nptes != AMDGPU_VM_PTE_COUNT(p->adev) || 1279 nptes != AMDGPU_VM_PTE_COUNT(p->adev) ||
1280 p->func == amdgpu_vm_do_copy_ptes || 1280 p->src ||
1281 !(flags & AMDGPU_PTE_VALID)) { 1281 !(flags & AMDGPU_PTE_VALID)) {
1282 1282
1283 dst = amdgpu_bo_gpu_offset(entry->bo); 1283 dst = amdgpu_bo_gpu_offset(entry->bo);
@@ -1294,9 +1294,23 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,
1294 entry->addr = (dst | flags); 1294 entry->addr = (dst | flags);
1295 1295
1296 if (use_cpu_update) { 1296 if (use_cpu_update) {
1297 /* In case a huge page is replaced with a system
1298 * memory mapping, p->pages_addr != NULL and
1299 * amdgpu_vm_cpu_set_ptes would try to translate dst
1300 * through amdgpu_vm_map_gart. But dst is already a
1301 * GPU address (of the page table). Disable
1302 * amdgpu_vm_map_gart temporarily.
1303 */
1304 dma_addr_t *tmp;
1305
1306 tmp = p->pages_addr;
1307 p->pages_addr = NULL;
1308
1297 pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo); 1309 pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo);
1298 pde = pd_addr + (entry - parent->entries) * 8; 1310 pde = pd_addr + (entry - parent->entries) * 8;
1299 amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); 1311 amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags);
1312
1313 p->pages_addr = tmp;
1300 } else { 1314 } else {
1301 if (parent->bo->shadow) { 1315 if (parent->bo->shadow) {
1302 pd_addr = amdgpu_bo_gpu_offset(parent->bo->shadow); 1316 pd_addr = amdgpu_bo_gpu_offset(parent->bo->shadow);