diff options
| author | Vinod Koul <[email protected]> | 2021-08-09 10:08:37 +0530 |
|---|---|---|
| committer | Vinod Koul <[email protected]> | 2021-08-09 10:08:37 +0530 |
| commit | 9760383b22edbfa407a1647969c26d62a501631f (patch) | |
| tree | 7bc0a440bec121c0bf3fc1f198fa5646eef751f2 /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |
| parent | 9fce3b3a0ab4cad407a27b5e36603c23f1b5b278 (diff) | |
| parent | 36a21d51725af2ce0700c6ebcb6b9594aac658a6 (diff) | |
Merge tag 'v5.14-rc5' into next
Linux 5.14-rc5
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index d0d9bc445d7b..854fc497844b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -255,6 +255,15 @@ static int amdgpu_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_str 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); } |