drm/amdgpu: sync fence of clear_invalids (v2)
authormonk.liu <monk.liu@amd.com>
Tue, 26 May 2015 07:01:54 +0000 (15:01 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 4 Jun 2015 01:03:54 +0000 (21:03 -0400)
bo_va may un-initialized, fix it.

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@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 8eb5c55293042e5d174171bbf4136de6516eb3af..6c8c24ba463dd4d2c4be7c710b8095468c73cd6f 100644 (file)
@@ -2268,7 +2268,7 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
 int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
                                struct amdgpu_vm *vm);
 int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
-                               struct amdgpu_vm *vm);
+                               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);
index ecb30a1a73cc61cdf371bfd73a375baf43469619..fefa48a59a7dd188a9cae5fc562d245e97d30cd5 100644 (file)
@@ -520,7 +520,7 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,
 
                amdgpu_sync_fence(&p->ibs[0].sync, bo_va->last_pt_update);
        }
-       return amdgpu_vm_clear_invalids(adev, vm);
+       return amdgpu_vm_clear_invalids(adev, vm, &p->ibs[0].sync);
 }
 
 static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,
index dcb2d3859cf12692bb27aa0761c508e4c5d95482..4d26b303b495c8f2aad28e4e2e311ebf1d65336c 100644 (file)
@@ -858,9 +858,9 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
  * PTs have to be reserved and mutex must be locked!
  */
 int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
-                            struct amdgpu_vm *vm)
+                            struct amdgpu_vm *vm, struct amdgpu_sync *sync)
 {
-       struct amdgpu_bo_va *bo_va;
+       struct amdgpu_bo_va *bo_va = NULL;
        int r;
 
        spin_lock(&vm->status_lock);
@@ -877,6 +877,8 @@ int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
        }
        spin_unlock(&vm->status_lock);
 
+       if (bo_va)
+               amdgpu_sync_fence(sync, bo_va->last_pt_update);
        return 0;
 }