diff mbox series

[2/2] drm/i915/gvt: Acutally use the map interface

Message ID 20210121124932.2143-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/gem: Remove special casing from reloc-gtt | expand

Commit Message

Chris Wilson Jan. 21, 2021, 12:49 p.m. UTC
Since we acquire the i915_gem_object_pin_map() to write into the shadow
buffer, we only need to flush the map after writing to ensure the buffer
is coherent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gvt/cmd_parser.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

Matthew Auld Jan. 21, 2021, 5:12 p.m. UTC | #1
On Thu, 21 Jan 2021 at 12:49, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> Since we acquire the i915_gem_object_pin_map() to write into the shadow
> buffer, we only need to flush the map after writing to ensure the buffer
> is coherent.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index 3fea967ee817..6b8eb9b92bdd 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
@@ -2982,23 +2982,16 @@  static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx)
 		goto put_obj;
 	}
 
-	i915_gem_object_lock(obj, NULL);
-	ret = i915_gem_object_set_to_cpu_domain(obj, false);
-	i915_gem_object_unlock(obj);
-	if (ret) {
-		gvt_vgpu_err("failed to set shadow indirect ctx to CPU\n");
-		goto unmap_src;
-	}
-
 	ret = copy_gma_to_hva(workload->vgpu,
-				workload->vgpu->gtt.ggtt_mm,
-				guest_gma, guest_gma + ctx_size,
-				map);
+			      workload->vgpu->gtt.ggtt_mm,
+			      guest_gma, guest_gma + ctx_size,
+			      map);
 	if (ret < 0) {
 		gvt_vgpu_err("fail to copy guest indirect ctx\n");
 		goto unmap_src;
 	}
 
+	i915_gem_object_flush_map(obj);
 	wa_ctx->indirect_ctx.obj = obj;
 	wa_ctx->indirect_ctx.shadow_va = map;
 	return 0;