diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c | 88 |
1 files changed, 30 insertions, 58 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c index 00e6a5955120..7d144f56f421 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c @@ -80,9 +80,6 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd, { struct kfd_mem_obj *mqd_mem_obj; - if (q->type == KFD_QUEUE_TYPE_HIQ) - return allocate_hiq_mqd(kfd); - if (kfd_gtt_sa_allocate(kfd, sizeof(struct vi_mqd), &mqd_mem_obj)) return NULL; @@ -90,21 +87,15 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd, return mqd_mem_obj; } -static int init_mqd(struct mqd_manager *mm, void **mqd, - struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr, +static void init_mqd(struct mqd_manager *mm, void **mqd, + struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, struct queue_properties *q) { - int retval; uint64_t addr; struct vi_mqd *m; - struct kfd_dev *kfd = mm->dev; - - *mqd_mem_obj = allocate_mqd(kfd, q); - if (!*mqd_mem_obj) - return -ENOMEM; - m = (struct vi_mqd *) (*mqd_mem_obj)->cpu_ptr; - addr = (*mqd_mem_obj)->gpu_addr; + m = (struct vi_mqd *) mqd_mem_obj->cpu_ptr; + addr = mqd_mem_obj->gpu_addr; memset(m, 0, sizeof(struct vi_mqd)); @@ -159,9 +150,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd, *mqd = m; if (gart_addr) *gart_addr = addr; - retval = mm->update_mqd(mm, m, q); - - return retval; + mm->update_mqd(mm, m, q); } static int load_mqd(struct mqd_manager *mm, void *mqd, @@ -177,7 +166,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd, wptr_shift, wptr_mask, mms); } -static int __update_mqd(struct mqd_manager *mm, void *mqd, +static void __update_mqd(struct mqd_manager *mm, void *mqd, struct queue_properties *q, unsigned int mtype, unsigned int atc_bit) { @@ -245,21 +234,19 @@ static int __update_mqd(struct mqd_manager *mm, void *mqd, set_priority(m, q); q->is_active = QUEUE_IS_ACTIVE(*q); - - return 0; } -static int update_mqd(struct mqd_manager *mm, void *mqd, +static void update_mqd(struct mqd_manager *mm, void *mqd, struct queue_properties *q) { - return __update_mqd(mm, mqd, q, MTYPE_CC, 1); + __update_mqd(mm, mqd, q, MTYPE_CC, 1); } -static int update_mqd_tonga(struct mqd_manager *mm, void *mqd, +static void update_mqd_tonga(struct mqd_manager *mm, void *mqd, struct queue_properties *q) { - return __update_mqd(mm, mqd, q, MTYPE_UC, 0); + __update_mqd(mm, mqd, q, MTYPE_UC, 0); } static int destroy_mqd(struct mqd_manager *mm, void *mqd, @@ -272,7 +259,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd, pipe_id, queue_id); } -static void uninit_mqd(struct mqd_manager *mm, void *mqd, +static void free_mqd(struct mqd_manager *mm, void *mqd, struct kfd_mem_obj *mqd_mem_obj) { kfd_gtt_sa_free(mm->dev, mqd_mem_obj); @@ -309,61 +296,44 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, return 0; } -static int init_mqd_hiq(struct mqd_manager *mm, void **mqd, - struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr, +static void init_mqd_hiq(struct mqd_manager *mm, void **mqd, + struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, struct queue_properties *q) { struct vi_mqd *m; - int retval = init_mqd(mm, mqd, mqd_mem_obj, gart_addr, q); - - if (retval != 0) - return retval; + init_mqd(mm, mqd, mqd_mem_obj, gart_addr, q); m = get_mqd(*mqd); m->cp_hqd_pq_control |= 1 << CP_HQD_PQ_CONTROL__PRIV_STATE__SHIFT | 1 << CP_HQD_PQ_CONTROL__KMD_QUEUE__SHIFT; - - return retval; } -static int update_mqd_hiq(struct mqd_manager *mm, void *mqd, +static void update_mqd_hiq(struct mqd_manager *mm, void *mqd, struct queue_properties *q) { struct vi_mqd *m; - int retval = __update_mqd(mm, mqd, q, MTYPE_UC, 0); - - if (retval != 0) - return retval; + __update_mqd(mm, mqd, q, MTYPE_UC, 0); m = get_mqd(mqd); m->cp_hqd_vmid = q->vmid; - return retval; } -static int init_mqd_sdma(struct mqd_manager *mm, void **mqd, - struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr, +static void init_mqd_sdma(struct mqd_manager *mm, void **mqd, + struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, struct queue_properties *q) { - int retval; struct vi_sdma_mqd *m; - struct kfd_dev *dev = mm->dev; - - *mqd_mem_obj = allocate_sdma_mqd(dev, q); - if (!*mqd_mem_obj) - return -ENOMEM; - m = (struct vi_sdma_mqd *) (*mqd_mem_obj)->cpu_ptr; + m = (struct vi_sdma_mqd *) mqd_mem_obj->cpu_ptr; memset(m, 0, sizeof(struct vi_sdma_mqd)); *mqd = m; if (gart_addr) - *gart_addr = (*mqd_mem_obj)->gpu_addr; + *gart_addr = mqd_mem_obj->gpu_addr; - retval = mm->update_mqd(mm, m, q); - - return retval; + mm->update_mqd(mm, m, q); } static int load_mqd_sdma(struct mqd_manager *mm, void *mqd, @@ -375,7 +345,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd, mms); } -static int update_mqd_sdma(struct mqd_manager *mm, void *mqd, +static void update_mqd_sdma(struct mqd_manager *mm, void *mqd, struct queue_properties *q) { struct vi_sdma_mqd *m; @@ -400,8 +370,6 @@ static int update_mqd_sdma(struct mqd_manager *mm, void *mqd, m->sdma_queue_id = q->sdma_queue_id; q->is_active = QUEUE_IS_ACTIVE(*q); - - return 0; } /* @@ -458,8 +426,9 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type, switch (type) { case KFD_MQD_TYPE_CP: case KFD_MQD_TYPE_COMPUTE: + mqd->allocate_mqd = allocate_mqd; mqd->init_mqd = init_mqd; - mqd->uninit_mqd = uninit_mqd; + mqd->free_mqd = free_mqd; mqd->load_mqd = load_mqd; mqd->update_mqd = update_mqd; mqd->destroy_mqd = destroy_mqd; @@ -471,8 +440,9 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type, #endif break; case KFD_MQD_TYPE_HIQ: + mqd->allocate_mqd = allocate_hiq_mqd; mqd->init_mqd = init_mqd_hiq; - mqd->uninit_mqd = uninit_mqd_hiq_sdma; + mqd->free_mqd = free_mqd_hiq_sdma; mqd->load_mqd = load_mqd; mqd->update_mqd = update_mqd_hiq; mqd->destroy_mqd = destroy_mqd; @@ -483,8 +453,9 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type, #endif break; case KFD_MQD_TYPE_DIQ: + mqd->allocate_mqd = allocate_hiq_mqd; mqd->init_mqd = init_mqd_hiq; - mqd->uninit_mqd = uninit_mqd; + mqd->free_mqd = free_mqd; mqd->load_mqd = load_mqd; mqd->update_mqd = update_mqd_hiq; mqd->destroy_mqd = destroy_mqd; @@ -495,8 +466,9 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type, #endif break; case KFD_MQD_TYPE_SDMA: + mqd->allocate_mqd = allocate_sdma_mqd; mqd->init_mqd = init_mqd_sdma; - mqd->uninit_mqd = uninit_mqd_hiq_sdma; + mqd->free_mqd = free_mqd_hiq_sdma; mqd->load_mqd = load_mqd_sdma; mqd->update_mqd = update_mqd_sdma; mqd->destroy_mqd = destroy_mqd_sdma; |