aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-10-16 04:32:04 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-10-19 15:27:21 -0400
commit4b6b691ee38abae8842aed61d442dfb315c45789 (patch)
tree3e2bd4e827f45c68c749e981f4d952615f3c50a3 /drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
parent658b93913e7a8a8d418b6d1208e88ddacc4d245d (diff)
drm/amdgpu: linear validate first then bind to GART
For VM emulation for old UVD/VCE we need to validate the BO with linear VRAM flag set first and then eventually bind it to GART. Validating with linear VRAM flag set can move the BO to GART making UVD/VCE read/write from an unbound GART BO. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> CC: stable@vger.kernel.org Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 32cf83e2f2d9..f7fceb63413c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1582,14 +1582,14 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
1582 if (READ_ONCE((*bo)->tbo.resv->lock.ctx) != &parser->ticket) 1582 if (READ_ONCE((*bo)->tbo.resv->lock.ctx) != &parser->ticket)
1583 return -EINVAL; 1583 return -EINVAL;
1584 1584
1585 r = amdgpu_ttm_bind(&(*bo)->tbo, &(*bo)->tbo.mem); 1585 if (!((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) {
1586 if (unlikely(r)) 1586 (*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
1587 return r; 1587 amdgpu_ttm_placement_from_domain(*bo, (*bo)->allowed_domains);
1588 1588 r = ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, false,
1589 if ((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) 1589 false);
1590 return 0; 1590 if (r)
1591 return r;
1592 }
1591 1593
1592 (*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS; 1594 return amdgpu_ttm_bind(&(*bo)->tbo, &(*bo)->tbo.mem);
1593 amdgpu_ttm_placement_from_domain(*bo, (*bo)->allowed_domains);
1594 return ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, false, false);
1595} 1595}