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

Christian König ckoenig.leichtzumerken at gmail.com
Sat Sep 16 12:26:34 UTC 2017


Am 16.09.2017 um 01:18 schrieb Yong Zhao:
> 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.

>
> Change-Id: I37c588a57cb63f1a8251fb5ead2eff4b39e047c9
> Signed-off-by: Yong Zhao <yong.zhao at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 2180ed3..257361a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -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,




More information about the amd-gfx mailing list