Commit 30837a49 authored by Lang Yu's avatar Lang Yu Committed by Alex Deucher
Browse files

drm/amdkfd: Map wptr BO to GART unconditionally



For simulation C models that don't run CP FW where adev->mes.sched_version
is not populated correctly. This causes NULL dereference in
amdgpu_amdkfd_free_gtt_mem(dev->adev, (void **)&pqn->q->wptr_bo_gart)
and warning on unpinned BO in amdgpu_bo_gpu_offset(q->properties.wptr_bo).

Compared with adding version check here and there,
always map wptr BO to GART simplifies things.

v2: Add NULL check in amdgpu_amdkfd_free_gtt_mem.(Philip)

Signed-off-by: default avatarLang Yu <lang.yu@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 68453052
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -368,6 +368,9 @@ void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj)
{
	struct amdgpu_bo **bo = (struct amdgpu_bo **) mem_obj;

	if (!bo || !*bo)
		return;

	(void)amdgpu_bo_reserve(*bo, true);
	amdgpu_bo_kunmap(*bo);
	amdgpu_bo_unpin(*bo);
+10 −13
Original line number Diff line number Diff line
@@ -279,8 +279,6 @@ static int init_user_queue(struct process_queue_manager *pqm,
		/* Starting with GFX11, wptr BOs must be mapped to GART for MES to determine work
		 * on unmapped queues for usermode queue oversubscription (no aggregated doorbell)
		 */
		if (((dev->adev->mes.sched_version & AMDGPU_MES_API_VERSION_MASK)
		    >> AMDGPU_MES_API_VERSION_SHIFT) >= 2) {
		if (dev->adev != amdgpu_ttm_adev(q_properties->wptr_bo->tbo.bdev)) {
			pr_err("Queue memory allocated to wrong device\n");
			retval = -EINVAL;
@@ -294,7 +292,6 @@ static int init_user_queue(struct process_queue_manager *pqm,
			goto free_gang_ctx_bo;
		}
	}
	}

	pr_debug("PQM After init queue");
	return 0;