mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
drm/amdgpu: set f_mapping on exported DMA-bufs
Otherwise we can't correctly CPU map TTM buffers. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
This commit is contained in:
parent
c5066129af
commit
4b277247b1
@ -169,10 +169,14 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev,
|
|||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
|
struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
|
||||||
|
struct dma_buf *buf;
|
||||||
|
|
||||||
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) ||
|
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) ||
|
||||||
bo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID)
|
bo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID)
|
||||||
return ERR_PTR(-EPERM);
|
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user