[PATCH 1/1] drm/ttm: Fix of rework on ttm_resource to use size_t type commit

Christian König christian.koenig at amd.com
Thu Jan 12 07:06:04 UTC 2023


Am 11.01.23 um 23:45 schrieb Kevin Brace:
> From: Kevin Brace <kevinbrace at bracecomputerlab.com>
>
> Commit e3c92eb4a84fb0f00442e6b5cabf4f11b0eaaf41 (drm/ttm: rework on
> ttm_resource to use size_t type) reworked ttm_resource{} to use size_t
> type size instead of unsigned long type num_pages.  In that commit,
> when ttm_move_memcpy() is being called from ttm_bo_move_memcpy(),
> the code was changed to specify the page size from ttm->num_pages
> instead of the original code's dst_mem->num_pages.  Since the commit
> is about reworking ttm_resource{} to use size_t type size instead of
> unsigned long type num_pages, the commit should have specified page
> size converted version of dst_mem->size.  Use PFN_UP macro to convert
> dst_mem->size to page size.

Zack already came up with the same patch, please review that one instead.

Thanks,
Christian.

>
> Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index ba3aa0a0fc43..da5493f789df 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -173,7 +173,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
>   
>   	clear = src_iter->ops->maps_tt && (!ttm || !ttm_tt_is_populated(ttm));
>   	if (!(clear && ttm && !(ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC)))
> -		ttm_move_memcpy(clear, ttm->num_pages, dst_iter, src_iter);
> +		ttm_move_memcpy(clear, PFN_UP(dst_mem->size), dst_iter, src_iter);
>   
>   	if (!src_iter->ops->maps_tt)
>   		ttm_kmap_iter_linear_io_fini(&_src_iter.io, bdev, src_mem);



More information about the dri-devel mailing list