drm/amdgpu: Add mem sync flag for IB allocated by SA
authorJinzhou Su <Jinzhou.Su@amd.com>
Tue, 20 Apr 2021 08:17:14 +0000 (16:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Apr 2021 01:45:24 +0000 (21:45 -0400)
The buffer of SA bo will be used by many cases. So it's better
to invalidate the cache of indirect buffer allocated by SA before
commit the IB.

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

index 148a3b4..a2fe2da 100644 (file)
@@ -76,6 +76,8 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                }
 
                ib->ptr = amdgpu_sa_bo_cpu_addr(ib->sa_bo);
+               /* flush the cache before commit the IB */
+               ib->flags = AMDGPU_IB_FLAG_EMIT_MEM_SYNC;
 
                if (!vm)
                        ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);