Skip to contentSkip to conversation

drm/amdgpu: Add mem sync flag for IB allocated by SA

PATCH In review Jinzhou Su 3 participants 3 messages Apr 20, 2021

Subsystems (2)
lore
Share & tools
lore

Jinzhou Su

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Add mem sync flag for IB allocated by SA

The buffer of SA bo will be used by many cases. So better to flush the cache of indirect buffer allocated by SA before commit the IB.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -0
index 148a3b481b12..a2fe2dac32c1 100644
@@ -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);
Signature · 6 lines
2.27.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

Am 20.04.21 um 10:27 schrieb Jinzhou Su:

Quoted 14 lines

The buffer of SA bo will be used by many cases. So better to flush the cache of indirect buffer allocated by SA before commit the IB.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
index 148a3b481b12..a2fe2dac32c1 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 79

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
@@ -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 */

Either drop the comment or change it a bit.

E.g. like "/* Invalidate the cache to make the GPU see the newest SA content */

With that done the patch is Reviewed-by: Christian König <[email protected]>

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 83

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
+		ib->flags = AMDGPU_IB_FLAG_EMIT_MEM_SYNC;
 
  		if (!vm)
  			ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#2 lore raw
Quoted 22 lines · Christian König

Am 20.04.21 um 10:27 schrieb Jinzhou Su:

Quoted 14 lines

The buffer of SA bo will be used by many cases. So better to flush the cache of indirect buffer allocated by SA before commit the IB.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
index 148a3b481b12..a2fe2dac32c1 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 79

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
@@ -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 */

Either drop the comment or change it a bit.

Quoted 5 lines

E.g. like "/* Invalidate the cache to make the GPU see the newest SA content */

With that done the patch is Reviewed-by: Christian König <[email protected]>

Yes, with this fix, patch looks good for me as well.

Quoted 9 lines

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 83

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
+		ib->flags = AMDGPU_IB_FLAG_EMIT_MEM_SYNC;
 
  		if (!vm)
  			ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx