mirror of
https://github.com/torvalds/linux.git
synced 2026-04-20 15:53:59 -04:00
drm/xe/uapi: Reject bo creation of unaligned size
For xe bo creation we request passing size which matches system or vram minimum page alignment. This way we want to ensure userspace is aware of region constraints and not aligned allocations will be rejected returning EINVAL. v2: - Rebase, Update uAPI documentation. (Thomas) v3: - Adjust the dma-buf kunit test accordingly. (Thomas) v4: - Fixed rebase conflicts and updated commit message. (Francois) Signed-off-by: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Francois Dugast <francois.dugast@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
committed by
Rodrigo Vivi
parent
2bec307154
commit
4e03b58414
@@ -109,15 +109,21 @@ static void xe_test_dmabuf_import_same_driver(struct xe_device *xe)
|
||||
struct drm_gem_object *import;
|
||||
struct dma_buf *dmabuf;
|
||||
struct xe_bo *bo;
|
||||
size_t size;
|
||||
|
||||
/* No VRAM on this device? */
|
||||
if (!ttm_manager_type(&xe->ttm, XE_PL_VRAM0) &&
|
||||
(params->mem_mask & XE_BO_CREATE_VRAM0_BIT))
|
||||
return;
|
||||
|
||||
size = PAGE_SIZE;
|
||||
if ((params->mem_mask & XE_BO_CREATE_VRAM0_BIT) &&
|
||||
xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K)
|
||||
size = SZ_64K;
|
||||
|
||||
kunit_info(test, "running %s\n", __func__);
|
||||
bo = xe_bo_create_user(xe, NULL, NULL, PAGE_SIZE, DRM_XE_GEM_CPU_CACHING_WC,
|
||||
ttm_bo_type_device, params->mem_mask);
|
||||
bo = xe_bo_create_user(xe, NULL, NULL, size, DRM_XE_GEM_CPU_CACHING_WC,
|
||||
ttm_bo_type_device, XE_BO_CREATE_USER_BIT | params->mem_mask);
|
||||
if (IS_ERR(bo)) {
|
||||
KUNIT_FAIL(test, "xe_bo_create() failed with err=%ld\n",
|
||||
PTR_ERR(bo));
|
||||
|
||||
Reference in New Issue
Block a user