]> git.hungrycats.org Git - linux/commitdiff
drm/amdgpu: Remove arbitrary number of contexts limitation
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Mon, 1 Jun 2026 14:08:23 +0000 (15:08 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jun 2026 20:31:47 +0000 (16:31 -0400)
There is no need for an arbitrary limit to number of contexts userspace
can be allowed to create. Remove the AMDGPU_VM_MAX_NUM_CTX (4096) and
allow for full 32-bit of handles to be allocated.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

index 45bf05306c90faa48663989fed2adf5cd595b876..e2d4be3c111d96fa3d0e44674cb323294ee8e19f 100644 (file)
@@ -272,7 +272,6 @@ extern int amdgpu_ptl;
 
 extern uint amdgpu_hdmi_hpd_debounce_delay_ms;
 
-#define AMDGPU_VM_MAX_NUM_CTX                  4096
 #define AMDGPU_SG_THRESHOLD                    (256*1024*1024)
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS         3000
 #define AMDGPU_MAX_USEC_TIMEOUT                        100000  /* 100 ms */
index ce35b415093d670aa677067973fbd00e9e03b99c..3f34ecda02888772c8a050931414e410cce64f87 100644 (file)
@@ -505,14 +505,14 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
                return -ENOMEM;
 
        mutex_lock(&mgr->lock);
-       r = idr_alloc(&mgr->ctx_handles, ctx, 1, AMDGPU_VM_MAX_NUM_CTX, GFP_KERNEL);
-       if (r < 0) {
+       *id = 1;
+       r = idr_alloc_u32(&mgr->ctx_handles, ctx, id, UINT_MAX, GFP_KERNEL);
+       if (r) {
                mutex_unlock(&mgr->lock);
                kfree(ctx);
                return r;
        }
 
-       *id = (uint32_t)r;
        r = amdgpu_ctx_init(mgr, priority, filp, ctx);
        if (r) {
                idr_remove(&mgr->ctx_handles, *id);