diff options
author | Christian König <christian.koenig@amd.com> | 2017-11-29 13:27:26 +0100 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-12 14:46:19 -0500 |
commit | 3de676d8e71c0a4094b3e5005a311c36c6b6ffc6 (patch) | |
tree | 3d41c8fbf1b5f90a310003570fd3bbea4d39204b /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 6989f2460f7d8163fcc4f0c99e47d62d22ea6f28 (diff) | |
download | linux-3de676d8e71c0a4094b3e5005a311c36c6b6ffc6.tar.gz linux-3de676d8e71c0a4094b3e5005a311c36c6b6ffc6.tar.bz2 linux-3de676d8e71c0a4094b3e5005a311c36c6b6ffc6.zip |
drm/amdgpu: allow get_vm_pde to change flags as well
And also provide the level for which we need a PDE.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@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.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 2482b5dbe31c..68039ad3c8e0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1070,9 +1070,10 @@ static void amdgpu_vm_update_pde(struct amdgpu_pte_update_params *params, struct amdgpu_vm_pt *parent, struct amdgpu_vm_pt *entry) { - struct amdgpu_bo *bo = entry->base.bo, *shadow = NULL; + struct amdgpu_bo *bo = entry->base.bo, *shadow = NULL, *pbo; uint64_t pd_addr, shadow_addr = 0; - uint64_t pde, pt; + uint64_t pde, pt, flags; + unsigned level; /* Don't update huge pages here */ if (entry->huge) @@ -1087,15 +1088,19 @@ static void amdgpu_vm_update_pde(struct amdgpu_pte_update_params *params, shadow_addr = amdgpu_bo_gpu_offset(shadow); } + for (level = 0, pbo = parent->base.bo->parent; pbo; ++level) + pbo = pbo->parent; + pt = amdgpu_bo_gpu_offset(bo); - pt = amdgpu_gart_get_vm_pde(params->adev, pt); + flags = AMDGPU_PTE_VALID; + amdgpu_gart_get_vm_pde(params->adev, level, &pt, &flags); if (shadow) { pde = shadow_addr + (entry - parent->entries) * 8; - params->func(params, pde, pt, 1, 0, AMDGPU_PTE_VALID); + params->func(params, pde, pt, 1, 0, flags); } pde = pd_addr + (entry - parent->entries) * 8; - params->func(params, pde, pt, 1, 0, AMDGPU_PTE_VALID); + params->func(params, pde, pt, 1, 0, flags); } /* @@ -1305,7 +1310,6 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, !(flags & AMDGPU_PTE_VALID)) { dst = amdgpu_bo_gpu_offset(entry->base.bo); - dst = amdgpu_gart_get_vm_pde(p->adev, dst); flags = AMDGPU_PTE_VALID; } else { /* Set the huge page flag to stop scanning at this PDE */ @@ -1314,9 +1318,11 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, if (!entry->huge && !(flags & AMDGPU_PDE_PTE)) return; - entry->huge = !!(flags & AMDGPU_PDE_PTE); + amdgpu_gart_get_vm_pde(p->adev, p->adev->vm_manager.num_level - 1, + &dst, &flags); + if (use_cpu_update) { /* In case a huge page is replaced with a system * memory mapping, p->pages_addr != NULL and |