drm/amdgpu: put VM page tables directly into duplicates list
authorChristian König <christian.koenig@amd.com>
Fri, 11 Dec 2015 13:39:05 +0000 (14:39 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 18 Dec 2015 22:29:45 +0000 (17:29 -0500)
They share the reservation object with the page directory anyway.

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

index c3996e0e2e7e52ce25db5600ade58d62d6d120fa..dc3dab539e4c3984c5e14d03789858968b5cf6ab 100644 (file)
@@ -982,7 +982,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
 void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
 struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
                                               struct amdgpu_vm *vm,
-                                              struct list_head *head);
+                                              struct list_head *validated,
+                                              struct list_head *duplicates);
 int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
                      struct amdgpu_sync *sync);
 void amdgpu_vm_flush(struct amdgpu_ring *ring,
index 1d44d508d4d4f50b249104b4aabc9a6cbab83e61..9591c13781bdd196578da0b2c1c14c6b77a095a2 100644 (file)
@@ -386,13 +386,13 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p)
                amdgpu_cs_buckets_get_list(&buckets, &p->validated);
        }
 
+       INIT_LIST_HEAD(&duplicates);
        p->vm_bos = amdgpu_vm_get_bos(p->adev, &fpriv->vm,
-                                     &p->validated);
+                                     &p->validated, &duplicates);
 
        if (need_mmap_lock)
                down_read(&current->mm->mmap_sem);
 
-       INIT_LIST_HEAD(&duplicates);
        r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, &duplicates);
        if (unlikely(r != 0))
                goto error_reserve;
index fc32fc01a64ba8f1d68ae8621af29195287881c8..7fe7f8afa5ffe0a9f0f60d1474c92677607a8bee 100644 (file)
@@ -460,7 +460,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
        tv.shared = true;
        list_add(&tv.head, &list);
 
-       vm_bos = amdgpu_vm_get_bos(adev, bo_va->vm, &list);
+       vm_bos = amdgpu_vm_get_bos(adev, bo_va->vm, &list, &duplicates);
        if (!vm_bos)
                return;
 
index fce4c6d952c86119618dbdb36f21e44d28b2e593..f6c1d6f0bf3787f9e9bef3d1fd7d2ce848b0e18c 100644 (file)
@@ -78,14 +78,16 @@ static unsigned amdgpu_vm_directory_size(struct amdgpu_device *adev)
  * amdgpu_vm_get_bos - add the vm BOs to a validation list
  *
  * @vm: vm providing the BOs
- * @head: head of validation list
+ * @validated: head of validation list
+ * @duplicates: head of duplicates list
  *
  * Add the page directory to the list of BOs to
  * validate for command submission (cayman+).
  */
 struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
-                                         struct amdgpu_vm *vm,
-                                         struct list_head *head)
+                                              struct amdgpu_vm *vm,
+                                              struct list_head *validated,
+                                              struct list_head *duplicates)
 {
        struct amdgpu_bo_list_entry *list;
        unsigned i, idx;
@@ -103,7 +105,7 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
        list[0].priority = 0;
        list[0].tv.bo = &vm->page_directory->tbo;
        list[0].tv.shared = true;
-       list_add(&list[0].tv.head, head);
+       list_add(&list[0].tv.head, validated);
 
        for (i = 0, idx = 1; i <= vm->max_pde_used; i++) {
                if (!vm->page_tables[i].bo)
@@ -115,7 +117,7 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
                list[idx].priority = 0;
                list[idx].tv.bo = &list[idx].robj->tbo;
                list[idx].tv.shared = true;
-               list_add(&list[idx++].tv.head, head);
+               list_add(&list[idx++].tv.head, duplicates);
        }
 
        return list;