AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: linear validate first then bind to GART
@ 2017-10-16  9:26 Christian König
       [not found] ` <20171016092646.1625-1-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Christian König @ 2017-10-16  9:26 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Christian König <christian.koenig@amd.com>

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>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 18 +++++++++---------
 1 file 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 52dd78ee8fd0..0c52295e74d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1583,14 +1583,14 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
 	if (READ_ONCE((*bo)->tbo.resv->lock.ctx) != &parser->ticket)
 		return -EINVAL;
 
-	r = amdgpu_ttm_bind(&(*bo)->tbo, &(*bo)->tbo.mem);
-	if (unlikely(r))
-		return r;
-
-	if ((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)
-		return 0;
+	if (!((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) {
+		(*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
+		amdgpu_ttm_placement_from_domain(*bo, (*bo)->allowed_domains);
+		r = ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, false,
+				    false);
+		if (r)
+			return r;
+	}
 
-	(*bo)->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
-	amdgpu_ttm_placement_from_domain(*bo, (*bo)->allowed_domains);
-	return ttm_bo_validate(&(*bo)->tbo, &(*bo)->placement, false, false);
+	return amdgpu_ttm_bind(&(*bo)->tbo, &(*bo)->tbo.mem);
 }
-- 
2.11.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-17  8:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16  9:26 [PATCH 1/2] drm/amdgpu: linear validate first then bind to GART Christian König
     [not found] ` <20171016092646.1625-1-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-10-16  9:26   ` [PATCH 2/2] drm/amdgpu: allow GTT overcommit during bind Christian König
     [not found]     ` <20171016092646.1625-2-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-10-16  9:42       ` Chunming Zhou
     [not found]         ` <eb30bfdf-e5ce-dc2d-1cdf-19f424894b74-5C7GfCeVMHo@public.gmane.org>
2017-10-16 11:40           ` Christian König
     [not found]             ` <8a8ade87-e51c-3aab-b5c0-207dbee60ef9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17  4:11               ` Chunming Zhou
     [not found]                 ` <88d7a8da-821d-396a-1fb9-84454478b7c4-5C7GfCeVMHo@public.gmane.org>
2017-10-17  7:46                   ` Christian König
     [not found]                     ` <d23f395f-df2e-8cba-c973-253111e92f61-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:15                       ` Chunming Zhou
     [not found]                         ` <621ab89b-83a7-1947-ecec-e371433bcaa6-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:27                           ` Christian König
     [not found]                             ` <d5ea66a0-134c-ac18-5056-ecf62d7b6dab-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:34                               ` Zhu, Rex
2017-10-17  8:34                               ` Chunming Zhou
     [not found]                                 ` <ce043b07-a962-c62e-451c-74b02c577fce-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:37                                   ` Chunming Zhou
2017-10-16 17:44   ` [PATCH 1/2] drm/amdgpu: linear validate first then bind to GART Deucher, Alexander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox