From patchwork Mon Dec 12 23:15:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niranjana Vishwanathapura X-Patchwork-Id: 13071564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0403CC00145 for ; Mon, 12 Dec 2022 23:17:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28EDC10E2DF; Mon, 12 Dec 2022 23:16:13 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9364610E2AE; Mon, 12 Dec 2022 23:15:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670886937; x=1702422937; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EAK+5hwzY0wvRP38xByRdKBSasfEWDRGmSbRSdfZRQM=; b=bxobFOcOT53GjxcX0jqi7jmc/LYNBvX87YbGn4RFlC/AL+Vdwc0oZ2md l9y+HgWL3F8ew+kE3UsMnuklyfgKvlOK0z/GfmFn4bhLVqJn1iBQUkse/ vuzilL4TJNqxyOlrXHlo0soGUKmBQiKtdqx85xwppH1mQcdUW5mf8bvp8 vz0TwwnEhpNcOCmqRf5qY2Ff02hrUICgbNkbBZPfTA1b9HnnAzd80ERy3 XRXz/EqU/wButwAOQCsLNm6HR1ylaitOwMQiL6foRtByK1+xvDa9V091Y SvYcjEbOyB1sXiH2HTrpryk9Img+6K/J3i5Qs87kyiiw0NRofonz1aamC A==; X-IronPort-AV: E=McAfee;i="6500,9779,10559"; a="380196393" X-IronPort-AV: E=Sophos;i="5.96,239,1665471600"; d="scan'208";a="380196393" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2022 15:15:37 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10559"; a="679090353" X-IronPort-AV: E=Sophos;i="5.96,239,1665471600"; d="scan'208";a="679090353" Received: from nvishwa1-desk.sc.intel.com ([172.25.29.76]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2022 15:15:36 -0800 From: Niranjana Vishwanathapura To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v9 15/23] drm/i915/vm_bind: Expose i915_request_await_bind() Date: Mon, 12 Dec 2022 15:15:19 -0800 Message-Id: <20221212231527.2384-16-niranjana.vishwanathapura@intel.com> X-Mailer: git-send-email 2.21.0.rc0.32.g243a4c7e27 In-Reply-To: <20221212231527.2384-1-niranjana.vishwanathapura@intel.com> References: <20221212231527.2384-1-niranjana.vishwanathapura@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matthew.brost@intel.com, paulo.r.zanoni@intel.com, tvrtko.ursulin@intel.com, jani.nikula@intel.com, lionel.g.landwerlin@intel.com, thomas.hellstrom@intel.com, matthew.auld@intel.com, jason@jlekstrand.net, andi.shyti@linux.intel.com, daniel.vetter@intel.com, christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Rename __i915_request_await_bind() as i915_request_await_bind() and make it non-static as it will be used in execbuf3 ioctl path. v2: add documentation Reviewed-by: Matthew Auld Reviewed-by: Andi Shyti Signed-off-by: Niranjana Vishwanathapura --- drivers/gpu/drm/i915/i915_vma.c | 8 +------- drivers/gpu/drm/i915/i915_vma.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index 7013b2936565..af3eb6ce68b0 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -1923,18 +1923,12 @@ void i915_vma_revoke_mmap(struct i915_vma *vma) list_del(&vma->obj->userfault_link); } -static int -__i915_request_await_bind(struct i915_request *rq, struct i915_vma *vma) -{ - return __i915_request_await_exclusive(rq, &vma->active); -} - static int __i915_vma_move_to_active(struct i915_vma *vma, struct i915_request *rq) { int err; /* Wait for the vma to be bound before we start! */ - err = __i915_request_await_bind(rq, vma); + err = i915_request_await_bind(rq, vma); if (err) return err; diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h index 1f25e45a6325..d6c05227fb04 100644 --- a/drivers/gpu/drm/i915/i915_vma.h +++ b/drivers/gpu/drm/i915/i915_vma.h @@ -55,6 +55,22 @@ void i915_vma_unpin_and_release(struct i915_vma **p_vma, unsigned int flags); #define __EXEC_OBJECT_NO_RESERVE BIT(31) #define __EXEC_OBJECT_NO_REQUEST_AWAIT BIT(30) +/** + * i915_request_await_bind() - Setup request to wait for a vma bind completion + * @rq: the request which should wait + * @vma: vma whose binding @rq should wait to complete + * + * Setup the request @rq to asynchronously wait for @vma bind to complete + * before starting execution. + * + * Returns 0 on success, error code on failure. + */ +static inline int +i915_request_await_bind(struct i915_request *rq, struct i915_vma *vma) +{ + return __i915_request_await_exclusive(rq, &vma->active); +} + int __must_check _i915_vma_move_to_active(struct i915_vma *vma, struct i915_request *rq, struct dma_fence *fence,