Skip to contentSkip to conversation

drm/amdgpu: Fix a bug in amdgpu_fill_buffer()

PATCH In review Yong Zhao 2 participants 2 messages Sep 15, 2017 – Sep 16, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Yong Zhao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix a bug in amdgpu_fill_buffer()

When max_bytes is not 8 bytes aligned and bo size is larger than max_bytes, the last 8 bytes in a ttm node may be left unchanged. For example, on pre SDMA 4.0, max_bytes = 0x1fffff, and the bo size is 0x200000, the problem will happen. This commit fixed that.

Change-Id I37c588a57cb63f1a8251fb5ead2eff4b39e047c9
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -1
index 2180ed3..257361a 100644
@@ -1619,7 +1619,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
 
 		dst_addr = amdgpu_mm_node_addr(&bo->tbo, mm_node, &bo->tbo.mem);
 		while (byte_count) {
-			uint32_t cur_size_in_bytes = min(byte_count, max_bytes);
+			uint32_t cur_size_in_bytes =
+					min(byte_count, max_bytes) & ~0x7;
 
 			amdgpu_vm_set_pte_pde(adev, &job->ibs[0],
 					dst_addr, 0,
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1505517489-17588-1-git-send-email-yong.zhao-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 16.09.2017 um 01:18 schrieb Yong Zhao:

Quoted 4 lines

When max_bytes is not 8 bytes aligned and bo size is larger than max_bytes, the last 8 bytes in a ttm node may be left unchanged. For example, on pre SDMA 4.0, max_bytes = 0x1fffff, and the bo size is 0x200000, the problem will happen. This commit fixed that.

Nice catch, but please fix buffer_funcs->fill_max_bytes instead of working around an incorrect value here.

Regards,
Christian.

Quoted 12 lines
Change-Id I37c588a57cb63f1a8251fb5ead2eff4b39e047c9
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 2180ed3..257361a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_fill_buffer(struct amdgpu_bo *bo, · line 1626

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -1
@@ -1619,7 +1619,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
 
  		dst_addr = amdgpu_mm_node_addr(&bo->tbo, mm_node, &bo->tbo.mem);
  		while (byte_count) {
-			uint32_t cur_size_in_bytes = min(byte_count, max_bytes);
+			uint32_t cur_size_in_bytes =
+					min(byte_count, max_bytes) & ~0x7;
 
  			amdgpu_vm_set_pte_pde(adev, &job->ibs[0],
  					dst_addr, 0,

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