drm/amdgpu: cleanup GWS, GDS and OA allocation
authorChristian König <christian.koenig@amd.com>
Wed, 23 Aug 2017 18:11:25 +0000 (20:11 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 29 Aug 2017 19:27:57 +0000 (15:27 -0400)
Those are certainly not kernel allocations, instead set the NO_CPU_ACCESS flag.

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

index 9b1b6bdd48410bbfab9fa0dc8fc66a25c68d3559..ba012933e6aaa3f595fc3319ad0701cdc079e358 100644 (file)
@@ -186,17 +186,17 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 {
        struct amdgpu_device *adev = dev->dev_private;
        union drm_amdgpu_gem_create *args = data;
+       uint64_t flags = args->in.domain_flags;
        uint64_t size = args->in.bo_size;
        struct drm_gem_object *gobj;
        uint32_t handle;
-       bool kernel = false;
        int r;
 
        /* reject invalid gem flags */
-       if (args->in.domain_flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
-                                     AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
-                                     AMDGPU_GEM_CREATE_CPU_GTT_USWC |
-                                     AMDGPU_GEM_CREATE_VRAM_CLEARED))
+       if (flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
+                     AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
+                     AMDGPU_GEM_CREATE_CPU_GTT_USWC |
+                     AMDGPU_GEM_CREATE_VRAM_CLEARED))
                return -EINVAL;
 
        /* reject invalid gem domains */
@@ -211,7 +211,7 @@ 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)) {
-               kernel = true;
+               flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
                if (args->in.domains == AMDGPU_GEM_DOMAIN_GDS)
                        size = size << AMDGPU_GDS_SHIFT;
                else if (args->in.domains == AMDGPU_GEM_DOMAIN_GWS)
@@ -225,8 +225,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 
        r = amdgpu_gem_object_create(adev, size, args->in.alignment,
                                     (u32)(0xffffffff & args->in.domains),
-                                    args->in.domain_flags,
-                                    kernel, &gobj);
+                                    flags, false, &gobj);
        if (r)
                return r;