From patchwork Tue Oct 3 22:57:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sundaresan, Sujaritha" X-Patchwork-Id: 9983613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89B806029B for ; Tue, 3 Oct 2017 22:59:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FC792896A for ; Tue, 3 Oct 2017 22:59:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74D2E289D0; Tue, 3 Oct 2017 22:59:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1264C2896A for ; Tue, 3 Oct 2017 22:59:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9966A6E615; Tue, 3 Oct 2017 22:59:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 58F376E615 for ; Tue, 3 Oct 2017 22:59:46 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 03 Oct 2017 15:59:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,475,1500966000"; d="scan'208";a="159011431" Received: from sujaritha-z170x-ud5.fm.intel.com ([10.1.27.118]) by fmsmga006.fm.intel.com with ESMTP; 03 Oct 2017 15:59:45 -0700 From: Sujaritha Sundaresan To: intel-gfx@lists.freedesktop.org Date: Tue, 3 Oct 2017 15:57:00 -0700 Message-Id: <1507071420-23339-1-git-send-email-sujaritha.sundaresan@intel.com> X-Mailer: git-send-email 1.9.1 Cc: Sujaritha Sundaresan Subject: [Intel-gfx] [PATCH 4/5] drm/i915/guc: group initialization of GuC objects X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The previous patch has split up the initialization of some of the GuC objects in 2 different functions, let's pull them back together. v3: Group initialization of GuC objects v2: Decoupling ADS together with logs (Daniele) v3: Rebase v4: Rebase v5: Separated from previous patch Cc: Anusha Srivatsa Cc: Daniele Ceraolo Spurio Cc: Michal Wajdeczko Cc: Oscar Mateo Cc: Sagar Arun Kamble Signed-off-by: Sujaritha Sundaresan --- drivers/gpu/drm/i915/i915_guc_submission.c | 7 ++--- drivers/gpu/drm/i915/intel_uc.c | 41 +++++++++++++++++------------- drivers/gpu/drm/i915/intel_uc.h | 4 +-- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c index c456c55..a351339 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.c +++ b/drivers/gpu/drm/i915/i915_guc_submission.c @@ -920,9 +920,8 @@ void i915_guc_policies_init(struct guc_policies *policies) * Set up the memory resources to be shared with the GuC (via the GGTT) * at firmware loading time. */ -int i915_guc_submission_init(struct drm_i915_private *dev_priv) +int i915_guc_submission_shared_objects_init(struct intel_guc *guc) { - struct intel_guc *guc = &dev_priv->guc; struct i915_vma *vma; void *vaddr; @@ -950,10 +949,8 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv) return 0; } -void i915_guc_submission_fini(struct drm_i915_private *dev_priv) +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc) { - struct intel_guc *guc = &dev_priv->guc; - ida_destroy(&guc->stage_ids); i915_gem_object_unpin_map(guc->stage_desc_pool->obj); i915_vma_unpin_and_release(&guc->stage_desc_pool); diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c index 732f188..69239e4 100644 --- a/drivers/gpu/drm/i915/intel_uc.c +++ b/drivers/gpu/drm/i915/intel_uc.c @@ -423,13 +423,33 @@ static int guc_shared_objects_init(struct intel_guc *guc) ret = guc_ads_create(guc); if (ret < 0) - intel_guc_log_destroy(guc); + goto err_logs; + + if (i915_modparams.enable_guc_submission) { + /* + * This is stuff we need to have available at fw load time + * if we are planning to enable submission later + */ + ret = i915_guc_submission_shared_objects_init(guc); + if (ret) + goto err_ads; + } + + return 0; + +err_ads: + guc_ads_destroy(guc); +err_logs: + intel_guc_log_destroy(guc); return ret; } static void guc_shared_objects_fini(struct intel_guc *guc) { + if (i915_modparams.enable_guc_submission) + i915_guc_submission_shared_objects_fini(guc); + guc_ads_destroy(guc); intel_guc_log_destroy(guc); } @@ -452,16 +472,6 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) if (ret) goto err_guc; - if (i915_modparams.enable_guc_submission) { - /* - * This is stuff we need to have available at fw load time - * if we are planning to enable submission later - */ - ret = i915_guc_submission_init(dev_priv); - if (ret) - goto err_shared; - } - /* init WOPCM */ I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv)); I915_WRITE(DMA_GUC_WOPCM_OFFSET, @@ -481,7 +491,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) */ ret = __intel_uc_reset_hw(dev_priv); if (ret) - goto err_submission; + goto err_shared; intel_huc_init_hw(&dev_priv->huc); ret = intel_guc_init_hw(&dev_priv->guc); @@ -526,11 +536,8 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) gen9_disable_guc_interrupts(dev_priv); err_log_capture: guc_capture_load_err_log(guc); -err_submission: - if (i915_modparams.enable_guc_submission) - i915_guc_submission_fini(dev_priv); err_shared: - guc_shared_objects_fini(guc); + guc_shared_objects_fini(guc); err_guc: i915_ggtt_disable_guc(dev_priv); @@ -567,7 +574,7 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv) if (i915_modparams.enable_guc_submission) { gen9_disable_guc_interrupts(dev_priv); - i915_guc_submission_fini(dev_priv); + i915_guc_submission_shared_objects_fini(dev_priv); } guc_shared_objects_fini(&dev_priv->guc); diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h index 0d12ff4..5106046 100644 --- a/drivers/gpu/drm/i915/intel_uc.h +++ b/drivers/gpu/drm/i915/intel_uc.h @@ -230,10 +230,10 @@ static inline void intel_guc_notify(struct intel_guc *guc) u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv); /* i915_guc_submission.c */ -int i915_guc_submission_init(struct drm_i915_private *dev_priv); +int i915_guc_submission_shared_objects_init(struct intel_guc *guc); int i915_guc_submission_enable(struct drm_i915_private *dev_priv); void i915_guc_submission_disable(struct drm_i915_private *dev_priv); -void i915_guc_submission_fini(struct drm_i915_private *dev_priv); +void i915_guc_submission_shared_objects_fini(struct intel_guc *guc); struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size); void i915_guc_policies_init(struct guc_policies *policies);