Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: do not use amdgpu_bo_gpu_offset_no_check individually

This should not be used indiviually, use amdgpu_bo_gpu_offset
with bo reserved.

v3 - unpin bo in queue destroy (Christian)
v2 - pin bo so that offset returned won't change after unlock (Christian)

Signed-off-by: Saleemkhan Jamadar <saleemkhan083@gmail.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>

authored by

Saleemkhan Jamadar and committed by
Alex Deucher
1bc44dee 81af7f17

+30 -2
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
··· 129 129 { 130 130 int db_bo_offset; 131 131 132 - db_bo_offset = amdgpu_bo_gpu_offset_no_check(db_bo); 132 + db_bo_offset = amdgpu_bo_gpu_offset(db_bo); 133 133 134 134 /* doorbell index is 32 bit but doorbell's size can be 32 bit 135 135 * or 64 bit, so *db_size(in byte)/4 for alignment.
+8
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
··· 586 586 amdgpu_bo_unreserve(queue->db_obj.obj); 587 587 } 588 588 amdgpu_bo_unref(&queue->db_obj.obj); 589 + 590 + r = amdgpu_bo_reserve(queue->wptr_obj.obj, true); 591 + if (!r) { 592 + amdgpu_bo_unpin(queue->wptr_obj.obj); 593 + amdgpu_bo_unreserve(queue->wptr_obj.obj); 594 + } 595 + amdgpu_bo_unref(&queue->wptr_obj.obj); 596 + 589 597 atomic_dec(&uq_mgr->userq_count[queue->queue_type]); 590 598 #if defined(CONFIG_DEBUG_FS) 591 599 debugfs_remove_recursive(queue->debugfs_queue);
+21 -1
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
··· 94 94 return ret; 95 95 } 96 96 97 - queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset_no_check(wptr_obj->obj); 97 + ret = amdgpu_bo_reserve(wptr_obj->obj, true); 98 + if (ret) { 99 + DRM_ERROR("Failed to reserve wptr bo\n"); 100 + return ret; 101 + } 102 + 103 + /* TODO use eviction fence instead of pinning. */ 104 + ret = amdgpu_bo_pin(wptr_obj->obj, AMDGPU_GEM_DOMAIN_GTT); 105 + if (ret) { 106 + drm_file_err(uq_mgr->file, "[Usermode queues] Failed to pin wptr bo\n"); 107 + goto unresv_bo; 108 + } 109 + 110 + queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset(wptr_obj->obj); 111 + amdgpu_bo_unreserve(wptr_obj->obj); 112 + 98 113 return 0; 114 + 115 + unresv_bo: 116 + amdgpu_bo_unreserve(wptr_obj->obj); 117 + return ret; 118 + 99 119 } 100 120 101 121 static int convert_to_mes_priority(int priority)