From patchwork Sun Nov 5 13:39:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 10042153 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 DEB186032D for ; Sun, 5 Nov 2017 13:36:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CABD5291D6 for ; Sun, 5 Nov 2017 13:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFE452957D; Sun, 5 Nov 2017 13:36:16 +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 4717F291D6 for ; Sun, 5 Nov 2017 13:36:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 52CA76E1AB; Sun, 5 Nov 2017 13:36:15 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E88B6E1AB for ; Sun, 5 Nov 2017 13:36:14 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2017 05:36:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,347,1505804400"; d="scan'208";a="171707946" Received: from sakamble-desktop.iind.intel.com ([10.223.26.118]) by fmsmga005.fm.intel.com with ESMTP; 05 Nov 2017 05:36:11 -0800 From: Sagar Arun Kamble To: intel-gfx@lists.freedesktop.org Date: Sun, 5 Nov 2017 19:09:40 +0530 Message-Id: <1509889183-2094-2-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509889183-2094-1-git-send-email-sagar.a.kamble@intel.com> References: <1509889183-2094-1-git-send-email-sagar.a.kamble@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/5] drm/i915/guc: Release all client doorbells on suspend and acquire on resume 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Before GT device suspend, i915 should release GuC client doorbells by stopping doorbell controller snooping and doorbell deallocation through GuC. They need to be acquired again on resume. This will also resolve the driver unload issue with GuC, where doorbell deallocation was being done post GEM suspend. Release function is called from guc_suspend prior to sending sleep action during runtime and drm suspend. Acquiral is different in runtime and drm resume paths as on drm resume we are currently doing full reinit. Release should be done in synchronization with acquire hence GuC suspend/resume along with doorbell release/acquire should be under struct_mutex. Upcoming suspend and resume restructuring for GuC will update these changes. Signed-off-by: Sagar Arun Kamble Cc: Chris Wilson Cc: MichaƂ Winiarski Cc: Michel Thierry Cc: Michal Wajdeczko Cc: Arkadiusz Hiler Cc: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_drv.c | 3 +++ drivers/gpu/drm/i915/i915_gem.c | 5 +++-- drivers/gpu/drm/i915/i915_guc_submission.c | 20 ++++++++++++++++---- drivers/gpu/drm/i915/i915_guc_submission.h | 2 ++ drivers/gpu/drm/i915/intel_guc.c | 2 ++ 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e7e9e06..3df8a7d 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -47,6 +47,7 @@ #include #include "i915_drv.h" +#include "i915_guc_submission.h" #include "i915_trace.h" #include "i915_vgpu.h" #include "intel_drv.h" @@ -2615,6 +2616,8 @@ static int intel_runtime_resume(struct device *kdev) intel_guc_resume(dev_priv); + i915_guc_clients_acquire_doorbells(&dev_priv->guc); + if (IS_GEN9_LP(dev_priv)) { bxt_disable_dc9(dev_priv); bxt_display_core_init(dev_priv, true); diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 6a71805..cbce714 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -29,13 +29,14 @@ #include #include #include "i915_drv.h" +#include "i915_gemfs.h" #include "i915_gem_clflush.h" -#include "i915_vgpu.h" +#include "i915_guc_submission.h" #include "i915_trace.h" +#include "i915_vgpu.h" #include "intel_drv.h" #include "intel_frontbuffer.h" #include "intel_mocs.h" -#include "i915_gemfs.h" #include #include #include diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c index b6486dc..b989edf 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.c +++ b/drivers/gpu/drm/i915/i915_guc_submission.c @@ -1047,10 +1047,6 @@ static void guc_client_free(struct i915_guc_client *client) * Be sure to drop any locks */ - /* FIXME: in many cases, by the time we get here the GuC has been - * reset, so we cannot destroy the doorbell properly. Ignore the - * error message for now */ - destroy_doorbell(client, true); guc_stage_desc_fini(client->guc, client); i915_gem_object_unpin_map(client->vma->obj); i915_vma_unpin_and_release(&client->vma); @@ -1102,6 +1098,21 @@ static void guc_clients_destroy(struct intel_guc *guc) guc_client_free(client); } +void i915_guc_clients_acquire_doorbells(struct intel_guc *guc) +{ + if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS) + return; + + create_doorbell(guc->execbuf_client); + create_doorbell(guc->preempt_client); +} + +void i915_guc_clients_release_doorbells(struct intel_guc *guc) +{ + destroy_doorbell(guc->preempt_client, true); + destroy_doorbell(guc->execbuf_client, true); +} + static void guc_policy_init(struct guc_policy *policy) { policy->execution_quantum = POLICY_DEFAULT_EXECUTION_QUANTUM_US; @@ -1423,6 +1434,7 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv) } else { guc_reset_wq(guc->execbuf_client); guc_reset_wq(guc->preempt_client); + i915_guc_clients_acquire_doorbells(guc); } err = intel_guc_sample_forcewake(guc); diff --git a/drivers/gpu/drm/i915/i915_guc_submission.h b/drivers/gpu/drm/i915/i915_guc_submission.h index cb4353b..1d5cf22 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.h +++ b/drivers/gpu/drm/i915/i915_guc_submission.h @@ -72,6 +72,8 @@ struct i915_guc_client { u64 submissions[I915_NUM_ENGINES]; }; +void i915_guc_clients_acquire_doorbells(struct intel_guc *guc); +void i915_guc_clients_release_doorbells(struct intel_guc *guc); int i915_guc_submission_init(struct drm_i915_private *dev_priv); int i915_guc_submission_enable(struct drm_i915_private *dev_priv); void i915_guc_submission_disable(struct drm_i915_private *dev_priv); diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c index 9678630..b6eb5ac 100644 --- a/drivers/gpu/drm/i915/intel_guc.c +++ b/drivers/gpu/drm/i915/intel_guc.c @@ -274,6 +274,8 @@ int intel_guc_suspend(struct drm_i915_private *dev_priv) if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS) return 0; + i915_guc_clients_release_doorbells(&dev_priv->guc); + gen9_disable_guc_interrupts(dev_priv); data[0] = INTEL_GUC_ACTION_ENTER_S_STATE;