diff options
author | Oak Zeng <Oak.Zeng@amd.com> | 2019-06-03 21:25:52 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-06-11 12:56:59 -0500 |
commit | 8636e53c4715d0fb92980d39e070c2c897b5a96e (patch) | |
tree | 77e8f9823adaecf008877b02c9df7ef8b8e60ea0 /drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | |
parent | d39b7737346328b66c46c54be973c5b3c176fc67 (diff) | |
download | linux-8636e53c4715d0fb92980d39e070c2c897b5a96e.tar.gz linux-8636e53c4715d0fb92980d39e070c2c897b5a96e.tar.bz2 linux-8636e53c4715d0fb92980d39e070c2c897b5a96e.zip |
drm/amdkfd: Separate mqd allocation and initialization
Introduce a new mqd allocation interface and split the original
init_mqd function into two functions: allocate_mqd and init_mqd.
Also renamed uninit_mqd to free_mqd. This is preparation work to
fix a circular lock dependency.
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c index 1cc03b3ddbb9..229500c8c958 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c @@ -132,13 +132,14 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, kq->queue->device = dev; kq->queue->process = kfd_get_process(current); - retval = kq->mqd_mgr->init_mqd(kq->mqd_mgr, &kq->queue->mqd, - &kq->queue->mqd_mem_obj, + kq->queue->mqd_mem_obj = kq->mqd_mgr->allocate_mqd(kq->mqd_mgr->dev, + &kq->queue->properties); + if (!kq->queue->mqd_mem_obj) + goto err_allocate_mqd; + kq->mqd_mgr->init_mqd(kq->mqd_mgr, &kq->queue->mqd, + kq->queue->mqd_mem_obj, &kq->queue->gart_mqd_addr, &kq->queue->properties); - if (retval != 0) - goto err_init_mqd; - /* assign HIQ to HQD */ if (type == KFD_QUEUE_TYPE_HIQ) { pr_debug("Assigning hiq to hqd\n"); @@ -164,7 +165,8 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, return true; err_alloc_fence: -err_init_mqd: + kq->mqd_mgr->free_mqd(kq->mqd_mgr, kq->queue->mqd, kq->queue->mqd_mem_obj); +err_allocate_mqd: uninit_queue(kq->queue); err_init_queue: kfd_gtt_sa_free(dev, kq->wptr_mem); @@ -193,7 +195,7 @@ static void uninitialize(struct kernel_queue *kq) else if (kq->queue->properties.type == KFD_QUEUE_TYPE_DIQ) kfd_gtt_sa_free(kq->dev, kq->fence_mem_obj); - kq->mqd_mgr->uninit_mqd(kq->mqd_mgr, kq->queue->mqd, + kq->mqd_mgr->free_mqd(kq->mqd_mgr, kq->queue->mqd, kq->queue->mqd_mem_obj); kfd_gtt_sa_free(kq->dev, kq->rptr_mem); |