diff mbox series

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

Message ID 20230111224544.4837-2-kevinbrace@gmx.com (mailing list archive)
State New, archived
Headers show
Series DRM commit e3c92eb causes OpenChrome DRM to crash during boot | expand

Commit Message

Kevin Brace Jan. 11, 2023, 10:45 p.m. UTC
From: Kevin Brace <kevinbrace@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.

Signed-off-by: Kevin Brace <kevinbrace@bracecomputerlab.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian König Jan. 12, 2023, 7:06 a.m. UTC | #1
Am 11.01.23 um 23:45 schrieb Kevin Brace:
> From: Kevin Brace <kevinbrace@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@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);
diff mbox series

Patch

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);