drm/amdgpu: workaround failed COW checks for Thunk VMAs
authorFelix Kuehling <Felix.Kuehling@amd.com>
Thu, 15 Jul 2021 19:05:37 +0000 (15:05 -0400)
committerChristian König <christian.koenig@amd.com>
Fri, 16 Jul 2021 07:22:57 +0000 (09:22 +0200)
commitfa5239f2af983ffdf08395a542a7d6356b6222c5
tree0f8338f92a816824522f6468a60217667a6a996d
parent32a19de21ae40f0601f48575b610dde4f518ccc6
drm/amdgpu: workaround failed COW checks for Thunk VMAs

KFD Thunk maps invisible VRAM BOs with PROT_NONE, MAP_PRIVATE.
is_cow_mapping returns true for these mappings, which causes mmap to fail
in ttm_bo_mmap_obj.

As a workaround, clear VM_MAYWRITE for PROT_NONE-COW mappings. This
should prevent the mapping from ever becoming writable and makes
is_cow_mapping(vm_flags) false.

Fixes: f91142c62161 ("drm/ttm: nuke VM_MIXEDMAP on BO mappings v3")
Suggested-by: Daniel Vetter <daniel.vetter@intel.com>
Tested-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210715190537.585456-1-Felix.Kuehling@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c