Skip to content

Commit

Permalink
Merge tag 'drm-amdkfd-fixes-2018-03-25' of git://people.freedesktop.o…
Browse files Browse the repository at this point in the history
…rg/~gabbayo/linux into drm-fixes

- Programming VMID correctly for scratch memory with HWS
- deallocating SDMA queues correctly in various situations

* tag 'drm-amdkfd-fixes-2018-03-25' of git://people.freedesktop.org/~gabbayo/linux:
  drm/amdkfd: Deallocate SDMA queues correctly
  drm/amdkfd: Fix scratch memory with HWS enabled
  • Loading branch information
Dave Airlie committed Mar 27, 2018
2 parents 3eb2ce8 + 72a01d2 commit 9713096
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 14 additions & 6 deletions drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,13 +821,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
pr_warn("Can't create new usermode queue because %d queues were already created\n",
dqm->total_queue_count);
retval = -EPERM;
goto out;
goto out_unlock;
}

if (q->properties.type == KFD_QUEUE_TYPE_SDMA) {
retval = allocate_sdma_queue(dqm, &q->sdma_id);
if (retval)
goto out;
goto out_unlock;
q->properties.sdma_queue_id =
q->sdma_id / CIK_SDMA_QUEUES_PER_ENGINE;
q->properties.sdma_engine_id =
Expand All @@ -838,7 +838,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,

if (!mqd) {
retval = -ENOMEM;
goto out;
goto out_deallocate_sdma_queue;
}

dqm->asic_ops.init_sdma_vm(dqm, q, qpd);
Expand All @@ -848,7 +848,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
retval = mqd->init_mqd(mqd, &q->mqd, &q->mqd_mem_obj,
&q->gart_mqd_addr, &q->properties);
if (retval)
goto out;
goto out_deallocate_sdma_queue;

list_add(&q->list, &qpd->queues_list);
qpd->queue_count++;
Expand All @@ -869,7 +869,13 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
pr_debug("Total of %d queues are accountable so far\n",
dqm->total_queue_count);

out:
mutex_unlock(&dqm->lock);
return retval;

out_deallocate_sdma_queue:
if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
deallocate_sdma_queue(dqm, q->sdma_id);
out_unlock:
mutex_unlock(&dqm->lock);
return retval;
}
Expand Down Expand Up @@ -1188,8 +1194,10 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,

/* Clear all user mode queues */
list_for_each_entry(q, &qpd->queues_list, list) {
if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
if (q->properties.type == KFD_QUEUE_TYPE_SDMA) {
dqm->sdma_queue_count--;
deallocate_sdma_queue(dqm, q->sdma_id);
}

if (q->properties.is_active)
dqm->queue_count--;
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ static int pm_create_map_process(struct packet_manager *pm, uint32_t *buffer,
packet->sh_mem_ape1_base = qpd->sh_mem_ape1_base;
packet->sh_mem_ape1_limit = qpd->sh_mem_ape1_limit;

/* TODO: scratch support */
packet->sh_hidden_private_base_vmid = 0;
packet->sh_hidden_private_base_vmid = qpd->sh_hidden_private_base;

packet->gds_addr_lo = lower_32_bits(qpd->gds_context_area);
packet->gds_addr_hi = upper_32_bits(qpd->gds_context_area);
Expand Down

0 comments on commit 9713096

Please sign in to comment.