mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 18:13:26 -04:00
drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large
The ttm_bo_init_reserved() functions returns -ENOSPC if the size is too big to add vma. The direct function that returns -ENOSPC is drm_mm_insert_node_in_range(). To handle the same error as other code returning -E2BIG when the size is too large, it converts return value to -E2BIG. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221228192252.917299-6-gwan-gyeong.mun@intel.com
This commit is contained in:
committed by
Rodrigo Vivi
parent
662c04e2b8
commit
18f968cb92
@@ -1309,6 +1309,17 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
|
||||
ret = ttm_bo_init_reserved(&i915->bdev, i915_gem_to_ttm(obj), bo_type,
|
||||
&i915_sys_placement, page_size >> PAGE_SHIFT,
|
||||
&ctx, NULL, NULL, i915_ttm_bo_destroy);
|
||||
|
||||
/*
|
||||
* XXX: The ttm_bo_init_reserved() functions returns -ENOSPC if the size
|
||||
* is too big to add vma. The direct function that returns -ENOSPC is
|
||||
* drm_mm_insert_node_in_range(). To handle the same error as other code
|
||||
* that returns -E2BIG when the size is too large, it converts -ENOSPC to
|
||||
* -E2BIG.
|
||||
*/
|
||||
if (size >> PAGE_SHIFT > INT_MAX && ret == -ENOSPC)
|
||||
ret = -E2BIG;
|
||||
|
||||
if (ret)
|
||||
return i915_ttm_err_to_gem(ret);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user