public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 8/8] drm/i915: make intel_wakeref work on the rpm struct
Date: Thu, 13 Jun 2019 16:21:56 -0700	[thread overview]
Message-ID: <20190613232156.34940-9-daniele.ceraolospurio@intel.com> (raw)
In-Reply-To: <20190613232156.34940-1-daniele.ceraolospurio@intel.com>

intel_runtime_pm is the only thing they use from the i915 structure,
so use that directly.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_engine_pm.c |  4 +--
 drivers/gpu/drm/i915/gt/intel_gt_pm.c     |  4 +--
 drivers/gpu/drm/i915/i915_gem_fence_reg.c |  2 +-
 drivers/gpu/drm/i915/intel_wakeref.c      | 32 +++++++++++------------
 drivers/gpu/drm/i915/intel_wakeref.h      | 18 ++++++-------
 5 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_pm.c b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
index ccf034764741..903bee3d6c6d 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
@@ -37,7 +37,7 @@ static int __engine_unpark(struct intel_wakeref *wf)
 
 void intel_engine_pm_get(struct intel_engine_cs *engine)
 {
-	intel_wakeref_get(engine->i915, &engine->wakeref, __engine_unpark);
+	intel_wakeref_get(&engine->i915->runtime_pm, &engine->wakeref, __engine_unpark);
 }
 
 void intel_engine_park(struct intel_engine_cs *engine)
@@ -131,7 +131,7 @@ static int __engine_park(struct intel_wakeref *wf)
 
 void intel_engine_pm_put(struct intel_engine_cs *engine)
 {
-	intel_wakeref_put(engine->i915, &engine->wakeref, __engine_park);
+	intel_wakeref_put(&engine->i915->runtime_pm, &engine->wakeref, __engine_park);
 }
 
 void intel_engine_init__pm(struct intel_engine_cs *engine)
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index ae7155f0e063..7b5967751762 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -52,7 +52,7 @@ static int intel_gt_unpark(struct intel_wakeref *wf)
 
 void intel_gt_pm_get(struct drm_i915_private *i915)
 {
-	intel_wakeref_get(i915, &i915->gt.wakeref, intel_gt_unpark);
+	intel_wakeref_get(&i915->runtime_pm, &i915->gt.wakeref, intel_gt_unpark);
 }
 
 static int intel_gt_park(struct intel_wakeref *wf)
@@ -77,7 +77,7 @@ static int intel_gt_park(struct intel_wakeref *wf)
 
 void intel_gt_pm_put(struct drm_i915_private *i915)
 {
-	intel_wakeref_put(i915, &i915->gt.wakeref, intel_gt_park);
+	intel_wakeref_put(&i915->runtime_pm, &i915->gt.wakeref, intel_gt_park);
 }
 
 void intel_gt_pm_init(struct drm_i915_private *i915)
diff --git a/drivers/gpu/drm/i915/i915_gem_fence_reg.c b/drivers/gpu/drm/i915/i915_gem_fence_reg.c
index 3b35bb114b14..0bf53ac1c835 100644
--- a/drivers/gpu/drm/i915/i915_gem_fence_reg.c
+++ b/drivers/gpu/drm/i915/i915_gem_fence_reg.c
@@ -804,7 +804,7 @@ void i915_ggtt_init_fences(struct i915_ggtt *ggtt)
 
 	INIT_LIST_HEAD(&ggtt->fence_list);
 	INIT_LIST_HEAD(&ggtt->userfault_list);
-	intel_wakeref_auto_init(&ggtt->userfault_wakeref, i915);
+	intel_wakeref_auto_init(&ggtt->userfault_wakeref, &i915->runtime_pm);
 
 	detect_bit_6_swizzle(i915);
 
diff --git a/drivers/gpu/drm/i915/intel_wakeref.c b/drivers/gpu/drm/i915/intel_wakeref.c
index b677ae893d6f..3db6fa682823 100644
--- a/drivers/gpu/drm/i915/intel_wakeref.c
+++ b/drivers/gpu/drm/i915/intel_wakeref.c
@@ -4,23 +4,23 @@
  * Copyright © 2019 Intel Corporation
  */
 
-#include "intel_drv.h"
-#include "intel_wakeref.h"
+#include "intel_runtime_pm.h"
+#include "i915_gem.h"
 
-static void rpm_get(struct drm_i915_private *i915, struct intel_wakeref *wf)
+static void rpm_get(struct intel_runtime_pm *rpm, struct intel_wakeref *wf)
 {
-	wf->wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+	wf->wakeref = intel_runtime_pm_get(rpm);
 }
 
-static void rpm_put(struct drm_i915_private *i915, struct intel_wakeref *wf)
+static void rpm_put(struct intel_runtime_pm *rpm, struct intel_wakeref *wf)
 {
 	intel_wakeref_t wakeref = fetch_and_zero(&wf->wakeref);
 
-	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	intel_runtime_pm_put(rpm, wakeref);
 	GEM_BUG_ON(!wakeref);
 }
 
-int __intel_wakeref_get_first(struct drm_i915_private *i915,
+int __intel_wakeref_get_first(struct intel_runtime_pm *rpm,
 			      struct intel_wakeref *wf,
 			      int (*fn)(struct intel_wakeref *wf))
 {
@@ -34,11 +34,11 @@ int __intel_wakeref_get_first(struct drm_i915_private *i915,
 	if (!atomic_read(&wf->count)) {
 		int err;
 
-		rpm_get(i915, wf);
+		rpm_get(rpm, wf);
 
 		err = fn(wf);
 		if (unlikely(err)) {
-			rpm_put(i915, wf);
+			rpm_put(rpm, wf);
 			mutex_unlock(&wf->mutex);
 			return err;
 		}
@@ -51,7 +51,7 @@ int __intel_wakeref_get_first(struct drm_i915_private *i915,
 	return 0;
 }
 
-int __intel_wakeref_put_last(struct drm_i915_private *i915,
+int __intel_wakeref_put_last(struct intel_runtime_pm *rpm,
 			     struct intel_wakeref *wf,
 			     int (*fn)(struct intel_wakeref *wf))
 {
@@ -59,7 +59,7 @@ int __intel_wakeref_put_last(struct drm_i915_private *i915,
 
 	err = fn(wf);
 	if (likely(!err))
-		rpm_put(i915, wf);
+		rpm_put(rpm, wf);
 	else
 		atomic_inc(&wf->count);
 	mutex_unlock(&wf->mutex);
@@ -86,17 +86,17 @@ static void wakeref_auto_timeout(struct timer_list *t)
 	wakeref = fetch_and_zero(&wf->wakeref);
 	spin_unlock_irqrestore(&wf->lock, flags);
 
-	intel_runtime_pm_put(&wf->i915->runtime_pm, wakeref);
+	intel_runtime_pm_put(wf->rpm, wakeref);
 }
 
 void intel_wakeref_auto_init(struct intel_wakeref_auto *wf,
-			     struct drm_i915_private *i915)
+			     struct intel_runtime_pm *rpm)
 {
 	spin_lock_init(&wf->lock);
 	timer_setup(&wf->timer, wakeref_auto_timeout, 0);
 	refcount_set(&wf->count, 0);
 	wf->wakeref = 0;
-	wf->i915 = i915;
+	wf->rpm = rpm;
 }
 
 void intel_wakeref_auto(struct intel_wakeref_auto *wf, unsigned long timeout)
@@ -110,13 +110,13 @@ void intel_wakeref_auto(struct intel_wakeref_auto *wf, unsigned long timeout)
 	}
 
 	/* Our mission is that we only extend an already active wakeref */
-	assert_rpm_wakelock_held(&wf->i915->runtime_pm);
+	assert_rpm_wakelock_held(wf->rpm);
 
 	if (!refcount_inc_not_zero(&wf->count)) {
 		spin_lock_irqsave(&wf->lock, flags);
 		if (!refcount_inc_not_zero(&wf->count)) {
 			GEM_BUG_ON(wf->wakeref);
-			wf->wakeref = intel_runtime_pm_get_if_in_use(&wf->i915->runtime_pm);
+			wf->wakeref = intel_runtime_pm_get_if_in_use(wf->rpm);
 			refcount_set(&wf->count, 1);
 		}
 		spin_unlock_irqrestore(&wf->lock, flags);
diff --git a/drivers/gpu/drm/i915/intel_wakeref.h b/drivers/gpu/drm/i915/intel_wakeref.h
index 8a5f85c000ce..9cbb2ebf575b 100644
--- a/drivers/gpu/drm/i915/intel_wakeref.h
+++ b/drivers/gpu/drm/i915/intel_wakeref.h
@@ -13,7 +13,7 @@
 #include <linux/stackdepot.h>
 #include <linux/timer.h>
 
-struct drm_i915_private;
+struct intel_runtime_pm;
 
 typedef depot_stack_handle_t intel_wakeref_t;
 
@@ -31,10 +31,10 @@ void __intel_wakeref_init(struct intel_wakeref *wf,
 	__intel_wakeref_init((wf), &__key);				\
 } while (0)
 
-int __intel_wakeref_get_first(struct drm_i915_private *i915,
+int __intel_wakeref_get_first(struct intel_runtime_pm *rpm,
 			      struct intel_wakeref *wf,
 			      int (*fn)(struct intel_wakeref *wf));
-int __intel_wakeref_put_last(struct drm_i915_private *i915,
+int __intel_wakeref_put_last(struct intel_runtime_pm *rpm,
 			     struct intel_wakeref *wf,
 			     int (*fn)(struct intel_wakeref *wf));
 
@@ -55,12 +55,12 @@ int __intel_wakeref_put_last(struct drm_i915_private *i915,
  * code otherwise.
  */
 static inline int
-intel_wakeref_get(struct drm_i915_private *i915,
+intel_wakeref_get(struct intel_runtime_pm *rpm,
 		  struct intel_wakeref *wf,
 		  int (*fn)(struct intel_wakeref *wf))
 {
 	if (unlikely(!atomic_inc_not_zero(&wf->count)))
-		return __intel_wakeref_get_first(i915, wf, fn);
+		return __intel_wakeref_get_first(rpm, wf, fn);
 
 	return 0;
 }
@@ -82,12 +82,12 @@ intel_wakeref_get(struct drm_i915_private *i915,
  * code otherwise.
  */
 static inline int
-intel_wakeref_put(struct drm_i915_private *i915,
+intel_wakeref_put(struct intel_runtime_pm *rpm,
 		  struct intel_wakeref *wf,
 		  int (*fn)(struct intel_wakeref *wf))
 {
 	if (atomic_dec_and_mutex_lock(&wf->count, &wf->mutex))
-		return __intel_wakeref_put_last(i915, wf, fn);
+		return __intel_wakeref_put_last(rpm, wf, fn);
 
 	return 0;
 }
@@ -133,7 +133,7 @@ intel_wakeref_active(struct intel_wakeref *wf)
 }
 
 struct intel_wakeref_auto {
-	struct drm_i915_private *i915;
+	struct intel_runtime_pm *rpm;
 	struct timer_list timer;
 	intel_wakeref_t wakeref;
 	spinlock_t lock;
@@ -158,7 +158,7 @@ struct intel_wakeref_auto {
 void intel_wakeref_auto(struct intel_wakeref_auto *wf, unsigned long timeout);
 
 void intel_wakeref_auto_init(struct intel_wakeref_auto *wf,
-			     struct drm_i915_private *i915);
+			     struct intel_runtime_pm *rpm);
 void intel_wakeref_auto_fini(struct intel_wakeref_auto *wf);
 
 #endif /* INTEL_WAKEREF_H */
-- 
2.20.1

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

  parent reply	other threads:[~2019-06-13 23:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 23:21 [PATCH v3 0/8] RPM encapsulation Daniele Ceraolo Spurio
2019-06-13 23:21 ` [PATCH v3 1/8] drm/i915: prefer i915_runtime_pm in intel_runtime function Daniele Ceraolo Spurio
2019-06-13 23:21 ` [PATCH v3 2/8] drm/i915: Remove rpm asserts that use i915 Daniele Ceraolo Spurio
2019-06-13 23:21 ` [PATCH v3 3/8] drm/i915: make enable/disable rpm assert function use the rpm structure Daniele Ceraolo Spurio
2019-06-13 23:21 ` [PATCH v3 4/8] drm/i915: move and rename i915_runtime_pm Daniele Ceraolo Spurio
2019-06-13 23:21 ` [PATCH v3 5/8] drm/i915: move a few more functions to accept the rpm structure Daniele Ceraolo Spurio
2019-06-13 23:21 ` [PATCH v3 6/8] drm/i915: update rpm_get/put to use " Daniele Ceraolo Spurio
2019-06-13 23:21 ` [PATCH v3 7/8] drm/i915: update with_intel_runtime_pm " Daniele Ceraolo Spurio
2019-06-13 23:21 ` Daniele Ceraolo Spurio [this message]
2019-06-13 23:37 ` ✗ Fi.CI.CHECKPATCH: warning for RPM Encapsulation (rev2) Patchwork
2019-06-13 23:43 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-14 13:21 ` [PATCH v3 0/8] RPM encapsulation Imre Deak
2019-06-14 14:59   ` Chris Wilson
2019-06-14 13:36 ` ✓ Fi.CI.BAT: success for RPM Encapsulation (rev2) Patchwork
2019-06-15 10:04 ` ✓ Fi.CI.IGT: " 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=20190613232156.34940-9-daniele.ceraolospurio@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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