drm/amdgpu: gds bo must not be per-vm-bo
authorChunming Zhou <david1.zhou@amd.com>
Wed, 30 May 2018 03:12:08 +0000 (11:12 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 May 2018 17:34:34 +0000 (12:34 -0500)
In per-vm-bo case, there could be no bo list.
But gds bo created from user space  must be passed to bo list.
So adding a check to prevent to creat gds bo as per-vm-bo.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

index 556406a..5fb156a 100644 (file)
@@ -236,6 +236,13 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
        /* create a gem object to contain this object in */
        if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
            AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
+               if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {
+                       /* if gds bo is created from user space, it must be
+                        * passed to bo list
+                        */
+                       DRM_ERROR("GDS bo cannot be per-vm-bo\n");
+                       return -EINVAL;
+               }
                flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
                if (args->in.domains == AMDGPU_GEM_DOMAIN_GDS)
                        size = size << AMDGPU_GDS_SHIFT;