[Intel-xe] [PATCH] fixup! drm/xe: Apply upper limit to sg element size

Thomas Hellström thomas.hellstrom at linux.intel.com
Fri Jun 2 10:05:09 UTC 2023


On 6/2/23 05:12, Niranjana Vishwanathapura wrote:
> Replace UINT_MAX with maximum value supported by sg->length.
>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_bo.h | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>

>
> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
> index d945675a259f..e6d08fa9c992 100644
> --- a/drivers/gpu/drm/xe/xe_bo.h
> +++ b/drivers/gpu/drm/xe/xe_bo.h
> @@ -306,7 +306,10 @@ struct sg_table *xe_bo_get_sg(struct xe_bo *bo);
>    */
>   static inline unsigned int xe_sg_segment_size(struct device *dev)
>   {
> -	size_t max = min_t(size_t, UINT_MAX, dma_max_mapping_size(dev));
> +	struct scatterlist __maybe_unused sg;
> +	size_t max = BIT_ULL(sizeof(sg.length) * 8) - 1;
> +
> +	max = min_t(size_t, max, dma_max_mapping_size(dev));
>   
>   	/*
>   	 * The iommu_dma_map_sg() function ensures iova allocation doesn't


More information about the Intel-xe mailing list