Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b277247 authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/amdgpu: set f_mapping on exported DMA-bufs



Otherwise we can't correctly CPU map TTM buffers.

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent c5066129
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -169,10 +169,14 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev,
					int flags)
{
	struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
	struct dma_buf *buf;

	if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) ||
	    bo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID)
		return ERR_PTR(-EPERM);

	return drm_gem_prime_export(dev, gobj, flags);
	buf = drm_gem_prime_export(dev, gobj, flags);
	if (!IS_ERR(buf))
		buf->file->f_mapping = dev->anon_inode->i_mapping;
	return buf;
}