]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdkfd: Return proper error code for gws alloc API
authorOak Zeng <Oak.Zeng@amd.com>
Tue, 28 May 2019 19:51:49 +0000 (14:51 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 31 May 2019 15:39:33 +0000 (10:39 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

index 87177ed37dd2ed592b164d9e6e54a39a771609f3..e304271612958a6cc872e6710c93a3363b779b0d 100644 (file)
@@ -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);
        if (!*mem)
-               return -EINVAL;
+               return -ENOMEM;
 
        mutex_init(&(*mem)->lock);
        (*mem)->bo = amdgpu_bo_ref(gws_bo);
index ea82828fdc76f438c813611aaebf059f9e5e1e9b..f91126f5f1be50b6096050cebd4ab6745cca81dc 100644 (file)
@@ -1575,15 +1575,15 @@ static int kfd_ioctl_alloc_queue_gws(struct file *filep,
        struct kfd_dev *dev;
 
        if (!hws_gws_support)
-               return -EINVAL;
+               return -ENODEV;
 
        dev = kfd_device_by_id(args->gpu_id);
        if (!dev) {
                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)
-               return -EINVAL;
+               return -ENODEV;
 
        mutex_lock(&p->mutex);
        retval = pqm_set_gws(&p->pqm, args->queue_id, args->num_gws ? dev->gws : NULL);
index c2c570e6e54f8245ffb7db3760541a174bdeacef..da09586258617914a7fc8a7683feb57651d9f98f 100644 (file)
@@ -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 */
        if (gws && pdd->qpd.num_gws)
-               return -EINVAL;
+               return -EBUSY;
 
        if (!gws && pdd->qpd.num_gws == 0)
                return -EINVAL;