drm/amdkfd: Return proper error code for gws alloc API
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -2124,7 +2124,7 @@ int amdgpu_amdkfd_add_gws_to_process(void *info, void *gws, struct kgd_mem **mem
|
|||||||
|
|
||||||
*mem = kzalloc(sizeof(struct kgd_mem), GFP_KERNEL);
|
*mem = kzalloc(sizeof(struct kgd_mem), GFP_KERNEL);
|
||||||
if (!*mem)
|
if (!*mem)
|
||||||
return -EINVAL;
|
return -ENOMEM;
|
||||||
|
|
||||||
mutex_init(&(*mem)->lock);
|
mutex_init(&(*mem)->lock);
|
||||||
(*mem)->bo = amdgpu_bo_ref(gws_bo);
|
(*mem)->bo = amdgpu_bo_ref(gws_bo);
|
||||||
|
|||||||
@@ -1575,15 +1575,15 @@ static int kfd_ioctl_alloc_queue_gws(struct file *filep,
|
|||||||
struct kfd_dev *dev;
|
struct kfd_dev *dev;
|
||||||
|
|
||||||
if (!hws_gws_support)
|
if (!hws_gws_support)
|
||||||
return -EINVAL;
|
return -ENODEV;
|
||||||
|
|
||||||
dev = kfd_device_by_id(args->gpu_id);
|
dev = kfd_device_by_id(args->gpu_id);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
pr_debug("Could not find gpu id 0x%x\n", args->gpu_id);
|
pr_debug("Could not find gpu id 0x%x\n", args->gpu_id);
|
||||||
return -EINVAL;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS)
|
if (dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS)
|
||||||
return -EINVAL;
|
return -ENODEV;
|
||||||
|
|
||||||
mutex_lock(&p->mutex);
|
mutex_lock(&p->mutex);
|
||||||
retval = pqm_set_gws(&p->pqm, args->queue_id, args->num_gws ? dev->gws : NULL);
|
retval = pqm_set_gws(&p->pqm, args->queue_id, args->num_gws ? dev->gws : NULL);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ int pqm_set_gws(struct process_queue_manager *pqm, unsigned int qid,
|
|||||||
|
|
||||||
/* Only allow one queue per process can have GWS assigned */
|
/* Only allow one queue per process can have GWS assigned */
|
||||||
if (gws && pdd->qpd.num_gws)
|
if (gws && pdd->qpd.num_gws)
|
||||||
return -EINVAL;
|
return -EBUSY;
|
||||||
|
|
||||||
if (!gws && pdd->qpd.num_gws == 0)
|
if (!gws && pdd->qpd.num_gws == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user