drm/amdgpu: simplify bo_va list when vm bo update (v2)

v2: fix compiling warning

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Junwei Zhang 2018-04-19 13:17:26 +08:00 коммит произвёл Alex Deucher
Родитель bfa8eea29b
Коммит bb475839ec
1 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -1509,6 +1509,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
struct drm_mm_node *nodes; struct drm_mm_node *nodes;
struct dma_fence *exclusive, **last_update; struct dma_fence *exclusive, **last_update;
uint64_t flags; uint64_t flags;
uint32_t mem_type;
int r; int r;
if (clear || !bo_va->base.bo) { if (clear || !bo_va->base.bo) {
@ -1561,19 +1562,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
} }
spin_lock(&vm->status_lock); spin_lock(&vm->status_lock);
if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { list_del_init(&bo_va->base.vm_status);
unsigned mem_type = bo->tbo.mem.mem_type;
/* If the BO is not in its preferred location add it back to /* If the BO is not in its preferred location add it back to
* the evicted list so that it gets validated again on the * the evicted list so that it gets validated again on the
* next command submission. * next command submission.
*/ */
list_del_init(&bo_va->base.vm_status); mem_type = bo->tbo.mem.mem_type;
if (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type))) if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv &&
list_add_tail(&bo_va->base.vm_status, &vm->evicted); !(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
} else { list_add_tail(&bo_va->base.vm_status, &vm->evicted);
list_del_init(&bo_va->base.vm_status);
}
spin_unlock(&vm->status_lock); spin_unlock(&vm->status_lock);
list_splice_init(&bo_va->invalids, &bo_va->valids); list_splice_init(&bo_va->invalids, &bo_va->valids);