Merge tag 'drm-misc-fixes-2021-07-22' of git://anongit.freedesktop.org/drm/drm-misc...
authorDave Airlie <airlied@redhat.com>
Fri, 23 Jul 2021 01:16:58 +0000 (11:16 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 23 Jul 2021 01:17:03 +0000 (11:17 +1000)
Short summary of fixes pull:

 * Return -ENOTTY for non-DRM ioctls
 * amdgpu: Fix COW checks
 * nouveau: init BO GME fields
 * panel: Avoid double free
 * ttm: Fix refcounting in ttm_global_init(); NULL checks
 * vc4: Fix interrupt handling

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/YPlbkmH6S4VAHP9j@linux-uq9g.fritz.box
1  2 
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

@@@ -255,6 -255,15 +255,15 @@@ static int amdgpu_gem_object_mmap(struc
        if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
                return -EPERM;
  
+       /* Workaround for Thunk bug creating PROT_NONE,MAP_PRIVATE mappings
+        * for debugger access to invisible VRAM. Should have used MAP_SHARED
+        * instead. Clearing VM_MAYWRITE prevents the mapping from ever
+        * becoming writable and makes is_cow_mapping(vm_flags) false.
+        */
+       if (is_cow_mapping(vma->vm_flags) &&
+           !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)))
+               vma->vm_flags &= ~VM_MAYWRITE;
        return drm_gem_ttm_mmap(obj, vma);
  }
  
@@@ -612,7 -621,7 +621,7 @@@ static void amdgpu_gem_va_update_vm(str
  
        if (operation == AMDGPU_VA_OP_MAP ||
            operation == AMDGPU_VA_OP_REPLACE) {
 -              r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
 +              r = amdgpu_vm_bo_update(adev, bo_va, false);
                if (r)
                        goto error;
        }