Commit 51696691 authored by Chris Wilson's avatar Chris Wilson

drm/i915/gem: Tidy up error handling for eb_parse()

As the caller no longer uses the i915_vma result, stop returning it and
just return the error code instead.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191211110437.4082687-4-chris@chris-wilson.co.uk
parent 37d1151c
...@@ -1982,19 +1982,24 @@ shadow_batch_pin(struct i915_execbuffer *eb, struct drm_i915_gem_object *obj) ...@@ -1982,19 +1982,24 @@ shadow_batch_pin(struct i915_execbuffer *eb, struct drm_i915_gem_object *obj)
return vma; return vma;
} }
static struct i915_vma *eb_parse(struct i915_execbuffer *eb) static int eb_parse(struct i915_execbuffer *eb)
{ {
struct intel_engine_pool_node *pool; struct intel_engine_pool_node *pool;
struct i915_vma *vma; struct i915_vma *vma;
int err; int err;
if (!eb_use_cmdparser(eb))
return 0;
pool = intel_engine_get_pool(eb->engine, eb->batch_len); pool = intel_engine_get_pool(eb->engine, eb->batch_len);
if (IS_ERR(pool)) if (IS_ERR(pool))
return ERR_CAST(pool); return PTR_ERR(pool);
vma = shadow_batch_pin(eb, pool->obj); vma = shadow_batch_pin(eb, pool->obj);
if (IS_ERR(vma)) if (IS_ERR(vma)) {
err = PTR_ERR(vma);
goto err; goto err;
}
err = intel_engine_cmd_parser(eb->engine, err = intel_engine_cmd_parser(eb->engine,
eb->batch, eb->batch,
...@@ -2002,8 +2007,6 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb) ...@@ -2002,8 +2007,6 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb)
eb->batch_len, eb->batch_len,
vma); vma);
if (err) { if (err) {
i915_vma_unpin(vma);
/* /*
* Unsafe GGTT-backed buffers can still be submitted safely * Unsafe GGTT-backed buffers can still be submitted safely
* as non-secure. * as non-secure.
...@@ -2011,11 +2014,9 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb) ...@@ -2011,11 +2014,9 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb)
* reject unsafe buffers * reject unsafe buffers
*/ */
if (i915_vma_is_ggtt(vma) && err == -EACCES) if (i915_vma_is_ggtt(vma) && err == -EACCES)
/* Execute original buffer non-secure */ err = 0;
vma = NULL;
else goto err_unpin;
vma = ERR_PTR(err);
goto err;
} }
eb->vma[eb->buffer_count] = i915_vma_get(vma); eb->vma[eb->buffer_count] = i915_vma_get(vma);
...@@ -2033,11 +2034,13 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb) ...@@ -2033,11 +2034,13 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb)
/* eb->batch_len unchanged */ /* eb->batch_len unchanged */
vma->private = pool; vma->private = pool;
return vma; return 0;
err_unpin:
i915_vma_unpin(vma);
err: err:
intel_engine_pool_put(pool); intel_engine_pool_put(pool);
return vma; return err;
} }
static void static void
...@@ -2558,15 +2561,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, ...@@ -2558,15 +2561,9 @@ i915_gem_do_execbuffer(struct drm_device *dev,
if (eb.batch_len == 0) if (eb.batch_len == 0)
eb.batch_len = eb.batch->size - eb.batch_start_offset; eb.batch_len = eb.batch->size - eb.batch_start_offset;
if (eb_use_cmdparser(&eb)) { err = eb_parse(&eb);
struct i915_vma *vma; if (err)
goto err_vma;
vma = eb_parse(&eb);
if (IS_ERR(vma)) {
err = PTR_ERR(vma);
goto err_vma;
}
}
/* /*
* snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment