]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdkfd: Relax size checking during queue buffer get
authorDonet Tom <donettom@linux.ibm.com>
Mon, 12 Jan 2026 14:06:54 +0000 (19:36 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 14 Jan 2026 19:28:48 +0000 (14:28 -0500)
HW-supported EOP buffer sizes are 4K and 32K. On systems that do not
use 4K pages, the minimum buffer object (BO) allocation size is
PAGE_SIZE (for example, 64K). During queue buffer acquisition, the driver
currently checks the allocated BO size against the supported EOP buffer
size. Since the allocated BO is larger than the expected size, this check
fails, preventing queue creation.

Relax the strict size validation and allow PAGE_SIZE-sized BOs to be used.
Only the required 4K region of the buffer will be used as the EOP buffer
and avoids queue creation failures on non-4K page systems.

Acked-by: Christian König <christian.koenig@amd.com>
Suggested-by: Philip Yang <yangp@amd.com>
Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_queue.c

index 1b465fdb2c645f8312322138eeac488fe2cc9b30..d1978e3f68bee6f1b5b742ef94b4867bbf728468 100644 (file)
@@ -278,8 +278,8 @@ int kfd_queue_acquire_buffers(struct kfd_process_device *pdd, struct queue_prope
 
        /* EOP buffer is not required for all ASICs */
        if (properties->eop_ring_buffer_address) {
-               if (properties->eop_ring_buffer_size != topo_dev->node_props.eop_buffer_size) {
-                       pr_debug("queue eop bo size 0x%x not equal to node eop buf size 0x%x\n",
+               if (properties->eop_ring_buffer_size < topo_dev->node_props.eop_buffer_size) {
+                       pr_debug("queue eop bo size 0x%x is less than node eop buf size 0x%x\n",
                                properties->eop_ring_buffer_size,
                                topo_dev->node_props.eop_buffer_size);
                        err = -EINVAL;
@@ -287,7 +287,7 @@ int kfd_queue_acquire_buffers(struct kfd_process_device *pdd, struct queue_prope
                }
                err = kfd_queue_buffer_get(vm, (void *)properties->eop_ring_buffer_address,
                                           &properties->eop_buf_bo,
-                                          properties->eop_ring_buffer_size);
+                                          ALIGN(properties->eop_ring_buffer_size, PAGE_SIZE));
                if (err)
                        goto out_err_unreserve;
        }