drm/amdgpu: cache the complete pde
authorChristian König <christian.koenig@amd.com>
Mon, 15 May 2017 13:19:10 +0000 (15:19 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 31 May 2017 18:16:39 +0000 (14:16 -0400)
Makes it easier to update the PDE with huge pages.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 90392a15fcb725bed3cbce6aef192f763b5c55e0..3d2ad3ae04bc6da4cf92622c4604ad4d51c0ae3b 100644 (file)
@@ -985,6 +985,7 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
                }
 
                pt = amdgpu_bo_gpu_offset(bo);
+               pt = amdgpu_gart_get_vm_pde(adev, pt);
                if (parent->entries[pt_idx].addr == pt)
                        continue;
 
@@ -996,18 +997,15 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
                    (count == AMDGPU_VM_MAX_UPDATE_SIZE)) {
 
                        if (count) {
-                               uint64_t entry;
-
-                               entry = amdgpu_gart_get_vm_pde(adev, last_pt);
                                if (shadow)
                                        amdgpu_vm_do_set_ptes(&params,
                                                              last_shadow,
-                                                             entry, count,
+                                                             last_pt, count,
                                                              incr,
                                                              AMDGPU_PTE_VALID);
 
                                amdgpu_vm_do_set_ptes(&params, last_pde,
-                                                     entry, count, incr,
+                                                     last_pt, count, incr,
                                                      AMDGPU_PTE_VALID);
                        }
 
@@ -1021,15 +1019,11 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
        }
 
        if (count) {
-               uint64_t entry;
-
-               entry = amdgpu_gart_get_vm_pde(adev, last_pt);
-
                if (vm->root.bo->shadow)
-                       amdgpu_vm_do_set_ptes(&params, last_shadow, entry,
+                       amdgpu_vm_do_set_ptes(&params, last_shadow, last_pt,
                                              count, incr, AMDGPU_PTE_VALID);
 
-               amdgpu_vm_do_set_ptes(&params, last_pde, entry,
+               amdgpu_vm_do_set_ptes(&params, last_pde, last_pt,
                                      count, incr, AMDGPU_PTE_VALID);
        }