]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdgpu: enforce AMDGPU_GEM_CREATE_NO_CPU_ACCESS
authorChristian König <christian.koenig@amd.com>
Wed, 13 May 2015 12:30:53 +0000 (14:30 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 4 Jun 2015 01:03:43 +0000 (21:03 -0400)
Deny user and kernel mapping if we said we never want to do so.

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

index 5fd0bc73b302acda6061a916c7562056c77e0b25..8dd843da799faf0d397683d8c51efc6a4077c1b5 100644 (file)
@@ -316,7 +316,8 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
                return -ENOENT;
        }
        robj = gem_to_amdgpu_bo(gobj);
-       if (amdgpu_ttm_tt_has_userptr(robj->tbo.ttm)) {
+       if (amdgpu_ttm_tt_has_userptr(robj->tbo.ttm) ||
+           (robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) {
                drm_gem_object_unreference_unlocked(gobj);
                return -EPERM;
        }
index 992b7f5843bc7c717f40924e21c66997dec0275e..a721f50445574cb9cc291386eca02e7efe7acc9c 100644 (file)
@@ -263,6 +263,9 @@ int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr)
        bool is_iomem;
        int r;
 
+       if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
+               return -EPERM;
+
        if (bo->kptr) {
                if (ptr) {
                        *ptr = bo->kptr;