[PATCH] drm/prime: Support page array >= 4GB

Christian König christian.koenig at amd.com
Tue Aug 22 09:43:30 UTC 2023



Am 21.08.23 um 22:02 schrieb Philip Yang:
> Without unsigned long typecast, the size is passed in as zero if page
> array size >= 4GB, nr_pages >= 0x100000, then sg list converted will
> have the first and the last chunk lost.

Good catch, but I'm not sure if this is enough to make it work.

Additional to that I don't think we have an use case for BOs > 4GiB.

Christian.

>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>
> ---
>   drivers/gpu/drm/drm_prime.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index f924b8b4ab6b..2630ad2e504d 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -830,7 +830,7 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev,
>   	if (max_segment == 0)
>   		max_segment = UINT_MAX;
>   	err = sg_alloc_table_from_pages_segment(sg, pages, nr_pages, 0,
> -						nr_pages << PAGE_SHIFT,
> +						(unsigned long)nr_pages << PAGE_SHIFT,
>   						max_segment, GFP_KERNEL);
>   	if (err) {
>   		kfree(sg);



More information about the dri-devel mailing list