Skip to content
Snippets Groups Projects
Commit e7a47773 authored by PhilipY's avatar PhilipY Committed by Alex Deucher
Browse files

drm/amdkfd: Fix user queue validation on Gfx7/8


To workaround queue full h/w issue on Gfx7/8, when application create
AQL queue, the ring buffer bo allocate size is queue_size/2 and
map queue_size ring buffer to GPU in 2 pieces using 2 attachments, each
attachment map size is queue_size/2, with same ring_bo backing memory.

For Gfx7/8, user queue buffer validation should use queue_size/2 to
verify ring_bo allocation and mapping size.

Fixes: 68e599db ("drm/amdkfd: Validate user queue buffers")
Suggested-by: default avatarTomáš Trnka <trnka@scm.com>
Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ad97840f
No related branches found
No related tags found
No related merge requests found
......@@ -233,6 +233,7 @@ void kfd_queue_buffer_put(struct amdgpu_bo **bo)
int kfd_queue_acquire_buffers(struct kfd_process_device *pdd, struct queue_properties *properties)
{
struct kfd_topology_device *topo_dev;
u64 expected_queue_size;
struct amdgpu_vm *vm;
u32 total_cwsr_size;
int err;
......@@ -241,6 +242,15 @@ int kfd_queue_acquire_buffers(struct kfd_process_device *pdd, struct queue_prope
if (!topo_dev)
return -EINVAL;
/* AQL queues on GFX7 and GFX8 appear twice their actual size */
if (properties->type == KFD_QUEUE_TYPE_COMPUTE &&
properties->format == KFD_QUEUE_FORMAT_AQL &&
topo_dev->node_props.gfx_target_version >= 70000 &&
topo_dev->node_props.gfx_target_version < 90000)
expected_queue_size = properties->queue_size / 2;
else
expected_queue_size = properties->queue_size;
vm = drm_priv_to_vm(pdd->drm_priv);
err = amdgpu_bo_reserve(vm->root.bo, false);
if (err)
......@@ -255,7 +265,7 @@ int kfd_queue_acquire_buffers(struct kfd_process_device *pdd, struct queue_prope
goto out_err_unreserve;
err = kfd_queue_buffer_get(vm, (void *)properties->queue_address,
&properties->ring_bo, properties->queue_size);
&properties->ring_bo, expected_queue_size);
if (err)
goto out_err_unreserve;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment