linux-next: manual merge of the drm tree with Linus' tree

Stephen Rothwell
2015-01-29T02:17:27Z

[-- Attachment #1: Type: text/plain, Size: 3704 bytes --]

Hi Dave,

Today's linux-next merge of the drm tree got conflicts in
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c and
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h between commits
b8cbab042cd6 ("drm/amdkfd: Allow user to limit only queues per device")
and 9fa843e76d90 ("drm/amdkfd: Fix bug in call to init_pipelines()")
from Linus' tree and commits bcea30817574 ("drm/amdkfd: Add SDMA
user-mode queues support to QCM") and fe502804205e ("drm/amdkfd: Remove
call to deprecated init_memory interface") from the drm tree.

I fixed it up (hopefully - see below) and can carry the fix as
necessary (no action is required).

--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au

diff --cc drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 0d8694f015c1,b189f9791c90..000000000000
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@@ -213,15 -161,8 +168,18 @@@ static int create_queue_nocpsch(struct

list_add(&q->list, &qpd->queues_list);
dqm->queue_count++;
+
+ /*
+ * Unconditionally increment this counter, regardless of the queue's
+ * type or whether the queue is active.
+ */
+ dqm->total_queue_count++;
+ pr_debug("Total of %d queues are accountable so far\n",
+ dqm->total_queue_count);
+
++
+ if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
+ dqm->sdma_queue_count++;
mutex_unlock(&dqm->lock);
return 0;
}
@@@ -588,11 -488,7 +518,7 @@@ static int init_scheduler(struct device

pr_debug("kfd: In %s\n", __func__);

- retval = init_pipelines(dqm, get_pipes_num(dqm), KFD_DQM_FIRST_PIPE);
+ retval = init_pipelines(dqm, get_pipes_num(dqm), get_first_pipe(dqm));
- if (retval != 0)
- return retval;
-
- retval = init_memory(dqm);

return retval;
}
@@@ -843,14 -793,12 +845,19 @@@ static int create_queue_cpsch(struct de

mutex_lock(&dqm->lock);

+ if (dqm->total_queue_count >= max_num_of_queues_per_device) {
+ pr_warn("amdkfd: Can't create new usermode queue because %d queues were already created\n",
+ dqm->total_queue_count);
+ retval = -EPERM;
+ goto out;
+ }
+
- mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_CIK_CP);
+ if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
+ select_sdma_engine_id(q);
+
+ mqd = dqm->ops.get_mqd_manager(dqm,
+ get_mqd_type_from_queue_type(q->properties.type));
+
if (mqd == NULL) {
mutex_unlock(&dqm->lock);
return -ENOMEM;
@@@ -867,15 -815,9 +874,18 @@@
retval = execute_queues_cpsch(dqm, false);
}

+ /*
+ * Unconditionally increment this counter, regardless of the queue's
+ * type or whether the queue is active.
+ */
+ dqm->total_queue_count++;
+
+ pr_debug("Total of %d queues are accountable so far\n",
+ dqm->total_queue_count);
+
+ if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
+ dqm->sdma_queue_count++;
+
out:
mutex_unlock(&dqm->lock);
return retval;
diff --cc drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
index 52035bf0c1cb,e7b17b28330e..000000000000
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
@@@ -130,9 -143,10 +143,11 @@@ struct device_queue_manager
struct list_head queues;
unsigned int processes_count;
unsigned int queue_count;
+ unsigned int total_queue_count;
+ unsigned int sdma_queue_count;
unsigned int next_pipe_to_allocate;
unsigned int *allocated_queues;
+ unsigned int sdma_bitmap;
unsigned int vmid_bitmap;
uint64_t pipelines_addr;
struct kfd_mem_obj *pipeline_mem;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]