summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Kuehling <Felix.Kuehling@amd.com>2017-09-27 00:09:55 -0400
committerOded Gabbay <oded.gabbay@gmail.com>2017-09-27 00:09:55 -0400
commit36c2d7eb5e99a4d765b1ec241823d563c71b1125 (patch)
treefed6137f4537567941d540c61870505acb6506b9
parentbc920fd4f4350a2e3094c165a77798d721f39e7b (diff)
downloadlinux-0-day-36c2d7eb5e99a4d765b1ec241823d563c71b1125.tar.gz
linux-0-day-36c2d7eb5e99a4d765b1ec241823d563c71b1125.tar.xz
drm/amdkfd: Limit queue number per process and device to 127
HWS uses bit 7 in the queue number of the map process packet for an undocumented feature. Therefore the queue number per process and device must be 127 or less. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 88ad178bffb65..5129dc1392195 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -150,6 +150,7 @@ int pqm_create_queue(struct process_queue_manager *pqm,
struct process_queue_node *pqn;
struct kernel_queue *kq;
enum kfd_queue_type type = properties->type;
+ unsigned int max_queues = 127; /* HWS limit */
q = NULL;
kq = NULL;
@@ -166,10 +167,11 @@ int pqm_create_queue(struct process_queue_manager *pqm,
* If we are just about to create DIQ, the is_debug flag is not set yet
* Hence we also check the type as well
*/
- if ((pdd->qpd.is_debug) || (type == KFD_QUEUE_TYPE_DIQ)) {
- if (pdd->qpd.queue_count >= dev->device_info->max_no_of_hqd/2)
- return -ENOSPC;
- }
+ if ((pdd->qpd.is_debug) || (type == KFD_QUEUE_TYPE_DIQ))
+ max_queues = dev->device_info->max_no_of_hqd/2;
+
+ if (pdd->qpd.queue_count >= max_queues)
+ return -ENOSPC;
retval = find_available_queue_slot(pqm, qid);
if (retval != 0)