Skip to content

Commit e3193f0

Browse files
committed
drm/panthor: Make sure the tiler initial/max chunks are consistent
It doesn't make sense to have a maximum number of chunks smaller than the initial number of chunks attached to the context. Fix the uAPI header to reflect the new constraint, and mention the undocumented "initial_chunk_count > 0" constraint while at it. v3: - Add R-b v2: - Fix the check Fixes: 9cca48f ("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Liviu Dudau <[email protected]> Reviewed-by: Steven Price <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d214329 commit e3193f0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

drivers/gpu/drm/panthor/panthor_heap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ int panthor_heap_create(struct panthor_heap_pool *pool,
281281
if (initial_chunk_count == 0)
282282
return -EINVAL;
283283

284+
if (initial_chunk_count > max_chunks)
285+
return -EINVAL;
286+
284287
if (hweight32(chunk_size) != 1 ||
285288
chunk_size < SZ_256K || chunk_size > SZ_2M)
286289
return -EINVAL;

include/uapi/drm/panthor_drm.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,13 +895,17 @@ struct drm_panthor_tiler_heap_create {
895895
/** @vm_id: VM ID the tiler heap should be mapped to */
896896
__u32 vm_id;
897897

898-
/** @initial_chunk_count: Initial number of chunks to allocate. */
898+
/** @initial_chunk_count: Initial number of chunks to allocate. Must be at least one. */
899899
__u32 initial_chunk_count;
900900

901901
/** @chunk_size: Chunk size. Must be a power of two at least 256KB large. */
902902
__u32 chunk_size;
903903

904-
/** @max_chunks: Maximum number of chunks that can be allocated. */
904+
/**
905+
* @max_chunks: Maximum number of chunks that can be allocated.
906+
*
907+
* Must be at least @initial_chunk_count.
908+
*/
905909
__u32 max_chunks;
906910

907911
/**

0 commit comments

Comments
 (0)