From patchwork Sat Dec 7 17:01:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11277683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 780F9139A for ; Sat, 7 Dec 2019 17:01:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60CAF20637 for ; Sat, 7 Dec 2019 17:01:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60CAF20637 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72B7A6E1F2; Sat, 7 Dec 2019 17:01:28 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 23BFD6E1EC for ; Sat, 7 Dec 2019 17:01:24 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 19496908-1500050 for multiple; Sat, 07 Dec 2019 17:01:11 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sat, 7 Dec 2019 17:01:06 +0000 Message-Id: <20191207170110.2200142-4-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191207170110.2200142-1-chris@chris-wilson.co.uk> References: <20191207170110.2200142-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 4/8] drm/i915/gem: Tidy up error handling for eb_parse() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" As the caller no longer uses the i915_vma result, stop returning it and just return the error code instead. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen --- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c index acf71466f8ea..690a3670ed08 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -1982,19 +1982,24 @@ shadow_batch_pin(struct i915_execbuffer *eb, struct drm_i915_gem_object *obj) 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 i915_vma *vma; int err; + if (!eb_use_cmdparser(eb)) + return 0; + pool = intel_engine_get_pool(eb->engine, eb->batch_len); if (IS_ERR(pool)) - return ERR_CAST(pool); + return PTR_ERR(pool); vma = shadow_batch_pin(eb, pool->obj); - if (IS_ERR(vma)) + if (IS_ERR(vma)) { + err = PTR_ERR(vma); goto err; + } err = intel_engine_cmd_parser(eb->engine, eb->batch, @@ -2002,8 +2007,6 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb) eb->batch_len, vma); if (err) { - i915_vma_unpin(vma); - /* * Unsafe GGTT-backed buffers can still be submitted safely * as non-secure. @@ -2012,10 +2015,8 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb) */ if (i915_vma_is_ggtt(vma) && err == -EACCES) /* Execute original buffer non-secure */ - vma = NULL; - else - vma = ERR_PTR(err); - goto err; + err = 0; + goto err_unpin; } eb->vma[eb->buffer_count] = i915_vma_get(vma); @@ -2033,11 +2034,13 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb) /* eb->batch_len unchanged */ vma->private = pool; - return vma; + return 0; +err_unpin: + i915_vma_unpin(vma); err: intel_engine_pool_put(pool); - return vma; + return err; } static void @@ -2558,15 +2561,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, if (eb.batch_len == 0) eb.batch_len = eb.batch->size - eb.batch_start_offset; - if (eb_use_cmdparser(&eb)) { - struct i915_vma *vma; - - vma = eb_parse(&eb); - if (IS_ERR(vma)) { - err = PTR_ERR(vma); - goto err_vma; - } - } + err = eb_parse(&eb); + if (err) + goto err_vma; /* * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure