Commit 8d5f3552 authored by Yong Zhao's avatar Yong Zhao Committed by Oded Gabbay

drm/amdkfd: Replace mqd with mqd_mgr as the variable name for mqd_manager

This will make reading code much easier.
Signed-off-by: default avatarYong Zhao <yong.zhao@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent 2b281977
...@@ -348,10 +348,10 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -348,10 +348,10 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm,
struct qcm_process_device *qpd) struct qcm_process_device *qpd)
{ {
int retval; int retval;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
mqd = dqm->ops.get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE); mqd_mgr = dqm->ops.get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE);
if (!mqd) if (!mqd_mgr)
return -ENOMEM; return -ENOMEM;
retval = allocate_hqd(dqm, q); retval = allocate_hqd(dqm, q);
...@@ -362,7 +362,7 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -362,7 +362,7 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm,
if (retval) if (retval)
goto out_deallocate_hqd; goto out_deallocate_hqd;
retval = mqd->init_mqd(mqd, &q->mqd, &q->mqd_mem_obj, retval = mqd_mgr->init_mqd(mqd_mgr, &q->mqd, &q->mqd_mem_obj,
&q->gart_mqd_addr, &q->properties); &q->gart_mqd_addr, &q->properties);
if (retval) if (retval)
goto out_deallocate_doorbell; goto out_deallocate_doorbell;
...@@ -376,15 +376,15 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -376,15 +376,15 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm,
if (!q->properties.is_active) if (!q->properties.is_active)
return 0; return 0;
retval = mqd->load_mqd(mqd, q->mqd, q->pipe, q->queue, &q->properties, retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,
q->process->mm); &q->properties, q->process->mm);
if (retval) if (retval)
goto out_uninit_mqd; goto out_uninit_mqd;
return 0; return 0;
out_uninit_mqd: out_uninit_mqd:
mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); mqd_mgr->uninit_mqd(mqd_mgr, q->mqd, q->mqd_mem_obj);
out_deallocate_doorbell: out_deallocate_doorbell:
deallocate_doorbell(qpd, q); deallocate_doorbell(qpd, q);
out_deallocate_hqd: out_deallocate_hqd:
...@@ -401,11 +401,11 @@ static int destroy_queue_nocpsch_locked(struct device_queue_manager *dqm, ...@@ -401,11 +401,11 @@ static int destroy_queue_nocpsch_locked(struct device_queue_manager *dqm,
struct queue *q) struct queue *q)
{ {
int retval; int retval;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
mqd = dqm->ops.get_mqd_manager(dqm, mqd_mgr = dqm->ops.get_mqd_manager(dqm,
get_mqd_type_from_queue_type(q->properties.type)); get_mqd_type_from_queue_type(q->properties.type));
if (!mqd) if (!mqd_mgr)
return -ENOMEM; return -ENOMEM;
if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) { if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) {
...@@ -422,14 +422,14 @@ static int destroy_queue_nocpsch_locked(struct device_queue_manager *dqm, ...@@ -422,14 +422,14 @@ static int destroy_queue_nocpsch_locked(struct device_queue_manager *dqm,
deallocate_doorbell(qpd, q); deallocate_doorbell(qpd, q);
retval = mqd->destroy_mqd(mqd, q->mqd, retval = mqd_mgr->destroy_mqd(mqd_mgr, q->mqd,
KFD_PREEMPT_TYPE_WAVEFRONT_RESET, KFD_PREEMPT_TYPE_WAVEFRONT_RESET,
KFD_UNMAP_LATENCY_MS, KFD_UNMAP_LATENCY_MS,
q->pipe, q->queue); q->pipe, q->queue);
if (retval == -ETIME) if (retval == -ETIME)
qpd->reset_wavefronts = true; qpd->reset_wavefronts = true;
mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); mqd_mgr->uninit_mqd(mqd_mgr, q->mqd, q->mqd_mem_obj);
list_del(&q->list); list_del(&q->list);
if (list_empty(&qpd->queues_list)) { if (list_empty(&qpd->queues_list)) {
...@@ -469,7 +469,7 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -469,7 +469,7 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm,
static int update_queue(struct device_queue_manager *dqm, struct queue *q) static int update_queue(struct device_queue_manager *dqm, struct queue *q)
{ {
int retval; int retval;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
bool prev_active = false; bool prev_active = false;
...@@ -479,9 +479,9 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) ...@@ -479,9 +479,9 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
retval = -ENODEV; retval = -ENODEV;
goto out_unlock; goto out_unlock;
} }
mqd = dqm->ops.get_mqd_manager(dqm, mqd_mgr = dqm->ops.get_mqd_manager(dqm,
get_mqd_type_from_queue_type(q->properties.type)); get_mqd_type_from_queue_type(q->properties.type));
if (!mqd) { if (!mqd_mgr) {
retval = -ENOMEM; retval = -ENOMEM;
goto out_unlock; goto out_unlock;
} }
...@@ -508,7 +508,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) ...@@ -508,7 +508,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
} else if (prev_active && } else if (prev_active &&
(q->properties.type == KFD_QUEUE_TYPE_COMPUTE || (q->properties.type == KFD_QUEUE_TYPE_COMPUTE ||
q->properties.type == KFD_QUEUE_TYPE_SDMA)) { q->properties.type == KFD_QUEUE_TYPE_SDMA)) {
retval = mqd->destroy_mqd(mqd, q->mqd, retval = mqd_mgr->destroy_mqd(mqd_mgr, q->mqd,
KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN, KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN,
KFD_UNMAP_LATENCY_MS, q->pipe, q->queue); KFD_UNMAP_LATENCY_MS, q->pipe, q->queue);
if (retval) { if (retval) {
...@@ -517,7 +517,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) ...@@ -517,7 +517,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
} }
} }
retval = mqd->update_mqd(mqd, q->mqd, &q->properties); retval = mqd_mgr->update_mqd(mqd_mgr, q->mqd, &q->properties);
/* /*
* check active state vs. the previous state and modify * check active state vs. the previous state and modify
...@@ -535,7 +535,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) ...@@ -535,7 +535,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
else if (q->properties.is_active && else if (q->properties.is_active &&
(q->properties.type == KFD_QUEUE_TYPE_COMPUTE || (q->properties.type == KFD_QUEUE_TYPE_COMPUTE ||
q->properties.type == KFD_QUEUE_TYPE_SDMA)) q->properties.type == KFD_QUEUE_TYPE_SDMA))
retval = mqd->load_mqd(mqd, q->mqd, q->pipe, q->queue, retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,
&q->properties, q->process->mm); &q->properties, q->process->mm);
out_unlock: out_unlock:
...@@ -546,29 +546,29 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) ...@@ -546,29 +546,29 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
static struct mqd_manager *get_mqd_manager( static struct mqd_manager *get_mqd_manager(
struct device_queue_manager *dqm, enum KFD_MQD_TYPE type) struct device_queue_manager *dqm, enum KFD_MQD_TYPE type)
{ {
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
if (WARN_ON(type >= KFD_MQD_TYPE_MAX)) if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL; return NULL;
pr_debug("mqd type %d\n", type); pr_debug("mqd type %d\n", type);
mqd = dqm->mqds[type]; mqd_mgr = dqm->mqd_mgrs[type];
if (!mqd) { if (!mqd_mgr) {
mqd = mqd_manager_init(type, dqm->dev); mqd_mgr = mqd_manager_init(type, dqm->dev);
if (!mqd) if (!mqd_mgr)
pr_err("mqd manager is NULL"); pr_err("mqd manager is NULL");
dqm->mqds[type] = mqd; dqm->mqd_mgrs[type] = mqd_mgr;
} }
return mqd; return mqd_mgr;
} }
static int evict_process_queues_nocpsch(struct device_queue_manager *dqm, static int evict_process_queues_nocpsch(struct device_queue_manager *dqm,
struct qcm_process_device *qpd) struct qcm_process_device *qpd)
{ {
struct queue *q; struct queue *q;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
int retval = 0; int retval = 0;
...@@ -584,16 +584,16 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm, ...@@ -584,16 +584,16 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm,
list_for_each_entry(q, &qpd->queues_list, list) { list_for_each_entry(q, &qpd->queues_list, list) {
if (!q->properties.is_active) if (!q->properties.is_active)
continue; continue;
mqd = dqm->ops.get_mqd_manager(dqm, mqd_mgr = dqm->ops.get_mqd_manager(dqm,
get_mqd_type_from_queue_type(q->properties.type)); get_mqd_type_from_queue_type(q->properties.type));
if (!mqd) { /* should not be here */ if (!mqd_mgr) { /* should not be here */
pr_err("Cannot evict queue, mqd mgr is NULL\n"); pr_err("Cannot evict queue, mqd mgr is NULL\n");
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
q->properties.is_evicted = true; q->properties.is_evicted = true;
q->properties.is_active = false; q->properties.is_active = false;
retval = mqd->destroy_mqd(mqd, q->mqd, retval = mqd_mgr->destroy_mqd(mqd_mgr, q->mqd,
KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN, KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN,
KFD_UNMAP_LATENCY_MS, q->pipe, q->queue); KFD_UNMAP_LATENCY_MS, q->pipe, q->queue);
if (retval) if (retval)
...@@ -643,7 +643,7 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm, ...@@ -643,7 +643,7 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,
struct qcm_process_device *qpd) struct qcm_process_device *qpd)
{ {
struct queue *q; struct queue *q;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
uint32_t pd_base; uint32_t pd_base;
int retval = 0; int retval = 0;
...@@ -679,16 +679,16 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm, ...@@ -679,16 +679,16 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,
list_for_each_entry(q, &qpd->queues_list, list) { list_for_each_entry(q, &qpd->queues_list, list) {
if (!q->properties.is_evicted) if (!q->properties.is_evicted)
continue; continue;
mqd = dqm->ops.get_mqd_manager(dqm, mqd_mgr = dqm->ops.get_mqd_manager(dqm,
get_mqd_type_from_queue_type(q->properties.type)); get_mqd_type_from_queue_type(q->properties.type));
if (!mqd) { /* should not be here */ if (!mqd_mgr) { /* should not be here */
pr_err("Cannot restore queue, mqd mgr is NULL\n"); pr_err("Cannot restore queue, mqd mgr is NULL\n");
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
q->properties.is_evicted = false; q->properties.is_evicted = false;
q->properties.is_active = true; q->properties.is_active = true;
retval = mqd->load_mqd(mqd, q->mqd, q->pipe, retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe,
q->queue, &q->properties, q->queue, &q->properties,
q->process->mm); q->process->mm);
if (retval) if (retval)
...@@ -868,7 +868,7 @@ static void uninitialize(struct device_queue_manager *dqm) ...@@ -868,7 +868,7 @@ static void uninitialize(struct device_queue_manager *dqm)
kfree(dqm->allocated_queues); kfree(dqm->allocated_queues);
for (i = 0 ; i < KFD_MQD_TYPE_MAX ; i++) for (i = 0 ; i < KFD_MQD_TYPE_MAX ; i++)
kfree(dqm->mqds[i]); kfree(dqm->mqd_mgrs[i]);
mutex_destroy(&dqm->lock_hidden); mutex_destroy(&dqm->lock_hidden);
kfd_gtt_sa_free(dqm->dev, dqm->pipeline_mem); kfd_gtt_sa_free(dqm->dev, dqm->pipeline_mem);
} }
...@@ -912,11 +912,11 @@ static int create_sdma_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -912,11 +912,11 @@ static int create_sdma_queue_nocpsch(struct device_queue_manager *dqm,
struct queue *q, struct queue *q,
struct qcm_process_device *qpd) struct qcm_process_device *qpd)
{ {
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
int retval; int retval;
mqd = dqm->ops.get_mqd_manager(dqm, KFD_MQD_TYPE_SDMA); mqd_mgr = dqm->ops.get_mqd_manager(dqm, KFD_MQD_TYPE_SDMA);
if (!mqd) if (!mqd_mgr)
return -ENOMEM; return -ENOMEM;
retval = allocate_sdma_queue(dqm, &q->sdma_id); retval = allocate_sdma_queue(dqm, &q->sdma_id);
...@@ -935,19 +935,20 @@ static int create_sdma_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -935,19 +935,20 @@ static int create_sdma_queue_nocpsch(struct device_queue_manager *dqm,
pr_debug("SDMA engine id: %d\n", q->properties.sdma_engine_id); pr_debug("SDMA engine id: %d\n", q->properties.sdma_engine_id);
dqm->asic_ops.init_sdma_vm(dqm, q, qpd); dqm->asic_ops.init_sdma_vm(dqm, q, qpd);
retval = mqd->init_mqd(mqd, &q->mqd, &q->mqd_mem_obj, retval = mqd_mgr->init_mqd(mqd_mgr, &q->mqd, &q->mqd_mem_obj,
&q->gart_mqd_addr, &q->properties); &q->gart_mqd_addr, &q->properties);
if (retval) if (retval)
goto out_deallocate_doorbell; goto out_deallocate_doorbell;
retval = mqd->load_mqd(mqd, q->mqd, 0, 0, &q->properties, NULL); retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, 0, 0, &q->properties,
NULL);
if (retval) if (retval)
goto out_uninit_mqd; goto out_uninit_mqd;
return 0; return 0;
out_uninit_mqd: out_uninit_mqd:
mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); mqd_mgr->uninit_mqd(mqd_mgr, q->mqd, q->mqd_mem_obj);
out_deallocate_doorbell: out_deallocate_doorbell:
deallocate_doorbell(qpd, q); deallocate_doorbell(qpd, q);
out_deallocate_sdma_queue: out_deallocate_sdma_queue:
...@@ -1123,7 +1124,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, ...@@ -1123,7 +1124,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
struct qcm_process_device *qpd) struct qcm_process_device *qpd)
{ {
int retval; int retval;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
retval = 0; retval = 0;
...@@ -1150,10 +1151,10 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, ...@@ -1150,10 +1151,10 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
if (retval) if (retval)
goto out_deallocate_sdma_queue; goto out_deallocate_sdma_queue;
mqd = dqm->ops.get_mqd_manager(dqm, mqd_mgr = dqm->ops.get_mqd_manager(dqm,
get_mqd_type_from_queue_type(q->properties.type)); get_mqd_type_from_queue_type(q->properties.type));
if (!mqd) { if (!mqd_mgr) {
retval = -ENOMEM; retval = -ENOMEM;
goto out_deallocate_doorbell; goto out_deallocate_doorbell;
} }
...@@ -1170,7 +1171,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, ...@@ -1170,7 +1171,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
q->properties.tba_addr = qpd->tba_addr; q->properties.tba_addr = qpd->tba_addr;
q->properties.tma_addr = qpd->tma_addr; q->properties.tma_addr = qpd->tma_addr;
retval = mqd->init_mqd(mqd, &q->mqd, &q->mqd_mem_obj, retval = mqd_mgr->init_mqd(mqd_mgr, &q->mqd, &q->mqd_mem_obj,
&q->gart_mqd_addr, &q->properties); &q->gart_mqd_addr, &q->properties);
if (retval) if (retval)
goto out_deallocate_doorbell; goto out_deallocate_doorbell;
...@@ -1326,7 +1327,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm, ...@@ -1326,7 +1327,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,
struct queue *q) struct queue *q)
{ {
int retval; int retval;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
bool preempt_all_queues; bool preempt_all_queues;
preempt_all_queues = false; preempt_all_queues = false;
...@@ -1346,9 +1347,9 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm, ...@@ -1346,9 +1347,9 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,
} }
mqd = dqm->ops.get_mqd_manager(dqm, mqd_mgr = dqm->ops.get_mqd_manager(dqm,
get_mqd_type_from_queue_type(q->properties.type)); get_mqd_type_from_queue_type(q->properties.type));
if (!mqd) { if (!mqd_mgr) {
retval = -ENOMEM; retval = -ENOMEM;
goto failed; goto failed;
} }
...@@ -1370,7 +1371,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm, ...@@ -1370,7 +1371,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,
qpd->reset_wavefronts = true; qpd->reset_wavefronts = true;
} }
mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); mqd_mgr->uninit_mqd(mqd_mgr, q->mqd, q->mqd_mem_obj);
/* /*
* Unconditionally decrement this counter, regardless of the queue's * Unconditionally decrement this counter, regardless of the queue's
...@@ -1520,7 +1521,7 @@ static int process_termination_cpsch(struct device_queue_manager *dqm, ...@@ -1520,7 +1521,7 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,
int retval; int retval;
struct queue *q, *next; struct queue *q, *next;
struct kernel_queue *kq, *kq_next; struct kernel_queue *kq, *kq_next;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
struct device_process_node *cur, *next_dpn; struct device_process_node *cur, *next_dpn;
enum kfd_unmap_queues_filter filter = enum kfd_unmap_queues_filter filter =
KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES; KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES;
...@@ -1570,15 +1571,15 @@ static int process_termination_cpsch(struct device_queue_manager *dqm, ...@@ -1570,15 +1571,15 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,
/* lastly, free mqd resources */ /* lastly, free mqd resources */
list_for_each_entry_safe(q, next, &qpd->queues_list, list) { list_for_each_entry_safe(q, next, &qpd->queues_list, list) {
mqd = dqm->ops.get_mqd_manager(dqm, mqd_mgr = dqm->ops.get_mqd_manager(dqm,
get_mqd_type_from_queue_type(q->properties.type)); get_mqd_type_from_queue_type(q->properties.type));
if (!mqd) { if (!mqd_mgr) {
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
list_del(&q->list); list_del(&q->list);
qpd->queue_count--; qpd->queue_count--;
mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); mqd_mgr->uninit_mqd(mqd_mgr, q->mqd, q->mqd_mem_obj);
} }
out: out:
......
...@@ -172,7 +172,7 @@ struct device_queue_manager { ...@@ -172,7 +172,7 @@ struct device_queue_manager {
struct device_queue_manager_ops ops; struct device_queue_manager_ops ops;
struct device_queue_manager_asic_ops asic_ops; struct device_queue_manager_asic_ops asic_ops;
struct mqd_manager *mqds[KFD_MQD_TYPE_MAX]; struct mqd_manager *mqd_mgrs[KFD_MQD_TYPE_MAX];
struct packet_manager packets; struct packet_manager packets;
struct kfd_dev *dev; struct kfd_dev *dev;
struct mutex lock_hidden; /* use dqm_lock/unlock(dqm) */ struct mutex lock_hidden; /* use dqm_lock/unlock(dqm) */
......
...@@ -59,7 +59,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, ...@@ -59,7 +59,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev,
switch (type) { switch (type) {
case KFD_QUEUE_TYPE_DIQ: case KFD_QUEUE_TYPE_DIQ:
case KFD_QUEUE_TYPE_HIQ: case KFD_QUEUE_TYPE_HIQ:
kq->mqd = dev->dqm->ops.get_mqd_manager(dev->dqm, kq->mqd_mgr = dev->dqm->ops.get_mqd_manager(dev->dqm,
KFD_MQD_TYPE_HIQ); KFD_MQD_TYPE_HIQ);
break; break;
default: default:
...@@ -67,7 +67,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, ...@@ -67,7 +67,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev,
return false; return false;
} }
if (!kq->mqd) if (!kq->mqd_mgr)
return false; return false;
prop.doorbell_ptr = kfd_get_kernel_doorbell(dev, &prop.doorbell_off); prop.doorbell_ptr = kfd_get_kernel_doorbell(dev, &prop.doorbell_off);
...@@ -130,7 +130,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, ...@@ -130,7 +130,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev,
kq->queue->device = dev; kq->queue->device = dev;
kq->queue->process = kfd_get_process(current); kq->queue->process = kfd_get_process(current);
retval = kq->mqd->init_mqd(kq->mqd, &kq->queue->mqd, retval = kq->mqd_mgr->init_mqd(kq->mqd_mgr, &kq->queue->mqd,
&kq->queue->mqd_mem_obj, &kq->queue->mqd_mem_obj,
&kq->queue->gart_mqd_addr, &kq->queue->gart_mqd_addr,
&kq->queue->properties); &kq->queue->properties);
...@@ -142,9 +142,9 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, ...@@ -142,9 +142,9 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev,
pr_debug("Assigning hiq to hqd\n"); pr_debug("Assigning hiq to hqd\n");
kq->queue->pipe = KFD_CIK_HIQ_PIPE; kq->queue->pipe = KFD_CIK_HIQ_PIPE;
kq->queue->queue = KFD_CIK_HIQ_QUEUE; kq->queue->queue = KFD_CIK_HIQ_QUEUE;
kq->mqd->load_mqd(kq->mqd, kq->queue->mqd, kq->queue->pipe, kq->mqd_mgr->load_mqd(kq->mqd_mgr, kq->queue->mqd,
kq->queue->queue, &kq->queue->properties, kq->queue->pipe, kq->queue->queue,
NULL); &kq->queue->properties, NULL);
} else { } else {
/* allocate fence for DIQ */ /* allocate fence for DIQ */
...@@ -182,7 +182,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev, ...@@ -182,7 +182,7 @@ static bool initialize(struct kernel_queue *kq, struct kfd_dev *dev,
static void uninitialize(struct kernel_queue *kq) static void uninitialize(struct kernel_queue *kq)
{ {
if (kq->queue->properties.type == KFD_QUEUE_TYPE_HIQ) if (kq->queue->properties.type == KFD_QUEUE_TYPE_HIQ)
kq->mqd->destroy_mqd(kq->mqd, kq->mqd_mgr->destroy_mqd(kq->mqd_mgr,
kq->queue->mqd, kq->queue->mqd,
KFD_PREEMPT_TYPE_WAVEFRONT_RESET, KFD_PREEMPT_TYPE_WAVEFRONT_RESET,
KFD_UNMAP_LATENCY_MS, KFD_UNMAP_LATENCY_MS,
...@@ -191,7 +191,8 @@ static void uninitialize(struct kernel_queue *kq) ...@@ -191,7 +191,8 @@ static void uninitialize(struct kernel_queue *kq)
else if (kq->queue->properties.type == KFD_QUEUE_TYPE_DIQ) else if (kq->queue->properties.type == KFD_QUEUE_TYPE_DIQ)
kfd_gtt_sa_free(kq->dev, kq->fence_mem_obj); kfd_gtt_sa_free(kq->dev, kq->fence_mem_obj);
kq->mqd->uninit_mqd(kq->mqd, kq->queue->mqd, kq->queue->mqd_mem_obj); kq->mqd_mgr->uninit_mqd(kq->mqd_mgr, kq->queue->mqd,
kq->queue->mqd_mem_obj);
kfd_gtt_sa_free(kq->dev, kq->rptr_mem); kfd_gtt_sa_free(kq->dev, kq->rptr_mem);
kfd_gtt_sa_free(kq->dev, kq->wptr_mem); kfd_gtt_sa_free(kq->dev, kq->wptr_mem);
......
...@@ -70,7 +70,7 @@ struct kernel_queue { ...@@ -70,7 +70,7 @@ struct kernel_queue {
/* data */ /* data */
struct kfd_dev *dev; struct kfd_dev *dev;
struct mqd_manager *mqd; struct mqd_manager *mqd_mgr;
struct queue *queue; struct queue *queue;
uint64_t pending_wptr64; uint64_t pending_wptr64;
uint32_t pending_wptr; uint32_t pending_wptr;
......
...@@ -387,7 +387,7 @@ int pqm_debugfs_mqds(struct seq_file *m, void *data) ...@@ -387,7 +387,7 @@ int pqm_debugfs_mqds(struct seq_file *m, void *data)
struct process_queue_node *pqn; struct process_queue_node *pqn;
struct queue *q; struct queue *q;
enum KFD_MQD_TYPE mqd_type; enum KFD_MQD_TYPE mqd_type;
struct mqd_manager *mqd_manager; struct mqd_manager *mqd_mgr;
int r = 0; int r = 0;
list_for_each_entry(pqn, &pqm->queues, process_queue_list) { list_for_each_entry(pqn, &pqm->queues, process_queue_list) {
...@@ -410,11 +410,11 @@ int pqm_debugfs_mqds(struct seq_file *m, void *data) ...@@ -410,11 +410,11 @@ int pqm_debugfs_mqds(struct seq_file *m, void *data)
q->properties.type, q->device->id); q->properties.type, q->device->id);
continue; continue;
} }
mqd_manager = q->device->dqm->ops.get_mqd_manager( mqd_mgr = q->device->dqm->ops.get_mqd_manager(
q->device->dqm, mqd_type); q->device->dqm, mqd_type);
} else if (pqn->kq) { } else if (pqn->kq) {
q = pqn->kq->queue; q = pqn->kq->queue;
mqd_manager = pqn->kq->mqd; mqd_mgr = pqn->kq->mqd_mgr;
switch (q->properties.type) { switch (q->properties.type) {
case KFD_QUEUE_TYPE_DIQ: case KFD_QUEUE_TYPE_DIQ:
seq_printf(m, " DIQ on device %x\n", seq_printf(m, " DIQ on device %x\n",
...@@ -434,7 +434,7 @@ int pqm_debugfs_mqds(struct seq_file *m, void *data) ...@@ -434,7 +434,7 @@ int pqm_debugfs_mqds(struct seq_file *m, void *data)
continue; continue;
} }
r = mqd_manager->debugfs_show_mqd(m, q->mqd); r = mqd_mgr->debugfs_show_mqd(m, q->mqd);
if (r != 0) if (r != 0)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment