Commit 2a665968 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Simona Vetter
Browse files

drm/i915: Move pinning to inside engine_wa_list_verify()



This should be done as part of the ww loop, in order to remove a
i915_vma_pin that needs ww held.

Now only i915_ggtt_pin() callers remaining.

Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210323155059.628690-25-maarten.lankhorst@linux.intel.com
parent 9fa1f478
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -427,7 +427,6 @@ __vm_create_scratch_for_read(struct i915_address_space *vm, unsigned long size)
{
	struct drm_i915_gem_object *obj;
	struct i915_vma *vma;
	int err;

	obj = i915_gem_object_create_internal(vm->i915, PAGE_ALIGN(size));
	if (IS_ERR(obj))
@@ -441,6 +440,19 @@ __vm_create_scratch_for_read(struct i915_address_space *vm, unsigned long size)
		return vma;
	}

	return vma;
}

struct i915_vma *
__vm_create_scratch_for_read_pinned(struct i915_address_space *vm, unsigned long size)
{
	struct i915_vma *vma;
	int err;

	vma = __vm_create_scratch_for_read(vm, size);
	if (IS_ERR(vma))
		return vma;

	err = i915_vma_pin(vma, 0, 0,
			   i915_vma_is_ggtt(vma) ? PIN_GLOBAL : PIN_USER);
	if (err) {
+3 −0
Original line number Diff line number Diff line
@@ -576,6 +576,9 @@ void i915_vm_free_pt_stash(struct i915_address_space *vm,
struct i915_vma *
__vm_create_scratch_for_read(struct i915_address_space *vm, unsigned long size);

struct i915_vma *
__vm_create_scratch_for_read_pinned(struct i915_address_space *vm, unsigned long size);

static inline struct sgt_dma {
	struct scatterlist *sg;
	dma_addr_t dma, max;
+8 −2
Original line number Diff line number Diff line
@@ -2213,10 +2213,15 @@ static int engine_wa_list_verify(struct intel_context *ce,
	if (err)
		goto err_pm;

	err = i915_vma_pin_ww(vma, &ww, 0, 0,
			   i915_vma_is_ggtt(vma) ? PIN_GLOBAL : PIN_USER);
	if (err)
		goto err_unpin;

	rq = i915_request_create(ce);
	if (IS_ERR(rq)) {
		err = PTR_ERR(rq);
		goto err_unpin;
		goto err_vma;
	}

	err = i915_request_await_object(rq, vma->obj, true);
@@ -2257,6 +2262,8 @@ static int engine_wa_list_verify(struct intel_context *ce,

err_rq:
	i915_request_put(rq);
err_vma:
	i915_vma_unpin(vma);
err_unpin:
	intel_context_unpin(ce);
err_pm:
@@ -2267,7 +2274,6 @@ static int engine_wa_list_verify(struct intel_context *ce,
	}
	i915_gem_ww_ctx_fini(&ww);
	intel_engine_pm_put(ce->engine);
	i915_vma_unpin(vma);
	i915_vma_put(vma);
	return err;
}
+3 −2
Original line number Diff line number Diff line
@@ -4197,7 +4197,8 @@ static int preserved_virtual_engine(struct intel_gt *gt,
	int err = 0;
	u32 *cs;

	scratch = __vm_create_scratch_for_read(&siblings[0]->gt->ggtt->vm,
	scratch =
		__vm_create_scratch_for_read_pinned(&siblings[0]->gt->ggtt->vm,
						    PAGE_SIZE);
	if (IS_ERR(scratch))
		return PTR_ERR(scratch);
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@

static struct i915_vma *create_scratch(struct intel_gt *gt)
{
	return __vm_create_scratch_for_read(&gt->ggtt->vm, PAGE_SIZE);
	return __vm_create_scratch_for_read_pinned(&gt->ggtt->vm, PAGE_SIZE);
}

static bool is_active(struct i915_request *rq)
Loading