]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/amdgpu: cleanup amdgpu_vm_bo_update params
authorChristian König <christian.koenig@amd.com>
Tue, 16 Aug 2016 12:43:17 +0000 (14:43 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 22 Aug 2016 17:47:24 +0000 (13:47 -0400)
Make it more obvious what we are doing here.

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

index e30a0d6353cd6fb96377be50301da30ca57819cc..3cc2629eb1583fd0580437e7a76b4b9db2a65c8b 100644 (file)
@@ -928,7 +928,7 @@ int amdgpu_vm_clear_invalids(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                             struct amdgpu_sync *sync);
 int amdgpu_vm_bo_update(struct amdgpu_device *adev,
                        struct amdgpu_bo_va *bo_va,
-                       struct ttm_mem_reg *mem);
+                       bool clear);
 void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
                             struct amdgpu_bo *bo);
 struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
index 396a412d70d4187c96323a54724cf4ae14eba467..d80e5d3a4add2e94dadd78d2455ba533b4076fd4 100644 (file)
@@ -642,7 +642,7 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,
                        if (bo_va == NULL)
                                continue;
 
-                       r = amdgpu_vm_bo_update(adev, bo_va, &bo->tbo.mem);
+                       r = amdgpu_vm_bo_update(adev, bo_va, false);
                        if (r)
                                return r;
 
index d2824d97b7e51590b30fabd3d4d268a463da1e1a..bf56f18144377e0626b913f9e5ec3daec245ffc3 100644 (file)
@@ -1117,28 +1117,32 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
  *
  * @adev: amdgpu_device pointer
  * @bo_va: requested BO and VM object
- * @mem: ttm mem
+ * @clear: if true clear the entries
  *
  * Fill in the page table entries for @bo_va.
  * Returns 0 for success, -EINVAL for failure.
- *
- * Object have to be reserved and mutex must be locked!
  */
 int amdgpu_vm_bo_update(struct amdgpu_device *adev,
                        struct amdgpu_bo_va *bo_va,
-                       struct ttm_mem_reg *mem)
+                       bool clear)
 {
        struct amdgpu_vm *vm = bo_va->vm;
        struct amdgpu_bo_va_mapping *mapping;
        dma_addr_t *pages_addr = NULL;
        uint32_t gtt_flags, flags;
+       struct ttm_mem_reg *mem;
        struct fence *exclusive;
        uint64_t addr;
        int r;
 
-       if (mem) {
+       if (clear) {
+               mem = NULL;
+               addr = 0;
+               exclusive = NULL;
+       } else {
                struct ttm_dma_tt *ttm;
 
+               mem = &bo_va->bo->tbo.mem;
                addr = (u64)mem->start << PAGE_SHIFT;
                switch (mem->mem_type) {
                case TTM_PL_TT:
@@ -1156,9 +1160,6 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
                }
 
                exclusive = reservation_object_get_excl(bo_va->bo->tbo.resv);
-       } else {
-               addr = 0;
-               exclusive = NULL;
        }
 
        flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
@@ -1189,7 +1190,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
        spin_lock(&vm->status_lock);
        list_splice_init(&bo_va->invalids, &bo_va->valids);
        list_del_init(&bo_va->vm_status);
-       if (!mem)
+       if (clear)
                list_add(&bo_va->vm_status, &vm->cleared);
        spin_unlock(&vm->status_lock);
 
@@ -1252,7 +1253,7 @@ int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
                        struct amdgpu_bo_va, vm_status);
                spin_unlock(&vm->status_lock);
 
-               r = amdgpu_vm_bo_update(adev, bo_va, NULL);
+               r = amdgpu_vm_bo_update(adev, bo_va, true);
                if (r)
                        return r;