The AQL queue size can be 4K, but the minimum buffer object (BO)
allocation size is PAGE_SIZE. On systems with a page size larger
than 4K, the expected queue size does not match the allocated BO
size, causing queue creation to fail.

Align the expected queue size to PAGE_SIZE so that it matches the
allocated BO size and allows queue creation to succeed.

Signed-off-by: Donet Tom <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
index d1978e3f68be..572b21e39e83 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
@@ -249,10 +249,10 @@ int kfd_queue_acquire_buffers(struct kfd_process_device 
*pdd, struct queue_prope
            topo_dev->node_props.gfx_target_version < 90000)
                /* metadata_queue_size not supported on GFX7/GFX8 */
                expected_queue_size =
-                       properties->queue_size / 2;
+                       PAGE_ALIGN(properties->queue_size / 2);
        else
                expected_queue_size =
-                       properties->queue_size + 
properties->metadata_queue_size;
+                       PAGE_ALIGN(properties->queue_size + 
properties->metadata_queue_size);
 
        vm = drm_priv_to_vm(pdd->drm_priv);
        err = amdgpu_bo_reserve(vm->root.bo, false);
-- 
2.52.0

Reply via email to