diff --git a/drivers/gpu/hsa/radeon/kfd_packet_manager.c b/drivers/gpu/hsa/radeon/kfd_packet_manager.c index 3d2fc165bccc4..9f7b4ff04b680 100644 --- a/drivers/gpu/hsa/radeon/kfd_packet_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_packet_manager.c @@ -85,9 +85,6 @@ static int pm_allocate_runlist_ib(struct packet_manager *pm, unsigned int **rl_b BUG_ON(is_over_subscription == NULL); pm_calc_rlib_size(pm, rl_buffer_size, is_over_subscription); - if (*is_over_subscription && - sched_policy == KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION) - return -EFAULT; retval = radeon_kfd_vidmem_alloc_map(pm->dqm->dev, &pm->ib_buffer_obj, (void **)rl_buffer, rl_gpu_buffer, ALIGN(*rl_buffer_size, PAGE_SIZE)); diff --git a/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c b/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c index c9e0f040b7bc4..70b7cf38e4205 100644 --- a/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c @@ -168,6 +168,15 @@ int pqm_create_queue(struct process_queue_manager *pqm, switch (type) { case KFD_QUEUE_TYPE_COMPUTE: + /* check if there is over subscription */ + if ((sched_policy == KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION) && + ((dev->dqm->processes_count >= VMID_PER_DEVICE) || + (dev->dqm->queue_count >= PIPE_PER_ME_CP_SCHEDULING * QUEUES_PER_PIPE))) { + pr_err("kfd: over-subscription is not allowed in radeon_kfd.sched_policy == 1\n"); + retval = -EPERM; + goto err_create_queue; + } + retval = create_cp_queue(pqm, dev, &q, &q_properties, f, *qid); if (retval != 0) goto err_create_queue;