All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sagar Arun Kamble <sagar.a.kamble@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH v13 08/21] drm/i915/guc: Update GEM suspend/resume flows with GuC suspend/resume functions
Date: Wed, 11 Oct 2017 14:24:03 +0530	[thread overview]
Message-ID: <1507712056-25030-9-git-send-email-sagar.a.kamble@intel.com> (raw)
In-Reply-To: <1507712056-25030-1-git-send-email-sagar.a.kamble@intel.com>

This patch moves GuC suspend/resume handlers to corresponding GEM handlers
and orders them properly in the runtime and system suspend/resume flows.
Also ensure all GEM suspend/resume paths are protected by struct_mutex.

v2: Removed documentation of suspend/resume handlers as those are not
interfaces and are just hooks. (Chris)

v3: Rebase. Removed i915_gem_restore_fences change from this patch.
(Michal Wajdeczko)

v4: Rebase. Added struct_mutex protection to i915_gem_runtime_suspend,
i915_gem_runtime_resume and intel_guc_suspend in i915_gem_suspend. Pulled
intel_guc_resume under struct_mutex in i915_gem_resume.

Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c |  7 -------
 drivers/gpu/drm/i915/i915_gem.c | 20 ++++++++++++++++++--
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 7b043d7..df9a561 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1710,8 +1710,6 @@ static int i915_drm_resume(struct drm_device *dev)
 	}
 	mutex_unlock(&dev->struct_mutex);
 
-	intel_guc_resume(&dev_priv->guc);
-
 	intel_modeset_init_hw(dev);
 
 	spin_lock_irq(&dev_priv->irq_lock);
@@ -2520,8 +2518,6 @@ static int intel_runtime_suspend(struct device *kdev)
 	if (ret)
 		goto err_gem;
 
-	intel_guc_suspend(&dev_priv->guc);
-
 	intel_runtime_pm_disable_interrupts(dev_priv);
 
 	ret = 0;
@@ -2582,7 +2578,6 @@ static int intel_runtime_suspend(struct device *kdev)
 
 err_disable:
 	intel_runtime_pm_enable_interrupts(dev_priv);
-	intel_guc_resume(&dev_priv->guc);
 	i915_gem_runtime_resume(dev_priv);
 
 err_gem:
@@ -2610,8 +2605,6 @@ static int intel_runtime_resume(struct device *kdev)
 	if (intel_uncore_unclaimed_mmio(dev_priv))
 		DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
 
-	intel_guc_resume(&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 facf681..38447ae 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2058,6 +2058,10 @@ int i915_gem_runtime_suspend(struct drm_i915_private *dev_priv)
 	struct drm_i915_gem_object *obj, *on;
 	int i;
 
+	mutex_lock(&dev_priv->drm.struct_mutex);
+
+	intel_guc_suspend(&dev_priv->guc);
+
 	/*
 	 * Only called during RPM suspend. All users of the userfault_list
 	 * must be holding an RPM wakeref to ensure that this can not
@@ -2094,13 +2098,21 @@ int i915_gem_runtime_suspend(struct drm_i915_private *dev_priv)
 		reg->dirty = true;
 	}
 
+	mutex_unlock(&dev_priv->drm.struct_mutex);
+
 	return 0;
 }
 
 void i915_gem_runtime_resume(struct drm_i915_private *dev_priv)
 {
+	mutex_lock(&dev_priv->drm.struct_mutex);
+
 	i915_gem_init_swizzling(dev_priv);
 	i915_gem_restore_fences(dev_priv);
+
+	intel_guc_resume(&dev_priv->guc);
+
+	mutex_unlock(&dev_priv->drm.struct_mutex);
 }
 
 static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
@@ -4653,8 +4665,6 @@ int i915_gem_suspend(struct drm_i915_private *dev_priv)
 	i915_gem_contexts_lost(dev_priv);
 	mutex_unlock(&dev->struct_mutex);
 
-	intel_guc_suspend(&dev_priv->guc);
-
 	cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
 	cancel_delayed_work_sync(&dev_priv->gt.retire_work);
 
@@ -4670,6 +4680,10 @@ int i915_gem_suspend(struct drm_i915_private *dev_priv)
 	if (WARN_ON(!intel_engines_are_idle(dev_priv)))
 		i915_gem_set_wedged(dev_priv); /* no hope, discard everything */
 
+	mutex_lock(&dev->struct_mutex);
+	intel_guc_suspend(&dev_priv->guc);
+	mutex_unlock(&dev->struct_mutex);
+
 	/*
 	 * Neither the BIOS, ourselves or any other kernel
 	 * expects the system to be in execlists mode on startup,
@@ -4716,6 +4730,8 @@ void i915_gem_resume(struct drm_i915_private *dev_priv)
 	 */
 	dev_priv->gt.resume(dev_priv);
 
+	intel_guc_resume(&dev_priv->guc);
+
 	mutex_unlock(&dev->struct_mutex);
 }
 
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-10-11  8:51 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11  8:53 [PATCH v13 00/21] drm/i915: GEM/GuC Suspend/Resume/Reset fixes and restructuring Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 01/21] drm/i915/guc: Add GuC submission initialization/enable state variables Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 02/21] drm/i915/guc: Sanitize module parameter guc_log_level Sagar Arun Kamble
2017-10-11 14:51   ` Michal Wajdeczko
2017-10-12  5:48     ` Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 03/21] drm/i915/guc: Add status checks to enable/disable_guc_interrupts Sagar Arun Kamble
2017-10-11 15:20   ` Michal Wajdeczko
2017-10-12  5:50     ` Sagar Arun Kamble
2017-10-12  6:17       ` Sagar Arun Kamble
2017-10-13  8:09         ` Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 04/21] drm/i915/guc: Remove enable_guc_submission dependency for invoking GuC log functions Sagar Arun Kamble
2017-10-11 15:40   ` Michal Wajdeczko
2017-10-12  5:58     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 05/21] drm/i915/guc: Update enable_guc_loading check in intel_uc_fini_hw Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 06/21] drm/i915/guc: Pass intel_guc struct parameter to intel_guc_suspend/resume Sagar Arun Kamble
2017-10-11 15:50   ` Michal Wajdeczko
2017-10-12  6:18     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 07/21] drm/i915: Create GEM runtime resume helper and handle GEM runtime suspend error Sagar Arun Kamble
2017-10-11  8:54 ` Sagar Arun Kamble [this message]
2017-10-11  8:54 ` [PATCH v13 09/21] drm/i915/uc: Create uC suspend and resume functions Sagar Arun Kamble
2017-10-11 15:57   ` Michal Wajdeczko
2017-10-12  6:25     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 10/21] drm/i915/guc: Update uC suspend/resume function separating Host/GuC tasks Sagar Arun Kamble
2017-10-11 16:19   ` Michal Wajdeczko
2017-10-12  6:38     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 11/21] drm/i915/guc: Remove GuC submission disable from i915_driver_unload Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 12/21] drm/i915/guc: Fix GuC related state cleanup in unload path Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 13/21] drm/i915/uc: Support resume from sleep w/ and w/o GuC/HuC reload Sagar Arun Kamble
2017-10-11 17:06   ` Michal Wajdeczko
2017-10-12  6:48     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 14/21] drm/i915/uc: Update GEM runtime resume with need for reload of GuC/HuC Sagar Arun Kamble
2017-10-11 17:19   ` Michal Wajdeczko
2017-10-12  6:50     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 15/21] drm/i915/guc: Add comment about update needed in GuC submission enable/disable for RPM Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 16/21] drm/i915: Enable interrupts prior to GEM resume during i915_drm_resume Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 17/21] drm/i915: Split i915_gem_suspend into gem quiescing and HW suspend Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 18/21] drm/i915/uc: Introduce intel_uc_sanitize to initialize GuC/HuC reset state Sagar Arun Kamble
2017-10-11 17:30   ` Michal Wajdeczko
2017-10-11 17:46     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 19/21] drm/i915/guc: Fix enable/disable of GuC GGTT invalidate functions Sagar Arun Kamble
2017-10-11 17:35   ` Michal Wajdeczko
2017-10-11 17:44     ` Sagar Arun Kamble
2017-10-11 17:58       ` Michal Wajdeczko
2017-10-11 18:09         ` Sagar Arun Kamble
2017-10-11 18:20           ` Michal Wajdeczko
2017-10-12  9:08             ` Joonas Lahtinen
2017-10-12 12:08               ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 20/21] drm/i915/guc: Disable GuC submission/interrupts/communication in intel_uc_sanitize Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 21/21] HAX enable GuC submission for CI Sagar Arun Kamble
2017-10-11  9:44 ` ✗ Fi.CI.BAT: failure for drm/i915: GEM/GuC Suspend/Resume/Reset fixes and restructuring Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507712056-25030-9-git-send-email-sagar.a.kamble@intel.com \
    --to=sagar.a.kamble@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.