Skip to content

Commit d15deaf

Browse files
jokim-amdalexdeucher
authored andcommitted
drm/amdkfd: relax checks for over allocation of save area
Over allocation of save area is not fatal, only under allocation is. ROCm has various components that independently claim authority over save area size. Unless KFD decides to claim single authority, relax size checks. Signed-off-by: Jonathan Kim <jonathan.kim@amd.com> Reviewed-by: Philip Yang <philip.yang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 15bd495) Cc: stable@vger.kernel.org
1 parent bbe3c11 commit d15deaf

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_queue.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,16 @@ int kfd_queue_acquire_buffers(struct kfd_process_device *pdd, struct queue_prope
297297
goto out_err_unreserve;
298298
}
299299

300-
if (properties->ctx_save_restore_area_size != topo_dev->node_props.cwsr_size) {
301-
pr_debug("queue cwsr size 0x%x not equal to node cwsr size 0x%x\n",
300+
if (properties->ctx_save_restore_area_size < topo_dev->node_props.cwsr_size) {
301+
pr_debug("queue cwsr size 0x%x not sufficient for node cwsr size 0x%x\n",
302302
properties->ctx_save_restore_area_size,
303303
topo_dev->node_props.cwsr_size);
304304
err = -EINVAL;
305305
goto out_err_unreserve;
306306
}
307307

308-
total_cwsr_size = (topo_dev->node_props.cwsr_size + topo_dev->node_props.debug_memory_size)
309-
* NUM_XCC(pdd->dev->xcc_mask);
308+
total_cwsr_size = (properties->ctx_save_restore_area_size +
309+
topo_dev->node_props.debug_memory_size) * NUM_XCC(pdd->dev->xcc_mask);
310310
total_cwsr_size = ALIGN(total_cwsr_size, PAGE_SIZE);
311311

312312
err = kfd_queue_buffer_get(vm, (void *)properties->ctx_save_restore_area_address,
@@ -352,8 +352,8 @@ int kfd_queue_release_buffers(struct kfd_process_device *pdd, struct queue_prope
352352
topo_dev = kfd_topology_device_by_id(pdd->dev->id);
353353
if (!topo_dev)
354354
return -EINVAL;
355-
total_cwsr_size = (topo_dev->node_props.cwsr_size + topo_dev->node_props.debug_memory_size)
356-
* NUM_XCC(pdd->dev->xcc_mask);
355+
total_cwsr_size = (properties->ctx_save_restore_area_size +
356+
topo_dev->node_props.debug_memory_size) * NUM_XCC(pdd->dev->xcc_mask);
357357
total_cwsr_size = ALIGN(total_cwsr_size, PAGE_SIZE);
358358

359359
kfd_queue_buffer_svm_put(pdd, properties->ctx_save_restore_area_address, total_cwsr_size);

0 commit comments

Comments
 (0)