Skip to contentSkip to conversation

drm/amdgpu: Use correct size when access vram

PATCH In review xinhui pan 2 participants 2 messages Mar 22, 2021

Subsystems (2)
lore
Share & tools
lore

xinhui pan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Use correct size when access vram

To make size is 4 byte aligned. Use &~0x3ULL instead of &3ULL.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
index 6d5cf0525325..41a4c456961c 100644
@@ -1503,7 +1503,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo,
 				memcpy(buf, &value, bytes);
 			}
 		} else {
-			bytes = cursor.size & 0x3ull;
+			bytes = cursor.size & ~0x3ULL;
 			amdgpu_device_vram_access(adev, cursor.start,
 						  (uint32_t *)buf, bytes,
 						  write);
Signature · 6 lines
2.25.1

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

Am 22.03.21 um 01:53 schrieb xinhui pan:

Quoted 3 lines

To make size is 4 byte aligned. Use &~0x3ULL instead of &3ULL.

Good catch. Patch is Reviewed-by: Christian König <[email protected]>

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 6d5cf0525325..41a4c456961c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, · line 1509

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -1503,7 +1503,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo,
  				memcpy(buf, &value, bytes);
  			}
  		} else {
-			bytes = cursor.size & 0x3ull;
+			bytes = cursor.size & ~0x3ULL;
  			amdgpu_device_vram_access(adev, cursor.start,
  						  (uint32_t *)buf, bytes,
  						  write);

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