Commit fa85bfd1 authored by Venkata Sandeep Dhanalakota's avatar Venkata Sandeep Dhanalakota Committed by Matthew Auld
Browse files

drm/i915: Update the helper to set correct mapping



Determine the possible coherent map type based on object location,
and if target has llc or if user requires an always coherent
mapping.

Cc: Matthew Auld <matthew.auld@intel.com>
Cc: CQ Tang <cq.tang@intel.com>
Suggested-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarVenkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210427085417.120246-2-matthew.auld@intel.com
parent c27d642b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ static void dbg_poison_ce(struct intel_context *ce)


	if (ce->state) {
	if (ce->state) {
		struct drm_i915_gem_object *obj = ce->state->obj;
		struct drm_i915_gem_object *obj = ce->state->obj;
		int type = i915_coherent_map_type(ce->engine->i915);
		int type = i915_coherent_map_type(ce->engine->i915, obj, true);
		void *map;
		void *map;


		if (!i915_gem_object_trylock(obj))
		if (!i915_gem_object_trylock(obj))
+3 −1
Original line number Original line Diff line number Diff line
@@ -903,7 +903,9 @@ lrc_pre_pin(struct intel_context *ce,
	GEM_BUG_ON(!i915_vma_is_pinned(ce->state));
	GEM_BUG_ON(!i915_vma_is_pinned(ce->state));


	*vaddr = i915_gem_object_pin_map(ce->state->obj,
	*vaddr = i915_gem_object_pin_map(ce->state->obj,
					 i915_coherent_map_type(ce->engine->i915) |
					 i915_coherent_map_type(ce->engine->i915,
								ce->state->obj,
								false) |
					 I915_MAP_OVERRIDE);
					 I915_MAP_OVERRIDE);


	return PTR_ERR_OR_ZERO(*vaddr);
	return PTR_ERR_OR_ZERO(*vaddr);
+7 −4
Original line number Original line Diff line number Diff line
@@ -51,11 +51,14 @@ int intel_ring_pin(struct intel_ring *ring, struct i915_gem_ww_ctx *ww)
	if (unlikely(ret))
	if (unlikely(ret))
		goto err_unpin;
		goto err_unpin;


	if (i915_vma_is_map_and_fenceable(vma))
	if (i915_vma_is_map_and_fenceable(vma)) {
		addr = (void __force *)i915_vma_pin_iomap(vma);
		addr = (void __force *)i915_vma_pin_iomap(vma);
	else
	} else {
		addr = i915_gem_object_pin_map(vma->obj,
		int type = i915_coherent_map_type(vma->vm->i915, vma->obj, false);
					       i915_coherent_map_type(vma->vm->i915));

		addr = i915_gem_object_pin_map(vma->obj, type);
	}

	if (IS_ERR(addr)) {
	if (IS_ERR(addr)) {
		ret = PTR_ERR(addr);
		ret = PTR_ERR(addr);
		goto err_ring;
		goto err_ring;
+2 −1
Original line number Original line Diff line number Diff line
@@ -88,7 +88,8 @@ static int __live_context_size(struct intel_engine_cs *engine)
		goto err;
		goto err;


	vaddr = i915_gem_object_pin_map_unlocked(ce->state->obj,
	vaddr = i915_gem_object_pin_map_unlocked(ce->state->obj,
						 i915_coherent_map_type(engine->i915));
						 i915_coherent_map_type(engine->i915,
									ce->state->obj, false));
	if (IS_ERR(vaddr)) {
	if (IS_ERR(vaddr)) {
		err = PTR_ERR(vaddr);
		err = PTR_ERR(vaddr);
		intel_context_unpin(ce);
		intel_context_unpin(ce);
+2 −2
Original line number Original line Diff line number Diff line
@@ -69,7 +69,7 @@ static int hang_init(struct hang *h, struct intel_gt *gt)
	h->seqno = memset(vaddr, 0xff, PAGE_SIZE);
	h->seqno = memset(vaddr, 0xff, PAGE_SIZE);


	vaddr = i915_gem_object_pin_map_unlocked(h->obj,
	vaddr = i915_gem_object_pin_map_unlocked(h->obj,
						 i915_coherent_map_type(gt->i915));
						 i915_coherent_map_type(gt->i915, h->obj, false));
	if (IS_ERR(vaddr)) {
	if (IS_ERR(vaddr)) {
		err = PTR_ERR(vaddr);
		err = PTR_ERR(vaddr);
		goto err_unpin_hws;
		goto err_unpin_hws;
@@ -130,7 +130,7 @@ hang_create_request(struct hang *h, struct intel_engine_cs *engine)
		return ERR_CAST(obj);
		return ERR_CAST(obj);
	}
	}


	vaddr = i915_gem_object_pin_map_unlocked(obj, i915_coherent_map_type(gt->i915));
	vaddr = i915_gem_object_pin_map_unlocked(obj, i915_coherent_map_type(gt->i915, obj, false));
	if (IS_ERR(vaddr)) {
	if (IS_ERR(vaddr)) {
		i915_gem_object_put(obj);
		i915_gem_object_put(obj);
		i915_vm_put(vm);
		i915_vm_put(vm);
Loading