From patchwork Wed Jan 5 19:56:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 12704669 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 A0E48C433F5 for ; Wed, 5 Jan 2022 19:57:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C177D10E3F4; Wed, 5 Jan 2022 19:57:54 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id EFCAB10E3EC for ; Wed, 5 Jan 2022 19:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641412673; x=1672948673; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bG5SAU+v3sE3IM09mH225WR8/vLae09lfl3jVBPJFfw=; b=m1K2G333QaDW8eppDZNf8RsAX54r6xpoLu42vtDufaJ55nkrCJ3V+oPr wz41b3VX67plRkJLHcrm2sHSreN0zGn1ZYCafA2KwOG+2qU022oswfztr iTBI1ToKelRXFXc5YnASuHIMzbhlhR0s1rzyXOIAHPxYCYuSDMB1/R9lq yKd9VMAbxM1oqoj/4SYjKLQ85MxqpC00N87najLs/C4vZtvPwPCSUMkyy bciaQ3OLNBWKge2/j8miXVnVozIE5q+O+5kqX4tVp8JEMnhUGHPfD9NKo UOahhp5lxSoF4cWGN075zPmN3+j52jvx3eQkOREbRkyygPF6M9i5WxIQR Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10217"; a="222521406" X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="222521406" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 11:57:53 -0800 X-IronPort-AV: E=Sophos;i="5.88,264,1635231600"; d="scan'208";a="611582064" Received: from menright-mobl1.amr.corp.intel.com (HELO localhost) ([10.252.25.244]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2022 11:57:51 -0800 From: Jani Nikula To: intel-gfx@lists.freedesktop.org Date: Wed, 5 Jan 2022 21:56:29 +0200 Message-Id: <6a8bef9f3a3ef69cb14f6130b76a3d8e59c99ff0.1641411696.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH 13/21] drm/i915: move i915_gem_vm_lookup() where it's used X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move the function next to the only user. Arguably it's perhaps not the best place, but it's much better than having a static inline in a header. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 15 +++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 14 -------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c index ebbac2ea0833..fff09df0009e 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -343,6 +343,21 @@ static int proto_context_register(struct drm_i915_file_private *fpriv, return ret; } + +static struct i915_address_space * +i915_gem_vm_lookup(struct drm_i915_file_private *file_priv, u32 id) +{ + struct i915_address_space *vm; + + xa_lock(&file_priv->vm_xa); + vm = xa_load(&file_priv->vm_xa, id); + if (vm) + kref_get(&vm->ref); + xa_unlock(&file_priv->vm_xa); + + return vm; +} + static int set_proto_ctx_vm(struct drm_i915_file_private *fpriv, struct i915_gem_proto_context *pc, const struct drm_i915_gem_context_param *args) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 3e9aeb51de34..aabd4a563a00 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1654,20 +1654,6 @@ static inline u32 i915_reset_engine_count(struct i915_gpu_error *error, return atomic_read(&error->reset_engine_count[engine->uabi_class]); } -static inline struct i915_address_space * -i915_gem_vm_lookup(struct drm_i915_file_private *file_priv, u32 id) -{ - struct i915_address_space *vm; - - xa_lock(&file_priv->vm_xa); - vm = xa_load(&file_priv->vm_xa, id); - if (vm) - kref_get(&vm->ref); - xa_unlock(&file_priv->vm_xa); - - return vm; -} - /* i915_gem_tiling.c */ static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) {