aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
diff options
context:
space:
mode:
authorJohn Brooks <john@fastquake.com>2017-06-30 11:31:08 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 11:06:33 -0400
commit96cf8271df546d0f4cfc9ddddbc42dce633e0190 (patch)
tree981e86f5e52091f11a03930cea2f7f5bd40ed35e /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
parent00f06b246a3056bbaa901a90a5a93c9f81ab8e36 (diff)
drm/amdgpu: Set/clear CPU_ACCESS flag on page fault and move to VRAM
When a BO is moved to VRAM, clear AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED. This allows it to potentially later move to invisible VRAM if the CPU does not access it again. Setting the CPU_ACCESS flag in amdgpu_bo_fault_reserve_notify() also means that we can remove the loop to restrict lpfn to the end of visible VRAM, because amdgpu_ttm_placement_init() will do it for us. v3 [Michel Dänzer] * Use AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED instead of a new flag (Christian König) * Clear flag in amdgpu_bo_move instead of amdgpu_move_ram_vram (Christian) * Explicitly mention amdgpu_bo_fault_reserve_notify in amdgpu_bo_move * Also clear flag in amdgpu_bo_create_restricted Suggested-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: John Brooks <john@fastquake.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index e238084b7142..9bbaffbd5f6a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -499,6 +499,15 @@ memcpy:
499 } 499 }
500 } 500 }
501 501
502 if (bo->type == ttm_bo_type_device &&
503 new_mem->mem_type == TTM_PL_VRAM &&
504 old_mem->mem_type != TTM_PL_VRAM) {
505 /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU
506 * accesses the BO after it's moved.
507 */
508 abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
509 }
510
502 /* update statistics */ 511 /* update statistics */
503 atomic64_add((u64)bo->num_pages << PAGE_SHIFT, &adev->num_bytes_moved); 512 atomic64_add((u64)bo->num_pages << PAGE_SHIFT, &adev->num_bytes_moved);
504 return 0; 513 return 0;