Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tilak Tangudu <tilak.tangudu@intel.com>
To: intel-gfx@lists.freedesktop.org, jon.ewins@intel.com,
	rodrigo.vivi@intel.com, vinay.belgaumkar@intel.com,
	chris.p.wilson@intel.com, ashutosh.dixit@intel.com,
	badal.nilawar@intel.com, anshuman.gupta@intel.com,
	tilak.tangudu@intel.com, matthew.d.roper@intel.com,
	saurabhg.gupta@intel.com, Aravind.Iddamsetty@intel.com,
	Sujaritha.Sundaresan@intel.com
Subject: [Intel-gfx] [PATCH 03/11] drm/i915: Avoid rpm helpers in intel_gt_suspend_late
Date: Tue, 21 Jun 2022 18:05:08 +0530	[thread overview]
Message-ID: <20220621123516.370479-4-tilak.tangudu@intel.com> (raw)
In-Reply-To: <20220621123516.370479-1-tilak.tangudu@intel.com>

Removed rpm helpers from intel_gt_suspend_late
and added rpm helpers at below high level functions
-__intel_gt_disable
-live_gt_resume

intel_gt_suspend_late is used in i915_gem_suspend_late
and i915_gem_suspend_late need to avoid rpm helpers
so added rpm helpers at higher level functions
-i915_gem_driver_remove
-i915_drm_suspend_late(already holds rpm wakeref)
-do_suspend (already holds rpm wakeref)

Removed rpm helpers from intel_uc_suspend and
acquired rpm wakref from above high functions.

Signed-off-by: Tilak Tangudu <tilak.tangudu@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt.c       |  4 +++-
 drivers/gpu/drm/i915/gt/intel_gt_pm.c    | 11 ++++-------
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c |  4 +++-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c    |  9 +++------
 drivers/gpu/drm/i915/i915_gem.c          |  5 ++++-
 5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index be9877c4b496..bb04ec32c54f 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -590,10 +590,12 @@ static int __engines_verify_workarounds(struct intel_gt *gt)
 
 static void __intel_gt_disable(struct intel_gt *gt)
 {
+	intel_wakeref_t wakeref = 0;
 	intel_gt_set_wedged_on_fini(gt);
 
 	intel_gt_suspend_prepare(gt);
-	intel_gt_suspend_late(gt);
+	with_intel_runtime_pm(gt->uncore->rpm, wakeref)
+		intel_gt_suspend_late(gt);
 
 	GEM_BUG_ON(intel_gt_pm_is_awake(gt));
 }
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index f553e2173bda..be99b01a0984 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -326,8 +326,6 @@ static suspend_state_t pm_suspend_target(void)
 
 void intel_gt_suspend_late(struct intel_gt *gt)
 {
-	intel_wakeref_t wakeref;
-
 	/* We expect to be idle already; but also want to be independent */
 	wait_for_suspend(gt);
 
@@ -352,11 +350,10 @@ void intel_gt_suspend_late(struct intel_gt *gt)
 	if (pm_suspend_target() == PM_SUSPEND_TO_IDLE)
 		return;
 
-	with_intel_runtime_pm(gt->uncore->rpm, wakeref) {
-		intel_rps_disable(&gt->rps);
-		intel_rc6_disable(&gt->rc6);
-		intel_llc_disable(&gt->llc);
-	}
+	intel_rps_disable(&gt->rps);
+	intel_rc6_disable(&gt->rc6);
+	intel_llc_disable(&gt->llc);
+
 
 	gt_sanitize(gt, false);
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_gt_pm.c b/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
index be94f863bdef..50f30a5295c4 100644
--- a/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
@@ -142,13 +142,15 @@ static int live_gt_clocks(void *arg)
 static int live_gt_resume(void *arg)
 {
 	struct intel_gt *gt = arg;
+	intel_wakeref_t wakeref = 0;
 	IGT_TIMEOUT(end_time);
 	int err;
 
 	/* Do several suspend/resume cycles to check we don't explode! */
 	do {
 		intel_gt_suspend_prepare(gt);
-		intel_gt_suspend_late(gt);
+		with_intel_runtime_pm(gt->uncore->rpm, wakeref)
+			intel_gt_suspend_late(gt);
 
 		if (gt->rc6.enabled) {
 			pr_err("rc6 still enabled after suspend!\n");
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
index f2e7c82985ef..425ad2ef1644 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
@@ -652,17 +652,14 @@ void intel_uc_runtime_suspend(struct intel_uc *uc)
 void intel_uc_suspend(struct intel_uc *uc)
 {
 	struct intel_guc *guc = &uc->guc;
-	intel_wakeref_t wakeref;
 	int err;
 
 	if (!intel_guc_is_ready(guc))
 		return;
 
-	with_intel_runtime_pm(&uc_to_gt(uc)->i915->runtime_pm, wakeref) {
-		err = intel_guc_suspend(guc);
-		if (err)
-			DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err);
-	}
+	err = intel_guc_suspend(guc);
+	if (err)
+		DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err);
 }
 
 static int __uc_resume(struct intel_uc *uc, bool enable_communication)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 702e5b89be22..bbe1dac2341c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1173,9 +1173,12 @@ void i915_gem_driver_unregister(struct drm_i915_private *i915)
 
 void i915_gem_driver_remove(struct drm_i915_private *dev_priv)
 {
+	intel_wakeref_t wakeref;
+
 	intel_wakeref_auto_fini(&to_gt(dev_priv)->ggtt->userfault_wakeref);
 
-	i915_gem_suspend_late(dev_priv);
+	with_intel_runtime_pm(&dev_priv->runtime_pm, wakeref)
+		i915_gem_suspend_late(dev_priv);
 	intel_gt_driver_remove(to_gt(dev_priv));
 	dev_priv->uabi_engines = RB_ROOT;
 
-- 
2.25.1


  parent reply	other threads:[~2022-06-21 12:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 12:35 [Intel-gfx] [PATCH 00/11] drm/i915: Add D3Cold-Off support for runtime-pm Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 01/11] drm/i915: Avoid rpm helpers in intel_guc_global_policies_update Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 02/11] drm/i915: Avoid rpm helpers in intel_guc_slpc_set_media_ratio_mode Tilak Tangudu
2022-06-21 12:35 ` Tilak Tangudu [this message]
2022-06-21 12:35 ` [Intel-gfx] [PATCH 04/11] drm/i915: Added is_intel_rpm_allowed helper Tilak Tangudu
2022-06-21 14:16   ` Gupta, Anshuman
2022-06-21 14:22     ` Tangudu, Tilak
2022-06-22 12:55       ` Jani Nikula
2022-06-22 20:40         ` Rodrigo Vivi
2022-06-23 17:21           ` Tangudu, Tilak
2022-06-23 17:49             ` Jani Nikula
2022-06-21 12:35 ` [Intel-gfx] [PATCH 05/11] drm/i915: Guard rpm helpers in gt helpers functions Tilak Tangudu
2022-06-22 12:52   ` Jani Nikula
2022-06-21 12:35 ` [Intel-gfx] [PATCH 06/11] drm/i915: Avoid rpm helpers in try_context_registration Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 07/11] drm/i915: Guard rc6 helpers with is_intel_rpm_allowed Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 08/11] drm/i915: Guard rpm helpers in rpm_get/put Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 09/11] drm/i915: Add i915_save/load_pci_state helpers Tilak Tangudu
2022-06-21 16:30   ` kernel test robot
2022-06-21 19:44   ` kernel test robot
2022-06-21 22:57   ` kernel test robot
2022-06-22  8:35   ` kernel test robot
2022-06-21 12:35 ` [Intel-gfx] [PATCH 10/11] drm/i915: Guard rpm helpers at gt_park/unpark Tilak Tangudu
2022-06-21 12:35 ` [Intel-gfx] [PATCH 11/11] drm/i915 : Add D3COLD OFF support Tilak Tangudu
2022-06-21 13:15   ` Gupta, Anshuman
2022-06-21 13:24 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Add D3Cold-Off support for runtime-pm Patchwork
2022-06-23 17:35 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: Add D3Cold-Off support for runtime-pm (rev2) 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=20220621123516.370479-4-tilak.tangudu@intel.com \
    --to=tilak.tangudu@intel.com \
    --cc=Aravind.Iddamsetty@intel.com \
    --cc=Sujaritha.Sundaresan@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jon.ewins@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=saurabhg.gupta@intel.com \
    --cc=vinay.belgaumkar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox